+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.
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
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
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
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");
void share(void);
void terminate_session(void);
void edit_me(void);
+void display_siteconfig(void);
+void siteconfig(void);
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]);
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");
/*
* 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>");
char c_username[256];
char c_password[256];
char c_roomname[256];
+ char cookie[256];
strcpy(c_host, defaulthost);
strcpy(c_port, defaultport);
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]);
}
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");
#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)
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 *);