diff -rubB larbin-orig/larbin.conf.ini larbin/larbin.conf.ini --- larbin-orig/larbin.conf.ini Tue Dec 30 10:10:01 2003 +++ larbin/larbin.conf.ini Tue Dec 30 16:11:22 2003 @@ -10,6 +10,10 @@ # port on which is launched the http statistic webserver # if unset or set to 0, no webserver is launched httpPort 8081 +# What is the address the statistic webserver should listen on +# if unset or set to 0.0.0.0 the webserver listens on all availabel adsresses +# hint: use 127.0.0.1 for some extra security +httpAddr 0.0.0.0 # optional passwd : to access http://localhost:8081/passwd/ # instead of http://localhost:8081/ webPasswd passwd diff -rubB larbin-orig/src/global.cc larbin/src/global.cc --- larbin-orig/src/global.cc Tue Dec 30 10:10:01 2003 +++ larbin/src/global.cc Tue Dec 30 12:57:25 2003 @@ -70,6 +70,7 @@ uint global::nb_conn; uint global::dnsConn; unsigned short int global::httpPort; +char *global::httpAddr = "0.0.0.0"; char *global::webPasswd = NULL; unsigned short int global::inputPort; struct pollfd *global::pollfds; @@ -140,6 +141,10 @@ // Read the configuration file crash("Read the configuration file"); parseFile(configFile); + if (strcmp(sender, "larbin@unspecified.mail") == 0) { + cerr << "Please set 'From' in larbin.conf to your email address" << endl; + exit(1); + } // Initialize everything crash("Create global values"); // Headers @@ -273,6 +278,9 @@ } else if (!strcasecmp(tok, "httpPort")) { tok = nextToken(&posParse); httpPort = atoi(tok); + } else if (!strcasecmp(tok, "httpAddr")) { + tok = nextToken(&posParse); + httpAddr = newString(tok); } else if (!strcasecmp(tok, "webPasswd")) { tok = nextToken(&posParse); webPasswd = newString(tok); diff -rubB larbin-orig/src/global.h larbin/src/global.h --- larbin-orig/src/global.h Tue Dec 30 10:10:01 2003 +++ larbin/src/global.h Tue Dec 30 16:10:49 2003 @@ -139,6 +139,8 @@ static int IPUrl; /** port on which is launched the http statistic webserver */ static unsigned short int httpPort; + /** address on which is launched the http statistic webserver */ + static char * httpAddr; /** passwd for http access */ static char *webPasswd; /** port on which input wait for queries */ diff -rubB larbin-orig/src/utils/webserver.cc larbin/src/utils/webserver.cc --- larbin-orig/src/utils/webserver.cc Tue Dec 30 10:10:01 2003 +++ larbin/src/utils/webserver.cc Tue Dec 30 14:57:44 2003 @@ -45,12 +45,18 @@ int fds; int nAllowReuse = 1; struct sockaddr_in addr; + struct hostent *hp; startTime = global::now; startDate = newString(ctime(&startTime)); memset(&addr, 0, sizeof(addr)); - addr.sin_addr.s_addr = INADDR_ANY; addr.sin_family = AF_INET; addr.sin_port = htons(global::httpPort); + if (((hp = gethostbyname(global::httpAddr)) == NULL) \ + || (!inet_aton(hp->h_name, &addr.sin_addr))) { + cerr << "Unable to parse httpAddr von configfile (" << global::httpAddr + << ") : " << strerror(errno) << endl; + exit(1); + } if ((fds = socket(AF_INET, SOCK_STREAM, 0)) == -1 || setsockopt(fds, SOL_SOCKET, SO_REUSEADDR, (char*)&nAllowReuse, sizeof(nAllowReuse)) || bind(fds, (struct sockaddr *) &addr, sizeof(addr)) != 0