The callers of clones_add and clone_remove were directly accessing the client's IP address. Move this checking into the two functions, to make it easier to change later. --- src/clones.c | 6 ++++++ src/s_misc.c | 6 ++---- src/s_user.c | 6 ++---- 3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/clones.c b/src/clones.c index 1c63914..f4d6fc2 100644 --- a/src/clones.c +++ b/src/clones.c @@ -274,6 +274,9 @@ clones_add(aClient *cptr) CloneEnt *ceip; CloneEnt *ce24;
+ if (cptr->ip.s_addr == 0) + return; + get_clones(cptr, &ceip, &ce24, 1);
cptr->clone.prev = NULL; @@ -301,6 +304,9 @@ clones_remove(aClient *cptr) CloneEnt *ceip; CloneEnt *ce24;
+ if (cptr->ip.s_addr == 0) + return; + get_clones(cptr, &ceip, &ce24, 0);
if (cptr->clone.next) diff --git a/src/s_misc.c b/src/s_misc.c index 39108c5..4114fd5 100644 --- a/src/s_misc.c +++ b/src/s_misc.c @@ -363,8 +363,7 @@ exit_one_client_in_split(aClient *cptr, aClient *dead, char *reason) if (cptr->user->alias) cptr->user->alias->client = NULL;
- if (cptr->ip.s_addr) - clones_remove(cptr); + clones_remove(cptr);
#ifdef RWHO_PROBABILITY probability_remove(cptr); @@ -763,8 +762,7 @@ exit_one_client(aClient *cptr, aClient *sptr, aClient *from, char *comment) while ((lp = sptr->user->channel)) remove_user_from_channel(sptr, lp->value.chptr);
- if (sptr->ip.s_addr) - clones_remove(sptr); + clones_remove(sptr);
#ifdef RWHO_PROBABILITY probability_remove(sptr); diff --git a/src/s_user.c b/src/s_user.c index c9d89d0..3d3cf34 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -1003,16 +1003,14 @@ register_user(aClient *cptr, aClient *sptr, char *nick, char *username) }
/* do this late because of oper masking */ - if (sptr->ip.s_addr) - clones_add(sptr); + clones_add(sptr); } else if (IsServer(cptr)) { aClient *acptr;
/* do this early because exit_client() calls clones_remove() */ - if (sptr->ip.s_addr) - clones_add(sptr); + clones_add(sptr);
if ((acptr = find_server(user->server, NULL)) && acptr->from != sptr->from)