From 195cfbb015a962a6de5feff2dd85df803775bceb Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 1 Jun 2012 18:08:45 -0400 Subject: Add function to special-filter OID sets --- proxy/src/mechglue/gss_plugin.c | 60 +++++++++++++++++++++++++++++++++++++++++ proxy/src/mechglue/gss_plugin.h | 1 + 2 files changed, 61 insertions(+) (limited to 'proxy/src') diff --git a/proxy/src/mechglue/gss_plugin.c b/proxy/src/mechglue/gss_plugin.c index 87c68d6..980e1ff 100644 --- a/proxy/src/mechglue/gss_plugin.c +++ b/proxy/src/mechglue/gss_plugin.c @@ -172,6 +172,66 @@ const gss_OID gpm_special_mech(const gss_OID mech_type) return mech_type; } +gss_OID_set gpm_special_available_mechs(const gss_OID_set mechs) +{ + gss_OID_set imechs = GSS_C_NO_OID_SET; + gss_OID_set amechs = GSS_C_NO_OID_SET; + uint32_t maj, min; + unsigned i, j; + + if (mechs == GSS_C_NO_OID_SET) { + maj = gss_indicate_mechs(&min, &imechs); + if (maj) { + goto done; + } + } else { + imechs = mechs; + } + + maj = gss_create_empty_oid_set(&min, &amechs); + if (maj) { + return GSS_C_NO_OID_SET; + } + for (i = 0; i < imechs->count; i++) { + for (j = 0; gpm_mechs[j].real != NULL; j++) { + if (gss_oid_equal(gpm_mechs[i].real, + &imechs->elements[i])) { + maj = gss_add_oid_set_member(&min, + no_const(gpm_mechs[i].special), + &amechs); + if (maj) { + goto done; + } + break; + } + } + /* none of the ones we intercept */ + if (gpm_mechs[j].real == NULL) { + + /* check if one is our own OID */ + if (gss_oid_equal(&gssproxy_mech_interposer, + &imechs->elements[i])) { + /* just skip */ + continue; + } + /* If nothing matched just copy verbatim */ + maj = gss_add_oid_set_member(&min, &imechs->elements[i], &amechs); + if (maj) { + goto done; + } + } + } + +done: + if (maj) { + (void)gss_release_oid_set(&min, &amechs); + } + if (mechs != imechs) { + (void)gss_release_oid_set(&min, &imechs); + } + return amechs; +} + /* gssi_acquire_cred gssi_release_cred diff --git a/proxy/src/mechglue/gss_plugin.h b/proxy/src/mechglue/gss_plugin.h index ab39d08..a3d2b36 100644 --- a/proxy/src/mechglue/gss_plugin.h +++ b/proxy/src/mechglue/gss_plugin.h @@ -32,5 +32,6 @@ extern const gss_OID_desc gssproxy_mech_interposer; gss_OID_set gss_mech_interposer(gss_OID mech_type); const gss_OID gpm_special_mech(const gss_OID mech_type); +gss_OID_set gpm_special_available_mechs(const gss_OID_set mechs); #endif /* _GGS_PLUGIN_H_ */ -- cgit