diff options
author | Günther Deschner <gdeschner@redhat.com> | 2013-05-30 15:54:33 +0200 |
---|---|---|
committer | Günther Deschner <gdeschner@redhat.com> | 2014-01-14 14:31:56 +0100 |
commit | 0e7a983ae04658f818bcc0332db3f30a58b01aba (patch) | |
tree | 22e10c9e514227e94aefa76aec147505a02c2e7d | |
parent | 8b147c9196d9068d0fc5e5a8919b84e8cbb97ef4 (diff) | |
download | gss-proxy-0e7a983ae04658f818bcc0332db3f30a58b01aba.tar.gz gss-proxy-0e7a983ae04658f818bcc0332db3f30a58b01aba.tar.xz gss-proxy-0e7a983ae04658f818bcc0332db3f30a58b01aba.zip |
Make it easier to enable mechglue plugin debugging.
Instead of recompiling, one can set the "GSSI_DEBUG" environment variable at
runtime.
Signed-off-by: Günther Deschner <gdeschner@redhat.com>
-rw-r--r-- | proxy/conf_macros.m4 | 14 | ||||
-rw-r--r-- | proxy/configure.ac | 1 | ||||
-rw-r--r-- | proxy/src/mechglue/gss_plugin.c | 17 | ||||
-rw-r--r-- | proxy/src/mechglue/gss_plugin.h | 25 |
4 files changed, 31 insertions, 26 deletions
diff --git a/proxy/conf_macros.m4 b/proxy/conf_macros.m4 index a0ecb13..aa443b3 100644 --- a/proxy/conf_macros.m4 +++ b/proxy/conf_macros.m4 @@ -236,20 +236,6 @@ AC_DEFUN([WITH_GPSTATE_PATH], AC_DEFINE_UNQUOTED(GPSTATE_PATH, "$config_gpstatepath", [Where to store ccache files for gssproxy]) ]) -AC_DEFUN([WITH_GSSIDEBUG], - [ AC_ARG_WITH([gssidebug], - [AC_HELP_STRING([--with-gssidebug], - [Whether to build with interposer debugging support [no]] - ) - ], - [], - with_gssidebug=no - ) - if test x"$with_gssidebug" = xyes; then - AC_DEFINE_UNQUOTED(GSSI_DEBUGGING, 1, [Build with interposer debugging support]) - fi - ]) - AC_DEFUN([WITH_GPP_DEFAULT_BEHAVIOR], [ AC_ARG_WITH([gpp_default_behavior], [AC_HELP_STRING([--with-gpp-default-behavior=LOCAL_FIRST|LOCAL_ONLY|REMOTE_FIRST|REMOTE_ONLY], diff --git a/proxy/configure.ac b/proxy/configure.ac index a0cc4ef..7eab772 100644 --- a/proxy/configure.ac +++ b/proxy/configure.ac @@ -65,7 +65,6 @@ WITH_TEST_DIR WITH_MANPAGES WITH_XML_CATALOG WITH_SELINUX -WITH_GSSIDEBUG WITH_GPSTATE_PATH WITH_GPP_DEFAULT_BEHAVIOR diff --git a/proxy/src/mechglue/gss_plugin.c b/proxy/src/mechglue/gss_plugin.c index 372ab2e..ab0f139 100644 --- a/proxy/src/mechglue/gss_plugin.c +++ b/proxy/src/mechglue/gss_plugin.c @@ -605,3 +605,20 @@ bool gpp_is_krb5_oid(const gss_OID mech) } return false; } + +bool gpp_debugging_enabled(void) +{ + static enum gpp_debugging debug = GPP_DEBUG_UNINITIALIZED; + char *envval; + + if (debug == GPP_DEBUG_UNINITIALIZED) { + envval = getenv("GSSI_DEBUG"); + if (envval) { + debug = GPP_DEBUG_ENABLED; + } else { + debug = GPP_DEBUG_DISABLED; + } + } + + return debug; +} diff --git a/proxy/src/mechglue/gss_plugin.h b/proxy/src/mechglue/gss_plugin.h index 739ec26..638ad77 100644 --- a/proxy/src/mechglue/gss_plugin.h +++ b/proxy/src/mechglue/gss_plugin.h @@ -54,26 +54,29 @@ enum gpp_behavior { GPP_REMOTE_ONLY, }; -#ifdef GSSI_DEBUGGING +enum gpp_debugging { + GPP_DEBUG_UNINITIALIZED = 0, + GPP_DEBUG_ENABLED, + GPP_DEBUG_DISABLED +}; #define GSSI_DEBUG(...) \ do { \ - fprintf(stderr, "GSSI %s:%d ", __FUNCTION__, __LINE__); \ - fprintf(stderr, __VA_ARGS__); \ - fflush(stderr); \ + if (gpp_debugging_enabled() == GPP_DEBUG_ENABLED) { \ + fprintf(stderr, "GSSI %s:%d ", __FUNCTION__, __LINE__); \ + fprintf(stderr, __VA_ARGS__); \ + fflush(stderr); \ + } \ } while(0); #define GSSI_TRACE(...) \ do { \ - fprintf(stderr, "GSSI %s:%d called\n", __FUNCTION__, __LINE__); \ - fflush(stderr); \ + if (gpp_debugging_enabled() == GPP_DEBUG_ENABLED) { \ + fprintf(stderr, "GSSI %s:%d called\n", __FUNCTION__, __LINE__); \ + fflush(stderr); \ + } \ } while(0); -#else -#define GSSI_DEBUG(...) -#define GSSI_TRACE(...) -#endif /* GSSI_DEBUGGING */ - gss_OID_set gss_mech_interposer(gss_OID mech_type); enum gpp_behavior gpp_get_behavior(void); bool gpp_is_special_oid(const gss_OID mech_type); |