struct in_addr in;
unsigned char a, b, c, d;
char lookup[128];
- node_t *p;
+ node_t *node;
int res;
struct dnsbl_scan *ds;
b = (unsigned char)(in.s_addr >> 8) & 0xFF;
a = (unsigned char) in.s_addr & 0xFF;
- LIST_FOREACH(p, OpmItem->blacklists->head)
+ LIST_FOREACH(node, OpmItem->blacklists->head)
{
- struct BlacklistConf *bl = p->data;
+ struct BlacklistConf *bl = node->data;
#ifdef WORDS_BIGENDIAN
snprintf(lookup, sizeof(lookup), "%d.%d.%d.%d.%s", a, b, c, d, bl->name);
dnsbl_positive(struct scan_struct *ss, struct BlacklistConf *bl, unsigned char type)
{
char text_type[128] = "";
- node_t *p;
+ node_t *node;
if (bl->type == A_BITMASK)
{
- LIST_FOREACH(p, bl->reply->head)
+ LIST_FOREACH(node, bl->reply->head)
{
- const struct BlacklistReplyConf *item = p->data;
+ const struct BlacklistReplyConf *item = node->data;
if (item->number & type)
{
}
else
{
- LIST_FOREACH(p, bl->reply->head)
+ LIST_FOREACH(node, bl->reply->head)
{
- const struct BlacklistReplyConf *item = p->data;
+ const struct BlacklistReplyConf *item = node->data;
if (item->number == type)
{
void
firedns_cycle(void)
{
- node_t *node, *next;
+ node_t *node, *node_next;
struct s_connection *p;
struct firedns_result *res, new_result;
static struct pollfd *ufds = NULL;
time(&timenow);
size = 0;
- LIST_FOREACH_SAFE(node, next, CONNECTIONS->head)
+ LIST_FOREACH_SAFE(node, node_next, CONNECTIONS->head)
{
if (size >= OptionsItem->dns_fdlimit)
break;
* Certain variables we don't want to allocate memory for over and over
* again so global scope is given.
*/
+static char IRC_RAW[MSGLENMAX]; /* Buffer to read data into */
+static unsigned int IRC_RAW_LEN; /* Position of IRC_RAW */
+static int IRC_FD; /* File descriptor for IRC client */
-static char IRC_RAW[MSGLENMAX]; /* Buffer to read data into */
-static unsigned int IRC_RAW_LEN = 0; /* Position of IRC_RAW */
-static int IRC_FD = 0; /* File descriptor for IRC client */
-
-static struct sockaddr_storage IRC_SVR; /* Sock Address Struct for IRC server */
-
-static time_t IRC_LAST = 0; /* Last full line of data from irc server*/
-static time_t IRC_LASTRECONNECT = 0; /* Time of last reconnection */
+static struct sockaddr_storage IRC_SVR; /* Sock Address Struct for IRC server */
+static time_t IRC_LAST; /* Last full line of data from irc server */
+static time_t IRC_LASTRECONNECT; /* Time of last reconnection */
/*
* Table should be ordered with most occuring (or priority)
if (IRC_FD <= 0)
{
/* Initialise negative cache. */
- if (OptionsItem->negcache > 0)
+ if (OptionsItem->negcache)
nc_init(&nc_head);
/* Resolve remote host. */
char *username = NULL;
char *hostname = NULL;
char tmp[MSGLENMAX];
- size_t i, len;
+ size_t len;
len = strlcpy(tmp, source, sizeof(tmp));
nick = tmp;
- for (i = 0; i < len; ++i)
+ for (size_t i = 0; i < len; ++i)
{
if (tmp[i] == '!')
{
time_t now;
struct cnode *n;
- if (OptionsItem->negcache <= 0)
+ if (OptionsItem->negcache == 0)
return(NULL);
n = nc_search(nc_head, ip);
command_timer(void)
{
static unsigned int interval;
- node_t *node, *next;
+ node_t *node, *node_next;
time_t present;
/* Only perform command removal every COMMANDINTERVAL seconds */
time(&present);
- LIST_FOREACH_SAFE(node, next, COMMANDS->head)
+ LIST_FOREACH_SAFE(node, node_next, COMMANDS->head)
{
struct Command *cs = node->data;
list_remove(COMMANDS, node);
node_free(node);
}
- else /* Since the queue is in order, it's also ordered by time, no nodes after this will be timed out */
+ else /* Since the queue is in order, it's also ordered by time, no nodes after this will be timed out */
return;
}
}
ret->irc_nick = xstrdup(irc_nick);
ret->target = target; /* FIXME: This needs fixed if rehash is implemented */
- time(&(ret->added));
+ time(&ret->added);
return ret;
}
void
command_userhost(const char *reply)
{
- node_t *node, *next;
+ node_t *node, *node_next;
char *tmp;
int oper = 0;
*(tmp) = '\0';
/* Find any queued commands that match this user */
- LIST_FOREACH_SAFE(node, next, COMMANDS->head)
+ LIST_FOREACH_SAFE(node, node_next, COMMANDS->head)
{
struct Command *cs = node->data;
void
scan_cycle(void)
{
- node_t *p;
+ node_t *node;
/* Cycle through the blacklist first.. */
dnsbl_cycle();
/* Cycle each scanner object */
- LIST_FOREACH(p, SCANNERS->head)
+ LIST_FOREACH(node, SCANNERS->head)
{
- struct scanner_struct *scs = p->data;
+ struct scanner_struct *scs = node->data;
opm_cycle(scs->scanner);
}
}
{
static time_t nc_counter;
- if (OptionsItem->negcache > 0)
+ if (OptionsItem->negcache)
{
if (nc_counter++ >= OptionsItem->negcache_rebuild)
{
}
/* Initialise negative cache */
- if (OptionsItem->negcache > 0)
+ if (OptionsItem->negcache)
{
if (OPT_DEBUG >= 2)
log_printf("SCAN -> Initializing negative cache");
char ipmask[MSGLENMAX];
/* Check negcache before anything */
- if (OptionsItem->negcache > 0)
+ if (OptionsItem->negcache)
{
if (inet_pton(AF_INET, user[3], &ip.sin_addr) <= 0)
{
scan_negative(const struct scan_struct *ss)
{
/* Insert IP in negcache */
- if (OptionsItem->negcache > 0)
+ if (OptionsItem->negcache)
{
if (OPT_DEBUG >= 2)
log_printf("SCAN -> Adding %s to negative cache", ss->ip);
struct scanner_struct *scs;
const char *ip = NULL;
char *scannername;
- node_t *p;
+ node_t *node;
int ret;
/* If there were no parameters sent, simply alert the user and return */
dnsbl_add(ss);
/* Add ss->remote to all scanners */
- LIST_FOREACH(p, SCANNERS->head)
+ LIST_FOREACH(node, SCANNERS->head)
{
- scs = p->data;
+ scs = node->data;
/*
* If we have a scannername, only allow that scanner