From: Art Cancro Date: Sun, 10 Jan 1999 01:40:47 +0000 (+0000) Subject: Lotsa stuff. See ChangeLog for details. X-Git-Tag: v7.86~7953 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=24b9bf8d808ecbc9fb9351e284abc99ed2b7debc;p=citadel.git Lotsa stuff. See ChangeLog for details. --- diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 1ccbb89d6..819520bcd 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -1,3 +1,6 @@ +Fri Jan 8 22:20:54 EST 1999 Art Cancro + * Reduced the multiple cookies down to one cookie combining all data. + Mon Jan 4 23:04:36 EST 1999 Art Cancro * Removed wc_host and wc_port cookies. * Added an "edit your session" screen to change your wholisting. diff --git a/webcit/Makefile.in b/webcit/Makefile.in index bbe64c88a..bf646162c 100644 --- a/webcit/Makefile.in +++ b/webcit/Makefile.in @@ -20,8 +20,9 @@ distclean: clean rm -f Makefile config.cache config.log config.status -webserver: webserver.o context_loop.o $(LIBOBJS) - $(CC) webserver.o context_loop.o $(LIBOBJS) $(LIBS) -o webserver +webserver: webserver.o context_loop.o tools.o cookie_conversion.o $(LIBOBJS) + $(CC) webserver.o context_loop.o tools.o cookie_conversion.o \ + $(LIBOBJS) $(LIBS) -o webserver webserver.o: webserver.c webcit.h $(CC) $(CFLAGS) $(DEFS) -c -D_REENTRANT -DWEBCITDIR=\"`pwd`\" webserver.c @@ -36,10 +37,10 @@ snprintf.o: snprintf.c webcit: webcit.o auth.o tcp_sockets.o mainmenu.o serv_func.o who.o \ roomops.o tools.o messages.o userlist.o paging.o sysmsgs.o \ - mime_parser.o graphics.o netconf.o + mime_parser.o graphics.o netconf.o cookie_conversion.o siteconfig.o $(CC) webcit.o auth.o tcp_sockets.o mainmenu.o serv_func.o who.o \ - tools.o roomops.o messages.o userlist.o paging.o sysmsgs.o \ - mime_parser.o graphics.o netconf.o -o webcit + tools.o roomops.o messages.o userlist.o paging.o sysmsgs.o siteconfig.o \ + mime_parser.o graphics.o netconf.o cookie_conversion.o -o webcit webcit.o: webcit.c webcit.h child.h $(CC) $(CFLAGS) $(DEFS) -c webcit.c @@ -83,6 +84,12 @@ sysmsgs.o: sysmsgs.c webcit.h child.h mime_parser.o: mime_parser.c webcit.h child.h $(CC) $(CFLAGS) $(DEFS) -c mime_parser.c +cookie_conversion.o: cookie_conversion.c webcit.h child.h + $(CC) $(CFLAGS) $(DEFS) -c cookie_conversion.c + +siteconfig.o: siteconfig.c webcit.h child.h + $(CC) $(CFLAGS) $(DEFS) -c siteconfig.c + netconf.o: netconf.c webcit.h child.h $(CC) $(CFLAGS) $(DEFS) -c netconf.c diff --git a/webcit/auth.c b/webcit/auth.c index 2262fd189..e48893bc0 100644 --- a/webcit/auth.c +++ b/webcit/auth.c @@ -189,8 +189,7 @@ void do_logout(void) { strcpy(wc_roomname, ""); printf("HTTP/1.0 200 OK\n"); - printf("X-WebCit-Session: close\n"); - output_headers(1); + output_headers(2); /* note the "2" which causes cookies to be unset */ wprintf("
"); serv_puts("MESG goodbye"); diff --git a/webcit/child.h b/webcit/child.h index c51a6697d..6826a07f2 100644 --- a/webcit/child.h +++ b/webcit/child.h @@ -98,3 +98,5 @@ void display_share(void); void share(void); void terminate_session(void); void edit_me(void); +void display_siteconfig(void); +void siteconfig(void); diff --git a/webcit/context_loop.c b/webcit/context_loop.c index 818067bf0..705b3710c 100644 --- a/webcit/context_loop.c +++ b/webcit/context_loop.c @@ -255,8 +255,8 @@ void *context_loop(int sock) { ContentLength = 0; do { req_gets(sock, buf, hold); - if (!strncasecmp(buf, "Cookie: wc_session=", 19)) { - desired_session = atoi(&buf[19]); + if (!strncasecmp(buf, "Cookie: webcit=", 15)) { + cookie_to_stuff(&buf[15], &desired_session, NULL, NULL, NULL); } if (!strncasecmp(buf, "Content-length: ", 16)) { ContentLength = atoi(&buf[16]); diff --git a/webcit/mainmenu.c b/webcit/mainmenu.c index d9d9d44b2..e31967a7f 100644 --- a/webcit/mainmenu.c +++ b/webcit/mainmenu.c @@ -164,6 +164,9 @@ if ((axlevel>=6) || (is_room_aide)) { wprintf("
  • \n"); wprintf("Edit this room's Info file\n"); + wprintf("
  • \n"); + wprintf("Edit site-wide configuration\n"); + if (axlevel>=6) { wprintf("
  • \n"); wprintf("Validate new users\n"); diff --git a/webcit/webcit.c b/webcit/webcit.c index 831c96718..0e56def6d 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -258,28 +258,28 @@ void getz(char *buf) { /* * Output all that important stuff that the browser will want to see + * + * If print_standard_html_head is nonzero, we also get some standard HTML + * headers. If it's set to 2, the session is considered to be closing. */ void output_headers(int print_standard_html_head) { static char *unset = "; expires=28-May-1971 18:10:00 GMT"; + char cookie[256]; printf("Server: %s\n", SERVER); printf("Connection: close\n"); - printf("Set-cookie: wc_session=%d\n", wc_session); - - if (strlen(wc_username)>0) printf("Set-cookie: wc_username=%s\n", - wc_username); - else printf("Set-cookie: wc_username=%s\n", unset); - - if (strlen(wc_password)>0) printf("Set-cookie: wc_password=%s\n", - wc_password); - else printf("Set-cookie: wc_password=%s\n", unset); - if (strlen(wc_roomname)>0) printf("Set-cookie: wc_roomname=%s\n", - wc_roomname); - else printf("Set-cookie: wc_roomname=%s\n", unset); + stuff_to_cookie(cookie, wc_session, wc_username, wc_password, wc_roomname); + if (print_standard_html_head==2) { + printf("X-WebCit-Session: close\n"); + printf("Set-cookie: webcit=%s\n", unset); + } + else { + printf("Set-cookie: webcit=%s\n", cookie); + } - if (print_standard_html_head) { + if (print_standard_html_head > 0) { wprintf(""); escputs("WebCit"); /* FIX -- add BBS name here */ wprintf(""); @@ -476,6 +476,7 @@ void session_loop(void) { char c_username[256]; char c_password[256]; char c_roomname[256]; + char cookie[256]; strcpy(c_host, defaulthost); strcpy(c_port, defaultport); @@ -492,12 +493,12 @@ void session_loop(void) { do { getz(buf); - if (!strncasecmp(buf, "Cookie: wc_username=", 20)) - strcpy(c_username, &buf[20]); - if (!strncasecmp(buf, "Cookie: wc_password=", 20)) - strcpy(c_password, &buf[20]); - if (!strncasecmp(buf, "Cookie: wc_roomname=", 20)) - strcpy(c_roomname, &buf[20]); + if (!strncasecmp(buf, "Cookie: webcit=", 15)) { + strcpy(cookie, &buf[15]); + cookie_to_stuff(cookie, NULL, + c_username, c_password, c_roomname); + } + if (!strncasecmp(buf, "Content-length: ", 16)) { ContentLength = atoi(&buf[16]); } @@ -862,6 +863,14 @@ void session_loop(void) { edit_me(); } + else if (!strcasecmp(action, "display_siteconfig")) { + display_siteconfig(); + } + + else if (!strcasecmp(action, "siteconfig")) { + siteconfig(); + } + /* When all else fails... */ else { printf("HTTP/1.0 200 OK\n"); diff --git a/webcit/webcit.h b/webcit/webcit.h index ef9760dae..38a40045a 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -7,7 +7,7 @@ #define DEVELOPER_ID 0 #define CLIENT_ID 4 #define CLIENT_VERSION 200 -#define DEFAULT_HOST "uncnsrd.mt-kisco.ny.us" +#define DEFAULT_HOST "localhost" #define DEFAULT_PORT "citadel" #define LB (1) #define RB (2) @@ -75,3 +75,6 @@ extern char *axdefs[]; extern int upload_length; extern char *upload; extern char floorlist[128][256]; + +void stuff_to_cookie(char *, int, char *, char *, char *); +void cookie_to_stuff(char *, int *, char *, char *, char *);