--- larbin-orig/larbin.conf.ini Tue Dec 30 10:10:01 2003 +++ larbin/larbin.conf.ini Thu Jan 1 10:47:57 2004 @@ -16,6 +16,11 @@ # port on which you can submit urls to fetch # no input is possible if you comment this line or use port 0 #inputPort 1976 +# What is the address to the port above to submit urls to fetch +# if unset or set to 0.0.0.0 the server listens on all available addresses +# hint: use 127.0.0.1 for some extra security +#httpAddr 0.0.0.0 + ############################################ # parameters to adapt depending on your network diff -rbBu 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 Thu Jan 1 10:41:09 2004 @@ -72,6 +72,7 @@ unsigned short int global::httpPort; char *global::webPasswd = NULL; unsigned short int global::inputPort; +char *global::inputAddr = "0.0.0.0"; struct pollfd *global::pollfds; uint global::posPoll; uint global::sizePoll; @@ -279,6 +280,9 @@ } else if (!strcasecmp(tok, "inputPort")) { tok = nextToken(&posParse); inputPort = atoi(tok); + } else if (!strcasecmp(tok, "inputAddr")) { + tok = nextToken(&posParse); + inputAddr = newString(tok); } else if (!strcasecmp(tok, "depthInSite")) { tok = nextToken(&posParse); depthInSite = atoi(tok); diff -rbBu 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 Thu Jan 1 10:49:18 2004 @@ -143,6 +143,8 @@ static char *webPasswd; /** port on which input wait for queries */ static unsigned short int inputPort; + /** address on which to one can submit urls to fetch */ + static char * inputAddr; /** parse configuration file */ static void parseFile (char *file); /** read the domain limit */ diff -rbBu larbin-orig/src/interf/input.cc larbin/src/interf/input.cc --- larbin-orig/src/interf/input.cc Tue Dec 30 10:10:01 2003 +++ larbin/src/interf/input.cc Thu Jan 1 10:53:35 2004 @@ -7,6 +7,9 @@ #include #include #include +#include +#include +#include #include "options.h" @@ -191,10 +194,16 @@ if (global::inputPort != 0) { int allowReuse = 1; struct sockaddr_in addr; + struct hostent *hp; memset ((void *) &addr, 0, sizeof(addr)); - addr.sin_addr.s_addr = INADDR_ANY; addr.sin_family = AF_INET; addr.sin_port = htons(global::inputPort); + if (((hp = gethostbyname(global::inputAddr)) == NULL) \ + || (!inet_aton(hp->h_name, &addr.sin_addr))) { + cerr << "Unable to parse inputAddr von configfile (" << global::inputAddr + << ") : " << strerror(errno) << endl; + exit(1); + } if ((inputFds = socket(AF_INET, SOCK_STREAM, 0)) == -1 || setsockopt(inputFds, SOL_SOCKET, SO_REUSEADDR, (char*)&allowReuse, sizeof(allowReuse)) diff -rbBu larbin-orig/src/utils/url.h larbin/src/utils/url.h --- larbin-orig/src/utils/url.h Tue Dec 30 10:10:01 2003 +++ larbin/src/utils/url.h Thu Jan 1 10:51:01 2004 @@ -11,6 +11,7 @@ #include #include #include +#include #include "types.h"