4 * WebcitAuth; Handles authentication of users to a Citadel server.
6 * Copyright (c) 1996-2010 by the citadel.org team
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "webserver.h"
27 extern uint32_t hashlittle( const void *key, size_t length, uint32_t initval);
29 void display_reg(int during_login);
32 * Access level definitions. This is initialized from a function rather than a
33 * static array so that the strings may be localized.
37 void initialize_axdefs(void) {
38 axdefs[0] = _("Deleted"); /* an erased user */
39 axdefs[1] = _("New User"); /* a new user */
40 axdefs[2] = _("Problem User"); /* a trouble maker */
41 axdefs[3] = _("Local User"); /* user with normal privileges */
42 axdefs[4] = _("Network User"); /* a user that may access network resources */
43 axdefs[5] = _("Preferred User");/* a moderator */
44 axdefs[6] = _("Aide"); /* chief */
50 * Display the login screen
51 * mesg = the error message if last attempt failed.
53 void display_login(void)
56 output_headers(1, 0, 0, 0, 1, 0);
57 do_template("login", NULL);
65 * Display the openid-enabled login screen
66 * mesg = the error message if last attempt failed.
68 void display_openid_login(char *mesg)
71 output_headers(1, 0, 0, 0, 1, 0);
72 do_template("openid_login", NULL);
79 /* Initialize the session
81 * This function needs to get called whenever the session changes from
82 * not-logged-in to logged-in, either by an explicit login by the user or
83 * by a timed-out session automatically re-establishing with a little help
84 * from the browser cookie. Either way, we need to load access controls and
85 * preferences from the server.
89 * serv_response The parameters returned from a Citadel USER or NEWU command
91 void become_logged_in(const StrBuf *user, const StrBuf *pass, StrBuf *serv_response)
99 if (WCC->wc_fullname == NULL)
100 WCC->wc_fullname = NewStrBufPlain(NULL, StrLength(serv_response));
101 StrBufExtract_token(WCC->wc_fullname, serv_response, 0, '|');
102 StrBufCutLeft(WCC->wc_fullname, 4 );
104 if (WCC->wc_username == NULL)
105 WCC->wc_username = NewStrBufDup(user);
107 FlushStrBuf(WCC->wc_username);
108 StrBufAppendBuf(WCC->wc_username, user, 0);
111 if (WCC->wc_password == NULL)
112 WCC->wc_password = NewStrBufDup(pass);
114 FlushStrBuf(WCC->wc_password);
115 StrBufAppendBuf(WCC->wc_password, pass, 0);
118 WCC->axlevel = StrBufExtract_int(serv_response, 1, '|');
119 if (WCC->axlevel >= 6) { /* TODO: make this a define, else it might trick us later */
127 StrBuf_ServGetln(Buf);
128 if (GetServerStatus(Buf, NULL) == 2) {
131 pch = ChrPtr(Buf) + 4;
132 /*WCC->new_mail =*/ StrBufExtractNext_long(Buf, &pch, '|');
133 WCC->need_regi = StrBufExtractNext_long(Buf, &pch, '|');
134 WCC->need_vali = StrBufExtractNext_long(Buf, &pch, '|');
135 if (WCC->cs_inet_email == NULL)
136 WCC->cs_inet_email = NewStrBuf();
137 StrBufExtract_NextToken(WCC->cs_inet_email, Buf, &pch, '|');
139 get_preference("floordiv_expanded", &FloorDiv);
140 WCC->floordiv_expanded = FloorDiv;
146 * Perform authentication using a user name and password
154 if (havebstr("language")) {
155 set_selected_language(bstr("language"));
156 go_selected_language();
159 if (havebstr("exit_action")) {
164 if (havebstr("login_action")) {
165 serv_printf("USER %s", bstr("name"));
166 StrBuf_ServGetln(Buf);
167 rc = GetServerStatus(Buf, &ret);
168 StrBufCutLeft(Buf, 4);
171 serv_printf("PASS %s", bstr("pass"));
172 StrBuf_ServGetln(Buf);
173 if (GetServerStatus(Buf, NULL) == 2) {
174 become_logged_in(sbstr("name"), sbstr("pass"), Buf);
176 StrBufCutLeft(Buf, 4);
177 AppendImportantMessage(SKEY(Buf));
186 AppendImportantMessage(SKEY(Buf));
191 AppendImportantMessage(SKEY(Buf));
197 if (havebstr("newuser_action")) {
198 if (!havebstr("pass")) {
199 AppendImportantMessage(_("Blank passwords are not allowed."), -1);
204 serv_printf("NEWU %s", bstr("name"));
205 StrBuf_ServGetln(Buf);
206 if (GetServerStatus(Buf, NULL) == 2) {
207 become_logged_in(sbstr("name"), sbstr("pass"), Buf);
208 serv_printf("SETP %s", bstr("pass"));
209 StrBuf_ServGetln(Buf); /* Don't care? */
211 StrBufCutLeft(Buf, 4);
212 AppendImportantMessage(SKEY(Buf));
218 if (WCC->logged_in) {
219 if (WCC->need_regi) {
221 } else if (WCC->need_vali) {
227 AppendImportantMessage(_("Your password was not accepted."), -1);
234 * Try to create an account manually after an OpenID was verified
236 void openid_manual_create(void)
240 if (havebstr("exit_action")) {
245 if (havebstr("newuser_action")) {
247 serv_printf("OIDC %s", bstr("name"));
248 StrBuf_ServGetln(Buf);
249 if (GetServerStatus(Buf, NULL) == 2) {
253 serv_puts("SETP GENERATE_RANDOM_PASSWORD");
254 StrBuf_ServGetln(gpass);
255 StrBufCutLeft(gpass, 4);
256 become_logged_in(sbstr("name"), gpass, Buf);
265 } else if (WC->need_vali) {
273 putbstr("__claimed_id", NewStrBufDup(sbstr("openid_url")));
275 if (StrLength(Buf) > 0)
276 putbstr("__username", NewStrBufDup(Buf));
278 do_template("openid_manual_create", NULL);
286 * Perform authentication using OpenID
287 * assemble the checkid_setup request and then redirect to the user's identity provider
289 void do_openid_login(void)
294 if (havebstr("language")) {
295 set_selected_language(bstr("language"));
296 go_selected_language();
299 if (havebstr("exit_action")) {
303 if (havebstr("login_action")) {
304 snprintf(buf, sizeof buf,
305 "OIDS %s|%s://%s/finalize_openid_login|%s://%s",
307 (is_https ? "https" : "http"), ChrPtr(WCC->Hdr->HR.http_host),
308 (is_https ? "https" : "http"), ChrPtr(WCC->Hdr->HR.http_host)
312 serv_getln(buf, sizeof buf);
314 lprintf(CTDL_DEBUG, "OpenID server contacted; redirecting to %s\n", &buf[4]);
315 http_redirect(&buf[4]);
319 display_openid_login(&buf[4]);
324 /* If we get to this point then something failed. */
325 display_openid_login(_("Your password was not accepted."));
329 * Complete the authentication using OpenID
330 * This function handles the positive or negative assertion from the user's Identity Provider
332 void finalize_openid_login(void)
336 int already_logged_in = (WCC->logged_in) ;
338 StrBuf *result = NULL;
339 StrBuf *username = NULL;
340 StrBuf *password = NULL;
341 StrBuf *logged_in_response = NULL;
342 StrBuf *claimed_id = NULL;
344 if (havebstr("openid.mode")) {
345 if (!strcasecmp(bstr("openid.mode"), "id_res")) {
348 StrBuf_ServGetln(Buf);
349 if (GetServerStatus(Buf, NULL) == 8) {
356 Cursor = GetNewHashPos (WCC->Hdr->urlstrings, 0);
357 while (GetNextHashPos(WCC->Hdr->urlstrings, Cursor, &HKLen, &HKey, &U)) {
359 if (!strncasecmp(u->url_key, "openid.", 7)) {
360 serv_printf("%s|%s", &u->url_key[7], ChrPtr(u->url_data));
367 while (StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000"))
369 if (linecount == 0) result = NewStrBufDup(Buf);
370 if (!strcasecmp(ChrPtr(result), "authenticate")) {
371 if (linecount == 1) {
372 username = NewStrBufDup(Buf);
374 else if (linecount == 2) {
375 password = NewStrBufDup(Buf);
377 else if (linecount == 3) {
378 logged_in_response = NewStrBufDup(Buf);
381 else if (!strcasecmp(ChrPtr(result), "verify_only")) {
382 if (linecount == 1) {
383 claimed_id = NewStrBufDup(Buf);
385 if (linecount == 2) {
386 username = NewStrBufDup(Buf);
396 /* If we were already logged in, this was an attempt to associate an OpenID account */
397 if (already_logged_in) {
400 FreeStrBuf(&username);
401 FreeStrBuf(&password);
402 FreeStrBuf(&claimed_id);
403 FreeStrBuf(&logged_in_response);
407 /* If this operation logged us in, either by connecting with an existing account or by
408 * auto-creating one using Simple Registration Extension, we're already on our way.
410 if (!strcasecmp(ChrPtr(result), "authenticate")) {
411 become_logged_in(username, password, logged_in_response);
414 /* The specified OpenID was verified but the desired user name was either not specified via SRI
415 * or conflicts with an existing user. Either way the user will need to specify a new name.
418 else if (!strcasecmp(ChrPtr(result), "verify_only")) {
419 putbstr("__claimed_id", claimed_id);
421 if (StrLength(username) > 0) {
422 putbstr("__username", username);
426 do_template("openid_manual_create", NULL);
430 /* Did we manage to log in? If so, continue with the normal flow... */
431 else if (WC->logged_in) {
438 display_openid_login(_("Your password was not accepted."));
442 FreeStrBuf(&username);
443 FreeStrBuf(&password);
444 FreeStrBuf(&claimed_id);
445 FreeStrBuf(&logged_in_response);
450 * Display a welcome screen to the user.
452 * If this is the first time login, and the web based setup is enabled,
453 * lead the user through the setup routines
455 void do_welcome(void)
458 #ifdef XXX_NOT_FINISHED_YET_XXX
463 * See if we have to run the first-time setup wizard
468 sprintf(wizard_filename, "setupwiz.%s.%s",
470 len = strlen(wizard_filename);
471 for (i=0; i<len; ++i) {
472 if ( (wizard_filename[i]==' ')
473 || (wizard_filename[i] == '/')
475 wizard_filename[i] = '_';
479 fp = fopen(wizard_filename, "r");
481 fgets(buf, sizeof buf, fp);
482 buf[strlen(buf)-1] = 0;
484 if (atoi(buf) == serv_info.serv_rev_level) {
485 setup_wizard = 1; /**< already run */
491 http_redirect("setup_wizard");
497 * Go to the user's preferred start page
499 if (!get_preference("startpage", &Buf)) {
501 StrBufPrintf(Buf, "dotskip?room=_BASEROOM_");
502 set_preference("startpage", Buf, 1);
504 if (ChrPtr(Buf)[0] == '/') {
505 StrBufCutLeft(Buf, 1);
507 if (StrLength(Buf) == 0) {
508 StrBufAppendBufPlain(Buf, "dotgoto?room=_BASEROOM_", -1, 0);
510 lprintf(9, "Redirecting to user's start page: %s\n", ChrPtr(Buf));
511 http_redirect(ChrPtr(Buf));
516 * Disconnect from the Citadel server, and end this WebCit session
518 void end_webcit_session(void) {
522 /* close() of citadel socket will be done by do_housekeeping() */
533 FlushStrBuf(WCC->wc_username);
534 FlushStrBuf(WCC->wc_password);
535 FlushStrBuf(WCC->CurRoom.name);
536 FlushStrBuf(WCC->wc_fullname);
538 /* FIXME: this is to suppress the iconbar displaying, because we aren't
539 actually logged out yet */
542 /** Calling output_headers() this way causes the cookies to be un-set */
543 output_headers(1, 1, 0, 1, 0, 0);
545 wc_printf("<div id=\"logout_screen\">");
546 wc_printf("<div class=\"box\">");
547 wc_printf("<div class=\"boxlabel\">");
548 wc_printf(_("Log off"));
549 wc_printf("</div><div class=\"boxcontent\">");
550 serv_puts("MESG goodbye");
551 serv_getln(buf, sizeof buf);
553 if (WCC->serv_sock >= 0) {
557 wc_printf("Goodbye\n");
561 wc_printf(_("This program was unable to connect or stay "
562 "connected to the Citadel server. Please report "
563 "this problem to your system administrator.")
565 wc_printf("<a href=\"http://www.citadel.org/doku.php/"
566 "faq:mastering_your_os:net#netstat\">%s</a>",
570 wc_printf("<hr /><div class=\"buttons\"> "
571 "<span class=\"button_link\"><a href=\".\">");
572 wc_printf(_("Log in again"));
573 wc_printf("</a></span>");
575 /* The "close window" link is commented out because some browsers don't
578 wc_printf(" <span class=\"button_link\">"
579 "<a href=\"javascript:window.close();\">");
580 wc_printf(_("Close window"));
581 wc_printf("</a></span>");
584 wc_printf("</div></div></div>\n");
586 end_webcit_session();
600 output_headers(1, 1, 2, 0, 0, 0);
601 wc_printf("<div id=\"banner\">\n");
603 wc_printf(_("Validate new users"));
605 wc_printf("</div>\n");
607 wc_printf("<div id=\"content\" class=\"service\">\n");
609 /* If the user just submitted a validation, process it... */
610 safestrncpy(buf, bstr("user"), sizeof buf);
611 if (!IsEmptyStr(buf)) {
612 if (havebstr("axlevel")) {
613 serv_printf("VALI %s|%s", buf, bstr("axlevel"));
614 serv_getln(buf, sizeof buf);
616 wc_printf("<b>%s</b><br>\n", &buf[4]);
621 /* Now see if any more users require validation. */
623 serv_getln(buf, sizeof buf);
626 wc_printf(_("No users require validation at this time."));
627 wc_printf("</b><br>\n");
632 wc_printf("<b>%s</b><br>\n", &buf[4]);
637 wc_printf("<div class=\"fix_scrollbar_bug\">"
638 "<table class=\"auth_validate\"><tr><td>\n");
639 wc_printf("<div id=\"validate\">");
641 safestrncpy(user, &buf[4], sizeof user);
642 serv_printf("GREG %s", user);
643 serv_getln(cmd, sizeof cmd);
647 serv_getln(buf, sizeof buf);
650 wc_printf("#%s<br><H1>%s</H1>",
659 while (!IsEmptyStr(pch))
663 else if (isalpha(*pch))
674 pch = _("very weak");
687 wc_printf("PW: %s<br>\n", pch);
690 wc_printf("%s<br>\n", buf);
692 wc_printf("%s<br>\n", buf);
694 wc_printf("%s, ", buf);
696 wc_printf("%s ", buf);
698 wc_printf("%s<br>\n", buf);
700 wc_printf("%s<br>\n", buf);
702 wc_printf(_("Current access level: %d (%s)\n"),
703 atoi(buf), axdefs[atoi(buf)]);
704 } while (strcmp(buf, "000"));
706 wc_printf("<H1>%s</H1>%s<br />\n", user, &cmd[4]);
710 wc_printf(_("Select access level for this user:"));
711 wc_printf("<br />\n");
712 for (a = 0; a <= 6; ++a) {
713 wc_printf("<a href=\"validate?nonce=%d?user=", WC->nonce);
715 wc_printf("&axlevel=%d\">%s</A> \n",
718 wc_printf("<br />\n");
720 wc_printf("</div>\n");
721 wc_printf("</td></tr></table></div>\n");
728 * Display form for registration.
730 * (Set during_login to 1 if this registration is being performed during
731 * new user login and will require chaining to the proper screen.)
733 void display_reg(int during_login)
737 message_summary *VCMsg = NULL;
738 wc_mime_attachment *VCAtt = NULL;
742 memset(&Room, 0, sizeof(folder));
743 if (goto_config_room(Buf, &Room) != 0) {
744 lprintf(9, "display_reg() exiting because goto_config_room() failed\n");
758 vcard_msgnum = locate_user_vcard_in_this_room(&VCMsg, &VCAtt);
759 if (vcard_msgnum < 0L) {
760 lprintf(9, "display_reg() exiting because locate_user_vcard_in_this_room() failed\n");
771 do_edit_vcard(vcard_msgnum, "1", VCMsg, VCAtt, "do_welcome", USERCONFIGROOM);
775 ReturnTo = NewStrBufPlain(HKEY("display_main_menu?gotofirst="));
776 StrBufAppendBuf(ReturnTo, WC->CurRoom.name, 0);
777 do_edit_vcard(vcard_msgnum, "1", VCMsg, VCAtt, ChrPtr(ReturnTo), USERCONFIGROOM);
778 FreeStrBuf(&ReturnTo);
781 /* FIXME - don't we have to free VCMsg and VCAtt ?? */
788 * display form for changing your password
790 void display_changepw(void)
792 WCTemplputParams SubTP;
795 output_headers(1, 1, 1, 0, 0, 0);
797 Buf = NewStrBufPlain(_("Change your password"), -1);
798 memset(&SubTP, 0, sizeof(WCTemplputParams));
799 SubTP.Filter.ContextType = CTX_STRBUF;
801 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
805 if (!IsEmptyStr(WC->ImportantMessage)) {
806 wc_printf("<span class=\"errormsg\">"
807 "%s</span><br />\n", WC->ImportantMessage);
808 safestrncpy(WC->ImportantMessage, "", sizeof WC->ImportantMessage);
811 serv_puts("MESG changepw");
812 serv_getln(buf, sizeof buf);
817 wc_printf("<form name=\"changepwform\" action=\"changepw\" method=\"post\">\n");
818 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
819 wc_printf("<table class=\"altern\" ");
820 wc_printf("<tr class=\"even\"><td>");
821 wc_printf(_("Enter new password:"));
822 wc_printf("</td><td>");
823 wc_printf("<input type=\"password\" name=\"newpass1\" value=\"\" maxlength=\"20\"></td></tr>\n");
824 wc_printf("<tr class=\"odd\"><td>");
825 wc_printf(_("Enter it again to confirm:"));
826 wc_printf("</td><td>");
827 wc_printf("<input type=\"password\" name=\"newpass2\" value=\"\" maxlength=\"20\"></td></tr>\n");
828 wc_printf("</table>\n");
830 wc_printf("<div class=\"buttons\">\n");
831 wc_printf("<input type=\"submit\" name=\"change_action\" value=\"%s\">", _("Change password"));
833 wc_printf("<input type=\"submit\" name=\"cancel_action\" value=\"%s\">\n", _("Cancel"));
834 wc_printf("</div>\n");
835 wc_printf("</form>\n");
837 do_template("endbox", NULL);
843 * if passwords match, propagate it to citserver.
848 char newpass1[32], newpass2[32];
850 if (!havebstr("change_action")) {
851 safestrncpy(WC->ImportantMessage,
852 _("Cancelled. Password was not changed."),
853 sizeof WC->ImportantMessage);
858 safestrncpy(newpass1, bstr("newpass1"), sizeof newpass1);
859 safestrncpy(newpass2, bstr("newpass2"), sizeof newpass2);
861 if (strcasecmp(newpass1, newpass2)) {
862 safestrncpy(WC->ImportantMessage,
863 _("They don't match. Password was not changed."),
864 sizeof WC->ImportantMessage);
869 if (IsEmptyStr(newpass1)) {
870 safestrncpy(WC->ImportantMessage,
871 _("Blank passwords are not allowed."),
872 sizeof WC->ImportantMessage);
877 serv_printf("SETP %s", newpass1);
878 serv_getln(buf, sizeof buf);
879 sprintf(WC->ImportantMessage, "%s", &buf[4]);
881 if (WC->wc_password == NULL)
882 WC->wc_password = NewStrBufPlain(buf, -1);
884 FlushStrBuf(WC->wc_password);
885 StrBufAppendBufPlain(WC->wc_password, buf, -1, 0);
894 int ConditionalHaveAccessCreateRoom(StrBuf *Target, WCTemplputParams *TP)
900 StrBuf_ServGetln(Buf);
902 if (GetServerStatus(Buf, NULL) == 2) {
903 StrBufCutLeft(Buf, 4);
904 AppendImportantMessage(SKEY(Buf));
912 int ConditionalAide(StrBuf *Target, WCTemplputParams *TP)
915 return (WCC != NULL)? (WC->is_aide == 0) : 0;
918 int ConditionalIsLoggedIn(StrBuf *Target, WCTemplputParams *TP)
921 return (WCC != NULL)? (WCC->logged_in == 0) : 0;
925 void _display_openid_login(void) {
926 display_openid_login(NULL);
930 void _display_reg(void) {
935 void Header_HandleAuth(StrBuf *Line, ParsedHttpHdrs *hdr)
937 if (hdr->HR.got_auth == NO_AUTH) /* don't override cookie auth... */
939 if (strncasecmp(ChrPtr(Line), "Basic", 5) == 0) {
940 StrBufCutLeft(Line, 6);
941 StrBufDecodeBase64(Line);
942 hdr->HR.plainauth = Line;
943 hdr->HR.got_auth = AUTH_BASIC;
946 lprintf(1, "Authentication scheme not supported! [%s]\n", ChrPtr(Line));
950 void CheckAuthBasic(ParsedHttpHdrs *hdr)
953 todo: enable this if we can have other sessions than authenticated ones.
954 if (hdr->DontNeedAuth)
957 StrBufAppendBufPlain(hdr->HR.plainauth, HKEY(":"), 0);
958 StrBufAppendBuf(hdr->HR.plainauth, hdr->HR.user_agent, 0);
959 hdr->HR.SessionKey = hashlittle(SKEY(hdr->HR.plainauth), 89479832);
961 lprintf(1, "CheckAuthBasic: calculated sessionkey %ld\n",
966 void GetAuthBasic(ParsedHttpHdrs *hdr)
968 const char *Pos = NULL;
969 if (hdr->c_username == NULL)
970 hdr->c_username = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_USER));
971 if (hdr->c_password == NULL)
972 hdr->c_password = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_PASS));
973 StrBufExtract_NextToken(hdr->c_username, hdr->HR.plainauth, &Pos, ':');
974 StrBufExtract_NextToken(hdr->c_password, hdr->HR.plainauth, &Pos, ':');
977 void Header_HandleCookie(StrBuf *Line, ParsedHttpHdrs *hdr)
981 todo: enable this if we can have other sessions than authenticated ones.
982 if (hdr->DontNeedAuth)
985 pch = strstr(ChrPtr(Line), "webcit=");
990 hdr->HR.RawCookie = Line;
991 StrBufCutLeft(hdr->HR.RawCookie, (pch - ChrPtr(hdr->HR.RawCookie)) + 7);
992 StrBufDecodeHex(hdr->HR.RawCookie);
994 cookie_to_stuff(Line, &hdr->HR.desired_session,
1000 hdr->HR.got_auth = AUTH_COOKIE;
1005 (ParsedHttpHdrs *httpreq)
1007 httpreq->c_username = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_USER));
1008 httpreq->c_password = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_PASS));
1009 httpreq->c_roomname = NewStrBuf();
1010 httpreq->c_language = NewStrBuf();
1013 HttpDetachModule_AUTH
1014 (ParsedHttpHdrs *httpreq)
1016 FLUSHStrBuf(httpreq->c_username);
1017 FLUSHStrBuf(httpreq->c_password);
1018 FLUSHStrBuf(httpreq->c_roomname);
1019 FLUSHStrBuf(httpreq->c_language);
1023 HttpDestroyModule_AUTH
1024 (ParsedHttpHdrs *httpreq)
1026 FreeStrBuf(&httpreq->c_username);
1027 FreeStrBuf(&httpreq->c_password);
1028 FreeStrBuf(&httpreq->c_roomname);
1029 FreeStrBuf(&httpreq->c_language);
1036 initialize_axdefs();
1037 RegisterHeaderHandler(HKEY("COOKIE"), Header_HandleCookie);
1038 RegisterHeaderHandler(HKEY("AUTHORIZATION"), Header_HandleAuth);
1040 WebcitAddUrlHandler(HKEY(""), "", 0, do_welcome, ANONYMOUS|COOKIEUNNEEDED); /* no url pattern at all? Show login. */
1041 WebcitAddUrlHandler(HKEY("do_welcome"), "", 0, do_welcome, ANONYMOUS|COOKIEUNNEEDED);
1042 WebcitAddUrlHandler(HKEY("login"), "", 0, do_login, ANONYMOUS|COOKIEUNNEEDED);
1043 WebcitAddUrlHandler(HKEY("display_openid_login"), "", 0, _display_openid_login, ANONYMOUS);
1044 WebcitAddUrlHandler(HKEY("openid_login"), "", 0, do_openid_login, ANONYMOUS);
1045 WebcitAddUrlHandler(HKEY("finalize_openid_login"), "", 0, finalize_openid_login, ANONYMOUS);
1046 WebcitAddUrlHandler(HKEY("openid_manual_create"), "", 0, openid_manual_create, ANONYMOUS);
1047 WebcitAddUrlHandler(HKEY("do_logout"), "", 0, do_logout, ANONYMOUS|COOKIEUNNEEDED|FORCE_SESSIONCLOSE);
1048 WebcitAddUrlHandler(HKEY("validate"), "", 0, validate, 0);
1049 WebcitAddUrlHandler(HKEY("display_reg"), "", 0, _display_reg, 0);
1050 WebcitAddUrlHandler(HKEY("display_changepw"), "", 0, display_changepw, 0);
1051 WebcitAddUrlHandler(HKEY("changepw"), "", 0, changepw, 0);
1052 WebcitAddUrlHandler(HKEY("termquit"), "", 0, do_logout, 0);
1054 RegisterConditional(HKEY("COND:AIDE"), 2, ConditionalAide, CTX_NONE);
1055 RegisterConditional(HKEY("COND:LOGGEDIN"), 2, ConditionalIsLoggedIn, CTX_NONE);
1056 RegisterConditional(HKEY("COND:MAY_CREATE_ROOM"), 2, ConditionalHaveAccessCreateRoom, CTX_NONE);
1062 SessionDestroyModule_AUTH
1065 FreeStrBuf(&sess->wc_username);
1066 FreeStrBuf(&sess->wc_fullname);
1067 FreeStrBuf(&sess->wc_password);
1068 FreeStrBuf(&sess->httpauth_pass);
1069 FreeStrBuf(&sess->cs_inet_email);