2 * WebcitAuth; Handles authentication of users to a Citadel server.
4 * Copyright (c) 1996-2010 by the citadel.org team
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "webserver.h"
25 extern uint32_t hashlittle( const void *key, size_t length, uint32_t initval);
27 void display_reg(int during_login);
30 * Access level definitions. This is initialized from a function rather than a
31 * static array so that the strings may be localized.
35 void initialize_axdefs(void) {
36 axdefs[0] = _("Deleted"); /* an erased user */
37 axdefs[1] = _("New User"); /* a new user */
38 axdefs[2] = _("Problem User"); /* a trouble maker */
39 axdefs[3] = _("Local User"); /* user with normal privileges */
40 axdefs[4] = _("Network User"); /* a user that may access network resources */
41 axdefs[5] = _("Preferred User");/* a moderator */
42 axdefs[6] = _("Aide"); /* chief */
48 * Display the login screen
49 * mesg = the error message if last attempt failed.
51 void display_login(void)
54 output_headers(1, 0, 0, 0, 1, 0);
55 do_template("login", NULL);
63 * Display the openid-enabled login screen
64 * mesg = the error message if last attempt failed.
66 void display_openid_login(char *mesg)
69 output_headers(1, 0, 0, 0, 1, 0);
70 do_template("openid_login", NULL);
77 /* Initialize the session
79 * This function needs to get called whenever the session changes from
80 * not-logged-in to logged-in, either by an explicit login by the user or
81 * by a timed-out session automatically re-establishing with a little help
82 * from the browser cookie. Either way, we need to load access controls and
83 * preferences from the server.
87 * serv_response The parameters returned from a Citadel USER or NEWU command
89 void become_logged_in(const StrBuf *user, const StrBuf *pass, StrBuf *serv_response)
97 if (WCC->wc_fullname == NULL)
98 WCC->wc_fullname = NewStrBufPlain(NULL, StrLength(serv_response));
99 StrBufExtract_token(WCC->wc_fullname, serv_response, 0, '|');
100 StrBufCutLeft(WCC->wc_fullname, 4 );
102 if (WCC->wc_username == NULL)
103 WCC->wc_username = NewStrBufDup(user);
105 FlushStrBuf(WCC->wc_username);
106 StrBufAppendBuf(WCC->wc_username, user, 0);
109 if (WCC->wc_password == NULL)
110 WCC->wc_password = NewStrBufDup(pass);
112 FlushStrBuf(WCC->wc_password);
113 StrBufAppendBuf(WCC->wc_password, pass, 0);
116 WCC->axlevel = StrBufExtract_int(serv_response, 1, '|');
117 if (WCC->axlevel >= 6) { /* TODO: make this a define, else it might trick us later */
125 StrBuf_ServGetln(Buf);
126 if (GetServerStatus(Buf, NULL) == 2) {
129 pch = ChrPtr(Buf) + 4;
130 /*WCC->new_mail =*/ StrBufExtractNext_long(Buf, &pch, '|');
131 WCC->need_regi = StrBufExtractNext_long(Buf, &pch, '|');
132 WCC->need_vali = StrBufExtractNext_long(Buf, &pch, '|');
133 if (WCC->cs_inet_email == NULL)
134 WCC->cs_inet_email = NewStrBuf();
135 StrBufExtract_NextToken(WCC->cs_inet_email, Buf, &pch, '|');
137 get_preference("floordiv_expanded", &FloorDiv);
138 WCC->floordiv_expanded = FloorDiv;
144 * Perform authentication using a user name and password
152 if (havebstr("language")) {
153 set_selected_language(bstr("language"));
154 go_selected_language();
157 if (havebstr("exit_action")) {
162 if (havebstr("login_action")) {
163 serv_printf("USER %s", bstr("name"));
164 StrBuf_ServGetln(Buf);
165 rc = GetServerStatus(Buf, &ret);
166 StrBufCutLeft(Buf, 4);
169 serv_printf("PASS %s", bstr("pass"));
170 StrBuf_ServGetln(Buf);
171 if (GetServerStatus(Buf, NULL) == 2) {
172 become_logged_in(sbstr("name"), sbstr("pass"), Buf);
174 StrBufCutLeft(Buf, 4);
175 AppendImportantMessage(SKEY(Buf));
184 AppendImportantMessage(SKEY(Buf));
189 AppendImportantMessage(SKEY(Buf));
195 if (havebstr("newuser_action")) {
196 if (!havebstr("pass")) {
197 AppendImportantMessage(_("Blank passwords are not allowed."), -1);
202 serv_printf("NEWU %s", bstr("name"));
203 StrBuf_ServGetln(Buf);
204 if (GetServerStatus(Buf, NULL) == 2) {
205 become_logged_in(sbstr("name"), sbstr("pass"), Buf);
206 serv_printf("SETP %s", bstr("pass"));
207 StrBuf_ServGetln(Buf); /* Don't care? */
209 StrBufCutLeft(Buf, 4);
210 AppendImportantMessage(SKEY(Buf));
216 if (WCC->logged_in) {
217 if (WCC->need_regi) {
219 } else if (WCC->need_vali) {
225 AppendImportantMessage(_("Your password was not accepted."), -1);
232 * Try to create an account manually after an OpenID was verified
234 void openid_manual_create(void)
238 if (havebstr("exit_action")) {
243 if (havebstr("newuser_action")) {
245 serv_printf("OIDC %s", bstr("name"));
246 StrBuf_ServGetln(Buf);
247 if (GetServerStatus(Buf, NULL) == 2) {
251 serv_puts("SETP GENERATE_RANDOM_PASSWORD");
252 StrBuf_ServGetln(gpass);
253 StrBufCutLeft(gpass, 4);
254 become_logged_in(sbstr("name"), gpass, Buf);
263 } else if (WC->need_vali) {
271 putbstr("__claimed_id", NewStrBufDup(sbstr("openid_url")));
273 if (StrLength(Buf) > 0)
274 putbstr("__username", NewStrBufDup(Buf));
276 do_template("openid_manual_create", NULL);
284 * Perform authentication using OpenID
285 * assemble the checkid_setup request and then redirect to the user's identity provider
287 void do_openid_login(void)
292 if (havebstr("language")) {
293 set_selected_language(bstr("language"));
294 go_selected_language();
297 if (havebstr("exit_action")) {
301 if (havebstr("login_action")) {
302 snprintf(buf, sizeof buf,
303 "OIDS %s|%s://%s/finalize_openid_login|%s://%s",
305 (is_https ? "https" : "http"), ChrPtr(WCC->Hdr->HR.http_host),
306 (is_https ? "https" : "http"), ChrPtr(WCC->Hdr->HR.http_host)
310 serv_getln(buf, sizeof buf);
312 lprintf(CTDL_DEBUG, "OpenID server contacted; redirecting to %s\n", &buf[4]);
313 http_redirect(&buf[4]);
317 display_openid_login(&buf[4]);
322 /* If we get to this point then something failed. */
323 display_openid_login(_("Your password was not accepted."));
327 * Complete the authentication using OpenID
328 * This function handles the positive or negative assertion from the user's Identity Provider
330 void finalize_openid_login(void)
334 int already_logged_in = (WCC->logged_in) ;
336 StrBuf *result = NULL;
337 StrBuf *username = NULL;
338 StrBuf *password = NULL;
339 StrBuf *logged_in_response = NULL;
340 StrBuf *claimed_id = NULL;
342 if (havebstr("openid.mode")) {
343 if (!strcasecmp(bstr("openid.mode"), "id_res")) {
346 StrBuf_ServGetln(Buf);
347 if (GetServerStatus(Buf, NULL) == 8) {
354 Cursor = GetNewHashPos (WCC->Hdr->urlstrings, 0);
355 while (GetNextHashPos(WCC->Hdr->urlstrings, Cursor, &HKLen, &HKey, &U)) {
357 if (!strncasecmp(u->url_key, "openid.", 7)) {
358 serv_printf("%s|%s", &u->url_key[7], ChrPtr(u->url_data));
365 while (StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000"))
367 if (linecount == 0) result = NewStrBufDup(Buf);
368 if (!strcasecmp(ChrPtr(result), "authenticate")) {
369 if (linecount == 1) {
370 username = NewStrBufDup(Buf);
372 else if (linecount == 2) {
373 password = NewStrBufDup(Buf);
375 else if (linecount == 3) {
376 logged_in_response = NewStrBufDup(Buf);
379 else if (!strcasecmp(ChrPtr(result), "verify_only")) {
380 if (linecount == 1) {
381 claimed_id = NewStrBufDup(Buf);
383 if (linecount == 2) {
384 username = NewStrBufDup(Buf);
394 /* If we were already logged in, this was an attempt to associate an OpenID account */
395 if (already_logged_in) {
398 FreeStrBuf(&username);
399 FreeStrBuf(&password);
400 FreeStrBuf(&claimed_id);
401 FreeStrBuf(&logged_in_response);
405 /* If this operation logged us in, either by connecting with an existing account or by
406 * auto-creating one using Simple Registration Extension, we're already on our way.
408 if (!strcasecmp(ChrPtr(result), "authenticate")) {
409 become_logged_in(username, password, logged_in_response);
412 /* The specified OpenID was verified but the desired user name was either not specified via SRI
413 * or conflicts with an existing user. Either way the user will need to specify a new name.
416 else if (!strcasecmp(ChrPtr(result), "verify_only")) {
417 putbstr("__claimed_id", claimed_id);
419 if (StrLength(username) > 0) {
420 putbstr("__username", username);
424 do_template("openid_manual_create", NULL);
428 /* Did we manage to log in? If so, continue with the normal flow... */
429 else if (WC->logged_in) {
436 display_openid_login(_("Your password was not accepted."));
440 FreeStrBuf(&username);
441 FreeStrBuf(&password);
442 FreeStrBuf(&claimed_id);
443 FreeStrBuf(&logged_in_response);
448 * Display a welcome screen to the user.
450 * If this is the first time login, and the web based setup is enabled,
451 * lead the user through the setup routines
453 void do_welcome(void)
456 #ifdef XXX_NOT_FINISHED_YET_XXX
461 * See if we have to run the first-time setup wizard
466 sprintf(wizard_filename, "setupwiz.%s.%s",
468 len = strlen(wizard_filename);
469 for (i=0; i<len; ++i) {
470 if ( (wizard_filename[i]==' ')
471 || (wizard_filename[i] == '/')
473 wizard_filename[i] = '_';
477 fp = fopen(wizard_filename, "r");
479 fgets(buf, sizeof buf, fp);
480 buf[strlen(buf)-1] = 0;
482 if (atoi(buf) == serv_info.serv_rev_level) {
483 setup_wizard = 1; /**< already run */
489 http_redirect("setup_wizard");
495 * Go to the user's preferred start page
497 if (!get_preference("startpage", &Buf)) {
499 StrBufPrintf(Buf, "dotskip?room=_BASEROOM_");
500 set_preference("startpage", Buf, 1);
502 if (ChrPtr(Buf)[0] == '/') {
503 StrBufCutLeft(Buf, 1);
505 if (StrLength(Buf) == 0) {
506 StrBufAppendBufPlain(Buf, "dotgoto?room=_BASEROOM_", -1, 0);
508 lprintf(9, "Redirecting to user's start page: %s\n", ChrPtr(Buf));
509 http_redirect(ChrPtr(Buf));
514 * Disconnect from the Citadel server, and end this WebCit session
516 void end_webcit_session(void) {
520 /* close() of citadel socket will be done by do_housekeeping() */
531 FlushStrBuf(WCC->wc_username);
532 FlushStrBuf(WCC->wc_password);
533 FlushStrBuf(WCC->CurRoom.name);
534 FlushStrBuf(WCC->wc_fullname);
536 /* FIXME: this is to suppress the iconbar displaying, because we aren't
537 actually logged out yet */
540 /** Calling output_headers() this way causes the cookies to be un-set */
541 output_headers(1, 1, 0, 1, 0, 0);
543 wc_printf("<div id=\"logout_screen\">");
544 wc_printf("<div class=\"box\">");
545 wc_printf("<div class=\"boxlabel\">");
546 wc_printf(_("Log off"));
547 wc_printf("</div><div class=\"boxcontent\">");
548 serv_puts("MESG goodbye");
549 serv_getln(buf, sizeof buf);
551 if (WCC->serv_sock >= 0) {
555 wc_printf("Goodbye\n");
559 wc_printf(_("This program was unable to connect or stay "
560 "connected to the Citadel server. Please report "
561 "this problem to your system administrator.")
563 wc_printf("<a href=\"http://www.citadel.org/doku.php/"
564 "faq:mastering_your_os:net#netstat\">%s</a>",
568 wc_printf("<hr /><div class=\"buttons\"> "
569 "<span class=\"button_link\"><a href=\".\">");
570 wc_printf(_("Log in again"));
571 wc_printf("</a></span>");
573 /* The "close window" link is commented out because some browsers don't
576 wc_printf(" <span class=\"button_link\">"
577 "<a href=\"javascript:window.close();\">");
578 wc_printf(_("Close window"));
579 wc_printf("</a></span>");
582 wc_printf("</div></div></div>\n");
584 end_webcit_session();
598 output_headers(1, 1, 2, 0, 0, 0);
599 wc_printf("<div id=\"banner\">\n");
601 wc_printf(_("Validate new users"));
603 wc_printf("</div>\n");
605 wc_printf("<div id=\"content\" class=\"service\">\n");
607 /* If the user just submitted a validation, process it... */
608 safestrncpy(buf, bstr("user"), sizeof buf);
609 if (!IsEmptyStr(buf)) {
610 if (havebstr("axlevel")) {
611 serv_printf("VALI %s|%s", buf, bstr("axlevel"));
612 serv_getln(buf, sizeof buf);
614 wc_printf("<b>%s</b><br>\n", &buf[4]);
619 /* Now see if any more users require validation. */
621 serv_getln(buf, sizeof buf);
624 wc_printf(_("No users require validation at this time."));
625 wc_printf("</b><br>\n");
630 wc_printf("<b>%s</b><br>\n", &buf[4]);
635 wc_printf("<div class=\"fix_scrollbar_bug\">"
636 "<table class=\"auth_validate\"><tr><td>\n");
637 wc_printf("<div id=\"validate\">");
639 safestrncpy(user, &buf[4], sizeof user);
640 serv_printf("GREG %s", user);
641 serv_getln(cmd, sizeof cmd);
645 serv_getln(buf, sizeof buf);
648 wc_printf("#%s<br><H1>%s</H1>",
657 while (!IsEmptyStr(pch))
661 else if (isalpha(*pch))
672 pch = _("very weak");
685 wc_printf("PW: %s<br>\n", pch);
688 wc_printf("%s<br>\n", buf);
690 wc_printf("%s<br>\n", buf);
692 wc_printf("%s, ", buf);
694 wc_printf("%s ", buf);
696 wc_printf("%s<br>\n", buf);
698 wc_printf("%s<br>\n", buf);
700 wc_printf(_("Current access level: %d (%s)\n"),
701 atoi(buf), axdefs[atoi(buf)]);
702 } while (strcmp(buf, "000"));
704 wc_printf("<H1>%s</H1>%s<br />\n", user, &cmd[4]);
708 wc_printf(_("Select access level for this user:"));
709 wc_printf("<br />\n");
710 for (a = 0; a <= 6; ++a) {
711 wc_printf("<a href=\"validate?nonce=%d?user=", WC->nonce);
713 wc_printf("&axlevel=%d\">%s</A> \n",
716 wc_printf("<br />\n");
718 wc_printf("</div>\n");
719 wc_printf("</td></tr></table></div>\n");
726 * Display form for registration.
728 * (Set during_login to 1 if this registration is being performed during
729 * new user login and will require chaining to the proper screen.)
731 void display_reg(int during_login)
735 message_summary *VCMsg = NULL;
736 wc_mime_attachment *VCAtt = NULL;
740 memset(&Room, 0, sizeof(folder));
741 if (goto_config_room(Buf, &Room) != 0) {
742 lprintf(9, "display_reg() exiting because goto_config_room() failed\n");
756 vcard_msgnum = locate_user_vcard_in_this_room(&VCMsg, &VCAtt);
757 if (vcard_msgnum < 0L) {
758 lprintf(9, "display_reg() exiting because locate_user_vcard_in_this_room() failed\n");
769 do_edit_vcard(vcard_msgnum, "1", VCMsg, VCAtt, "do_welcome", USERCONFIGROOM);
773 ReturnTo = NewStrBufPlain(HKEY("display_main_menu?gotofirst="));
774 StrBufAppendBuf(ReturnTo, WC->CurRoom.name, 0);
775 do_edit_vcard(vcard_msgnum, "1", VCMsg, VCAtt, ChrPtr(ReturnTo), USERCONFIGROOM);
776 FreeStrBuf(&ReturnTo);
779 /* FIXME - don't we have to free VCMsg and VCAtt ?? */
786 * display form for changing your password
788 void display_changepw(void)
790 WCTemplputParams SubTP;
793 output_headers(1, 1, 1, 0, 0, 0);
795 Buf = NewStrBufPlain(_("Change your password"), -1);
796 memset(&SubTP, 0, sizeof(WCTemplputParams));
797 SubTP.Filter.ContextType = CTX_STRBUF;
799 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
803 if (!IsEmptyStr(WC->ImportantMessage)) {
804 wc_printf("<span class=\"errormsg\">"
805 "%s</span><br />\n", WC->ImportantMessage);
806 safestrncpy(WC->ImportantMessage, "", sizeof WC->ImportantMessage);
809 serv_puts("MESG changepw");
810 serv_getln(buf, sizeof buf);
815 wc_printf("<form name=\"changepwform\" action=\"changepw\" method=\"post\">\n");
816 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
817 wc_printf("<table class=\"altern\" ");
818 wc_printf("<tr class=\"even\"><td>");
819 wc_printf(_("Enter new password:"));
820 wc_printf("</td><td>");
821 wc_printf("<input type=\"password\" name=\"newpass1\" value=\"\" maxlength=\"20\"></td></tr>\n");
822 wc_printf("<tr class=\"odd\"><td>");
823 wc_printf(_("Enter it again to confirm:"));
824 wc_printf("</td><td>");
825 wc_printf("<input type=\"password\" name=\"newpass2\" value=\"\" maxlength=\"20\"></td></tr>\n");
826 wc_printf("</table>\n");
828 wc_printf("<div class=\"buttons\">\n");
829 wc_printf("<input type=\"submit\" name=\"change_action\" value=\"%s\">", _("Change password"));
831 wc_printf("<input type=\"submit\" name=\"cancel_action\" value=\"%s\">\n", _("Cancel"));
832 wc_printf("</div>\n");
833 wc_printf("</form>\n");
835 do_template("endbox", NULL);
841 * if passwords match, propagate it to citserver.
846 char newpass1[32], newpass2[32];
848 if (!havebstr("change_action")) {
849 safestrncpy(WC->ImportantMessage,
850 _("Cancelled. Password was not changed."),
851 sizeof WC->ImportantMessage);
856 safestrncpy(newpass1, bstr("newpass1"), sizeof newpass1);
857 safestrncpy(newpass2, bstr("newpass2"), sizeof newpass2);
859 if (strcasecmp(newpass1, newpass2)) {
860 safestrncpy(WC->ImportantMessage,
861 _("They don't match. Password was not changed."),
862 sizeof WC->ImportantMessage);
867 if (IsEmptyStr(newpass1)) {
868 safestrncpy(WC->ImportantMessage,
869 _("Blank passwords are not allowed."),
870 sizeof WC->ImportantMessage);
875 serv_printf("SETP %s", newpass1);
876 serv_getln(buf, sizeof buf);
877 sprintf(WC->ImportantMessage, "%s", &buf[4]);
879 if (WC->wc_password == NULL)
880 WC->wc_password = NewStrBufPlain(buf, -1);
882 FlushStrBuf(WC->wc_password);
883 StrBufAppendBufPlain(WC->wc_password, buf, -1, 0);
892 int ConditionalHaveAccessCreateRoom(StrBuf *Target, WCTemplputParams *TP)
898 StrBuf_ServGetln(Buf);
900 if (GetServerStatus(Buf, NULL) == 2) {
901 StrBufCutLeft(Buf, 4);
902 AppendImportantMessage(SKEY(Buf));
910 int ConditionalAide(StrBuf *Target, WCTemplputParams *TP)
913 return (WCC != NULL)? (WC->is_aide == 0) : 0;
916 int ConditionalIsLoggedIn(StrBuf *Target, WCTemplputParams *TP)
919 return (WCC != NULL)? (WCC->logged_in == 0) : 0;
923 void _display_openid_login(void) {
924 display_openid_login(NULL);
928 void _display_reg(void) {
933 void Header_HandleAuth(StrBuf *Line, ParsedHttpHdrs *hdr)
935 if (hdr->HR.got_auth == NO_AUTH) /* don't override cookie auth... */
937 if (strncasecmp(ChrPtr(Line), "Basic", 5) == 0) {
938 StrBufCutLeft(Line, 6);
939 StrBufDecodeBase64(Line);
940 hdr->HR.plainauth = Line;
941 hdr->HR.got_auth = AUTH_BASIC;
944 lprintf(1, "Authentication scheme not supported! [%s]\n", ChrPtr(Line));
948 void CheckAuthBasic(ParsedHttpHdrs *hdr)
951 todo: enable this if we can have other sessions than authenticated ones.
952 if (hdr->DontNeedAuth)
955 StrBufAppendBufPlain(hdr->HR.plainauth, HKEY(":"), 0);
956 StrBufAppendBuf(hdr->HR.plainauth, hdr->HR.user_agent, 0);
957 hdr->HR.SessionKey = hashlittle(SKEY(hdr->HR.plainauth), 89479832);
959 lprintf(1, "CheckAuthBasic: calculated sessionkey %ld\n",
964 void GetAuthBasic(ParsedHttpHdrs *hdr)
966 const char *Pos = NULL;
967 if (hdr->c_username == NULL)
968 hdr->c_username = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_USER));
969 if (hdr->c_password == NULL)
970 hdr->c_password = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_PASS));
971 StrBufExtract_NextToken(hdr->c_username, hdr->HR.plainauth, &Pos, ':');
972 StrBufExtract_NextToken(hdr->c_password, hdr->HR.plainauth, &Pos, ':');
975 void Header_HandleCookie(StrBuf *Line, ParsedHttpHdrs *hdr)
979 todo: enable this if we can have other sessions than authenticated ones.
980 if (hdr->DontNeedAuth)
983 pch = strstr(ChrPtr(Line), "webcit=");
988 hdr->HR.RawCookie = Line;
989 StrBufCutLeft(hdr->HR.RawCookie, (pch - ChrPtr(hdr->HR.RawCookie)) + 7);
990 StrBufDecodeHex(hdr->HR.RawCookie);
992 cookie_to_stuff(Line, &hdr->HR.desired_session,
998 hdr->HR.got_auth = AUTH_COOKIE;
1003 (ParsedHttpHdrs *httpreq)
1005 httpreq->c_username = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_USER));
1006 httpreq->c_password = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_PASS));
1007 httpreq->c_roomname = NewStrBuf();
1008 httpreq->c_language = NewStrBuf();
1011 HttpDetachModule_AUTH
1012 (ParsedHttpHdrs *httpreq)
1014 FLUSHStrBuf(httpreq->c_username);
1015 FLUSHStrBuf(httpreq->c_password);
1016 FLUSHStrBuf(httpreq->c_roomname);
1017 FLUSHStrBuf(httpreq->c_language);
1021 HttpDestroyModule_AUTH
1022 (ParsedHttpHdrs *httpreq)
1024 FreeStrBuf(&httpreq->c_username);
1025 FreeStrBuf(&httpreq->c_password);
1026 FreeStrBuf(&httpreq->c_roomname);
1027 FreeStrBuf(&httpreq->c_language);
1034 initialize_axdefs();
1035 RegisterHeaderHandler(HKEY("COOKIE"), Header_HandleCookie);
1036 RegisterHeaderHandler(HKEY("AUTHORIZATION"), Header_HandleAuth);
1038 WebcitAddUrlHandler(HKEY(""), "", 0, do_welcome, ANONYMOUS|COOKIEUNNEEDED); /* no url pattern at all? Show login. */
1039 WebcitAddUrlHandler(HKEY("do_welcome"), "", 0, do_welcome, ANONYMOUS|COOKIEUNNEEDED);
1040 WebcitAddUrlHandler(HKEY("login"), "", 0, do_login, ANONYMOUS|COOKIEUNNEEDED);
1041 WebcitAddUrlHandler(HKEY("display_openid_login"), "", 0, _display_openid_login, ANONYMOUS);
1042 WebcitAddUrlHandler(HKEY("openid_login"), "", 0, do_openid_login, ANONYMOUS);
1043 WebcitAddUrlHandler(HKEY("finalize_openid_login"), "", 0, finalize_openid_login, ANONYMOUS);
1044 WebcitAddUrlHandler(HKEY("openid_manual_create"), "", 0, openid_manual_create, ANONYMOUS);
1045 WebcitAddUrlHandler(HKEY("do_logout"), "", 0, do_logout, ANONYMOUS|COOKIEUNNEEDED|FORCE_SESSIONCLOSE);
1046 WebcitAddUrlHandler(HKEY("validate"), "", 0, validate, 0);
1047 WebcitAddUrlHandler(HKEY("display_reg"), "", 0, _display_reg, 0);
1048 WebcitAddUrlHandler(HKEY("display_changepw"), "", 0, display_changepw, 0);
1049 WebcitAddUrlHandler(HKEY("changepw"), "", 0, changepw, 0);
1050 WebcitAddUrlHandler(HKEY("termquit"), "", 0, do_logout, 0);
1052 RegisterConditional(HKEY("COND:AIDE"), 2, ConditionalAide, CTX_NONE);
1053 RegisterConditional(HKEY("COND:LOGGEDIN"), 2, ConditionalIsLoggedIn, CTX_NONE);
1054 RegisterConditional(HKEY("COND:MAY_CREATE_ROOM"), 2, ConditionalHaveAccessCreateRoom, CTX_NONE);
1060 SessionDestroyModule_AUTH
1063 FreeStrBuf(&sess->wc_username);
1064 FreeStrBuf(&sess->wc_fullname);
1065 FreeStrBuf(&sess->wc_password);
1066 FreeStrBuf(&sess->httpauth_pass);
1067 FreeStrBuf(&sess->cs_inet_email);