diff --git a/src/dbuf.c b/src/dbuf.c index 6a237d780..2024dc59f 100644 --- a/src/dbuf.c +++ b/src/dbuf.c @@ -207,7 +207,7 @@ int dbuf_get(dbuf *dyn, char **buf) /* First calculate the room needed... */ list_for_each_entry2(block, dbufbuf, &dyn->dbuf_list, dbuf_node) - bytes += block->size; + bytes += block->size; d = *buf = safe_alloc(bytes + 1); diff --git a/src/hash.c b/src/hash.c index 4b0243387..39ad7fd92 100644 --- a/src/hash.c +++ b/src/hash.c @@ -640,7 +640,7 @@ EVENT(update_known_user_cache_timer) do { list_for_each_entry(client, &idTable[slot], id_hash) - update_known_user_cache(client); + update_known_user_cache(client); if (++slot >= NICK_HASH_TABLE_SIZE) slot = 0; diff --git a/src/log.c b/src/log.c index 745ddf643..b978a9220 100644 --- a/src/log.c +++ b/src/log.c @@ -1566,8 +1566,10 @@ void do_unreal_log_control(LogLevel loglevel, const char *subsystem, const char if (!strcmp(subsystem, "rawtraffic")) return; - list_for_each_entry(client, &control_list, lclient_node) if (IsMonitorRehash(client) && IsControl(client)) for (m = msg; m; m = m->next) - sendto_one(client, NULL, "REPLY [%s] %s", log_level_valtostring(loglevel), m->line); + list_for_each_entry(client, &control_list, lclient_node) + if (IsMonitorRehash(client) && IsControl(client)) + for (m = msg; m; m = m->next) + sendto_one(client, NULL, "REPLY [%s] %s", log_level_valtostring(loglevel), m->line); if (json_rehash_log) { diff --git a/src/misc.c b/src/misc.c index c639602dc..4c2cd82ae 100644 --- a/src/misc.c +++ b/src/misc.c @@ -2649,7 +2649,8 @@ void s_die() loop.terminating = 1; unload_all_modules(); - list_for_each_entry(client, &lclient_list, lclient_node)(void) send_queued(client); + list_for_each_entry(client, &lclient_list, lclient_node) + (void)send_queued(client); exit(-1); } else @@ -2732,7 +2733,8 @@ void server_reboot(const char *mesg) "Restarting server: $reason", log_data_string("reason", mesg)); - list_for_each_entry(client, &lclient_list, lclient_node)(void) send_queued(client); + list_for_each_entry(client, &lclient_list, lclient_node) + (void)send_queued(client); /* * ** fd 0 must be 'preserved' if either the -d or -i options have diff --git a/src/modules/connthrottle.c b/src/modules/connthrottle.c index b044f6214..32f718a7c 100644 --- a/src/modules/connthrottle.c +++ b/src/modules/connthrottle.c @@ -916,9 +916,9 @@ EVENT(ct_check) b->check_known = b->check_excepted = b->check_unknown = 0; list_for_each_entry(client, &client_list, client_node) - ct_check_walk_one(client); + ct_check_walk_one(client); list_for_each_entry(client, &unknown_list, lclient_node) - ct_check_walk_one(client); + ct_check_walk_one(client); for (tier = 0; tier < CT_NUM_TIERS; tier++) { diff --git a/src/modules/isupport.c b/src/modules/isupport.c index c8944ca0b..f67365c94 100644 --- a/src/modules/isupport.c +++ b/src/modules/isupport.c @@ -145,8 +145,9 @@ void isupport_check_for_changes_one(const char *addstr, char *buf, size_t buflen if (*changes == 0) { /* First change, need to start the batch */ - list_for_each_entry(acptr, &lclient_list, lclient_node) if (HasCapability(acptr, "draft/extended-isupport") && HasCapability(acptr, "batch")) - sendto_one(acptr, NULL, ":%s BATCH +%s draft/isupport", me.name, batch); + list_for_each_entry(acptr, &lclient_list, lclient_node) + if (HasCapability(acptr, "draft/extended-isupport") && HasCapability(acptr, "batch")) + sendto_one(acptr, NULL, ":%s BATCH +%s draft/isupport", me.name, batch); } *changes = *changes + 1; @@ -221,8 +222,9 @@ void _isupport_check_for_changes(void) if (changes) { /* End the batch (for those clients who received a batch, that is) */ - list_for_each_entry(acptr, &lclient_list, lclient_node) if (HasCapability(acptr, "draft/extended-isupport") && HasCapability(acptr, "batch")) - sendto_one(acptr, NULL, ":%s BATCH -%s", me.name, batch); + list_for_each_entry(acptr, &lclient_list, lclient_node) + if (HasCapability(acptr, "draft/extended-isupport") && HasCapability(acptr, "batch")) + sendto_one(acptr, NULL, ":%s BATCH -%s", me.name, batch); } safe_free_message_tags(mtags); diff --git a/src/modules/quit.c b/src/modules/quit.c index 5563f8cc3..2d1db6e20 100644 --- a/src/modules/quit.c +++ b/src/modules/quit.c @@ -331,8 +331,9 @@ void _exit_client_ex(Client *client, Client *origin, MessageTag *recv_mtags, con remove_dependents(client, origin, recv_mtags, comment, splitstr); /* Special case for remote async RPC, server.rehash in particular.. */ - list_for_each_entry_safe(acptr, next, &rpc_remote_list, client_node) if (!strncmp(client->id, acptr->id, SIDLEN)) - free_client(acptr); + list_for_each_entry_safe(acptr, next, &rpc_remote_list, client_node) + if (!strncmp(client->id, acptr->id, SIDLEN)) + free_client(acptr); RunHook(HOOKTYPE_SERVER_QUIT, client, recv_mtags); } else if (IsUser(client) && !IsKilled(client)) diff --git a/src/modules/stats.c b/src/modules/stats.c index e406f735a..e7a96eb4d 100644 --- a/src/modules/stats.c +++ b/src/modules/stats.c @@ -422,18 +422,19 @@ int stats_links(Client *client, const char *para) link_p->leaf, link_p->servername, link_p->leaf_depth); } #ifdef DEBUGMODE - list_for_each_entry(acptr, &client_list, client_node) if (MyConnect(acptr) && acptr->server && !IsMe(acptr)) - { - if (!acptr->server->conf) - sendnotice(client, "client '%s' (%p) has NO CONF attached (? :P)", - acptr->name, acptr); - else - sendnotice(client, "client '%s' (%p) has conf %p attached, refcount: %d, temporary: %s", - acptr->name, acptr, - acptr->server->conf, - acptr->server->conf->refcount, - acptr->server->conf->flag.temporary ? "YES" : "NO"); - } + list_for_each_entry(acptr, &client_list, client_node) + if (MyConnect(acptr) && acptr->server && !IsMe(acptr)) + { + if (!acptr->server->conf) + sendnotice(client, "client '%s' (%p) has NO CONF attached (? :P)", + acptr->name, acptr); + else + sendnotice(client, "client '%s' (%p) has conf %p attached, refcount: %d, temporary: %s", + acptr->name, acptr, + acptr->server->conf, + acptr->server->conf->refcount, + acptr->server->conf->flag.temporary ? "YES" : "NO"); + } #endif return 0; } diff --git a/src/modules/tkl.c b/src/modules/tkl.c index 6e517a1bd..dd5b777ed 100644 --- a/src/modules/tkl.c +++ b/src/modules/tkl.c @@ -3784,50 +3784,51 @@ void _tkl_check_local_remove_shun(TKL *tmp) for (i = 0; i <= 5; i++) { - list_for_each_entry(client, &lclient_list, lclient_node) if (MyUser(client) && IsShunned(client)) - { - chost = client->local->sockhost; - cname = client->user->username; - - cip = GetIP(client); - - if ((*tmp->ptr.serverban->hostmask >= '0') && (*tmp->ptr.serverban->hostmask <= '9')) - is_ip = 1; - else - is_ip = 0; - - if (is_ip == 0 - ? (match_simple(tmp->ptr.serverban->hostmask, chost) && match_simple(tmp->ptr.serverban->usermask, cname)) - : (match_simple(tmp->ptr.serverban->hostmask, chost) || match_simple(tmp->ptr.serverban->hostmask, cip)) && - match_simple(tmp->ptr.serverban->usermask, cname)) + list_for_each_entry(client, &lclient_list, lclient_node) + if (MyUser(client) && IsShunned(client)) { - /* + chost = client->local->sockhost; + cname = client->user->username; + + cip = GetIP(client); + + if ((*tmp->ptr.serverban->hostmask >= '0') && (*tmp->ptr.serverban->hostmask <= '9')) + is_ip = 1; + else + is_ip = 0; + + if (is_ip == 0 + ? (match_simple(tmp->ptr.serverban->hostmask, chost) && match_simple(tmp->ptr.serverban->usermask, cname)) + : (match_simple(tmp->ptr.serverban->hostmask, chost) || match_simple(tmp->ptr.serverban->hostmask, cip)) && + match_simple(tmp->ptr.serverban->usermask, cname)) + { + /* before blindly marking this user as un-shunned, we need to check if the user is under any other existing shuns. (#0003906) Unfortunately, this requires crazy amounts of indentation ;-). This enumeration code is based off of _tkl_stats() */ - keep_shun = 0; - for (tk = tklines[tkl_hash('s')]; tk && !keep_shun; tk = tk->next) - if (tk != tmp && match_simple(tk->ptr.serverban->usermask, cname)) - { - if ((*tk->ptr.serverban->hostmask >= '0') && (*tk->ptr.serverban->hostmask <= '9') - /* the hostmask is an IP */ - && (match_simple(tk->ptr.serverban->hostmask, chost) || match_simple(tk->ptr.serverban->hostmask, cip))) - keep_shun = 1; - else - /* the hostmask is not an IP */ - if (match_simple(tk->ptr.serverban->hostmask, chost) && match_simple(tk->ptr.serverban->usermask, cname)) + keep_shun = 0; + for (tk = tklines[tkl_hash('s')]; tk && !keep_shun; tk = tk->next) + if (tk != tmp && match_simple(tk->ptr.serverban->usermask, cname)) + { + if ((*tk->ptr.serverban->hostmask >= '0') && (*tk->ptr.serverban->hostmask <= '9') + /* the hostmask is an IP */ + && (match_simple(tk->ptr.serverban->hostmask, chost) || match_simple(tk->ptr.serverban->hostmask, cip))) keep_shun = 1; - } + else + /* the hostmask is not an IP */ + if (match_simple(tk->ptr.serverban->hostmask, chost) && match_simple(tk->ptr.serverban->usermask, cname)) + keep_shun = 1; + } - if (!keep_shun) - { - ClearShunned(client); + if (!keep_shun) + { + ClearShunned(client); + } } } - } } } diff --git a/src/modules/whowasdb.c b/src/modules/whowasdb.c index b64984fed..d1b0ebcb2 100644 --- a/src/modules/whowasdb.c +++ b/src/modules/whowasdb.c @@ -285,8 +285,9 @@ int count_whowas_and_user_entries(void) cnt++; } - list_for_each_entry(client, &client_list, client_node) if (IsUser(client)) - cnt++; + list_for_each_entry(client, &client_list, client_node) + if (IsUser(client)) + cnt++; return cnt; } diff --git a/src/modules/whox.c b/src/modules/whox.c index d0939c6af..3221d6cde 100644 --- a/src/modules/whox.c +++ b/src/modules/whox.c @@ -630,7 +630,7 @@ static void who_global(Client *client, char *mask, int operspy, struct who_forma /* Initialize the markers to zero */ list_for_each_entry(acptr, &client_list, client_node) - ClearMark(acptr); + ClearMark(acptr); /* First, if not operspy, then list all matching clients on common channels */ if (!operspy) diff --git a/src/send.c b/src/send.c index 3dcb74175..ef65b0c93 100644 --- a/src/send.c +++ b/src/send.c @@ -881,15 +881,16 @@ void sendto_umode(int umodes, FORMAT_STRING(const char *pattern), ...) Client *acptr; char nbuf[1024]; - list_for_each_entry(acptr, &lclient_list, lclient_node) if (IsUser(acptr) && (acptr->umodes & umodes) == umodes) - { - ircsnprintf(nbuf, sizeof(nbuf), ":%s NOTICE %s :", me.name, acptr->name); - strlcat(nbuf, pattern, sizeof nbuf); + list_for_each_entry(acptr, &lclient_list, lclient_node) + if (IsUser(acptr) && (acptr->umodes & umodes) == umodes) + { + ircsnprintf(nbuf, sizeof(nbuf), ":%s NOTICE %s :", me.name, acptr->name); + strlcat(nbuf, pattern, sizeof nbuf); - va_start(vl, pattern); - vsendto_one(acptr, NULL, nbuf, vl); - va_end(vl); - } + va_start(vl, pattern); + vsendto_one(acptr, NULL, nbuf, vl); + va_end(vl); + } } /** Send a message to all users with specified user mode (local & remote users).