From 1d6400f2ac9d0268b87d0910853e328b7ca840e6 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 26 Mar 2013 20:37:24 -0400 Subject: Add helper function to check for krb5 oid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The krb5 mechanism supports multiple oids for historical reasons. Add a function to generically check if a mech oid is any of the krb5 mechanism known oids for functions that do not care which exact oid is being used of the krb5 family. Signed-off-by: Simo Sorce Reviewed-by: Günther Deschner --- proxy/src/mechglue/gss_plugin.c | 14 ++++++++++++++ proxy/src/mechglue/gss_plugin.h | 1 + 2 files changed, 15 insertions(+) (limited to 'proxy/src') diff --git a/proxy/src/mechglue/gss_plugin.c b/proxy/src/mechglue/gss_plugin.c index 744965e..5713320 100644 --- a/proxy/src/mechglue/gss_plugin.c +++ b/proxy/src/mechglue/gss_plugin.c @@ -560,3 +560,17 @@ uint32_t gpp_copy_oid(uint32_t *minor, gss_OID in, gss_OID *out) *minor = 0; return GSS_S_COMPLETE; } + +bool gpp_is_krb5_oid(const gss_OID mech) +{ + if (gss_oid_equal(&gpoid_krb5, mech)) { + return true; + } else if (gss_oid_equal(&gpoid_krb5_old, mech)) { + return true; + } else if (gss_oid_equal(&gpoid_krb5_wrong, mech)) { + return true; + } else if (gss_oid_equal(&gpoid_iakerb, mech)) { + return true; + } + return false; +} diff --git a/proxy/src/mechglue/gss_plugin.h b/proxy/src/mechglue/gss_plugin.h index de8e7be..26e04c5 100644 --- a/proxy/src/mechglue/gss_plugin.h +++ b/proxy/src/mechglue/gss_plugin.h @@ -86,6 +86,7 @@ uint32_t gpp_wrap_sec_ctx_token(uint32_t *minor, gss_OID mech_type, uint32_t gpp_remote_to_local_ctx(uint32_t *minor, gssx_ctx **remote_ctx, gss_ctx_id_t *local_ctx); uint32_t gpp_copy_oid(uint32_t *minor, gss_OID in, gss_OID *out); +bool gpp_is_krb5_oid(const gss_OID mech); uint32_t gpp_name_to_local(uint32_t *minor, gssx_name *name, gss_OID mech_type, gss_name_t *mech_name); uint32_t gpp_local_to_name(uint32_t *minor, -- cgit