fix up libopm so it will bind to a IP address

This commit is contained in:
Fish 2004-10-19 06:31:55 +00:00
parent 9f3e6e0270
commit d45207e9a4
2 changed files with 16 additions and 0 deletions

View file

@ -1,5 +1,8 @@
Open Proxy Scanning Bot Module for NeoStats Changelog.
==============================================================================
* Version 2.4 * 19/10/2004 * Fish (F)
- Fix OPSB so it will bind to a Local IP address (F)
* Version 2.3 * 25/7/2004 * Fish (F)
- Fix a problem with "OPSB is not configured" messages
- Make sure we are using the correct config type for serval set variables

13
proxy.c
View file

@ -116,6 +116,7 @@ int load_ports() {
int init_libopm() {
lnode_t *pn;
port_list *pl;
struct hostent *hp;
scanner = opm_create();
/* setup the callbacks to our code */
@ -125,6 +126,18 @@ int init_libopm() {
opm_callback(scanner, OPM_CALLBACK_END, &scan_end, NULL);
opm_callback(scanner, OPM_CALLBACK_ERROR, &scan_error, NULL);
/* configure opm to bind to a IP address */
if (me.local[0] != 0) {
if ((hp = gethostbyname(me.local)) == NULL) {
nlog(LOG_WARNING, LOG_MOD, "Warning, Couldn't bind OPSB ports to IP address: %s", me.local);
} else {
if (opm_config(scanner, OPM_CONFIG_BIND_IP, &me.local) != OPM_SUCCESS) {
nlog(LOG_WARNING, LOG_MOD, "LIBOPM couldn't bind to a IP address");
}
}
}
/* max number of socks we allow */
opm_config(scanner, OPM_CONFIG_FD_LIMIT, &opsb.socks);
/* host to try to connect to */