blacklist: Remove the sscanf() for the IPv4 blacklist check.
From ratbox r27061 (androsyn).
This commit is contained in:
parent
b0e752b0f9
commit
b67bc679f3
|
@ -117,7 +117,7 @@ static void initiate_blacklist_dnsquery(struct Blacklist *blptr, struct Client *
|
||||||
{
|
{
|
||||||
struct BlacklistClient *blcptr = rb_malloc(sizeof(struct BlacklistClient));
|
struct BlacklistClient *blcptr = rb_malloc(sizeof(struct BlacklistClient));
|
||||||
char buf[IRCD_RES_HOSTLEN + 1];
|
char buf[IRCD_RES_HOSTLEN + 1];
|
||||||
int ip[4];
|
uint8_t *ip;
|
||||||
|
|
||||||
blcptr->blacklist = blptr;
|
blcptr->blacklist = blptr;
|
||||||
blcptr->client_p = client_p;
|
blcptr->client_p = client_p;
|
||||||
|
@ -125,11 +125,15 @@ static void initiate_blacklist_dnsquery(struct Blacklist *blptr, struct Client *
|
||||||
blcptr->dns_query.ptr = blcptr;
|
blcptr->dns_query.ptr = blcptr;
|
||||||
blcptr->dns_query.callback = blacklist_dns_callback;
|
blcptr->dns_query.callback = blacklist_dns_callback;
|
||||||
|
|
||||||
/* XXX: yes I know this is bad, I don't really care right now */
|
ip = (uint8_t *)&((struct sockaddr_in *)&client_p->localClient->ip)->sin_addr.s_addr;
|
||||||
sscanf(client_p->sockhost, "%d.%d.%d.%d", &ip[3], &ip[2], &ip[1], &ip[0]);
|
|
||||||
|
|
||||||
/* becomes 2.0.0.127.torbl.ahbl.org or whatever */
|
/* becomes 2.0.0.127.torbl.ahbl.org or whatever */
|
||||||
rb_snprintf(buf, sizeof buf, "%d.%d.%d.%d.%s", ip[0], ip[1], ip[2], ip[3], blptr->host);
|
rb_snprintf(buf, sizeof buf, "%d.%d.%d.%d.%s",
|
||||||
|
(unsigned int) ip[3],
|
||||||
|
(unsigned int) ip[2],
|
||||||
|
(unsigned int) ip[1],
|
||||||
|
(unsigned int) ip[0],
|
||||||
|
blptr->host);
|
||||||
|
|
||||||
gethost_byname_type(buf, &blcptr->dns_query, T_A);
|
gethost_byname_type(buf, &blcptr->dns_query, T_A);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue