From 8e1c8b75436d82a9e2a71d765c816fdbf9eb22fc Mon Sep 17 00:00:00 2001 From: Sam Dodrill Date: Thu, 7 Nov 2013 11:35:46 -0800 Subject: [PATCH] src/channel: Fix for autojoin_opers segfault --- src/channel.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/channel.c b/src/channel.c index 89e433b..a7ee7ca 100644 --- a/src/channel.c +++ b/src/channel.c @@ -2013,10 +2013,21 @@ void user_join(struct Client * client_p, struct Client * source_p, const char * source_p->tsinfo, source_p->info); /* Send away message to away-notify enabled clients. */ - if (client_p->user->away) - sendto_channel_local_with_capability_butone(client_p, ALL_MEMBERS, CLICAP_AWAY_NOTIFY, NOCAPS, chptr, - ":%s!%s@%s AWAY :%s", client_p->name, client_p->username, - client_p->host, client_p->user->away); + + /* + * The following test fixes autojoin_opers in an auth block joining + * clients to channels from segfaulting the irc daemon. + * - Niichan + */ + if (client_p->user != NULL) + { + if (client_p->user->away) + { + sendto_channel_local_with_capability_butone(client_p, ALL_MEMBERS, CLICAP_AWAY_NOTIFY, NOCAPS, chptr, + ":%s!%s@%s AWAY :%s", client_p->name, client_p->username, + client_p->host, client_p->user->away); + } + } /* its a new channel, set +nt and burst. */ if(flags & CHFL_CHANOP)