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 * modal/ajax version of 'login' (username and password)
146 void ajax_login_username_password(void) {
147 StrBuf *Buf = NewStrBuf();
149 serv_printf("USER %s", bstr("name"));
150 StrBuf_ServGetln(Buf);
151 if (GetServerStatus(Buf, NULL) == 3) {
152 serv_printf("PASS %s", bstr("pass"));
153 StrBuf_ServGetln(Buf);
154 if (GetServerStatus(Buf, NULL) == 2) {
155 become_logged_in(sbstr("name"), sbstr("pass"), Buf);
159 /* The client is expecting to read back a citadel protocol response */
160 wc_printf("%s", ChrPtr(Buf));
167 * modal/ajax version of 'new user' (username and password)
169 void ajax_login_newuser(void) {
170 StrBuf *NBuf = NewStrBuf();
171 StrBuf *SBuf = NewStrBuf();
173 serv_printf("NEWU %s", bstr("name"));
174 StrBuf_ServGetln(NBuf);
175 if (GetServerStatus(NBuf, NULL) == 2) {
176 become_logged_in(sbstr("name"), sbstr("pass"), NBuf);
177 serv_printf("SETP %s", bstr("pass"));
178 StrBuf_ServGetln(SBuf);
181 /* The client is expecting to read back a citadel protocol response */
182 wc_printf("%s", ChrPtr(NBuf));
190 * Try to create an account manually after an OpenID was verified
192 void openid_manual_create(void)
196 if (havebstr("exit_action")) {
201 if (havebstr("newuser_action")) {
203 serv_printf("OIDC %s", bstr("name"));
204 StrBuf_ServGetln(Buf);
205 if (GetServerStatus(Buf, NULL) == 2) {
209 serv_puts("SETP GENERATE_RANDOM_PASSWORD");
210 StrBuf_ServGetln(gpass);
211 StrBufCutLeft(gpass, 4);
212 become_logged_in(sbstr("name"), gpass, Buf);
221 } else if (WC->need_vali) {
229 putbstr("__claimed_id", NewStrBufDup(sbstr("openid_url")));
231 if (StrLength(Buf) > 0)
232 putbstr("__username", NewStrBufDup(Buf));
234 do_template("openid_manual_create", NULL);
242 * Perform authentication using OpenID
243 * assemble the checkid_setup request and then redirect to the user's identity provider
245 void do_openid_login(void)
249 snprintf(buf, sizeof buf,
250 "OIDS %s|%s/finalize_openid_login|%s",
257 serv_getln(buf, sizeof buf);
259 syslog(LOG_DEBUG, "OpenID server contacted; redirecting to %s\n", &buf[4]);
260 http_redirect(&buf[4]);
265 output_headers(1, 0, 0, 0, 1, 0);
266 wc_printf("<html><body>");
268 wc_printf("</body></html>");
274 * Complete the authentication using OpenID
275 * This function handles the positive or negative assertion from the user's Identity Provider
277 void finalize_openid_login(void)
281 int already_logged_in = (WCC->logged_in) ;
283 StrBuf *result = NULL;
284 StrBuf *username = NULL;
285 StrBuf *password = NULL;
286 StrBuf *logged_in_response = NULL;
287 StrBuf *claimed_id = NULL;
289 if (havebstr("openid.mode")) {
290 if (!strcasecmp(bstr("openid.mode"), "id_res")) {
293 StrBuf_ServGetln(Buf);
294 if (GetServerStatus(Buf, NULL) == 8) {
301 Cursor = GetNewHashPos (WCC->Hdr->urlstrings, 0);
302 while (GetNextHashPos(WCC->Hdr->urlstrings, Cursor, &HKLen, &HKey, &U)) {
304 if (!strncasecmp(u->url_key, "openid.", 7)) {
305 serv_printf("%s|%s", &u->url_key[7], ChrPtr(u->url_data));
312 while (StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000"))
314 if (linecount == 0) result = NewStrBufDup(Buf);
315 if (!strcasecmp(ChrPtr(result), "authenticate")) {
316 if (linecount == 1) {
317 username = NewStrBufDup(Buf);
319 else if (linecount == 2) {
320 password = NewStrBufDup(Buf);
322 else if (linecount == 3) {
323 logged_in_response = NewStrBufDup(Buf);
326 else if (!strcasecmp(ChrPtr(result), "verify_only")) {
327 if (linecount == 1) {
328 claimed_id = NewStrBufDup(Buf);
330 if (linecount == 2) {
331 username = NewStrBufDup(Buf);
341 /* If we were already logged in, this was an attempt to associate an OpenID account
342 FIXME put this back in
343 if (already_logged_in) {
346 FreeStrBuf(&username);
347 FreeStrBuf(&password);
348 FreeStrBuf(&claimed_id);
349 FreeStrBuf(&logged_in_response);
354 /* If this operation logged us in, either by connecting with an existing account or by
355 * auto-creating one using Simple Registration Extension, we're already on our way.
357 if (!strcasecmp(ChrPtr(result), "authenticate")) {
358 become_logged_in(username, password, logged_in_response);
361 /* The specified OpenID was verified but the desired user name was either not specified via SRI
362 * or conflicts with an existing user. Either way the user will need to specify a new name.
366 * FIXME make this work again!!!!
368 else if (!strcasecmp(ChrPtr(result), "verify_only")) {
369 putbstr("__claimed_id", claimed_id);
371 if (StrLength(username) > 0) {
372 putbstr("__username", username);
376 do_template("openid_manual_create", NULL);
383 /* Did we manage to log in? If so, continue with the normal flow... */
386 output_headers(1, 0, 0, 0, 1, 0);
387 do_template("authpopup_finished", NULL);
391 output_headers(1, 0, 0, 0, 1, 0);
392 wc_printf("<html><body>");
393 wc_printf(_("An error has occurred.")); /* FIXME do something prettier here */
394 wc_printf("</body></html>");
399 FreeStrBuf(&username);
400 FreeStrBuf(&password);
401 FreeStrBuf(&claimed_id);
402 FreeStrBuf(&logged_in_response);
407 * Display a welcome screen to the user.
409 * If this is the first time login, and the web based setup is enabled,
410 * lead the user through the setup routines
412 void do_welcome(void)
415 #ifdef XXX_NOT_FINISHED_YET_XXX
420 * See if we have to run the first-time setup wizard
425 sprintf(wizard_filename, "setupwiz.%s.%s",
427 len = strlen(wizard_filename);
428 for (i=0; i<len; ++i) {
429 if ( (wizard_filename[i]==' ')
430 || (wizard_filename[i] == '/')
432 wizard_filename[i] = '_';
436 fp = fopen(wizard_filename, "r");
438 fgets(buf, sizeof buf, fp);
439 buf[strlen(buf)-1] = 0;
441 if (atoi(buf) == serv_info.serv_rev_level) {
442 setup_wizard = 1; /**< already run */
448 http_redirect("setup_wizard");
454 * Go to the user's preferred start page
456 if (!get_preference("startpage", &Buf)) {
458 StrBufPrintf(Buf, "dotskip?room=_BASEROOM_");
459 set_preference("startpage", Buf, 1);
461 if (ChrPtr(Buf)[0] == '/') {
462 StrBufCutLeft(Buf, 1);
464 if (StrLength(Buf) == 0) {
465 StrBufAppendBufPlain(Buf, "dotgoto?room=_BASEROOM_", -1, 0);
467 syslog(9, "Redirecting to user's start page: %s\n", ChrPtr(Buf));
468 http_redirect(ChrPtr(Buf));
473 * Disconnect from the Citadel server, and end this WebCit session
475 void end_webcit_session(void) {
479 /* close() of citadel socket will be done by do_housekeeping() */
490 FlushStrBuf(WCC->wc_username);
491 FlushStrBuf(WCC->wc_password);
492 FlushStrBuf(WCC->wc_fullname);
495 serv_getln(buf, sizeof buf);
498 if (WC->serv_info->serv_supports_guest) {
499 display_default_landing_page();
503 FlushStrBuf(WCC->CurRoom.name);
505 /* Calling output_headers() this way causes the cookies to be un-set */
506 output_headers(1, 1, 0, 1, 0, 0);
508 wc_printf("<div id=\"logout_screen\">");
509 wc_printf("<div class=\"box\">");
510 wc_printf("<div class=\"boxlabel\">");
511 wc_printf(_("Log off"));
512 wc_printf("</div><div class=\"boxcontent\">");
513 serv_puts("MESG goodbye");
514 serv_getln(buf, sizeof buf);
516 if (WCC->serv_sock >= 0) {
520 wc_printf("Goodbye\n");
524 wc_printf(_("This program was unable to connect or stay "
525 "connected to the Citadel server. Please report "
526 "this problem to your system administrator.")
528 wc_printf("<a href=\"http://www.citadel.org/doku.php/"
529 "faq:mastering_your_os:net#netstat\">%s</a>",
533 wc_printf("<hr /><div class=\"buttons\"> "
534 "<span class=\"button_link\"><a href=\".\">");
535 wc_printf(_("Log in again"));
536 wc_printf("</a></span>");
537 wc_printf("</div></div></div>\n");
539 end_webcit_session();
553 output_headers(1, 1, 2, 0, 0, 0);
554 wc_printf("<div id=\"banner\">\n");
556 wc_printf(_("Validate new users"));
558 wc_printf("</div>\n");
560 wc_printf("<div id=\"content\" class=\"service\">\n");
562 /* If the user just submitted a validation, process it... */
563 safestrncpy(buf, bstr("user"), sizeof buf);
564 if (!IsEmptyStr(buf)) {
565 if (havebstr("axlevel")) {
566 serv_printf("VALI %s|%s", buf, bstr("axlevel"));
567 serv_getln(buf, sizeof buf);
569 wc_printf("<b>%s</b><br>\n", &buf[4]);
574 /* Now see if any more users require validation. */
576 serv_getln(buf, sizeof buf);
579 wc_printf(_("No users require validation at this time."));
580 wc_printf("</b><br>\n");
585 wc_printf("<b>%s</b><br>\n", &buf[4]);
590 wc_printf("<table class=\"auth_validate\"><tr><td>\n");
591 wc_printf("<div id=\"validate\">");
593 safestrncpy(user, &buf[4], sizeof user);
594 serv_printf("GREG %s", user);
595 serv_getln(cmd, sizeof cmd);
599 serv_getln(buf, sizeof buf);
602 wc_printf("#%s<br><H1>%s</H1>",
611 while (!IsEmptyStr(pch))
615 else if (isalpha(*pch))
626 pch = _("very weak");
639 wc_printf("PW: %s<br>\n", pch);
642 wc_printf("%s<br>\n", buf);
644 wc_printf("%s<br>\n", buf);
646 wc_printf("%s, ", buf);
648 wc_printf("%s ", buf);
650 wc_printf("%s<br>\n", buf);
652 wc_printf("%s<br>\n", buf);
654 wc_printf(_("Current access level: %d (%s)\n"),
655 atoi(buf), axdefs[atoi(buf)]);
656 } while (strcmp(buf, "000"));
658 wc_printf("<H1>%s</H1>%s<br>\n", user, &cmd[4]);
662 wc_printf(_("Select access level for this user:"));
664 for (a = 0; a <= 6; ++a) {
665 wc_printf("<a href=\"validate?nonce=%d?user=", WC->nonce);
667 wc_printf("&axlevel=%d\">%s</A> \n",
672 wc_printf("</div>\n");
673 wc_printf("</td></tr></table>\n");
680 * Display form for registration.
682 * (Set during_login to 1 if this registration is being performed during
683 * new user login and will require chaining to the proper screen.)
685 void display_reg(int during_login)
689 message_summary *VCMsg = NULL;
690 wc_mime_attachment *VCAtt = NULL;
694 memset(&Room, 0, sizeof(folder));
695 if (goto_config_room(Buf, &Room) != 0) {
696 syslog(9, "display_reg() exiting because goto_config_room() failed\n");
710 vcard_msgnum = locate_user_vcard_in_this_room(&VCMsg, &VCAtt);
711 if (vcard_msgnum < 0L) {
712 syslog(9, "display_reg() exiting because locate_user_vcard_in_this_room() failed\n");
723 do_edit_vcard(vcard_msgnum, "1", VCMsg, VCAtt, "pop", USERCONFIGROOM);
727 ReturnTo = NewStrBufPlain(HKEY("display_main_menu?go="));
728 StrBufAppendBuf(ReturnTo, WC->CurRoom.name, 0);
729 do_edit_vcard(vcard_msgnum, "1", VCMsg, VCAtt, ChrPtr(ReturnTo), USERCONFIGROOM);
730 FreeStrBuf(&ReturnTo);
733 /* FIXME - don't we have to free VCMsg and VCAtt ?? */
740 * display form for changing your password
742 void display_changepw(void)
744 WCTemplputParams SubTP;
747 output_headers(1, 1, 1, 0, 0, 0);
749 Buf = NewStrBufPlain(_("Change your password"), -1);
750 memset(&SubTP, 0, sizeof(WCTemplputParams));
751 SubTP.Filter.ContextType = CTX_STRBUF;
753 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
757 if (!IsEmptyStr(WC->ImportantMessage)) {
758 wc_printf("<span class=\"errormsg\">"
759 "%s</span><br>\n", WC->ImportantMessage);
760 safestrncpy(WC->ImportantMessage, "", sizeof WC->ImportantMessage);
763 serv_puts("MESG changepw");
764 serv_getln(buf, sizeof buf);
769 wc_printf("<form name=\"changepwform\" action=\"changepw\" method=\"post\">\n");
770 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
771 wc_printf("<table class=\"altern\" ");
772 wc_printf("<tr class=\"even\"><td>");
773 wc_printf(_("Enter new password:"));
774 wc_printf("</td><td>");
775 wc_printf("<input type=\"password\" name=\"newpass1\" value=\"\" maxlength=\"20\"></td></tr>\n");
776 wc_printf("<tr class=\"odd\"><td>");
777 wc_printf(_("Enter it again to confirm:"));
778 wc_printf("</td><td>");
779 wc_printf("<input type=\"password\" name=\"newpass2\" value=\"\" maxlength=\"20\"></td></tr>\n");
780 wc_printf("</table>\n");
782 wc_printf("<div class=\"buttons\">\n");
783 wc_printf("<input type=\"submit\" name=\"change_action\" value=\"%s\">", _("Change password"));
785 wc_printf("<input type=\"submit\" name=\"cancel_action\" value=\"%s\">\n", _("Cancel"));
786 wc_printf("</div>\n");
787 wc_printf("</form>\n");
789 do_template("endbox", NULL);
795 * if passwords match, propagate it to citserver.
800 char newpass1[32], newpass2[32];
802 if (!havebstr("change_action")) {
803 safestrncpy(WC->ImportantMessage,
804 _("Cancelled. Password was not changed."),
805 sizeof WC->ImportantMessage);
810 safestrncpy(newpass1, bstr("newpass1"), sizeof newpass1);
811 safestrncpy(newpass2, bstr("newpass2"), sizeof newpass2);
813 if (strcasecmp(newpass1, newpass2)) {
814 safestrncpy(WC->ImportantMessage,
815 _("They don't match. Password was not changed."),
816 sizeof WC->ImportantMessage);
821 if (IsEmptyStr(newpass1)) {
822 safestrncpy(WC->ImportantMessage,
823 _("Blank passwords are not allowed."),
824 sizeof WC->ImportantMessage);
829 serv_printf("SETP %s", newpass1);
830 serv_getln(buf, sizeof buf);
831 sprintf(WC->ImportantMessage, "%s", &buf[4]);
833 if (WC->wc_password == NULL)
834 WC->wc_password = NewStrBufPlain(buf, -1);
836 FlushStrBuf(WC->wc_password);
837 StrBufAppendBufPlain(WC->wc_password, buf, -1, 0);
846 int ConditionalHaveAccessCreateRoom(StrBuf *Target, WCTemplputParams *TP)
852 StrBuf_ServGetln(Buf);
854 if (GetServerStatus(Buf, NULL) == 2) {
855 StrBufCutLeft(Buf, 4);
856 AppendImportantMessage(SKEY(Buf));
864 int ConditionalAide(StrBuf *Target, WCTemplputParams *TP)
867 return (WCC != NULL) ? ((WCC->logged_in == 0)||(WC->is_aide == 0)) : 0;
870 int ConditionalIsLoggedIn(StrBuf *Target, WCTemplputParams *TP)
873 return (WCC != NULL) ? (WCC->logged_in == 0) : 0;
879 void _display_reg(void) {
884 void Header_HandleAuth(StrBuf *Line, ParsedHttpHdrs *hdr)
886 if (hdr->HR.got_auth == NO_AUTH) /* don't override cookie auth... */
888 if (strncasecmp(ChrPtr(Line), "Basic", 5) == 0) {
889 StrBufCutLeft(Line, 6);
890 StrBufDecodeBase64(Line);
891 hdr->HR.plainauth = Line;
892 hdr->HR.got_auth = AUTH_BASIC;
895 syslog(1, "Authentication scheme not supported! [%s]\n", ChrPtr(Line));
899 void CheckAuthBasic(ParsedHttpHdrs *hdr)
902 todo: enable this if we can have other sessions than authenticated ones.
903 if (hdr->DontNeedAuth)
906 StrBufAppendBufPlain(hdr->HR.plainauth, HKEY(":"), 0);
907 StrBufAppendBuf(hdr->HR.plainauth, hdr->HR.user_agent, 0);
908 hdr->HR.SessionKey = hashlittle(SKEY(hdr->HR.plainauth), 89479832);
910 syslog(1, "CheckAuthBasic: calculated sessionkey %ld\n",
915 void GetAuthBasic(ParsedHttpHdrs *hdr)
917 const char *Pos = NULL;
918 if (hdr->c_username == NULL)
919 hdr->c_username = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_USER));
920 if (hdr->c_password == NULL)
921 hdr->c_password = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_PASS));
922 StrBufExtract_NextToken(hdr->c_username, hdr->HR.plainauth, &Pos, ':');
923 StrBufExtract_NextToken(hdr->c_password, hdr->HR.plainauth, &Pos, ':');
926 void Header_HandleCookie(StrBuf *Line, ParsedHttpHdrs *hdr)
930 todo: enable this if we can have other sessions than authenticated ones.
931 if (hdr->DontNeedAuth)
934 pch = strstr(ChrPtr(Line), "webcit=");
939 hdr->HR.RawCookie = Line;
940 StrBufCutLeft(hdr->HR.RawCookie, (pch - ChrPtr(hdr->HR.RawCookie)) + 7);
941 StrBufDecodeHex(hdr->HR.RawCookie);
943 cookie_to_stuff(Line, &hdr->HR.desired_session,
949 hdr->HR.got_auth = AUTH_COOKIE;
954 (ParsedHttpHdrs *httpreq)
956 httpreq->c_username = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_USER));
957 httpreq->c_password = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_PASS));
958 httpreq->c_roomname = NewStrBuf();
959 httpreq->c_language = NewStrBuf();
962 HttpDetachModule_AUTH
963 (ParsedHttpHdrs *httpreq)
965 FLUSHStrBuf(httpreq->c_username);
966 FLUSHStrBuf(httpreq->c_password);
967 FLUSHStrBuf(httpreq->c_roomname);
968 FLUSHStrBuf(httpreq->c_language);
972 HttpDestroyModule_AUTH
973 (ParsedHttpHdrs *httpreq)
975 FreeStrBuf(&httpreq->c_username);
976 FreeStrBuf(&httpreq->c_password);
977 FreeStrBuf(&httpreq->c_roomname);
978 FreeStrBuf(&httpreq->c_language);
986 RegisterHeaderHandler(HKEY("COOKIE"), Header_HandleCookie);
987 RegisterHeaderHandler(HKEY("AUTHORIZATION"), Header_HandleAuth);
989 /* no url pattern at all? Show login. */
990 WebcitAddUrlHandler(HKEY(""), "", 0, do_welcome, ANONYMOUS|COOKIEUNNEEDED);
992 /* some of these will be removed soon */
993 WebcitAddUrlHandler(HKEY("do_welcome"), "", 0, do_welcome, ANONYMOUS|COOKIEUNNEEDED);
994 WebcitAddUrlHandler(HKEY("openid_login"), "", 0, do_openid_login, ANONYMOUS);
995 WebcitAddUrlHandler(HKEY("finalize_openid_login"), "", 0, finalize_openid_login, ANONYMOUS);
996 WebcitAddUrlHandler(HKEY("openid_manual_create"), "", 0, openid_manual_create, ANONYMOUS);
997 WebcitAddUrlHandler(HKEY("validate"), "", 0, validate, 0);
998 WebcitAddUrlHandler(HKEY("do_welcome"), "", 0, do_welcome, 0);
999 WebcitAddUrlHandler(HKEY("display_reg"), "", 0, _display_reg, 0);
1000 WebcitAddUrlHandler(HKEY("display_changepw"), "", 0, display_changepw, 0);
1001 WebcitAddUrlHandler(HKEY("changepw"), "", 0, changepw, 0);
1002 WebcitAddUrlHandler(HKEY("termquit"), "", 0, do_logout, 0);
1003 WebcitAddUrlHandler(HKEY("do_logout"), "", 0, do_logout, ANONYMOUS|COOKIEUNNEEDED|FORCE_SESSIONCLOSE);
1004 WebcitAddUrlHandler(HKEY("ajax_login_username_password"), "", 0, ajax_login_username_password, AJAX|ANONYMOUS);
1005 WebcitAddUrlHandler(HKEY("ajax_login_newuser"), "", 0, ajax_login_newuser, AJAX|ANONYMOUS);
1006 RegisterConditional(HKEY("COND:AIDE"), 2, ConditionalAide, CTX_NONE);
1007 RegisterConditional(HKEY("COND:LOGGEDIN"), 2, ConditionalIsLoggedIn, CTX_NONE);
1008 RegisterConditional(HKEY("COND:MAY_CREATE_ROOM"), 2, ConditionalHaveAccessCreateRoom, CTX_NONE);
1014 SessionDestroyModule_AUTH
1017 FreeStrBuf(&sess->wc_username);
1018 FreeStrBuf(&sess->wc_fullname);
1019 FreeStrBuf(&sess->wc_password);
1020 FreeStrBuf(&sess->httpauth_pass);
1021 FreeStrBuf(&sess->cs_inet_email);