diff options
author | Simo Sorce <simo@redhat.com> | 2012-06-01 18:08:45 -0400 |
---|---|---|
committer | Günther Deschner <gdeschner@redhat.com> | 2012-06-26 14:44:43 +0200 |
commit | 931c4d61e64af9db194c82c5d750d018710d4628 (patch) | |
tree | f75592177a84e82e5800c8c6d9e6de9d9ecd99c1 | |
parent | 1fed9b154a3dd1f76e7a62e0a5db3099554a66bd (diff) | |
download | gss-proxy-931c4d61e64af9db194c82c5d750d018710d4628.tar.gz gss-proxy-931c4d61e64af9db194c82c5d750d018710d4628.tar.xz gss-proxy-931c4d61e64af9db194c82c5d750d018710d4628.zip |
Add function to special-filter OID sets
-rw-r--r-- | proxy/src/mechglue/gss_plugin.c | 53 | ||||
-rw-r--r-- | proxy/src/mechglue/gss_plugin.h | 1 |
2 files changed, 54 insertions, 0 deletions
diff --git a/proxy/src/mechglue/gss_plugin.c b/proxy/src/mechglue/gss_plugin.c index a0a0aab..834b68b 100644 --- a/proxy/src/mechglue/gss_plugin.c +++ b/proxy/src/mechglue/gss_plugin.c @@ -173,6 +173,59 @@ 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 amechs = GSS_C_NO_OID_SET; + uint32_t maj, min; + unsigned i, j; + + maj = gss_create_empty_oid_set(&min, &amechs); + if (maj) { + return GSS_C_NO_OID_SET; + } + for (i = 0; i < mechs->count; i++) { + for (j = 0; gpm_mechs[j].real != NULL; j++) { + if (gss_oid_equal(gpm_mechs[i].real, + &mechs->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, + &mechs->elements[i])) { + /* just skip */ + continue; + } + /* If nothing matched just copy verbatim */ + maj = gss_add_oid_set_member(&min, &mechs->elements[i], &amechs); + if (maj) { + goto done; + } + } + } + + if (amechs->count == 0) { + maj = GSS_S_FAILURE; + } else { + maj = GSS_S_COMPLETE; + } + +done: + if (maj) { + (void)gss_release_oid_set(&min, &amechs); + } + 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_ */ |