Author: Kev <klmitch@mit.edu>
authorKevin L. Mitchell <klmitch@mit.edu>
Wed, 22 Feb 2006 15:18:39 +0000 (15:18 +0000)
committerKevin L. Mitchell <klmitch@mit.edu>
Wed, 22 Feb 2006 15:18:39 +0000 (15:18 +0000)
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
ircd/s_auth.c

index af92b251d8478f98a54098a1f0ddb43c2df2e707..123f3668b52df47f3ba6b64b5a3686a5644f8591 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-02-22  Kevin L. Mitchell  <klmitch@mit.edu>
+
+       * ircd/s_auth.c: fix macros to not dereference a NULL pointer when
+       iauth is not connected
+
 2006-02-17  Alex Badea <vamposdecampos@gmail.com>
 
        * ircd/s_auth.c (auth_set_username): Check if the last
index 6dd7b2d709a9abd725f8bc9198262eff90ef9115..4cb8de4cd520c59ff5e6d70ba2eca1d58f77f7dc 100644 (file)
@@ -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;