Lotsa stuff. See ChangeLog for details.
authorArt Cancro <ajc@citadel.org>
Sun, 10 Jan 1999 01:40:47 +0000 (01:40 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 10 Jan 1999 01:40:47 +0000 (01:40 +0000)
webcit/ChangeLog
webcit/Makefile.in
webcit/auth.c
webcit/child.h
webcit/context_loop.c
webcit/mainmenu.c
webcit/webcit.c
webcit/webcit.h

index 1ccbb89d62b03d8c93664005102db64aaff1e800..819520bcd0eeb6ddc44ee0c4fe08fd5257eb8a1c 100644 (file)
@@ -1,3 +1,6 @@
+Fri Jan  8 22:20:54 EST 1999 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
+       * Reduced the multiple cookies down to one cookie combining all data.
+
 Mon Jan  4 23:04:36 EST 1999 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * Removed wc_host and wc_port cookies.
        * Added an "edit your session" screen to change your wholisting.
index bbe64c88ad1be493bf39ef54230055b40f1da989..bf646162c7e82dc2bcf689e1ca10366b417b173f 100644 (file)
@@ -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
 
index 2262fd189d0b0be081cf510f96302c6db15adf82..e48893bc059c1ca3dfd732bb12d7512a3d2b722d 100644 (file)
@@ -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("<CENTER>");    
        serv_puts("MESG goodbye");
index c51a6697d9af487f1c65e84419f42adbe9e63199..6826a07f22b2cc1e764c588d1a07dd0035224a19 100644 (file)
@@ -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);
index 818067bf0eb3cd91a31b03981458560ab5e6613d..705b3710c8d8b6e4727a0b5a79c9320de376bde6 100644 (file)
@@ -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]);
index d9d9d44b27035b8781b925927f224fcea9960bfc..e31967a7f187129dab28faf1092dfe9bb0f71024 100644 (file)
@@ -164,6 +164,9 @@ if ((axlevel>=6) || (is_room_aide)) {
        wprintf("<LI><A HREF=\"/display_editinfo\">\n");
        wprintf("Edit this room's Info file</A>\n");
 
+       wprintf("<LI><A HREF=\"/display_siteconfig\">\n");
+       wprintf("Edit site-wide configuration</A>\n");
+
        if (axlevel>=6) {
                wprintf("<LI><A HREF=\"/validate\">\n");
                wprintf("Validate new users</A>\n");
index 831c96718b17807a451d8ac2e0dcfda93765e330..0e56def6d4f6b83887a54f2aa7e9dce43163a49f 100644 (file)
@@ -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("<HTML><HEAD><TITLE>");
                escputs("WebCit");       /* FIX -- add BBS name here */
                wprintf("</TITLE></HEAD>");
@@ -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");
index ef9760dae531faae509163d9910659b8a565bd49..38a40045a8b9a9e847a78660685d437c81973d65 100644 (file)
@@ -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 *);