Skip to content

Commit

Permalink
Allow to build with inteposer enabled by default
Browse files Browse the repository at this point in the history
Signed-off-by: Simo Sorce <simo@redhat.com>
  • Loading branch information
simo5 committed May 23, 2022
1 parent 0f4bce2 commit 0837a56
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
12 changes: 12 additions & 0 deletions configure.ac
Expand Up @@ -292,6 +292,18 @@ fi

AC_CHECK_FUNCS([__secure_getenv secure_getenv])

AC_ARG_ENABLE([always-interpose],
[AC_HELP_STRING([--enable-always-interpose],
[Whether to build with interposer always enabled [no]]
)],
[always_interpose=$enableval],
[always_interpose=no])
if test x$always_interpose != xno; then
AC_DEFINE_UNQUOTED(GSS_ALWAYS_INTERPOSE, true, [Interposer always enabled by default])
else
AC_DEFINE_UNQUOTED(GSS_ALWAYS_INTERPOSE, false, [Interposer not enabled by default])
fi

WITH_INITSCRIPT
if test x$initscript = xsystemd; then
WITH_SYSTEMD_UNIT_DIR
Expand Down
21 changes: 13 additions & 8 deletions src/mechglue/gss_plugin.c
Expand Up @@ -73,22 +73,27 @@ const gss_OID_desc gssproxy_mech_interposer = {
.elements = "\140\206\110\001\206\370\102\003\010\017\001"
};

gss_OID_set gss_mech_interposer(gss_OID mech_type)
static bool enabled(void)
{
gss_OID_set interposed_mechs;
OM_uint32 maj, min;
char *envval;
bool ret = GSS_ALWAYS_INTERPOSE;

/* avoid looping in the gssproxy daemon by avoiding to interpose
* any mechanism */
envval = gp_getenv("GSS_USE_PROXY");
if (!envval) {
return NULL;
if (envval) {
ret = gp_boolean_is_true(envval);
}

if (!gp_boolean_is_true(envval)) {
return NULL;
}
return ret;
}

gss_OID_set gss_mech_interposer(gss_OID mech_type)
{
gss_OID_set interposed_mechs;
OM_uint32 maj, min;

if (!enabled()) return NULL;

interposed_mechs = NULL;
maj = 0;
Expand Down

0 comments on commit 0837a56

Please sign in to comment.