2 * These functions handle authentication of users to a Citadel server.
4 * Copyright (c) 1996-2010 by the citadel.org team
6 * This program is open source software. You can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 3 of the
9 * License, or (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) {
38 axdefs[0] = _("Deleted");
41 axdefs[1] = _("New User");
44 axdefs[2] = _("Problem User");
46 /* user with normal privileges */
47 axdefs[3] = _("Local User");
49 /* a user that may access network resources */
50 axdefs[4] = _("Network User");
53 axdefs[5] = _("Preferred User");
56 axdefs[6] = _("Aide");
62 * Display the login screen
63 * mesg = the error message if last attempt failed.
65 void display_login(void)
68 output_headers(1, 0, 0, 0, 1, 0);
69 do_template("login", NULL);
77 * Display the openid-enabled login screen
78 * mesg = the error message if last attempt failed.
80 void display_openid_login(char *mesg)
83 output_headers(1, 0, 0, 0, 1, 0);
84 do_template("openid_login", NULL);
91 /* Initialize the session
93 * This function needs to get called whenever the session changes from
94 * not-logged-in to logged-in, either by an explicit login by the user or
95 * by a timed-out session automatically re-establishing with a little help
96 * from the browser cookie. Either way, we need to load access controls and
97 * preferences from the server.
101 * serv_response The parameters returned from a Citadel USER or NEWU command
103 void become_logged_in(const StrBuf *user, const StrBuf *pass, StrBuf *serv_response)
111 if (WCC->wc_fullname == NULL)
112 WCC->wc_fullname = NewStrBufPlain(NULL, StrLength(serv_response));
113 StrBufExtract_token(WCC->wc_fullname, serv_response, 0, '|');
114 StrBufCutLeft(WCC->wc_fullname, 4 );
116 if (WCC->wc_username == NULL)
117 WCC->wc_username = NewStrBufDup(user);
119 FlushStrBuf(WCC->wc_username);
120 StrBufAppendBuf(WCC->wc_username, user, 0);
123 if (WCC->wc_password == NULL)
124 WCC->wc_password = NewStrBufDup(pass);
126 FlushStrBuf(WCC->wc_password);
127 StrBufAppendBuf(WCC->wc_password, pass, 0);
130 WCC->axlevel = StrBufExtract_int(serv_response, 1, '|');
131 if (WCC->axlevel >= 6) { /* TODO: make this a define, else it might trick us later */
139 StrBuf_ServGetln(Buf);
140 if (GetServerStatus(Buf, NULL) == 2) {
143 pch = ChrPtr(Buf) + 4;
144 /*WCC->new_mail =*/ StrBufExtractNext_long(Buf, &pch, '|');
145 WCC->need_regi = StrBufExtractNext_long(Buf, &pch, '|');
146 WCC->need_vali = StrBufExtractNext_long(Buf, &pch, '|');
147 if (WCC->cs_inet_email == NULL)
148 WCC->cs_inet_email = NewStrBuf();
149 StrBufExtract_NextToken(WCC->cs_inet_email, Buf, &pch, '|');
151 get_preference("floordiv_expanded", &FloorDiv);
152 WCC->floordiv_expanded = FloorDiv;
158 * Perform authentication using a user name and password
166 if (havebstr("language")) {
167 set_selected_language(bstr("language"));
168 go_selected_language();
171 if (havebstr("exit_action")) {
176 if (havebstr("login_action")) {
177 serv_printf("USER %s", bstr("name"));
178 StrBuf_ServGetln(Buf);
179 rc = GetServerStatus(Buf, &ret);
180 StrBufCutLeft(Buf, 4);
183 serv_printf("PASS %s", bstr("pass"));
184 StrBuf_ServGetln(Buf);
185 if (GetServerStatus(Buf, NULL) == 2) {
186 become_logged_in(sbstr("name"), sbstr("pass"), Buf);
188 StrBufCutLeft(Buf, 4);
189 AppendImportantMessage(SKEY(Buf));
198 AppendImportantMessage(SKEY(Buf));
203 AppendImportantMessage(SKEY(Buf));
209 if (havebstr("newuser_action")) {
210 if (!havebstr("pass")) {
211 AppendImportantMessage(_("Blank passwords are not allowed."), -1);
216 serv_printf("NEWU %s", bstr("name"));
217 StrBuf_ServGetln(Buf);
218 if (GetServerStatus(Buf, NULL) == 2) {
219 become_logged_in(sbstr("name"), sbstr("pass"), Buf);
220 serv_printf("SETP %s", bstr("pass"));
221 StrBuf_ServGetln(Buf); /* Don't care? */
223 StrBufCutLeft(Buf, 4);
224 AppendImportantMessage(SKEY(Buf));
230 if (WCC->logged_in) {
231 if (WCC->need_regi) {
233 } else if (WCC->need_vali) {
239 AppendImportantMessage(_("Your password was not accepted."), -1);
248 * modal/ajax version of 'login' (username and password)
250 void ajax_login_username_password(void) {
251 StrBuf *Buf = NewStrBuf();
253 serv_printf("USER %s", bstr("name"));
254 StrBuf_ServGetln(Buf);
255 if (GetServerStatus(Buf, NULL) == 3) {
256 serv_printf("PASS %s", bstr("pass"));
257 StrBuf_ServGetln(Buf);
258 if (GetServerStatus(Buf, NULL) == 2) {
259 become_logged_in(sbstr("name"), sbstr("pass"), Buf);
263 /* The client is expecting to read back a citadel protocol response */
264 wc_printf("%s", ChrPtr(Buf));
271 * Try to create an account manually after an OpenID was verified
273 void openid_manual_create(void)
277 if (havebstr("exit_action")) {
282 if (havebstr("newuser_action")) {
284 serv_printf("OIDC %s", bstr("name"));
285 StrBuf_ServGetln(Buf);
286 if (GetServerStatus(Buf, NULL) == 2) {
290 serv_puts("SETP GENERATE_RANDOM_PASSWORD");
291 StrBuf_ServGetln(gpass);
292 StrBufCutLeft(gpass, 4);
293 become_logged_in(sbstr("name"), gpass, Buf);
302 } else if (WC->need_vali) {
310 putbstr("__claimed_id", NewStrBufDup(sbstr("openid_url")));
312 if (StrLength(Buf) > 0)
313 putbstr("__username", NewStrBufDup(Buf));
315 do_template("openid_manual_create", NULL);
323 * Perform authentication using OpenID
324 * assemble the checkid_setup request and then redirect to the user's identity provider
326 void do_openid_login(void)
330 if (havebstr("language")) {
331 set_selected_language(bstr("language"));
332 go_selected_language();
335 if (havebstr("exit_action")) {
339 if (havebstr("login_action")) {
340 snprintf(buf, sizeof buf,
341 "OIDS %s|%s/finalize_openid_login|%s",
348 serv_getln(buf, sizeof buf);
350 syslog(LOG_DEBUG, "OpenID server contacted; redirecting to %s\n", &buf[4]);
351 http_redirect(&buf[4]);
355 display_openid_login(&buf[4]);
360 /* If we get to this point then something failed. */
361 display_openid_login(_("Your password was not accepted."));
365 * Complete the authentication using OpenID
366 * This function handles the positive or negative assertion from the user's Identity Provider
368 void finalize_openid_login(void)
372 int already_logged_in = (WCC->logged_in) ;
374 StrBuf *result = NULL;
375 StrBuf *username = NULL;
376 StrBuf *password = NULL;
377 StrBuf *logged_in_response = NULL;
378 StrBuf *claimed_id = NULL;
380 if (havebstr("openid.mode")) {
381 if (!strcasecmp(bstr("openid.mode"), "id_res")) {
384 StrBuf_ServGetln(Buf);
385 if (GetServerStatus(Buf, NULL) == 8) {
392 Cursor = GetNewHashPos (WCC->Hdr->urlstrings, 0);
393 while (GetNextHashPos(WCC->Hdr->urlstrings, Cursor, &HKLen, &HKey, &U)) {
395 if (!strncasecmp(u->url_key, "openid.", 7)) {
396 serv_printf("%s|%s", &u->url_key[7], ChrPtr(u->url_data));
403 while (StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000"))
405 if (linecount == 0) result = NewStrBufDup(Buf);
406 if (!strcasecmp(ChrPtr(result), "authenticate")) {
407 if (linecount == 1) {
408 username = NewStrBufDup(Buf);
410 else if (linecount == 2) {
411 password = NewStrBufDup(Buf);
413 else if (linecount == 3) {
414 logged_in_response = NewStrBufDup(Buf);
417 else if (!strcasecmp(ChrPtr(result), "verify_only")) {
418 if (linecount == 1) {
419 claimed_id = NewStrBufDup(Buf);
421 if (linecount == 2) {
422 username = NewStrBufDup(Buf);
432 /* If we were already logged in, this was an attempt to associate an OpenID account */
433 if (already_logged_in) {
436 FreeStrBuf(&username);
437 FreeStrBuf(&password);
438 FreeStrBuf(&claimed_id);
439 FreeStrBuf(&logged_in_response);
443 /* If this operation logged us in, either by connecting with an existing account or by
444 * auto-creating one using Simple Registration Extension, we're already on our way.
446 if (!strcasecmp(ChrPtr(result), "authenticate")) {
447 become_logged_in(username, password, logged_in_response);
450 /* The specified OpenID was verified but the desired user name was either not specified via SRI
451 * or conflicts with an existing user. Either way the user will need to specify a new name.
454 else if (!strcasecmp(ChrPtr(result), "verify_only")) {
455 putbstr("__claimed_id", claimed_id);
457 if (StrLength(username) > 0) {
458 putbstr("__username", username);
462 do_template("openid_manual_create", NULL);
466 /* Did we manage to log in? If so, continue with the normal flow... */
467 else if (WC->logged_in) {
474 display_openid_login(_("Your password was not accepted."));
478 FreeStrBuf(&username);
479 FreeStrBuf(&password);
480 FreeStrBuf(&claimed_id);
481 FreeStrBuf(&logged_in_response);
486 * Display a welcome screen to the user.
488 * If this is the first time login, and the web based setup is enabled,
489 * lead the user through the setup routines
491 void do_welcome(void)
494 #ifdef XXX_NOT_FINISHED_YET_XXX
499 * See if we have to run the first-time setup wizard
504 sprintf(wizard_filename, "setupwiz.%s.%s",
506 len = strlen(wizard_filename);
507 for (i=0; i<len; ++i) {
508 if ( (wizard_filename[i]==' ')
509 || (wizard_filename[i] == '/')
511 wizard_filename[i] = '_';
515 fp = fopen(wizard_filename, "r");
517 fgets(buf, sizeof buf, fp);
518 buf[strlen(buf)-1] = 0;
520 if (atoi(buf) == serv_info.serv_rev_level) {
521 setup_wizard = 1; /**< already run */
527 http_redirect("setup_wizard");
533 * Go to the user's preferred start page
535 if (!get_preference("startpage", &Buf)) {
537 StrBufPrintf(Buf, "dotskip?room=_BASEROOM_");
538 set_preference("startpage", Buf, 1);
540 if (ChrPtr(Buf)[0] == '/') {
541 StrBufCutLeft(Buf, 1);
543 if (StrLength(Buf) == 0) {
544 StrBufAppendBufPlain(Buf, "dotgoto?room=_BASEROOM_", -1, 0);
546 lprintf(9, "Redirecting to user's start page: %s\n", ChrPtr(Buf));
547 http_redirect(ChrPtr(Buf));
552 * Disconnect from the Citadel server, and end this WebCit session
554 void end_webcit_session(void) {
558 /* close() of citadel socket will be done by do_housekeeping() */
569 FlushStrBuf(WCC->wc_username);
570 FlushStrBuf(WCC->wc_password);
571 FlushStrBuf(WCC->wc_fullname);
574 serv_getln(buf, sizeof buf);
577 if (WC->serv_info->serv_supports_guest) {
578 display_default_landing_page();
582 FlushStrBuf(WCC->CurRoom.name);
584 /* Calling output_headers() this way causes the cookies to be un-set */
585 output_headers(1, 1, 0, 1, 0, 0);
587 wc_printf("<div id=\"logout_screen\">");
588 wc_printf("<div class=\"box\">");
589 wc_printf("<div class=\"boxlabel\">");
590 wc_printf(_("Log off"));
591 wc_printf("</div><div class=\"boxcontent\">");
592 serv_puts("MESG goodbye");
593 serv_getln(buf, sizeof buf);
595 if (WCC->serv_sock >= 0) {
599 wc_printf("Goodbye\n");
603 wc_printf(_("This program was unable to connect or stay "
604 "connected to the Citadel server. Please report "
605 "this problem to your system administrator.")
607 wc_printf("<a href=\"http://www.citadel.org/doku.php/"
608 "faq:mastering_your_os:net#netstat\">%s</a>",
612 wc_printf("<hr /><div class=\"buttons\"> "
613 "<span class=\"button_link\"><a href=\".\">");
614 wc_printf(_("Log in again"));
615 wc_printf("</a></span>");
616 wc_printf("</div></div></div>\n");
618 end_webcit_session();
632 output_headers(1, 1, 2, 0, 0, 0);
633 wc_printf("<div id=\"banner\">\n");
635 wc_printf(_("Validate new users"));
637 wc_printf("</div>\n");
639 wc_printf("<div id=\"content\" class=\"service\">\n");
641 /* If the user just submitted a validation, process it... */
642 safestrncpy(buf, bstr("user"), sizeof buf);
643 if (!IsEmptyStr(buf)) {
644 if (havebstr("axlevel")) {
645 serv_printf("VALI %s|%s", buf, bstr("axlevel"));
646 serv_getln(buf, sizeof buf);
648 wc_printf("<b>%s</b><br>\n", &buf[4]);
653 /* Now see if any more users require validation. */
655 serv_getln(buf, sizeof buf);
658 wc_printf(_("No users require validation at this time."));
659 wc_printf("</b><br>\n");
664 wc_printf("<b>%s</b><br>\n", &buf[4]);
669 wc_printf("<table class=\"auth_validate\"><tr><td>\n");
670 wc_printf("<div id=\"validate\">");
672 safestrncpy(user, &buf[4], sizeof user);
673 serv_printf("GREG %s", user);
674 serv_getln(cmd, sizeof cmd);
678 serv_getln(buf, sizeof buf);
681 wc_printf("#%s<br><H1>%s</H1>",
690 while (!IsEmptyStr(pch))
694 else if (isalpha(*pch))
705 pch = _("very weak");
718 wc_printf("PW: %s<br>\n", pch);
721 wc_printf("%s<br>\n", buf);
723 wc_printf("%s<br>\n", buf);
725 wc_printf("%s, ", buf);
727 wc_printf("%s ", buf);
729 wc_printf("%s<br>\n", buf);
731 wc_printf("%s<br>\n", buf);
733 wc_printf(_("Current access level: %d (%s)\n"),
734 atoi(buf), axdefs[atoi(buf)]);
735 } while (strcmp(buf, "000"));
737 wc_printf("<H1>%s</H1>%s<br>\n", user, &cmd[4]);
741 wc_printf(_("Select access level for this user:"));
743 for (a = 0; a <= 6; ++a) {
744 wc_printf("<a href=\"validate?nonce=%d?user=", WC->nonce);
746 wc_printf("&axlevel=%d\">%s</A> \n",
751 wc_printf("</div>\n");
752 wc_printf("</td></tr></table>\n");
759 * Display form for registration.
761 * (Set during_login to 1 if this registration is being performed during
762 * new user login and will require chaining to the proper screen.)
764 void display_reg(int during_login)
768 message_summary *VCMsg = NULL;
769 wc_mime_attachment *VCAtt = NULL;
773 memset(&Room, 0, sizeof(folder));
774 if (goto_config_room(Buf, &Room) != 0) {
775 lprintf(9, "display_reg() exiting because goto_config_room() failed\n");
789 vcard_msgnum = locate_user_vcard_in_this_room(&VCMsg, &VCAtt);
790 if (vcard_msgnum < 0L) {
791 lprintf(9, "display_reg() exiting because locate_user_vcard_in_this_room() failed\n");
802 do_edit_vcard(vcard_msgnum, "1", VCMsg, VCAtt, "do_welcome", USERCONFIGROOM);
806 ReturnTo = NewStrBufPlain(HKEY("display_main_menu?go="));
807 StrBufAppendBuf(ReturnTo, WC->CurRoom.name, 0);
808 do_edit_vcard(vcard_msgnum, "1", VCMsg, VCAtt, ChrPtr(ReturnTo), USERCONFIGROOM);
809 FreeStrBuf(&ReturnTo);
812 /* FIXME - don't we have to free VCMsg and VCAtt ?? */
819 * display form for changing your password
821 void display_changepw(void)
823 WCTemplputParams SubTP;
826 output_headers(1, 1, 1, 0, 0, 0);
828 Buf = NewStrBufPlain(_("Change your password"), -1);
829 memset(&SubTP, 0, sizeof(WCTemplputParams));
830 SubTP.Filter.ContextType = CTX_STRBUF;
832 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
836 if (!IsEmptyStr(WC->ImportantMessage)) {
837 wc_printf("<span class=\"errormsg\">"
838 "%s</span><br>\n", WC->ImportantMessage);
839 safestrncpy(WC->ImportantMessage, "", sizeof WC->ImportantMessage);
842 serv_puts("MESG changepw");
843 serv_getln(buf, sizeof buf);
848 wc_printf("<form name=\"changepwform\" action=\"changepw\" method=\"post\">\n");
849 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
850 wc_printf("<table class=\"altern\" ");
851 wc_printf("<tr class=\"even\"><td>");
852 wc_printf(_("Enter new password:"));
853 wc_printf("</td><td>");
854 wc_printf("<input type=\"password\" name=\"newpass1\" value=\"\" maxlength=\"20\"></td></tr>\n");
855 wc_printf("<tr class=\"odd\"><td>");
856 wc_printf(_("Enter it again to confirm:"));
857 wc_printf("</td><td>");
858 wc_printf("<input type=\"password\" name=\"newpass2\" value=\"\" maxlength=\"20\"></td></tr>\n");
859 wc_printf("</table>\n");
861 wc_printf("<div class=\"buttons\">\n");
862 wc_printf("<input type=\"submit\" name=\"change_action\" value=\"%s\">", _("Change password"));
864 wc_printf("<input type=\"submit\" name=\"cancel_action\" value=\"%s\">\n", _("Cancel"));
865 wc_printf("</div>\n");
866 wc_printf("</form>\n");
868 do_template("endbox", NULL);
874 * if passwords match, propagate it to citserver.
879 char newpass1[32], newpass2[32];
881 if (!havebstr("change_action")) {
882 safestrncpy(WC->ImportantMessage,
883 _("Cancelled. Password was not changed."),
884 sizeof WC->ImportantMessage);
889 safestrncpy(newpass1, bstr("newpass1"), sizeof newpass1);
890 safestrncpy(newpass2, bstr("newpass2"), sizeof newpass2);
892 if (strcasecmp(newpass1, newpass2)) {
893 safestrncpy(WC->ImportantMessage,
894 _("They don't match. Password was not changed."),
895 sizeof WC->ImportantMessage);
900 if (IsEmptyStr(newpass1)) {
901 safestrncpy(WC->ImportantMessage,
902 _("Blank passwords are not allowed."),
903 sizeof WC->ImportantMessage);
908 serv_printf("SETP %s", newpass1);
909 serv_getln(buf, sizeof buf);
910 sprintf(WC->ImportantMessage, "%s", &buf[4]);
912 if (WC->wc_password == NULL)
913 WC->wc_password = NewStrBufPlain(buf, -1);
915 FlushStrBuf(WC->wc_password);
916 StrBufAppendBufPlain(WC->wc_password, buf, -1, 0);
925 int ConditionalHaveAccessCreateRoom(StrBuf *Target, WCTemplputParams *TP)
931 StrBuf_ServGetln(Buf);
933 if (GetServerStatus(Buf, NULL) == 2) {
934 StrBufCutLeft(Buf, 4);
935 AppendImportantMessage(SKEY(Buf));
943 int ConditionalAide(StrBuf *Target, WCTemplputParams *TP)
946 return (WCC != NULL)? (WC->is_aide == 0) : 0;
949 int ConditionalIsLoggedIn(StrBuf *Target, WCTemplputParams *TP)
952 return (WCC != NULL)? (WCC->logged_in == 0) : 0;
957 void _display_openid_login(void) {
958 display_openid_login(NULL);
962 void _display_reg(void) {
967 void Header_HandleAuth(StrBuf *Line, ParsedHttpHdrs *hdr)
969 if (hdr->HR.got_auth == NO_AUTH) /* don't override cookie auth... */
971 if (strncasecmp(ChrPtr(Line), "Basic", 5) == 0) {
972 StrBufCutLeft(Line, 6);
973 StrBufDecodeBase64(Line);
974 hdr->HR.plainauth = Line;
975 hdr->HR.got_auth = AUTH_BASIC;
978 lprintf(1, "Authentication scheme not supported! [%s]\n", ChrPtr(Line));
982 void CheckAuthBasic(ParsedHttpHdrs *hdr)
985 todo: enable this if we can have other sessions than authenticated ones.
986 if (hdr->DontNeedAuth)
989 StrBufAppendBufPlain(hdr->HR.plainauth, HKEY(":"), 0);
990 StrBufAppendBuf(hdr->HR.plainauth, hdr->HR.user_agent, 0);
991 hdr->HR.SessionKey = hashlittle(SKEY(hdr->HR.plainauth), 89479832);
993 lprintf(1, "CheckAuthBasic: calculated sessionkey %ld\n",
998 void GetAuthBasic(ParsedHttpHdrs *hdr)
1000 const char *Pos = NULL;
1001 if (hdr->c_username == NULL)
1002 hdr->c_username = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_USER));
1003 if (hdr->c_password == NULL)
1004 hdr->c_password = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_PASS));
1005 StrBufExtract_NextToken(hdr->c_username, hdr->HR.plainauth, &Pos, ':');
1006 StrBufExtract_NextToken(hdr->c_password, hdr->HR.plainauth, &Pos, ':');
1009 void Header_HandleCookie(StrBuf *Line, ParsedHttpHdrs *hdr)
1013 todo: enable this if we can have other sessions than authenticated ones.
1014 if (hdr->DontNeedAuth)
1017 pch = strstr(ChrPtr(Line), "webcit=");
1022 hdr->HR.RawCookie = Line;
1023 StrBufCutLeft(hdr->HR.RawCookie, (pch - ChrPtr(hdr->HR.RawCookie)) + 7);
1024 StrBufDecodeHex(hdr->HR.RawCookie);
1026 cookie_to_stuff(Line, &hdr->HR.desired_session,
1032 hdr->HR.got_auth = AUTH_COOKIE;
1037 (ParsedHttpHdrs *httpreq)
1039 httpreq->c_username = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_USER));
1040 httpreq->c_password = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_PASS));
1041 httpreq->c_roomname = NewStrBuf();
1042 httpreq->c_language = NewStrBuf();
1045 HttpDetachModule_AUTH
1046 (ParsedHttpHdrs *httpreq)
1048 FLUSHStrBuf(httpreq->c_username);
1049 FLUSHStrBuf(httpreq->c_password);
1050 FLUSHStrBuf(httpreq->c_roomname);
1051 FLUSHStrBuf(httpreq->c_language);
1055 HttpDestroyModule_AUTH
1056 (ParsedHttpHdrs *httpreq)
1058 FreeStrBuf(&httpreq->c_username);
1059 FreeStrBuf(&httpreq->c_password);
1060 FreeStrBuf(&httpreq->c_roomname);
1061 FreeStrBuf(&httpreq->c_language);
1068 initialize_axdefs();
1069 RegisterHeaderHandler(HKEY("COOKIE"), Header_HandleCookie);
1070 RegisterHeaderHandler(HKEY("AUTHORIZATION"), Header_HandleAuth);
1072 WebcitAddUrlHandler(HKEY(""), "", 0, do_welcome, ANONYMOUS|COOKIEUNNEEDED); /* no url pattern at all? Show login. */
1073 WebcitAddUrlHandler(HKEY("do_welcome"), "", 0, do_welcome, ANONYMOUS|COOKIEUNNEEDED);
1074 WebcitAddUrlHandler(HKEY("login"), "", 0, do_login, ANONYMOUS|COOKIEUNNEEDED);
1075 WebcitAddUrlHandler(HKEY("display_openid_login"), "", 0, _display_openid_login, ANONYMOUS);
1076 WebcitAddUrlHandler(HKEY("openid_login"), "", 0, do_openid_login, ANONYMOUS);
1077 WebcitAddUrlHandler(HKEY("finalize_openid_login"), "", 0, finalize_openid_login, ANONYMOUS);
1078 WebcitAddUrlHandler(HKEY("openid_manual_create"), "", 0, openid_manual_create, ANONYMOUS);
1079 WebcitAddUrlHandler(HKEY("do_logout"), "", 0, do_logout, ANONYMOUS|COOKIEUNNEEDED|FORCE_SESSIONCLOSE);
1080 WebcitAddUrlHandler(HKEY("ajax_login_username_password"), "", 0, ajax_login_username_password, AJAX);
1081 WebcitAddUrlHandler(HKEY("validate"), "", 0, validate, 0);
1082 WebcitAddUrlHandler(HKEY("do_welcome"), "", 0, do_welcome, 0);
1083 WebcitAddUrlHandler(HKEY("display_reg"), "", 0, _display_reg, 0);
1084 WebcitAddUrlHandler(HKEY("display_changepw"), "", 0, display_changepw, 0);
1085 WebcitAddUrlHandler(HKEY("changepw"), "", 0, changepw, 0);
1086 WebcitAddUrlHandler(HKEY("termquit"), "", 0, do_logout, 0);
1089 RegisterConditional(HKEY("COND:AIDE"), 2, ConditionalAide, CTX_NONE);
1090 RegisterConditional(HKEY("COND:LOGGEDIN"), 2, ConditionalIsLoggedIn, CTX_NONE);
1091 RegisterConditional(HKEY("COND:MAY_CREATE_ROOM"), 2, ConditionalHaveAccessCreateRoom, CTX_NONE);
1097 SessionDestroyModule_AUTH
1100 FreeStrBuf(&sess->wc_username);
1101 FreeStrBuf(&sess->wc_fullname);
1102 FreeStrBuf(&sess->wc_password);
1103 FreeStrBuf(&sess->httpauth_pass);
1104 FreeStrBuf(&sess->cs_inet_email);