X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/90a3c35b295b07ebe3793bf5d3b882c3c1a5dc7c..6b2cf989b6f77ca06d6d46efa3b26c0ea22d76e4:/src/blacklist.c diff --git a/src/blacklist.c b/src/blacklist.c index 7645545..fc355a8 100644 --- a/src/blacklist.c +++ b/src/blacklist.c @@ -78,16 +78,16 @@ static void blacklist_dns_callback(void *vptr, struct DNSReply *reply) if (reply != NULL) { - /* only accept 127.0.0.x as a listing */ + /* only accept 127.x.y.z as a listing */ if (reply->addr.ss_family == AF_INET && - !memcmp(&((struct sockaddr_in *)&reply->addr)->sin_addr, "\177\0\0", 3)) + !memcmp(&((struct sockaddr_in *)&reply->addr)->sin_addr, "\177", 1)) listed = TRUE; - else if (blcptr->blacklist->lastwarning + 3600 < CurrentTime) + else if (blcptr->blacklist->lastwarning + 3600 < rb_current_time()) { sendto_realops_snomask(SNO_GENERAL, L_ALL, "Garbage reply from blacklist %s", blcptr->blacklist->host); - blcptr->blacklist->lastwarning = CurrentTime; + blcptr->blacklist->lastwarning = rb_current_time(); } } @@ -106,7 +106,7 @@ static void blacklist_dns_callback(void *vptr, struct DNSReply *reply) if (rb_dlink_list_length(&blcptr->client_p->preClient->dnsbl_queries) == 0 && blcptr->client_p->flags & FLAGS_SENTUSER && !EmptyString(blcptr->client_p->name)) { char buf[USERLEN + 1]; - strlcpy(buf, blcptr->client_p->username, sizeof buf); + rb_strlcpy(buf, blcptr->client_p->username, sizeof buf); register_local_user(blcptr->client_p, blcptr->client_p, buf); } @@ -116,8 +116,8 @@ static void blacklist_dns_callback(void *vptr, struct DNSReply *reply) /* XXX: no IPv6 implementation, not to concerned right now though. */ static void initiate_blacklist_dnsquery(struct Blacklist *blptr, struct Client *client_p) { - struct BlacklistClient *blcptr = MyMalloc(sizeof(struct BlacklistClient)); - char buf[IRCD_BUFSIZE]; + struct BlacklistClient *blcptr = rb_malloc(sizeof(struct BlacklistClient)); + char buf[IRCD_RES_HOSTLEN + 1]; int ip[4]; blcptr->blacklist = blptr; @@ -130,7 +130,7 @@ static void initiate_blacklist_dnsquery(struct Blacklist *blptr, struct Client * 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 */ - rb_snprintf(buf, IRCD_BUFSIZE, "%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", ip[0], ip[1], ip[2], ip[3], blptr->host); gethost_byname_type(buf, &blcptr->dns_query, T_A); @@ -149,13 +149,13 @@ struct Blacklist *new_blacklist(char *name, char *reject_reason) blptr = find_blacklist(name); if (blptr == NULL) { - blptr = MyMalloc(sizeof(struct Blacklist)); + blptr = rb_malloc(sizeof(struct Blacklist)); rb_dlinkAddAlloc(blptr, &blacklist_list); } else blptr->status &= ~CONF_ILLEGAL; - strlcpy(blptr->host, name, HOSTLEN); - strlcpy(blptr->reject_reason, reject_reason, IRCD_BUFSIZE); + rb_strlcpy(blptr->host, name, IRCD_RES_HOSTLEN + 1); + rb_strlcpy(blptr->reject_reason, reject_reason, IRCD_BUFSIZE); blptr->lastwarning = 0; return blptr;