From ae46de7efe28abb4b9c1161eacf31a782e92e23d Mon Sep 17 00:00:00 2001 From: "Kevin L. Mitchell" Date: Wed, 22 Feb 2006 15:18:39 +0000 Subject: [PATCH] Author: Kev Log message: Stomp a crash bug when no iauthd is configured git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/branches/u2_10_12_branch@1623 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 5 +++++ ircd/s_auth.c | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index af92b25..123f366 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-02-22 Kevin L. Mitchell + + * ircd/s_auth.c: fix macros to not dereference a NULL pointer when + iauth is not connected + 2006-02-17 Alex Badea * ircd/s_auth.c (auth_set_username): Check if the last diff --git a/ircd/s_auth.c b/ircd/s_auth.c index 6dd7b2d..4cb8de4 100644 --- a/ircd/s_auth.c +++ b/ircd/s_auth.c @@ -178,13 +178,13 @@ struct IAuth { }; /** Return whether flag \a flag is set on \a iauth. */ -#define IAuthHas(iauth, flag) FlagHas(&iauth->i_flags, flag) +#define IAuthHas(iauth, flag) ((iauth) && FlagHas(&(iauth)->i_flags, flag)) /** Set flag \a flag on \a iauth. */ -#define IAuthSet(iauth, flag) FlagSet(&iauth->i_flags, flag) +#define IAuthSet(iauth, flag) FlagSet(&(iauth)->i_flags, flag) /** Clear flag \a flag from \a iauth. */ -#define IAuthClr(iauth, flag) FlagClr(&iauth->i_flags, flag) +#define IAuthClr(iauth, flag) FlagClr(&(iauth)->i_flags, flag) /** Get connected flag for \a iauth. */ -#define i_GetConnected(iauth) (s_fd(i_socket(iauth)) > -1) +#define i_GetConnected(iauth) ((iauth) && s_fd(i_socket(iauth)) > -1) /** Return socket event generator for \a iauth. */ #define i_socket(iauth) (&(iauth)->i_socket) @@ -193,7 +193,7 @@ struct IAuth { /** Return outbound message queue for \a iauth. */ #define i_sendQ(iauth) (&(iauth)->i_sendQ) /** Return debug level for \a iauth. */ -#define i_debug(iauth) (iauth->i_debug) +#define i_debug(iauth) ((iauth)->i_debug) /** Active instance of IAuth. */ struct IAuth *iauth; -- 2.20.1