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)
291 if (havebstr("language")) {
292 set_selected_language(bstr("language"));
293 go_selected_language();
296 if (havebstr("exit_action")) {
300 if (havebstr("login_action")) {
301 snprintf(buf, sizeof buf,
302 "OIDS %s|%s/finalize_openid_login|%s",
309 serv_getln(buf, sizeof buf);
311 lprintf(CTDL_DEBUG, "OpenID server contacted; redirecting to %s\n", &buf[4]);
312 http_redirect(&buf[4]);
316 display_openid_login(&buf[4]);
321 /* If we get to this point then something failed. */
322 display_openid_login(_("Your password was not accepted."));
326 * Complete the authentication using OpenID
327 * This function handles the positive or negative assertion from the user's Identity Provider
329 void finalize_openid_login(void)
333 int already_logged_in = (WCC->logged_in) ;
335 StrBuf *result = NULL;
336 StrBuf *username = NULL;
337 StrBuf *password = NULL;
338 StrBuf *logged_in_response = NULL;
339 StrBuf *claimed_id = NULL;
341 if (havebstr("openid.mode")) {
342 if (!strcasecmp(bstr("openid.mode"), "id_res")) {
345 StrBuf_ServGetln(Buf);
346 if (GetServerStatus(Buf, NULL) == 8) {
353 Cursor = GetNewHashPos (WCC->Hdr->urlstrings, 0);
354 while (GetNextHashPos(WCC->Hdr->urlstrings, Cursor, &HKLen, &HKey, &U)) {
356 if (!strncasecmp(u->url_key, "openid.", 7)) {
357 serv_printf("%s|%s", &u->url_key[7], ChrPtr(u->url_data));
364 while (StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000"))
366 if (linecount == 0) result = NewStrBufDup(Buf);
367 if (!strcasecmp(ChrPtr(result), "authenticate")) {
368 if (linecount == 1) {
369 username = NewStrBufDup(Buf);
371 else if (linecount == 2) {
372 password = NewStrBufDup(Buf);
374 else if (linecount == 3) {
375 logged_in_response = NewStrBufDup(Buf);
378 else if (!strcasecmp(ChrPtr(result), "verify_only")) {
379 if (linecount == 1) {
380 claimed_id = NewStrBufDup(Buf);
382 if (linecount == 2) {
383 username = NewStrBufDup(Buf);
393 /* If we were already logged in, this was an attempt to associate an OpenID account */
394 if (already_logged_in) {
397 FreeStrBuf(&username);
398 FreeStrBuf(&password);
399 FreeStrBuf(&claimed_id);
400 FreeStrBuf(&logged_in_response);
404 /* If this operation logged us in, either by connecting with an existing account or by
405 * auto-creating one using Simple Registration Extension, we're already on our way.
407 if (!strcasecmp(ChrPtr(result), "authenticate")) {
408 become_logged_in(username, password, logged_in_response);
411 /* The specified OpenID was verified but the desired user name was either not specified via SRI
412 * or conflicts with an existing user. Either way the user will need to specify a new name.
415 else if (!strcasecmp(ChrPtr(result), "verify_only")) {
416 putbstr("__claimed_id", claimed_id);
418 if (StrLength(username) > 0) {
419 putbstr("__username", username);
423 do_template("openid_manual_create", NULL);
427 /* Did we manage to log in? If so, continue with the normal flow... */
428 else if (WC->logged_in) {
435 display_openid_login(_("Your password was not accepted."));
439 FreeStrBuf(&username);
440 FreeStrBuf(&password);
441 FreeStrBuf(&claimed_id);
442 FreeStrBuf(&logged_in_response);
447 * Display a welcome screen to the user.
449 * If this is the first time login, and the web based setup is enabled,
450 * lead the user through the setup routines
452 void do_welcome(void)
455 #ifdef XXX_NOT_FINISHED_YET_XXX
460 * See if we have to run the first-time setup wizard
465 sprintf(wizard_filename, "setupwiz.%s.%s",
467 len = strlen(wizard_filename);
468 for (i=0; i<len; ++i) {
469 if ( (wizard_filename[i]==' ')
470 || (wizard_filename[i] == '/')
472 wizard_filename[i] = '_';
476 fp = fopen(wizard_filename, "r");
478 fgets(buf, sizeof buf, fp);
479 buf[strlen(buf)-1] = 0;
481 if (atoi(buf) == serv_info.serv_rev_level) {
482 setup_wizard = 1; /**< already run */
488 http_redirect("setup_wizard");
494 * Go to the user's preferred start page
496 if (!get_preference("startpage", &Buf)) {
498 StrBufPrintf(Buf, "dotskip?room=_BASEROOM_");
499 set_preference("startpage", Buf, 1);
501 if (ChrPtr(Buf)[0] == '/') {
502 StrBufCutLeft(Buf, 1);
504 if (StrLength(Buf) == 0) {
505 StrBufAppendBufPlain(Buf, "dotgoto?room=_BASEROOM_", -1, 0);
507 lprintf(9, "Redirecting to user's start page: %s\n", ChrPtr(Buf));
508 http_redirect(ChrPtr(Buf));
513 * Disconnect from the Citadel server, and end this WebCit session
515 void end_webcit_session(void) {
519 /* close() of citadel socket will be done by do_housekeeping() */
530 FlushStrBuf(WCC->wc_username);
531 FlushStrBuf(WCC->wc_password);
532 FlushStrBuf(WCC->CurRoom.name);
533 FlushStrBuf(WCC->wc_fullname);
535 /* FIXME: this is to suppress the iconbar displaying, because we aren't
536 actually logged out yet */
539 /** Calling output_headers() this way causes the cookies to be un-set */
540 output_headers(1, 1, 0, 1, 0, 0);
542 wc_printf("<div id=\"logout_screen\">");
543 wc_printf("<div class=\"box\">");
544 wc_printf("<div class=\"boxlabel\">");
545 wc_printf(_("Log off"));
546 wc_printf("</div><div class=\"boxcontent\">");
547 serv_puts("MESG goodbye");
548 serv_getln(buf, sizeof buf);
550 if (WCC->serv_sock >= 0) {
554 wc_printf("Goodbye\n");
558 wc_printf(_("This program was unable to connect or stay "
559 "connected to the Citadel server. Please report "
560 "this problem to your system administrator.")
562 wc_printf("<a href=\"http://www.citadel.org/doku.php/"
563 "faq:mastering_your_os:net#netstat\">%s</a>",
567 wc_printf("<hr /><div class=\"buttons\"> "
568 "<span class=\"button_link\"><a href=\".\">");
569 wc_printf(_("Log in again"));
570 wc_printf("</a></span>");
572 /* The "close window" link is commented out because some browsers don't
575 wc_printf(" <span class=\"button_link\">"
576 "<a href=\"javascript:window.close();\">");
577 wc_printf(_("Close window"));
578 wc_printf("</a></span>");
581 wc_printf("</div></div></div>\n");
583 end_webcit_session();
597 output_headers(1, 1, 2, 0, 0, 0);
598 wc_printf("<div id=\"banner\">\n");
600 wc_printf(_("Validate new users"));
602 wc_printf("</div>\n");
604 wc_printf("<div id=\"content\" class=\"service\">\n");
606 /* If the user just submitted a validation, process it... */
607 safestrncpy(buf, bstr("user"), sizeof buf);
608 if (!IsEmptyStr(buf)) {
609 if (havebstr("axlevel")) {
610 serv_printf("VALI %s|%s", buf, bstr("axlevel"));
611 serv_getln(buf, sizeof buf);
613 wc_printf("<b>%s</b><br>\n", &buf[4]);
618 /* Now see if any more users require validation. */
620 serv_getln(buf, sizeof buf);
623 wc_printf(_("No users require validation at this time."));
624 wc_printf("</b><br>\n");
629 wc_printf("<b>%s</b><br>\n", &buf[4]);
634 wc_printf("<div class=\"fix_scrollbar_bug\">"
635 "<table class=\"auth_validate\"><tr><td>\n");
636 wc_printf("<div id=\"validate\">");
638 safestrncpy(user, &buf[4], sizeof user);
639 serv_printf("GREG %s", user);
640 serv_getln(cmd, sizeof cmd);
644 serv_getln(buf, sizeof buf);
647 wc_printf("#%s<br><H1>%s</H1>",
656 while (!IsEmptyStr(pch))
660 else if (isalpha(*pch))
671 pch = _("very weak");
684 wc_printf("PW: %s<br>\n", pch);
687 wc_printf("%s<br>\n", buf);
689 wc_printf("%s<br>\n", buf);
691 wc_printf("%s, ", buf);
693 wc_printf("%s ", buf);
695 wc_printf("%s<br>\n", buf);
697 wc_printf("%s<br>\n", buf);
699 wc_printf(_("Current access level: %d (%s)\n"),
700 atoi(buf), axdefs[atoi(buf)]);
701 } while (strcmp(buf, "000"));
703 wc_printf("<H1>%s</H1>%s<br />\n", user, &cmd[4]);
707 wc_printf(_("Select access level for this user:"));
708 wc_printf("<br />\n");
709 for (a = 0; a <= 6; ++a) {
710 wc_printf("<a href=\"validate?nonce=%d?user=", WC->nonce);
712 wc_printf("&axlevel=%d\">%s</A> \n",
715 wc_printf("<br />\n");
717 wc_printf("</div>\n");
718 wc_printf("</td></tr></table></div>\n");
725 * Display form for registration.
727 * (Set during_login to 1 if this registration is being performed during
728 * new user login and will require chaining to the proper screen.)
730 void display_reg(int during_login)
734 message_summary *VCMsg = NULL;
735 wc_mime_attachment *VCAtt = NULL;
739 memset(&Room, 0, sizeof(folder));
740 if (goto_config_room(Buf, &Room) != 0) {
741 lprintf(9, "display_reg() exiting because goto_config_room() failed\n");
755 vcard_msgnum = locate_user_vcard_in_this_room(&VCMsg, &VCAtt);
756 if (vcard_msgnum < 0L) {
757 lprintf(9, "display_reg() exiting because locate_user_vcard_in_this_room() failed\n");
768 do_edit_vcard(vcard_msgnum, "1", VCMsg, VCAtt, "do_welcome", USERCONFIGROOM);
772 ReturnTo = NewStrBufPlain(HKEY("display_main_menu?gotofirst="));
773 StrBufAppendBuf(ReturnTo, WC->CurRoom.name, 0);
774 do_edit_vcard(vcard_msgnum, "1", VCMsg, VCAtt, ChrPtr(ReturnTo), USERCONFIGROOM);
775 FreeStrBuf(&ReturnTo);
778 /* FIXME - don't we have to free VCMsg and VCAtt ?? */
785 * display form for changing your password
787 void display_changepw(void)
789 WCTemplputParams SubTP;
792 output_headers(1, 1, 1, 0, 0, 0);
794 Buf = NewStrBufPlain(_("Change your password"), -1);
795 memset(&SubTP, 0, sizeof(WCTemplputParams));
796 SubTP.Filter.ContextType = CTX_STRBUF;
798 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
802 if (!IsEmptyStr(WC->ImportantMessage)) {
803 wc_printf("<span class=\"errormsg\">"
804 "%s</span><br />\n", WC->ImportantMessage);
805 safestrncpy(WC->ImportantMessage, "", sizeof WC->ImportantMessage);
808 serv_puts("MESG changepw");
809 serv_getln(buf, sizeof buf);
814 wc_printf("<form name=\"changepwform\" action=\"changepw\" method=\"post\">\n");
815 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
816 wc_printf("<table class=\"altern\" ");
817 wc_printf("<tr class=\"even\"><td>");
818 wc_printf(_("Enter new password:"));
819 wc_printf("</td><td>");
820 wc_printf("<input type=\"password\" name=\"newpass1\" value=\"\" maxlength=\"20\"></td></tr>\n");
821 wc_printf("<tr class=\"odd\"><td>");
822 wc_printf(_("Enter it again to confirm:"));
823 wc_printf("</td><td>");
824 wc_printf("<input type=\"password\" name=\"newpass2\" value=\"\" maxlength=\"20\"></td></tr>\n");
825 wc_printf("</table>\n");
827 wc_printf("<div class=\"buttons\">\n");
828 wc_printf("<input type=\"submit\" name=\"change_action\" value=\"%s\">", _("Change password"));
830 wc_printf("<input type=\"submit\" name=\"cancel_action\" value=\"%s\">\n", _("Cancel"));
831 wc_printf("</div>\n");
832 wc_printf("</form>\n");
834 do_template("endbox", NULL);
840 * if passwords match, propagate it to citserver.
845 char newpass1[32], newpass2[32];
847 if (!havebstr("change_action")) {
848 safestrncpy(WC->ImportantMessage,
849 _("Cancelled. Password was not changed."),
850 sizeof WC->ImportantMessage);
855 safestrncpy(newpass1, bstr("newpass1"), sizeof newpass1);
856 safestrncpy(newpass2, bstr("newpass2"), sizeof newpass2);
858 if (strcasecmp(newpass1, newpass2)) {
859 safestrncpy(WC->ImportantMessage,
860 _("They don't match. Password was not changed."),
861 sizeof WC->ImportantMessage);
866 if (IsEmptyStr(newpass1)) {
867 safestrncpy(WC->ImportantMessage,
868 _("Blank passwords are not allowed."),
869 sizeof WC->ImportantMessage);
874 serv_printf("SETP %s", newpass1);
875 serv_getln(buf, sizeof buf);
876 sprintf(WC->ImportantMessage, "%s", &buf[4]);
878 if (WC->wc_password == NULL)
879 WC->wc_password = NewStrBufPlain(buf, -1);
881 FlushStrBuf(WC->wc_password);
882 StrBufAppendBufPlain(WC->wc_password, buf, -1, 0);
891 int ConditionalHaveAccessCreateRoom(StrBuf *Target, WCTemplputParams *TP)
897 StrBuf_ServGetln(Buf);
899 if (GetServerStatus(Buf, NULL) == 2) {
900 StrBufCutLeft(Buf, 4);
901 AppendImportantMessage(SKEY(Buf));
909 int ConditionalAide(StrBuf *Target, WCTemplputParams *TP)
912 return (WCC != NULL)? (WC->is_aide == 0) : 0;
915 int ConditionalIsLoggedIn(StrBuf *Target, WCTemplputParams *TP)
918 return (WCC != NULL)? (WCC->logged_in == 0) : 0;
922 void _display_openid_login(void) {
923 display_openid_login(NULL);
927 void _display_reg(void) {
932 void Header_HandleAuth(StrBuf *Line, ParsedHttpHdrs *hdr)
934 if (hdr->HR.got_auth == NO_AUTH) /* don't override cookie auth... */
936 if (strncasecmp(ChrPtr(Line), "Basic", 5) == 0) {
937 StrBufCutLeft(Line, 6);
938 StrBufDecodeBase64(Line);
939 hdr->HR.plainauth = Line;
940 hdr->HR.got_auth = AUTH_BASIC;
943 lprintf(1, "Authentication scheme not supported! [%s]\n", ChrPtr(Line));
947 void CheckAuthBasic(ParsedHttpHdrs *hdr)
950 todo: enable this if we can have other sessions than authenticated ones.
951 if (hdr->DontNeedAuth)
954 StrBufAppendBufPlain(hdr->HR.plainauth, HKEY(":"), 0);
955 StrBufAppendBuf(hdr->HR.plainauth, hdr->HR.user_agent, 0);
956 hdr->HR.SessionKey = hashlittle(SKEY(hdr->HR.plainauth), 89479832);
958 lprintf(1, "CheckAuthBasic: calculated sessionkey %ld\n",
963 void GetAuthBasic(ParsedHttpHdrs *hdr)
965 const char *Pos = NULL;
966 if (hdr->c_username == NULL)
967 hdr->c_username = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_USER));
968 if (hdr->c_password == NULL)
969 hdr->c_password = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_PASS));
970 StrBufExtract_NextToken(hdr->c_username, hdr->HR.plainauth, &Pos, ':');
971 StrBufExtract_NextToken(hdr->c_password, hdr->HR.plainauth, &Pos, ':');
974 void Header_HandleCookie(StrBuf *Line, ParsedHttpHdrs *hdr)
978 todo: enable this if we can have other sessions than authenticated ones.
979 if (hdr->DontNeedAuth)
982 pch = strstr(ChrPtr(Line), "webcit=");
987 hdr->HR.RawCookie = Line;
988 StrBufCutLeft(hdr->HR.RawCookie, (pch - ChrPtr(hdr->HR.RawCookie)) + 7);
989 StrBufDecodeHex(hdr->HR.RawCookie);
991 cookie_to_stuff(Line, &hdr->HR.desired_session,
997 hdr->HR.got_auth = AUTH_COOKIE;
1002 (ParsedHttpHdrs *httpreq)
1004 httpreq->c_username = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_USER));
1005 httpreq->c_password = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_PASS));
1006 httpreq->c_roomname = NewStrBuf();
1007 httpreq->c_language = NewStrBuf();
1010 HttpDetachModule_AUTH
1011 (ParsedHttpHdrs *httpreq)
1013 FLUSHStrBuf(httpreq->c_username);
1014 FLUSHStrBuf(httpreq->c_password);
1015 FLUSHStrBuf(httpreq->c_roomname);
1016 FLUSHStrBuf(httpreq->c_language);
1020 HttpDestroyModule_AUTH
1021 (ParsedHttpHdrs *httpreq)
1023 FreeStrBuf(&httpreq->c_username);
1024 FreeStrBuf(&httpreq->c_password);
1025 FreeStrBuf(&httpreq->c_roomname);
1026 FreeStrBuf(&httpreq->c_language);
1033 initialize_axdefs();
1034 RegisterHeaderHandler(HKEY("COOKIE"), Header_HandleCookie);
1035 RegisterHeaderHandler(HKEY("AUTHORIZATION"), Header_HandleAuth);
1037 WebcitAddUrlHandler(HKEY(""), "", 0, do_welcome, ANONYMOUS|COOKIEUNNEEDED); /* no url pattern at all? Show login. */
1038 WebcitAddUrlHandler(HKEY("do_welcome"), "", 0, do_welcome, ANONYMOUS|COOKIEUNNEEDED);
1039 WebcitAddUrlHandler(HKEY("login"), "", 0, do_login, ANONYMOUS|COOKIEUNNEEDED);
1040 WebcitAddUrlHandler(HKEY("display_openid_login"), "", 0, _display_openid_login, ANONYMOUS);
1041 WebcitAddUrlHandler(HKEY("openid_login"), "", 0, do_openid_login, ANONYMOUS);
1042 WebcitAddUrlHandler(HKEY("finalize_openid_login"), "", 0, finalize_openid_login, ANONYMOUS);
1043 WebcitAddUrlHandler(HKEY("openid_manual_create"), "", 0, openid_manual_create, ANONYMOUS);
1044 WebcitAddUrlHandler(HKEY("do_logout"), "", 0, do_logout, ANONYMOUS|COOKIEUNNEEDED|FORCE_SESSIONCLOSE);
1045 WebcitAddUrlHandler(HKEY("validate"), "", 0, validate, 0);
1046 WebcitAddUrlHandler(HKEY("display_reg"), "", 0, _display_reg, 0);
1047 WebcitAddUrlHandler(HKEY("display_changepw"), "", 0, display_changepw, 0);
1048 WebcitAddUrlHandler(HKEY("changepw"), "", 0, changepw, 0);
1049 WebcitAddUrlHandler(HKEY("termquit"), "", 0, do_logout, 0);
1051 RegisterConditional(HKEY("COND:AIDE"), 2, ConditionalAide, CTX_NONE);
1052 RegisterConditional(HKEY("COND:LOGGEDIN"), 2, ConditionalIsLoggedIn, CTX_NONE);
1053 RegisterConditional(HKEY("COND:MAY_CREATE_ROOM"), 2, ConditionalHaveAccessCreateRoom, CTX_NONE);
1059 SessionDestroyModule_AUTH
1062 FreeStrBuf(&sess->wc_username);
1063 FreeStrBuf(&sess->wc_fullname);
1064 FreeStrBuf(&sess->wc_password);
1065 FreeStrBuf(&sess->httpauth_pass);
1066 FreeStrBuf(&sess->cs_inet_email);