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);
28 * Access level definitions. This is initialized from a function rather than a
29 * static array so that the strings may be localized.
33 void initialize_axdefs(void) {
36 axdefs[0] = _("Deleted");
39 axdefs[1] = _("New User");
42 axdefs[2] = _("Problem User");
44 /* user with normal privileges */
45 axdefs[3] = _("Local User");
47 /* a user that may access network resources */
48 axdefs[4] = _("Network User");
51 axdefs[5] = _("Preferred User");
54 axdefs[6] = _("Aide");
60 * Display the login screen
61 * mesg = the error message if last attempt failed.
63 void display_login(void)
66 output_headers(1, 0, 0, 0, 1, 0);
67 do_template("login", NULL);
75 /* Initialize the session
77 * This function needs to get called whenever the session changes from
78 * not-logged-in to logged-in, either by an explicit login by the user or
79 * by a timed-out session automatically re-establishing with a little help
80 * from the browser cookie. Either way, we need to load access controls and
81 * preferences from the server.
85 * serv_response The parameters returned from a Citadel USER or NEWU command
87 void become_logged_in(const StrBuf *user, const StrBuf *pass, StrBuf *serv_response)
95 if (WCC->wc_fullname == NULL)
96 WCC->wc_fullname = NewStrBufPlain(NULL, StrLength(serv_response));
97 StrBufExtract_token(WCC->wc_fullname, serv_response, 0, '|');
98 StrBufCutLeft(WCC->wc_fullname, 4 );
100 if (WCC->wc_username == NULL)
101 WCC->wc_username = NewStrBufDup(user);
103 FlushStrBuf(WCC->wc_username);
104 StrBufAppendBuf(WCC->wc_username, user, 0);
107 if (WCC->wc_password == NULL)
108 WCC->wc_password = NewStrBufDup(pass);
110 FlushStrBuf(WCC->wc_password);
111 StrBufAppendBuf(WCC->wc_password, pass, 0);
114 WCC->axlevel = StrBufExtract_int(serv_response, 1, '|');
115 if (WCC->axlevel >= 6) { /* TODO: make this a define, else it might trick us later */
123 StrBuf_ServGetln(Buf);
124 if (GetServerStatus(Buf, NULL) == 2) {
127 pch = ChrPtr(Buf) + 4;
128 /*WCC->new_mail =*/ StrBufExtractNext_long(Buf, &pch, '|');
129 WCC->need_regi = StrBufExtractNext_long(Buf, &pch, '|');
130 WCC->need_vali = StrBufExtractNext_long(Buf, &pch, '|');
131 if (WCC->cs_inet_email == NULL)
132 WCC->cs_inet_email = NewStrBuf();
133 StrBufExtract_NextToken(WCC->cs_inet_email, Buf, &pch, '|');
135 get_preference("floordiv_expanded", &FloorDiv);
136 WCC->floordiv_expanded = FloorDiv;
142 * modal/ajax version of 'login' (username and password)
144 void ajax_login_username_password(void) {
145 StrBuf *Buf = NewStrBuf();
147 serv_printf("USER %s", bstr("name"));
148 StrBuf_ServGetln(Buf);
149 if (GetServerStatus(Buf, NULL) == 3) {
150 serv_printf("PASS %s", bstr("pass"));
151 StrBuf_ServGetln(Buf);
152 if (GetServerStatus(Buf, NULL) == 2) {
153 become_logged_in(sbstr("name"), sbstr("pass"), Buf);
157 /* The client is expecting to read back a citadel protocol response */
158 wc_printf("%s", ChrPtr(Buf));
165 * modal/ajax version of 'new user' (username and password)
167 void ajax_login_newuser(void) {
168 StrBuf *NBuf = NewStrBuf();
169 StrBuf *SBuf = NewStrBuf();
171 serv_printf("NEWU %s", bstr("name"));
172 StrBuf_ServGetln(NBuf);
173 if (GetServerStatus(NBuf, NULL) == 2) {
174 become_logged_in(sbstr("name"), sbstr("pass"), NBuf);
175 serv_printf("SETP %s", bstr("pass"));
176 StrBuf_ServGetln(SBuf);
179 /* The client is expecting to read back a citadel protocol response */
180 wc_printf("%s", ChrPtr(NBuf));
188 * Try to create an account manually after an OpenID was verified
190 void openid_manual_create(void)
194 if (havebstr("exit_action")) {
199 if (havebstr("newuser_action")) {
201 serv_printf("OIDC %s", bstr("name"));
202 StrBuf_ServGetln(Buf);
203 if (GetServerStatus(Buf, NULL) == 2) {
207 serv_puts("SETP GENERATE_RANDOM_PASSWORD");
208 StrBuf_ServGetln(gpass);
209 StrBufCutLeft(gpass, 4);
210 become_logged_in(sbstr("name"), gpass, Buf);
219 } else if (WC->need_vali) {
227 putbstr("__claimed_id", NewStrBufDup(sbstr("openid_url")));
229 if (StrLength(Buf) > 0)
230 putbstr("__username", NewStrBufDup(Buf));
232 do_template("openid_manual_create", NULL);
240 * Perform authentication using OpenID
241 * assemble the checkid_setup request and then redirect to the user's identity provider
243 void do_openid_login(void)
247 snprintf(buf, sizeof buf,
248 "OIDS %s|%s/finalize_openid_login|%s",
255 serv_getln(buf, sizeof buf);
257 syslog(LOG_DEBUG, "OpenID server contacted; redirecting to %s\n", &buf[4]);
258 http_redirect(&buf[4]);
263 output_headers(1, 0, 0, 0, 1, 0);
264 wc_printf("<html><body>");
266 wc_printf("</body></html>");
272 * Complete the authentication using OpenID
273 * This function handles the positive or negative assertion from the user's Identity Provider
275 void finalize_openid_login(void)
279 int already_logged_in = (WCC->logged_in) ;
281 StrBuf *result = NULL;
282 StrBuf *username = NULL;
283 StrBuf *password = NULL;
284 StrBuf *logged_in_response = NULL;
285 StrBuf *claimed_id = NULL;
287 if (havebstr("openid.mode")) {
288 if (!strcasecmp(bstr("openid.mode"), "id_res")) {
291 StrBuf_ServGetln(Buf);
292 if (GetServerStatus(Buf, NULL) == 8) {
299 Cursor = GetNewHashPos (WCC->Hdr->urlstrings, 0);
300 while (GetNextHashPos(WCC->Hdr->urlstrings, Cursor, &HKLen, &HKey, &U)) {
302 if (!strncasecmp(u->url_key, "openid.", 7)) {
303 serv_printf("%s|%s", &u->url_key[7], ChrPtr(u->url_data));
310 while (StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000"))
312 if (linecount == 0) result = NewStrBufDup(Buf);
313 if (!strcasecmp(ChrPtr(result), "authenticate")) {
314 if (linecount == 1) {
315 username = NewStrBufDup(Buf);
317 else if (linecount == 2) {
318 password = NewStrBufDup(Buf);
320 else if (linecount == 3) {
321 logged_in_response = NewStrBufDup(Buf);
324 else if (!strcasecmp(ChrPtr(result), "verify_only")) {
325 if (linecount == 1) {
326 claimed_id = NewStrBufDup(Buf);
328 if (linecount == 2) {
329 username = NewStrBufDup(Buf);
339 /* If we were already logged in, this was an attempt to associate an OpenID account
340 FIXME put this back in
341 if (already_logged_in) {
344 FreeStrBuf(&username);
345 FreeStrBuf(&password);
346 FreeStrBuf(&claimed_id);
347 FreeStrBuf(&logged_in_response);
352 /* If this operation logged us in, either by connecting with an existing account or by
353 * auto-creating one using Simple Registration Extension, we're already on our way.
355 if (!strcasecmp(ChrPtr(result), "authenticate")) {
356 become_logged_in(username, password, logged_in_response);
359 /* The specified OpenID was verified but the desired user name was either not specified via SRI
360 * or conflicts with an existing user. Either way the user will need to specify a new name.
364 * FIXME make this work again!!!!
366 else if (!strcasecmp(ChrPtr(result), "verify_only")) {
367 putbstr("__claimed_id", claimed_id);
369 if (StrLength(username) > 0) {
370 putbstr("__username", username);
374 do_template("openid_manual_create", NULL);
381 /* Did we manage to log in? If so, continue with the normal flow... */
384 output_headers(1, 0, 0, 0, 1, 0);
385 do_template("authpopup_finished", NULL);
389 output_headers(1, 0, 0, 0, 1, 0);
390 wc_printf("<html><body>");
391 wc_printf(_("An error has occurred.")); /* FIXME do something prettier here */
392 wc_printf("</body></html>");
397 FreeStrBuf(&username);
398 FreeStrBuf(&password);
399 FreeStrBuf(&claimed_id);
400 FreeStrBuf(&logged_in_response);
405 * Display a welcome screen to the user.
407 * If this is the first time login, and the web based setup is enabled,
408 * lead the user through the setup routines
410 void do_welcome(void)
413 #ifdef XXX_NOT_FINISHED_YET_XXX
418 * See if we have to run the first-time setup wizard
423 sprintf(wizard_filename, "setupwiz.%s.%s",
425 len = strlen(wizard_filename);
426 for (i=0; i<len; ++i) {
427 if ( (wizard_filename[i]==' ')
428 || (wizard_filename[i] == '/')
430 wizard_filename[i] = '_';
434 fp = fopen(wizard_filename, "r");
436 fgets(buf, sizeof buf, fp);
437 buf[strlen(buf)-1] = 0;
439 if (atoi(buf) == serv_info.serv_rev_level) {
440 setup_wizard = 1; /**< already run */
446 http_redirect("setup_wizard");
452 * Go to the user's preferred start page
454 if (!get_preference("startpage", &Buf)) {
456 StrBufPrintf(Buf, "dotskip?room=_BASEROOM_");
457 set_preference("startpage", Buf, 1);
459 if (ChrPtr(Buf)[0] == '/') {
460 StrBufCutLeft(Buf, 1);
462 if (StrLength(Buf) == 0) {
463 StrBufAppendBufPlain(Buf, "dotgoto?room=_BASEROOM_", -1, 0);
465 syslog(9, "Redirecting to user's start page: %s\n", ChrPtr(Buf));
466 http_redirect(ChrPtr(Buf));
471 * Disconnect from the Citadel server, and end this WebCit session
473 void end_webcit_session(void) {
477 /* close() of citadel socket will be done by do_housekeeping() */
488 FlushStrBuf(WCC->wc_username);
489 FlushStrBuf(WCC->wc_password);
490 FlushStrBuf(WCC->wc_fullname);
493 serv_getln(buf, sizeof buf);
496 if (WC->serv_info->serv_supports_guest) {
497 display_default_landing_page();
501 FlushStrBuf(WCC->CurRoom.name);
503 /* Calling output_headers() this way causes the cookies to be un-set */
504 output_headers(1, 1, 0, 1, 0, 0);
506 wc_printf("<div id=\"logout_screen\">");
507 wc_printf("<div class=\"box\">");
508 wc_printf("<div class=\"boxlabel\">");
509 wc_printf(_("Log off"));
510 wc_printf("</div><div class=\"boxcontent\">");
511 serv_puts("MESG goodbye");
512 serv_getln(buf, sizeof buf);
514 if (WCC->serv_sock >= 0) {
518 wc_printf("Goodbye\n");
522 wc_printf(_("This program was unable to connect or stay "
523 "connected to the Citadel server. Please report "
524 "this problem to your system administrator.")
526 wc_printf("<a href=\"http://www.citadel.org/doku.php/"
527 "faq:mastering_your_os:net#netstat\">%s</a>",
531 wc_printf("<hr /><div class=\"buttons\"> "
532 "<span class=\"button_link\"><a href=\".\">");
533 wc_printf(_("Log in again"));
534 wc_printf("</a></span>");
535 wc_printf("</div></div></div>\n");
537 end_webcit_session();
551 output_headers(1, 1, 2, 0, 0, 0);
552 wc_printf("<div id=\"banner\">\n");
554 wc_printf(_("Validate new users"));
556 wc_printf("</div>\n");
558 wc_printf("<div id=\"content\" class=\"service\">\n");
560 /* If the user just submitted a validation, process it... */
561 safestrncpy(buf, bstr("user"), sizeof buf);
562 if (!IsEmptyStr(buf)) {
563 if (havebstr("axlevel")) {
564 serv_printf("VALI %s|%s", buf, bstr("axlevel"));
565 serv_getln(buf, sizeof buf);
567 wc_printf("<b>%s</b><br>\n", &buf[4]);
572 /* Now see if any more users require validation. */
574 serv_getln(buf, sizeof buf);
577 wc_printf(_("No users require validation at this time."));
578 wc_printf("</b><br>\n");
583 wc_printf("<b>%s</b><br>\n", &buf[4]);
588 wc_printf("<table class=\"auth_validate\"><tr><td>\n");
589 wc_printf("<div id=\"validate\">");
591 safestrncpy(user, &buf[4], sizeof user);
592 serv_printf("GREG %s", user);
593 serv_getln(cmd, sizeof cmd);
597 serv_getln(buf, sizeof buf);
600 wc_printf("#%s<br><H1>%s</H1>",
609 while (!IsEmptyStr(pch))
613 else if (isalpha(*pch))
624 pch = _("very weak");
637 wc_printf("PW: %s<br>\n", pch);
640 wc_printf("%s<br>\n", buf);
642 wc_printf("%s<br>\n", buf);
644 wc_printf("%s, ", buf);
646 wc_printf("%s ", buf);
648 wc_printf("%s<br>\n", buf);
650 wc_printf("%s<br>\n", buf);
652 wc_printf(_("Current access level: %d (%s)\n"),
653 atoi(buf), axdefs[atoi(buf)]);
654 } while (strcmp(buf, "000"));
656 wc_printf("<H1>%s</H1>%s<br>\n", user, &cmd[4]);
660 wc_printf(_("Select access level for this user:"));
662 for (a = 0; a <= 6; ++a) {
663 wc_printf("<a href=\"validate?nonce=%d?user=", WC->nonce);
665 wc_printf("&axlevel=%d\">%s</A> \n",
670 wc_printf("</div>\n");
671 wc_printf("</td></tr></table>\n");
678 * Display form for registration.
680 * (Set during_login to 1 if this registration is being performed during
681 * new user login and will require chaining to the proper screen.)
683 void display_reg(int during_login)
687 message_summary *VCMsg = NULL;
688 wc_mime_attachment *VCAtt = NULL;
692 memset(&Room, 0, sizeof(folder));
693 if (goto_config_room(Buf, &Room) != 0) {
694 syslog(9, "display_reg() exiting because goto_config_room() failed\n");
708 vcard_msgnum = locate_user_vcard_in_this_room(&VCMsg, &VCAtt);
709 if (vcard_msgnum < 0L) {
710 syslog(9, "display_reg() exiting because locate_user_vcard_in_this_room() failed\n");
721 do_edit_vcard(vcard_msgnum, "1", VCMsg, VCAtt, "pop", USERCONFIGROOM);
725 ReturnTo = NewStrBufPlain(HKEY("display_main_menu?go="));
726 StrBufAppendBuf(ReturnTo, WC->CurRoom.name, 0);
727 do_edit_vcard(vcard_msgnum, "1", VCMsg, VCAtt, ChrPtr(ReturnTo), USERCONFIGROOM);
728 FreeStrBuf(&ReturnTo);
731 /* FIXME - don't we have to free VCMsg and VCAtt ?? */
738 * display form for changing your password
740 void display_changepw(void)
742 WCTemplputParams SubTP;
745 output_headers(1, 1, 1, 0, 0, 0);
747 Buf = NewStrBufPlain(_("Change your password"), -1);
748 memset(&SubTP, 0, sizeof(WCTemplputParams));
749 SubTP.Filter.ContextType = CTX_STRBUF;
751 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
755 if (!IsEmptyStr(WC->ImportantMessage)) {
756 wc_printf("<span class=\"errormsg\">"
757 "%s</span><br>\n", WC->ImportantMessage);
758 safestrncpy(WC->ImportantMessage, "", sizeof WC->ImportantMessage);
761 serv_puts("MESG changepw");
762 serv_getln(buf, sizeof buf);
767 wc_printf("<form name=\"changepwform\" action=\"changepw\" method=\"post\">\n");
768 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
769 wc_printf("<table class=\"altern\" ");
770 wc_printf("<tr class=\"even\"><td>");
771 wc_printf(_("Enter new password:"));
772 wc_printf("</td><td>");
773 wc_printf("<input type=\"password\" name=\"newpass1\" value=\"\" maxlength=\"20\"></td></tr>\n");
774 wc_printf("<tr class=\"odd\"><td>");
775 wc_printf(_("Enter it again to confirm:"));
776 wc_printf("</td><td>");
777 wc_printf("<input type=\"password\" name=\"newpass2\" value=\"\" maxlength=\"20\"></td></tr>\n");
778 wc_printf("</table>\n");
780 wc_printf("<div class=\"buttons\">\n");
781 wc_printf("<input type=\"submit\" name=\"change_action\" value=\"%s\">", _("Change password"));
783 wc_printf("<input type=\"submit\" name=\"cancel_action\" value=\"%s\">\n", _("Cancel"));
784 wc_printf("</div>\n");
785 wc_printf("</form>\n");
787 do_template("endbox", NULL);
793 * if passwords match, propagate it to citserver.
798 char newpass1[32], newpass2[32];
800 if (!havebstr("change_action")) {
801 safestrncpy(WC->ImportantMessage,
802 _("Cancelled. Password was not changed."),
803 sizeof WC->ImportantMessage);
808 safestrncpy(newpass1, bstr("newpass1"), sizeof newpass1);
809 safestrncpy(newpass2, bstr("newpass2"), sizeof newpass2);
811 if (strcasecmp(newpass1, newpass2)) {
812 safestrncpy(WC->ImportantMessage,
813 _("They don't match. Password was not changed."),
814 sizeof WC->ImportantMessage);
819 if (IsEmptyStr(newpass1)) {
820 safestrncpy(WC->ImportantMessage,
821 _("Blank passwords are not allowed."),
822 sizeof WC->ImportantMessage);
827 serv_printf("SETP %s", newpass1);
828 serv_getln(buf, sizeof buf);
829 sprintf(WC->ImportantMessage, "%s", &buf[4]);
831 if (WC->wc_password == NULL)
832 WC->wc_password = NewStrBufPlain(buf, -1);
834 FlushStrBuf(WC->wc_password);
835 StrBufAppendBufPlain(WC->wc_password, buf, -1, 0);
844 int ConditionalHaveAccessCreateRoom(StrBuf *Target, WCTemplputParams *TP)
850 StrBuf_ServGetln(Buf);
852 if (GetServerStatus(Buf, NULL) == 2) {
853 StrBufCutLeft(Buf, 4);
854 AppendImportantMessage(SKEY(Buf));
862 int ConditionalAide(StrBuf *Target, WCTemplputParams *TP)
865 return (WCC != NULL) ? ((WCC->logged_in == 0)||(WC->is_aide == 0)) : 0;
868 int ConditionalIsLoggedIn(StrBuf *Target, WCTemplputParams *TP)
871 return (WCC != NULL) ? (WCC->logged_in == 0) : 0;
877 void _display_reg(void) {
882 void Header_HandleAuth(StrBuf *Line, ParsedHttpHdrs *hdr)
884 if (hdr->HR.got_auth == NO_AUTH) /* don't override cookie auth... */
886 if (strncasecmp(ChrPtr(Line), "Basic", 5) == 0) {
887 StrBufCutLeft(Line, 6);
888 StrBufDecodeBase64(Line);
889 hdr->HR.plainauth = Line;
890 hdr->HR.got_auth = AUTH_BASIC;
893 syslog(1, "Authentication scheme not supported! [%s]\n", ChrPtr(Line));
897 void CheckAuthBasic(ParsedHttpHdrs *hdr)
900 todo: enable this if we can have other sessions than authenticated ones.
901 if (hdr->DontNeedAuth)
904 StrBufAppendBufPlain(hdr->HR.plainauth, HKEY(":"), 0);
905 StrBufAppendBuf(hdr->HR.plainauth, hdr->HR.user_agent, 0);
906 hdr->HR.SessionKey = hashlittle(SKEY(hdr->HR.plainauth), 89479832);
908 syslog(1, "CheckAuthBasic: calculated sessionkey %ld\n",
913 void GetAuthBasic(ParsedHttpHdrs *hdr)
915 const char *Pos = NULL;
916 if (hdr->c_username == NULL)
917 hdr->c_username = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_USER));
918 if (hdr->c_password == NULL)
919 hdr->c_password = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_PASS));
920 StrBufExtract_NextToken(hdr->c_username, hdr->HR.plainauth, &Pos, ':');
921 StrBufExtract_NextToken(hdr->c_password, hdr->HR.plainauth, &Pos, ':');
924 void Header_HandleCookie(StrBuf *Line, ParsedHttpHdrs *hdr)
928 todo: enable this if we can have other sessions than authenticated ones.
929 if (hdr->DontNeedAuth)
932 pch = strstr(ChrPtr(Line), "webcit=");
937 hdr->HR.RawCookie = Line;
938 StrBufCutLeft(hdr->HR.RawCookie, (pch - ChrPtr(hdr->HR.RawCookie)) + 7);
939 StrBufDecodeHex(hdr->HR.RawCookie);
941 cookie_to_stuff(Line, &hdr->HR.desired_session,
947 hdr->HR.got_auth = AUTH_COOKIE;
952 (ParsedHttpHdrs *httpreq)
954 httpreq->c_username = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_USER));
955 httpreq->c_password = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_PASS));
956 httpreq->c_roomname = NewStrBuf();
957 httpreq->c_language = NewStrBuf();
960 HttpDetachModule_AUTH
961 (ParsedHttpHdrs *httpreq)
963 FLUSHStrBuf(httpreq->c_username);
964 FLUSHStrBuf(httpreq->c_password);
965 FLUSHStrBuf(httpreq->c_roomname);
966 FLUSHStrBuf(httpreq->c_language);
970 HttpDestroyModule_AUTH
971 (ParsedHttpHdrs *httpreq)
973 FreeStrBuf(&httpreq->c_username);
974 FreeStrBuf(&httpreq->c_password);
975 FreeStrBuf(&httpreq->c_roomname);
976 FreeStrBuf(&httpreq->c_language);
984 RegisterHeaderHandler(HKEY("COOKIE"), Header_HandleCookie);
985 RegisterHeaderHandler(HKEY("AUTHORIZATION"), Header_HandleAuth);
987 /* no url pattern at all? Show login. */
988 WebcitAddUrlHandler(HKEY(""), "", 0, do_welcome, ANONYMOUS|COOKIEUNNEEDED);
990 /* some of these will be removed soon */
991 WebcitAddUrlHandler(HKEY("do_welcome"), "", 0, do_welcome, ANONYMOUS|COOKIEUNNEEDED);
992 WebcitAddUrlHandler(HKEY("openid_login"), "", 0, do_openid_login, ANONYMOUS);
993 WebcitAddUrlHandler(HKEY("finalize_openid_login"), "", 0, finalize_openid_login, ANONYMOUS);
994 WebcitAddUrlHandler(HKEY("openid_manual_create"), "", 0, openid_manual_create, ANONYMOUS);
995 WebcitAddUrlHandler(HKEY("validate"), "", 0, validate, 0);
996 WebcitAddUrlHandler(HKEY("do_welcome"), "", 0, do_welcome, 0);
997 WebcitAddUrlHandler(HKEY("display_reg"), "", 0, _display_reg, 0);
998 WebcitAddUrlHandler(HKEY("display_changepw"), "", 0, display_changepw, 0);
999 WebcitAddUrlHandler(HKEY("changepw"), "", 0, changepw, 0);
1000 WebcitAddUrlHandler(HKEY("termquit"), "", 0, do_logout, 0);
1001 WebcitAddUrlHandler(HKEY("do_logout"), "", 0, do_logout, ANONYMOUS|COOKIEUNNEEDED|FORCE_SESSIONCLOSE);
1002 WebcitAddUrlHandler(HKEY("ajax_login_username_password"), "", 0, ajax_login_username_password, AJAX|ANONYMOUS);
1003 WebcitAddUrlHandler(HKEY("ajax_login_newuser"), "", 0, ajax_login_newuser, AJAX|ANONYMOUS);
1004 RegisterConditional(HKEY("COND:AIDE"), 2, ConditionalAide, CTX_NONE);
1005 RegisterConditional(HKEY("COND:LOGGEDIN"), 2, ConditionalIsLoggedIn, CTX_NONE);
1006 RegisterConditional(HKEY("COND:MAY_CREATE_ROOM"), 2, ConditionalHaveAccessCreateRoom, CTX_NONE);
1012 SessionDestroyModule_AUTH
1015 FreeStrBuf(&sess->wc_username);
1016 FreeStrBuf(&sess->wc_fullname);
1017 FreeStrBuf(&sess->wc_password);
1018 FreeStrBuf(&sess->httpauth_pass);
1019 FreeStrBuf(&sess->cs_inet_email);