+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
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
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
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);
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;
*/
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));
/* 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");
/*
* 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;
CLIENT_ID,
CLIENT_VERSION,
SERVER,
- "" /* FIX find out where the user is */
+ browser_host
);
serv_gets(buf);
}
-void session_loop(void) {
+void session_loop(char *browser_host) {
char cmd[256];
char action[256];
char buf[256];
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();
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]);
}
}
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);
+