2 * These functions handle authentication of users to a Citadel server.
4 * Copyright (c) 1996-2011 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 /* 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);
234 * modal/ajax version of 'login' (username and password)
236 void ajax_login_username_password(void) {
237 StrBuf *Buf = NewStrBuf();
239 serv_printf("USER %s", bstr("name"));
240 StrBuf_ServGetln(Buf);
241 if (GetServerStatus(Buf, NULL) == 3) {
242 serv_printf("PASS %s", bstr("pass"));
243 StrBuf_ServGetln(Buf);
244 if (GetServerStatus(Buf, NULL) == 2) {
245 become_logged_in(sbstr("name"), sbstr("pass"), Buf);
249 /* The client is expecting to read back a citadel protocol response */
250 wc_printf("%s", ChrPtr(Buf));
257 * Try to create an account manually after an OpenID was verified
259 void openid_manual_create(void)
263 if (havebstr("exit_action")) {
268 if (havebstr("newuser_action")) {
270 serv_printf("OIDC %s", bstr("name"));
271 StrBuf_ServGetln(Buf);
272 if (GetServerStatus(Buf, NULL) == 2) {
276 serv_puts("SETP GENERATE_RANDOM_PASSWORD");
277 StrBuf_ServGetln(gpass);
278 StrBufCutLeft(gpass, 4);
279 become_logged_in(sbstr("name"), gpass, Buf);
288 } else if (WC->need_vali) {
296 putbstr("__claimed_id", NewStrBufDup(sbstr("openid_url")));
298 if (StrLength(Buf) > 0)
299 putbstr("__username", NewStrBufDup(Buf));
301 do_template("openid_manual_create", NULL);
309 * Perform authentication using OpenID
310 * assemble the checkid_setup request and then redirect to the user's identity provider
312 void do_openid_login(void)
316 snprintf(buf, sizeof buf,
317 "OIDS %s|%s/finalize_openid_login|%s",
324 serv_getln(buf, sizeof buf);
326 syslog(LOG_DEBUG, "OpenID server contacted; redirecting to %s\n", &buf[4]);
327 http_redirect(&buf[4]);
331 convenience_page("770000", _("Error"), &buf[4]);
336 * Complete the authentication using OpenID
337 * This function handles the positive or negative assertion from the user's Identity Provider
339 void finalize_openid_login(void)
343 int already_logged_in = (WCC->logged_in) ;
345 StrBuf *result = NULL;
346 StrBuf *username = NULL;
347 StrBuf *password = NULL;
348 StrBuf *logged_in_response = NULL;
349 StrBuf *claimed_id = NULL;
351 if (havebstr("openid.mode")) {
352 if (!strcasecmp(bstr("openid.mode"), "id_res")) {
355 StrBuf_ServGetln(Buf);
356 if (GetServerStatus(Buf, NULL) == 8) {
363 Cursor = GetNewHashPos (WCC->Hdr->urlstrings, 0);
364 while (GetNextHashPos(WCC->Hdr->urlstrings, Cursor, &HKLen, &HKey, &U)) {
366 if (!strncasecmp(u->url_key, "openid.", 7)) {
367 serv_printf("%s|%s", &u->url_key[7], ChrPtr(u->url_data));
374 while (StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000"))
376 if (linecount == 0) result = NewStrBufDup(Buf);
377 if (!strcasecmp(ChrPtr(result), "authenticate")) {
378 if (linecount == 1) {
379 username = NewStrBufDup(Buf);
381 else if (linecount == 2) {
382 password = NewStrBufDup(Buf);
384 else if (linecount == 3) {
385 logged_in_response = NewStrBufDup(Buf);
388 else if (!strcasecmp(ChrPtr(result), "verify_only")) {
389 if (linecount == 1) {
390 claimed_id = NewStrBufDup(Buf);
392 if (linecount == 2) {
393 username = NewStrBufDup(Buf);
403 /* If we were already logged in, this was an attempt to associate an OpenID account
404 FIXME put this back in
405 if (already_logged_in) {
408 FreeStrBuf(&username);
409 FreeStrBuf(&password);
410 FreeStrBuf(&claimed_id);
411 FreeStrBuf(&logged_in_response);
416 /* If this operation logged us in, either by connecting with an existing account or by
417 * auto-creating one using Simple Registration Extension, we're already on our way.
419 if (!strcasecmp(ChrPtr(result), "authenticate")) {
420 become_logged_in(username, password, logged_in_response);
423 /* The specified OpenID was verified but the desired user name was either not specified via SRI
424 * or conflicts with an existing user. Either way the user will need to specify a new name.
428 else if (!strcasecmp(ChrPtr(result), "verify_only")) {
429 putbstr("__claimed_id", claimed_id);
431 if (StrLength(username) > 0) {
432 putbstr("__username", username);
436 do_template("openid_manual_create", NULL);
443 /* Did we manage to log in? If so, continue with the normal flow... */
447 output_headers(1, 0, 0, 0, 1, 0);
448 do_template("authpopup_finished", NULL);
451 /* FIXME make all this crap work again
460 /* maybe do something prettier here? */
461 convenience_page("770000", _("Error"), _("Error") );
465 FreeStrBuf(&username);
466 FreeStrBuf(&password);
467 FreeStrBuf(&claimed_id);
468 FreeStrBuf(&logged_in_response);
473 * Display a welcome screen to the user.
475 * If this is the first time login, and the web based setup is enabled,
476 * lead the user through the setup routines
478 void do_welcome(void)
481 #ifdef XXX_NOT_FINISHED_YET_XXX
486 * See if we have to run the first-time setup wizard
491 sprintf(wizard_filename, "setupwiz.%s.%s",
493 len = strlen(wizard_filename);
494 for (i=0; i<len; ++i) {
495 if ( (wizard_filename[i]==' ')
496 || (wizard_filename[i] == '/')
498 wizard_filename[i] = '_';
502 fp = fopen(wizard_filename, "r");
504 fgets(buf, sizeof buf, fp);
505 buf[strlen(buf)-1] = 0;
507 if (atoi(buf) == serv_info.serv_rev_level) {
508 setup_wizard = 1; /**< already run */
514 http_redirect("setup_wizard");
520 * Go to the user's preferred start page
522 if (!get_preference("startpage", &Buf)) {
524 StrBufPrintf(Buf, "dotskip?room=_BASEROOM_");
525 set_preference("startpage", Buf, 1);
527 if (ChrPtr(Buf)[0] == '/') {
528 StrBufCutLeft(Buf, 1);
530 if (StrLength(Buf) == 0) {
531 StrBufAppendBufPlain(Buf, "dotgoto?room=_BASEROOM_", -1, 0);
533 syslog(9, "Redirecting to user's start page: %s\n", ChrPtr(Buf));
534 http_redirect(ChrPtr(Buf));
539 * Disconnect from the Citadel server, and end this WebCit session
541 void end_webcit_session(void) {
545 /* close() of citadel socket will be done by do_housekeeping() */
556 FlushStrBuf(WCC->wc_username);
557 FlushStrBuf(WCC->wc_password);
558 FlushStrBuf(WCC->wc_fullname);
561 serv_getln(buf, sizeof buf);
564 if (WC->serv_info->serv_supports_guest) {
565 display_default_landing_page();
569 FlushStrBuf(WCC->CurRoom.name);
571 /* Calling output_headers() this way causes the cookies to be un-set */
572 output_headers(1, 1, 0, 1, 0, 0);
574 wc_printf("<div id=\"logout_screen\">");
575 wc_printf("<div class=\"box\">");
576 wc_printf("<div class=\"boxlabel\">");
577 wc_printf(_("Log off"));
578 wc_printf("</div><div class=\"boxcontent\">");
579 serv_puts("MESG goodbye");
580 serv_getln(buf, sizeof buf);
582 if (WCC->serv_sock >= 0) {
586 wc_printf("Goodbye\n");
590 wc_printf(_("This program was unable to connect or stay "
591 "connected to the Citadel server. Please report "
592 "this problem to your system administrator.")
594 wc_printf("<a href=\"http://www.citadel.org/doku.php/"
595 "faq:mastering_your_os:net#netstat\">%s</a>",
599 wc_printf("<hr /><div class=\"buttons\"> "
600 "<span class=\"button_link\"><a href=\".\">");
601 wc_printf(_("Log in again"));
602 wc_printf("</a></span>");
603 wc_printf("</div></div></div>\n");
605 end_webcit_session();
619 output_headers(1, 1, 2, 0, 0, 0);
620 wc_printf("<div id=\"banner\">\n");
622 wc_printf(_("Validate new users"));
624 wc_printf("</div>\n");
626 wc_printf("<div id=\"content\" class=\"service\">\n");
628 /* If the user just submitted a validation, process it... */
629 safestrncpy(buf, bstr("user"), sizeof buf);
630 if (!IsEmptyStr(buf)) {
631 if (havebstr("axlevel")) {
632 serv_printf("VALI %s|%s", buf, bstr("axlevel"));
633 serv_getln(buf, sizeof buf);
635 wc_printf("<b>%s</b><br>\n", &buf[4]);
640 /* Now see if any more users require validation. */
642 serv_getln(buf, sizeof buf);
645 wc_printf(_("No users require validation at this time."));
646 wc_printf("</b><br>\n");
651 wc_printf("<b>%s</b><br>\n", &buf[4]);
656 wc_printf("<table class=\"auth_validate\"><tr><td>\n");
657 wc_printf("<div id=\"validate\">");
659 safestrncpy(user, &buf[4], sizeof user);
660 serv_printf("GREG %s", user);
661 serv_getln(cmd, sizeof cmd);
665 serv_getln(buf, sizeof buf);
668 wc_printf("#%s<br><H1>%s</H1>",
677 while (!IsEmptyStr(pch))
681 else if (isalpha(*pch))
692 pch = _("very weak");
705 wc_printf("PW: %s<br>\n", pch);
708 wc_printf("%s<br>\n", buf);
710 wc_printf("%s<br>\n", buf);
712 wc_printf("%s, ", buf);
714 wc_printf("%s ", buf);
716 wc_printf("%s<br>\n", buf);
718 wc_printf("%s<br>\n", buf);
720 wc_printf(_("Current access level: %d (%s)\n"),
721 atoi(buf), axdefs[atoi(buf)]);
722 } while (strcmp(buf, "000"));
724 wc_printf("<H1>%s</H1>%s<br>\n", user, &cmd[4]);
728 wc_printf(_("Select access level for this user:"));
730 for (a = 0; a <= 6; ++a) {
731 wc_printf("<a href=\"validate?nonce=%d?user=", WC->nonce);
733 wc_printf("&axlevel=%d\">%s</A> \n",
738 wc_printf("</div>\n");
739 wc_printf("</td></tr></table>\n");
746 * Display form for registration.
748 * (Set during_login to 1 if this registration is being performed during
749 * new user login and will require chaining to the proper screen.)
751 void display_reg(int during_login)
755 message_summary *VCMsg = NULL;
756 wc_mime_attachment *VCAtt = NULL;
760 memset(&Room, 0, sizeof(folder));
761 if (goto_config_room(Buf, &Room) != 0) {
762 syslog(9, "display_reg() exiting because goto_config_room() failed\n");
776 vcard_msgnum = locate_user_vcard_in_this_room(&VCMsg, &VCAtt);
777 if (vcard_msgnum < 0L) {
778 syslog(9, "display_reg() exiting because locate_user_vcard_in_this_room() failed\n");
789 do_edit_vcard(vcard_msgnum, "1", VCMsg, VCAtt, "do_welcome", USERCONFIGROOM);
793 ReturnTo = NewStrBufPlain(HKEY("display_main_menu?go="));
794 StrBufAppendBuf(ReturnTo, WC->CurRoom.name, 0);
795 do_edit_vcard(vcard_msgnum, "1", VCMsg, VCAtt, ChrPtr(ReturnTo), USERCONFIGROOM);
796 FreeStrBuf(&ReturnTo);
799 /* FIXME - don't we have to free VCMsg and VCAtt ?? */
806 * display form for changing your password
808 void display_changepw(void)
810 WCTemplputParams SubTP;
813 output_headers(1, 1, 1, 0, 0, 0);
815 Buf = NewStrBufPlain(_("Change your password"), -1);
816 memset(&SubTP, 0, sizeof(WCTemplputParams));
817 SubTP.Filter.ContextType = CTX_STRBUF;
819 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
823 if (!IsEmptyStr(WC->ImportantMessage)) {
824 wc_printf("<span class=\"errormsg\">"
825 "%s</span><br>\n", WC->ImportantMessage);
826 safestrncpy(WC->ImportantMessage, "", sizeof WC->ImportantMessage);
829 serv_puts("MESG changepw");
830 serv_getln(buf, sizeof buf);
835 wc_printf("<form name=\"changepwform\" action=\"changepw\" method=\"post\">\n");
836 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
837 wc_printf("<table class=\"altern\" ");
838 wc_printf("<tr class=\"even\"><td>");
839 wc_printf(_("Enter new password:"));
840 wc_printf("</td><td>");
841 wc_printf("<input type=\"password\" name=\"newpass1\" value=\"\" maxlength=\"20\"></td></tr>\n");
842 wc_printf("<tr class=\"odd\"><td>");
843 wc_printf(_("Enter it again to confirm:"));
844 wc_printf("</td><td>");
845 wc_printf("<input type=\"password\" name=\"newpass2\" value=\"\" maxlength=\"20\"></td></tr>\n");
846 wc_printf("</table>\n");
848 wc_printf("<div class=\"buttons\">\n");
849 wc_printf("<input type=\"submit\" name=\"change_action\" value=\"%s\">", _("Change password"));
851 wc_printf("<input type=\"submit\" name=\"cancel_action\" value=\"%s\">\n", _("Cancel"));
852 wc_printf("</div>\n");
853 wc_printf("</form>\n");
855 do_template("endbox", NULL);
861 * if passwords match, propagate it to citserver.
866 char newpass1[32], newpass2[32];
868 if (!havebstr("change_action")) {
869 safestrncpy(WC->ImportantMessage,
870 _("Cancelled. Password was not changed."),
871 sizeof WC->ImportantMessage);
876 safestrncpy(newpass1, bstr("newpass1"), sizeof newpass1);
877 safestrncpy(newpass2, bstr("newpass2"), sizeof newpass2);
879 if (strcasecmp(newpass1, newpass2)) {
880 safestrncpy(WC->ImportantMessage,
881 _("They don't match. Password was not changed."),
882 sizeof WC->ImportantMessage);
887 if (IsEmptyStr(newpass1)) {
888 safestrncpy(WC->ImportantMessage,
889 _("Blank passwords are not allowed."),
890 sizeof WC->ImportantMessage);
895 serv_printf("SETP %s", newpass1);
896 serv_getln(buf, sizeof buf);
897 sprintf(WC->ImportantMessage, "%s", &buf[4]);
899 if (WC->wc_password == NULL)
900 WC->wc_password = NewStrBufPlain(buf, -1);
902 FlushStrBuf(WC->wc_password);
903 StrBufAppendBufPlain(WC->wc_password, buf, -1, 0);
912 int ConditionalHaveAccessCreateRoom(StrBuf *Target, WCTemplputParams *TP)
918 StrBuf_ServGetln(Buf);
920 if (GetServerStatus(Buf, NULL) == 2) {
921 StrBufCutLeft(Buf, 4);
922 AppendImportantMessage(SKEY(Buf));
930 int ConditionalAide(StrBuf *Target, WCTemplputParams *TP)
933 return (WCC != NULL)? (WC->is_aide == 0) : 0;
936 int ConditionalIsLoggedIn(StrBuf *Target, WCTemplputParams *TP)
939 return (WCC != NULL)? (WCC->logged_in == 0) : 0;
945 void _display_reg(void) {
950 void Header_HandleAuth(StrBuf *Line, ParsedHttpHdrs *hdr)
952 if (hdr->HR.got_auth == NO_AUTH) /* don't override cookie auth... */
954 if (strncasecmp(ChrPtr(Line), "Basic", 5) == 0) {
955 StrBufCutLeft(Line, 6);
956 StrBufDecodeBase64(Line);
957 hdr->HR.plainauth = Line;
958 hdr->HR.got_auth = AUTH_BASIC;
961 syslog(1, "Authentication scheme not supported! [%s]\n", ChrPtr(Line));
965 void CheckAuthBasic(ParsedHttpHdrs *hdr)
968 todo: enable this if we can have other sessions than authenticated ones.
969 if (hdr->DontNeedAuth)
972 StrBufAppendBufPlain(hdr->HR.plainauth, HKEY(":"), 0);
973 StrBufAppendBuf(hdr->HR.plainauth, hdr->HR.user_agent, 0);
974 hdr->HR.SessionKey = hashlittle(SKEY(hdr->HR.plainauth), 89479832);
976 syslog(1, "CheckAuthBasic: calculated sessionkey %ld\n",
981 void GetAuthBasic(ParsedHttpHdrs *hdr)
983 const char *Pos = NULL;
984 if (hdr->c_username == NULL)
985 hdr->c_username = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_USER));
986 if (hdr->c_password == NULL)
987 hdr->c_password = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_PASS));
988 StrBufExtract_NextToken(hdr->c_username, hdr->HR.plainauth, &Pos, ':');
989 StrBufExtract_NextToken(hdr->c_password, hdr->HR.plainauth, &Pos, ':');
992 void Header_HandleCookie(StrBuf *Line, ParsedHttpHdrs *hdr)
996 todo: enable this if we can have other sessions than authenticated ones.
997 if (hdr->DontNeedAuth)
1000 pch = strstr(ChrPtr(Line), "webcit=");
1005 hdr->HR.RawCookie = Line;
1006 StrBufCutLeft(hdr->HR.RawCookie, (pch - ChrPtr(hdr->HR.RawCookie)) + 7);
1007 StrBufDecodeHex(hdr->HR.RawCookie);
1009 cookie_to_stuff(Line, &hdr->HR.desired_session,
1015 hdr->HR.got_auth = AUTH_COOKIE;
1020 (ParsedHttpHdrs *httpreq)
1022 httpreq->c_username = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_USER));
1023 httpreq->c_password = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_PASS));
1024 httpreq->c_roomname = NewStrBuf();
1025 httpreq->c_language = NewStrBuf();
1028 HttpDetachModule_AUTH
1029 (ParsedHttpHdrs *httpreq)
1031 FLUSHStrBuf(httpreq->c_username);
1032 FLUSHStrBuf(httpreq->c_password);
1033 FLUSHStrBuf(httpreq->c_roomname);
1034 FLUSHStrBuf(httpreq->c_language);
1038 HttpDestroyModule_AUTH
1039 (ParsedHttpHdrs *httpreq)
1041 FreeStrBuf(&httpreq->c_username);
1042 FreeStrBuf(&httpreq->c_password);
1043 FreeStrBuf(&httpreq->c_roomname);
1044 FreeStrBuf(&httpreq->c_language);
1051 initialize_axdefs();
1052 RegisterHeaderHandler(HKEY("COOKIE"), Header_HandleCookie);
1053 RegisterHeaderHandler(HKEY("AUTHORIZATION"), Header_HandleAuth);
1055 /* no url pattern at all? Show login. */
1056 WebcitAddUrlHandler(HKEY(""), "", 0, do_welcome, ANONYMOUS|COOKIEUNNEEDED);
1058 /* some of these will be removed soon */
1059 WebcitAddUrlHandler(HKEY("do_welcome"), "", 0, do_welcome, ANONYMOUS|COOKIEUNNEEDED);
1060 WebcitAddUrlHandler(HKEY("login"), "", 0, do_login, ANONYMOUS|COOKIEUNNEEDED);
1061 WebcitAddUrlHandler(HKEY("openid_login"), "", 0, do_openid_login, ANONYMOUS);
1062 WebcitAddUrlHandler(HKEY("finalize_openid_login"), "", 0, finalize_openid_login, ANONYMOUS);
1063 WebcitAddUrlHandler(HKEY("openid_manual_create"), "", 0, openid_manual_create, ANONYMOUS);
1064 WebcitAddUrlHandler(HKEY("validate"), "", 0, validate, 0);
1065 WebcitAddUrlHandler(HKEY("do_welcome"), "", 0, do_welcome, 0);
1066 WebcitAddUrlHandler(HKEY("display_reg"), "", 0, _display_reg, 0);
1067 WebcitAddUrlHandler(HKEY("display_changepw"), "", 0, display_changepw, 0);
1068 WebcitAddUrlHandler(HKEY("changepw"), "", 0, changepw, 0);
1069 WebcitAddUrlHandler(HKEY("termquit"), "", 0, do_logout, 0);
1070 WebcitAddUrlHandler(HKEY("do_logout"), "", 0, do_logout, ANONYMOUS|COOKIEUNNEEDED|FORCE_SESSIONCLOSE);
1071 WebcitAddUrlHandler(HKEY("ajax_login_username_password"), "", 0,
1072 ajax_login_username_password, AJAX|ANONYMOUS);
1074 RegisterConditional(HKEY("COND:AIDE"), 2, ConditionalAide, CTX_NONE);
1075 RegisterConditional(HKEY("COND:LOGGEDIN"), 2, ConditionalIsLoggedIn, CTX_NONE);
1076 RegisterConditional(HKEY("COND:MAY_CREATE_ROOM"), 2, ConditionalHaveAccessCreateRoom, CTX_NONE);
1082 SessionDestroyModule_AUTH
1085 FreeStrBuf(&sess->wc_username);
1086 FreeStrBuf(&sess->wc_fullname);
1087 FreeStrBuf(&sess->wc_password);
1088 FreeStrBuf(&sess->httpauth_pass);
1089 FreeStrBuf(&sess->cs_inet_email);