From: Michael Poole Date: Fri, 6 Mar 2009 12:40:01 +0000 (-0500) Subject: Avoid crashing when a user is killed by an on-auth callback. X-Git-Url: http://git.pk910.de/?p=srvx.git;a=commitdiff_plain;h=86bc398ada76c3a6ba15f3ab00fa381e9e66edfc Avoid crashing when a user is killed by an on-auth callback. src/nickserv.c (set_user_handle_info): Handle no users on the account when updating the linked list of authed users. Do not run the last bit of code when an auth_func kills the user, either. --- diff --git a/src/nickserv.c b/src/nickserv.c index c4fe618..0ba125e 100644 --- a/src/nickserv.c +++ b/src/nickserv.c @@ -917,11 +917,14 @@ set_user_handle_info(struct userNode *user, struct handle_info *hi, int stamp) /* remove from next_authed linked list */ if (user->handle_info->users == user) { user->handle_info->users = user->next_authed; - } else { + } else if (user->handle_info->users != NULL) { for (other = user->handle_info->users; other->next_authed != user; other = other->next_authed) ; other->next_authed = user->next_authed; + } else { + /* No users authed to the account - can happen if they get + * killed for authing. */ } /* if nobody left on old handle, and they're not an oper, remove !god */ if (!user->handle_info->users && !user->handle_info->opserv_level) @@ -935,8 +938,11 @@ set_user_handle_info(struct userNode *user, struct handle_info *hi, int stamp) user->handle_info = hi; if (hi && !hi->users && !hi->opserv_level) HANDLE_CLEAR_FLAG(hi, HELPING); - for (n=0; (ndead; n++) + for (n=0; ndead) + return; + } if (hi) { struct nick_info *ni;