From: Art Cancro Date: Sun, 31 Jan 1999 00:01:51 +0000 (+0000) Subject: Resolve the name of the connecting host and pass it on to Citadel X-Git-Tag: v7.86~7914 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=a25f55f1799d22d06e8609a224bdfc298b5ef4ea;p=citadel.git Resolve the name of the connecting host and pass it on to Citadel --- diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 671181ee0..1747142a2 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -1,3 +1,6 @@ +Sat Jan 30 19:00:58 EST 1999 Art Cancro + * Resolve the name of the connecting host and pass it on to Citadel + Fri Jan 29 14:49:49 EST 1999 Art Cancro * wDumpContent() is now responsible for most of the time (parameter settable) so that the main menu can easily be diff --git a/webcit/Makefile.in b/webcit/Makefile.in index a26260b9f..0ed4d6452 100644 --- a/webcit/Makefile.in +++ b/webcit/Makefile.in @@ -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 diff --git a/webcit/child.h b/webcit/child.h index b13d3fe87..7cfbc2f3e 100644 --- a/webcit/child.h +++ b/webcit/child.h @@ -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); diff --git a/webcit/context_loop.c b/webcit/context_loop.c index cf76bca46..d64b513eb 100644 --- a/webcit/context_loop.c +++ b/webcit/context_loop.c @@ -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"); diff --git a/webcit/serv_func.c b/webcit/serv_func.c index fd23284f4..878ba9f5c 100644 --- a/webcit/serv_func.c +++ b/webcit/serv_func.c @@ -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); diff --git a/webcit/webcit.c b/webcit/webcit.c index 092302f66..ddbc9d762 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -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 [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]); } } diff --git a/webcit/webcit.h b/webcit/webcit.h index 90fd99807..2798b7ab4 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -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); +