Resolve the name of the connecting host and pass it on to Citadel
authorArt Cancro <ajc@citadel.org>
Sun, 31 Jan 1999 00:01:51 +0000 (00:01 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 31 Jan 1999 00:01:51 +0000 (00:01 +0000)
webcit/ChangeLog
webcit/Makefile.in
webcit/child.h
webcit/context_loop.c
webcit/serv_func.c
webcit/webcit.c
webcit/webcit.h

index 671181ee090c5e7cac2d07a6804611fd3db75f50..1747142a2434d047c86f9633a50aea12813f9310 100644 (file)
@@ -1,3 +1,6 @@
+Sat Jan 30 19:00:58 EST 1999 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
+       * Resolve the name of the connecting host and pass it on to Citadel
+
 Fri Jan 29 14:49:49 EST 1999 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * wDumpContent() is now responsible for </BODY></HTML> most of the
          time (parameter settable) so that the main menu can easily be
index a26260b9f11e50eb259e9636e987b5b609011297..0ed4d64521db46145843316667d20b59a398d55a 100644 (file)
@@ -20,9 +20,10 @@ distclean: clean
        rm -f Makefile config.cache config.log config.status
 
 
-webserver: webserver.o context_loop.o tools.o cookie_conversion.o $(LIBOBJS)
+webserver: webserver.o context_loop.o tools.o \
+       cookie_conversion.o locate_host.o $(LIBOBJS)
        $(CC) webserver.o context_loop.o tools.o cookie_conversion.o \
-       $(LIBOBJS) $(LIBS) -o webserver
+       locate_host.o $(LIBOBJS) $(LIBS) -o webserver
 
 webserver.o: webserver.c webcit.h
        $(CC) $(CFLAGS) $(DEFS) -c -D_REENTRANT -DWEBCITDIR=\"`pwd`\" webserver.c
@@ -93,6 +94,9 @@ siteconfig.o: siteconfig.c webcit.h child.h
 netconf.o: netconf.c webcit.h child.h
        $(CC) $(CFLAGS) $(DEFS) -c netconf.c
 
+locate_host.o: locate_host.c webcit.h child.h
+       $(CC) $(CFLAGS) $(DEFS) -c locate_host.c
+
 Makefile: $(srcdir)/Makefile.in config.status
        CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
 
index b13d3fe878ceedbc225cbd5b5b5e0c8200ce8513..7cfbc2f3e71834d92abcb0a6654894f7e04fca5b 100644 (file)
@@ -15,7 +15,7 @@ void list_all_rooms_by_floor(void);
 void slrp_highest(void);
 void gotonext(void);
 void ungoto(void);
-void get_serv_info(void);
+void get_serv_info(char *);
 int connectsock(char *host, char *service, char *protocol);
 void serv_gets(char *strbuf);
 void serv_puts(char *string);
index cf76bca4695ada1302f905d7b77db1181b31d00e..d64b513eba3a2a3f6cbd33187e3c6616aa263585 100644 (file)
@@ -227,6 +227,7 @@ static int lingering_close(int fd) {
 void *context_loop(int sock) {
        char (*req)[256];
        char buf[256], hold[256];
+       char browser_host[256];
        int num_lines = 0;
        int a;
        int f;
@@ -296,6 +297,7 @@ void *context_loop(int sock) {
         */
        if (TheSession == NULL) {
                printf("Creating a new session\n");
+               locate_host(browser_host, sock);
                pthread_mutex_lock(&MasterCritter);
                TheSession = (struct wc_session *)
                        malloc(sizeof(struct wc_session));
@@ -327,7 +329,7 @@ void *context_loop(int sock) {
 
                        /* Run the actual WebCit session */
                        execlp("./webcit", "webcit", str_session, defaulthost,
-                              defaultport, NULL);
+                              defaultport, browser_host, NULL);
 
                        /* Simple page to display if exec fails */
                        printf("HTTP/1.0 404 WebCit Failure\n\n");
index fd23284f4d7722308d2b50239b3fa592caf9c550..878ba9f5cf78474dc5cfcd48cf4409be3a79940b 100644 (file)
@@ -15,7 +15,7 @@ struct serv_info serv_info;
 /*
  * get info about the server we've connected to
  */
-void get_serv_info(void) {
+void get_serv_info(char *browser_host) {
        char buf[256];
        int a;
 
@@ -24,7 +24,7 @@ void get_serv_info(void) {
                CLIENT_ID,
                CLIENT_VERSION,
                SERVER,
-               ""              /* FIX find out where the user is */
+               browser_host
                );
        serv_gets(buf);
 
index 092302f661aba52af93d0a37e2e473c8d1233049..ddbc9d762c448c6b4a599d567759748829d6f21b 100644 (file)
@@ -516,7 +516,7 @@ void upload_handler(char *name, char *filename, char *encoding,
        }
 
 
-void session_loop(void) {
+void session_loop(char *browser_host) {
        char cmd[256];
        char action[256];
        char buf[256];
@@ -604,7 +604,7 @@ void session_loop(void) {
                serv_sock = connectsock(c_host, c_port, "tcp");
                connected = 1;
                serv_gets(buf); /* get the server welcome message */
-               get_serv_info();
+               get_serv_info(browser_host);
                }
 
        check_for_express_messages();
@@ -968,25 +968,22 @@ void session_loop(void) {
 
 int main(int argc, char *argv[]) {
 
-       if (argc < 2 || argc > 4) {
+       if (argc != 5) {
                fprintf(stderr,
-                       "webcit: usage: webcit <session_id> [host [port]]\n");
+                       "webcit: usage error (argc must be 5, not %d)\n",
+                       argc);
                return 1;
                }
 
        wc_session = atoi(argv[1]);
-
-       if (argc > 2) {
-               defaulthost = argv[2];
-               if (argc > 3)
-                       defaultport = argv[3];
-               }
+       defaulthost = argv[2];
+       defaultport = argv[3];
 
        strcpy(wc_username, "");
        strcpy(wc_password, "");
        strcpy(wc_roomname, "");
 
        while (1) {
-               session_loop();
+               session_loop(argv[4]);
                }
        }
index 90fd99807d7d09dd0b084f2f37070ecd087875b3..2798b7ab44507c8d6d94c593f3e92c77970eaf4e 100644 (file)
@@ -79,3 +79,5 @@ extern int noframes;
 
 void stuff_to_cookie(char *, int, char *, char *, char *, int);
 void cookie_to_stuff(char *, int *, char *, char *, char *, int *);
+void locate_host(char *, int);
+