]> granicus.if.org Git - libtirpc/commitdiff
Fix debugging reference from non-GSS to optional GSS code.
authorNick Alcock <nick.alcock@oracle.com>
Thu, 26 Apr 2012 19:12:08 +0000 (15:12 -0400)
committerSteve Dickson <steved@redhat.com>
Thu, 26 Apr 2012 19:54:02 +0000 (15:54 -0400)
From: Nick Alcock <nick.alcock@oracle.com>

AUTH_DESTROY() and auth_destroy() are pulling in log_debug() from
authgss_prot.c, but are used from outside the GSS code, thus preventing
libtirpc
from being used if compiled without GSS support.

The (somewhat ugly) fix here defines a new macro to do the job. Because
we're
not compiling as C99, I use the GNU C variadic macro extension: if we
mean to
be compiled with other compilers, this needs to change.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
tirpc/rpc/auth.h

index 5f66e67d328e10af280e14a05dcf61bc5bc687c4..e7bbe36273c881edce7b72da3e7ba2cf5ced039c 100644 (file)
@@ -51,6 +51,7 @@
 #include <sys/cdefs.h>
 #include <sys/socket.h>
 #include <sys/types.h>
+#include <stdio.h>
 
 
 #define MAX_AUTH_BYTES 400
@@ -248,12 +249,18 @@ auth_put(AUTH *auth)
 #define auth_refresh(auth, msg)                \
                ((*((auth)->ah_ops->ah_refresh))(auth, msg))
 
+#if defined(__GNUC__) && defined(DEBUG)
+#define auth_log_debug(fmt,args...) printf(stderr, fmt, args)
+#else
+#define auth_log_debug(fmt,args...)
+#endif
+
 #define AUTH_DESTROY(auth)                                             \
                do {                                                    \
                        int refs;                                       \
                        if ((refs = auth_put((auth))) == 0)             \
                                ((*((auth)->ah_ops->ah_destroy))(auth));\
-                       log_debug("%s: auth_put(), refs %d\n",          \
+                       auth_log_debug("%s: auth_put(), refs %d\n",     \
                                __func__, refs);                        \
                } while (0)
 
@@ -262,7 +269,7 @@ auth_put(AUTH *auth)
                        int refs;                                       \
                        if ((refs = auth_put((auth))) == 0)             \
                                ((*((auth)->ah_ops->ah_destroy))(auth));\
-                       log_debug("%s: auth_put(), refs %d\n",          \
+                       auth_log_debug("%s: auth_put(), refs %d\n",     \
                                __func__, refs);                        \
                } while (0)