diff options
author | Günther Deschner <gdeschner@redhat.com> | 2013-05-30 15:54:33 +0200 |
---|---|---|
committer | Günther Deschner <gdeschner@redhat.com> | 2013-06-06 16:52:10 +0200 |
commit | ef891ef33eac43d8f91e4c3b167afd72aba613a7 (patch) | |
tree | 3f799dc48bf74620396b9fb856ee51f9c82bcda5 | |
parent | b52f868b7fce0828409b55790c21bbf8ed228641 (diff) | |
download | gss-proxy-ef891ef33eac43d8f91e4c3b167afd72aba613a7.tar.gz gss-proxy-ef891ef33eac43d8f91e4c3b167afd72aba613a7.tar.xz gss-proxy-ef891ef33eac43d8f91e4c3b167afd72aba613a7.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 a04f694..40288dd 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 f3269e3..8a31f3f 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 0e62990..db4896d 100644 --- a/proxy/src/mechglue/gss_plugin.c +++ b/proxy/src/mechglue/gss_plugin.c @@ -576,3 +576,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 26e04c5..f0a2811 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); |