diff options
| author | Simo Sorce <simo@redhat.com> | 2012-06-01 18:08:45 -0400 |
|---|---|---|
| committer | Simo Sorce <simo@redhat.com> | 2012-06-05 11:03:09 -0400 |
| commit | 195cfbb015a962a6de5feff2dd85df803775bceb (patch) | |
| tree | f79dc66a706de7266c566d0f7c567c44eb770ac9 /proxy/src | |
| parent | 763ac250a2b0dfa082ddd1f382546056ee21533d (diff) | |
Add function to special-filter OID sets
Diffstat (limited to 'proxy/src')
| -rw-r--r-- | proxy/src/mechglue/gss_plugin.c | 60 | ||||
| -rw-r--r-- | proxy/src/mechglue/gss_plugin.h | 1 |
2 files changed, 61 insertions, 0 deletions
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_ */ |
