diff options
author | Simo Sorce <simo@redhat.com> | 2012-08-01 16:44:52 -0400 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2012-10-25 15:52:03 -0400 |
commit | deab6159a27b10818532ac2a8386352ad167bf52 (patch) | |
tree | 729c53d82e324072ec43ed6d469c1c0106cbaad4 /proxy/src | |
parent | d7033ead5fc0b7b72a14348ce25401a9ec9098d4 (diff) | |
download | gss-proxy-deab6159a27b10818532ac2a8386352ad167bf52.tar.gz gss-proxy-deab6159a27b10818532ac2a8386352ad167bf52.tar.xz gss-proxy-deab6159a27b10818532ac2a8386352ad167bf52.zip |
Add mechanism to select behavior based on envvar
Diffstat (limited to 'proxy/src')
-rw-r--r-- | proxy/src/mechglue/gss_plugin.c | 29 | ||||
-rw-r--r-- | proxy/src/mechglue/gss_plugin.h | 9 |
2 files changed, 38 insertions, 0 deletions
diff --git a/proxy/src/mechglue/gss_plugin.c b/proxy/src/mechglue/gss_plugin.c index 8a90da3..f574929 100644 --- a/proxy/src/mechglue/gss_plugin.c +++ b/proxy/src/mechglue/gss_plugin.c @@ -56,6 +56,35 @@ const gss_OID_desc gpoid_iakerb = { .elements = IAKERB_OID }; +enum gpp_behavior gpp_get_behavior(void) +{ + static enum gpp_behavior behavior = GPP_UNINITIALIZED; + char *envval; + + if (behavior == GPP_UNINITIALIZED) { + envval = getenv("GSSPROXY_BEHAVIOR"); + if (envval) { + if (strcmp(envval, "LOCAL_ONLY") == 0) { + behavior = GPP_LOCAL_ONLY; + } else if (strcmp(envval, "LOCAL_FIRST") == 0) { + behavior = GPP_LOCAL_FIRST; + } else if (strcmp(envval, "REMOTE_FIRST") == 0) { + behavior = GPP_REMOTE_FIRST; + } else if (strcmp(envval, "REMOTE_ONLY") == 0) { + behavior = GPP_REMOTE_ONLY; + } else { + /* unknwon setting, default to local first */ + behavior = GPP_LOCAL_FIRST; + } + } else { + /* default to local only for now */ + behavior = GPP_LOCAL_FIRST; + } + } + + return behavior; +} + /* 2.16.840.1.113730.3.8.15.1 */ const gss_OID_desc gssproxy_mech_interposer = { .length = 11, diff --git a/proxy/src/mechglue/gss_plugin.h b/proxy/src/mechglue/gss_plugin.h index 2b24e74..f472b47 100644 --- a/proxy/src/mechglue/gss_plugin.h +++ b/proxy/src/mechglue/gss_plugin.h @@ -30,6 +30,15 @@ extern const gss_OID_desc gssproxy_mech_interposer; +enum gpp_behavior { + GPP_UNINITIALIZED = 0, + GPP_LOCAL_ONLY, + GPP_LOCAL_FIRST, + GPP_REMOTE_FIRST, + GPP_REMOTE_ONLY, +}; + gss_OID_set gss_mech_interposer(gss_OID mech_type); +enum gpp_behavior gpp_get_behavior(void); #endif /* _GSS_PLUGIN_H_ */ |