freesstring(cfgstr);
ps_mailname=getcopyconfigitem("proxyscan","mailname","some.mail.server",HOSTLEN);
- Error("proxyscan",ERR_INFO,"Proxyscan mailer enabled; mailing to %s as %s.",IPtostr(ps_mailip),ps_mailname->content);
+ Error("proxyscan",ERR_INFO,"Proxyscan mailer enabled; mailing to %s as %s.",IPlongtostr(ps_mailip),ps_mailname->content);
} else {
ps_mailport=0;
ps_mailname=NULL;
glinedhosts++;
loggline(chp);
irc_send("%s GL * +*@%s 1800 :Open Proxy, see http://www.quakenet.org/openproxies.html - ID: %d",
- mynumeric->content,IPtostr(sp->IP),chp->glineid);
- Error("proxyscan",ERR_DEBUG,"Found open proxy on host %s",IPtostr(sp->IP));
+ mynumeric->content,IPlongtostr(sp->IP),chp->glineid);
+ Error("proxyscan",ERR_DEBUG,"Found open proxy on host %s",IPlongtostr(sp->IP));
} else {
loggline(chp); /* Update log only */
}
}
totalscansfound++;
sendnoticetouser(proxyscannick,np,"fd: %d type: %d port: %d state: %d outcome: %d IP: %s",
- sp->fd,sp->type,sp->port,sp->state,sp->outcome,IPtostr(sp->IP));
+ sp->fd,sp->type,sp->port,sp->state,sp->outcome,IPlongtostr(sp->IP));
}
}
np->host->marker=hostmarker;
- if ((chp=findcachehost(np->ipaddress)))
+ if (!irc_in_addr_is_ipv4(&np->p_ipaddr))
+ continue;
+
+ unsigned int ip2 = irc_in_addr_v4_to_int(&np->p_ipaddr);
+
+ if ((chp=findcachehost(ip2)))
chp->marker=1;
- queuescan(np->ipaddress, type, port, SCLASS_NORMAL, 0);
+ queuescan(ip2, type, port, SCLASS_NORMAL, 0);
}
}
mysql_escape_string(reasonesc,reasonlist,strlen(reasonlist));
sprintf(sqlquery,"INSERT INTO openproxies VALUES(%u,'%s',%d,NOW(),'%s')",chp->glineid,
- IPtostr(chp->IP),reasonmask,reasonesc);
+ IPlongtostr(chp->IP),reasonmask,reasonesc);
mysql_query(&proxyscansql,sqlquery);
} else {
mysql_escape_string(reasonesc,reasonlist,strlen(reasonlist));
int i;
/* Skip 127.* and 0.* hosts */
- if ((np->ipaddress>>24==0) || (np->ipaddress>>24==127))
+ if (irc_in_addr_is_loopback(&np->p_ipaddr) || !irc_in_addr_is_ipv4(&np->p_ipaddr))
return;
+ unsigned int ip = irc_in_addr_v4_to_int(&np->p_ipaddr);
+
/*
* Logic for connecting hosts:
*
* If they're not in the cache, we queue up their scans
*/
- if ((chp=findcachehost(np->ipaddress))) {
+ if ((chp=findcachehost(ip))) {
if (!chp->proxies)
return;
break;
if (!fpp)
- queuescan(np->ipaddress, thescans[i].type, thescans[i].port, SCLASS_NORMAL, 0);
+ queuescan(ip, thescans[i].type, thescans[i].port, SCLASS_NORMAL, 0);
}
}
/* We want these scans to start around now, so we put them at the front of the priority queue */
for (fpp=chp->proxies;fpp;fpp=nfpp) {
nfpp=fpp->next;
- queuescan(np->ipaddress, fpp->type, fpp->port, SCLASS_CHECK, time(NULL));
+ queuescan(ip, fpp->type, fpp->port, SCLASS_CHECK, time(NULL));
freefoundproxy(fpp);
}
/* set a SHORT gline - if they really have an open proxy the gline will be re-set, with a new ID */
irc_send("%s GL * +*@%s 600 :Open Proxy, see http://www.quakenet.org/openproxies.html - ID: %d",
- mynumeric->content,IPtostr(np->ipaddress),chp->glineid);
+ mynumeric->content,IPtostr(np->p_ipaddr),chp->glineid);
chp->lastscan=time(NULL);
chp->proxies=NULL;
chp->glineid=0;
} else {
- chp=addcleanhost(np->ipaddress, time(NULL));
+ chp=addcleanhost(ip, time(NULL));
/* Queue up all the normal scans - on the normal queue */
for (i=0;i<numscans;i++)
- queuescan(np->ipaddress, thescans[i].type, thescans[i].port, SCLASS_NORMAL, 0);
+ queuescan(ip, thescans[i].type, thescans[i].port, SCLASS_NORMAL, 0);
}
}