axdefs[6] = _("Aide"); /* chief */
}
-int ReEstablish_Session(void)
-{
- StrBuf *Buf = NewStrBuf();
- wcsession *WCC = WC;
-
- serv_printf("USER %s", ChrPtr(WCC->Hdr->c_username));
- StrBuf_ServGetln(Buf);
- if (GetServerStatus(Buf, NULL) == 3) {
- serv_printf("PASS %s", ChrPtr(WCC->Hdr->c_password));
- StrBuf_ServGetln(Buf);
- if (GetServerStatus(Buf, NULL) == 2) {
- become_logged_in(WCC->Hdr->c_username,
- WCC->Hdr->c_password, Buf);
- get_preference("default_header_charset", &WCC->DefaultCharset);
- }
- }
- /*
- * If we don't have a current room, but a cookie specifying the
- * current room is supplied, make an effort to go there.
- */
- if ((StrLength(WCC->wc_roomname) == 0) && (StrLength(WCC->Hdr->c_roomname) > 0)) {
- serv_printf("GOTO %s",
- ChrPtr(WCC->Hdr->c_roomname));
- StrBuf_ServGetln(Buf);
- if (GetServerStatus(Buf, NULL) == 2) {
- if (WCC->wc_roomname == NULL) {
- WCC->wc_roomname = NewStrBufDup(WCC->Hdr->c_roomname);
- }
- else {
- FlushStrBuf(WCC->wc_roomname);
- StrBufAppendBuf(WCC->wc_roomname, WCC->Hdr->c_roomname, 0);
- }
- }
- }
- FreeStrBuf(&Buf);
- return 0;
-}
/*
/*
- * If we're not logged in, but we have HTTP Authentication data,
- * try logging in to Citadel using that.
+ * If we're not logged in, but we have authentication data (either from
+ * a cookie or from http-auth), try logging in to Citadel using that.
*/
if ((!WCC->logged_in)
&& (StrLength(WCC->Hdr->c_username) > 0)
(WCC->Hdr->eReqType != eHEAD);
/*
- * If we're not logged in, but we have username and password cookies
- * supplied by the browser, try using them to log in.
+ * If a 'gotofirst' parameter has been specified, attempt to goto that room
+ * prior to doing anything else.
*/
- if ((!WCC->logged_in)
- && (StrLength(WCC->Hdr->c_username)>0)
- && (StrLength(WCC->Hdr->c_password)>0)) {
- ReEstablish_Session();
+ if (havebstr("gotofirst")) {
+ int ret;
+ ret = gotoroom(sbstr("gotofirst")); /* do quietly to avoid session output! */
+ if ((ret/100) != 2) {
+ lprintf(1, "GOTOFIRST: Unable to change to [%s]; Reason: %d\n",
+ bstr("gotofirst"), ret);
+ }
}
/*
- * If a 'gotofirst' parameter has been specified, attempt to goto that room
- * prior to doing anything else.
+ * If we aren't in any room yet, but we have cookie data telling us where we're
+ * supposed to be, and 'gotofirst' was not specified, then go there.
*/
- if (havebstr("gotofirst")) {
+ else if ( (StrLength(WCC->wc_roomname) == 0) && ( (StrLength(WCC->Hdr->c_roomname) > 0) )) {
+ lprintf(9, "We are in '%s' but cookie indicates '%s', going there...\n",
+ ChrPtr(WCC->wc_roomname),
+ ChrPtr(WCC->Hdr->c_roomname)
+ );
int ret;
- ret = gotoroom(sbstr("gotofirst")); /* do this quietly to avoid session output! */
- if (ret != 0)
- lprintf(1, "GOTOFIRST: Unable to change to [%s]; Reason: %d\n", bstr("gotofirst"), ret);
+ ret = gotoroom(WCC->Hdr->c_roomname); /* do quietly to avoid session output! */
+ if ((ret/100) != 2) {
+ lprintf(1, "COOKIEGOTO: Unable to change to [%s]; Reason: %d\n",
+ ChrPtr(WCC->Hdr->c_roomname), ret);
+ }
}
if (WCC->Hdr->Handler != NULL) {
void authorization_required(const char *message);
void CheckAuthBasic(ParsedHttpHdrs *hdr);
void GetAuthBasic(ParsedHttpHdrs *hdr);
-
-int ReEstablish_Session(void);
-
void server_to_text(void);
void save_edit(char *description, char *enter_cmd, int regoto);
void display_edit(char *description, char *check_cmd,