diff options
Diffstat (limited to 'proxy/src')
-rw-r--r-- | proxy/src/client/gpm_import_and_canon_name.c | 49 | ||||
-rw-r--r-- | proxy/src/client/gssapi_gpm.h | 4 |
2 files changed, 53 insertions, 0 deletions
diff --git a/proxy/src/client/gpm_import_and_canon_name.c b/proxy/src/client/gpm_import_and_canon_name.c index 5301d60..9c60754 100644 --- a/proxy/src/client/gpm_import_and_canon_name.c +++ b/proxy/src/client/gpm_import_and_canon_name.c @@ -340,3 +340,52 @@ OM_uint32 gpm_release_name(OM_uint32 *minor_status, } return GSS_S_COMPLETE; } + +OM_uint32 gpm_compare_name(OM_uint32 *minor_status, + gssx_name *name1, + gssx_name *name2, + int *name_equal) +{ + gss_buffer_desc buf1 = {0}; + gss_buffer_desc buf2 = {0}; + gss_OID type1 = GSS_C_NO_OID; + gss_OID type2 = GSS_C_NO_OID; + uint32_t ret_maj; + uint32_t ret_min; + int c; + + *name_equal = 0; + + ret_maj = gpm_display_name(&ret_min, (gss_name_t)name1, &buf1, &type1); + if (ret_maj != GSS_S_COMPLETE) { + goto done; + } + + ret_maj = gpm_display_name(&ret_min, (gss_name_t)name2, &buf2, &type2); + if (ret_maj != GSS_S_COMPLETE) { + goto done; + } + + c = buf1.length - buf2.length; + if (c == 0) { + c = memcmp(buf1.value, buf2.value, buf1.length); + if (c == 0) { + c = gss_oid_equal(type1, type2); + } + } + + if (c != 0) { + *name_equal = 1; + } + + ret_min = 0; + ret_maj = GSS_S_COMPLETE; + +done: + *minor_status = ret_min; + gss_release_buffer(&ret_min, &buf1); + gss_release_buffer(&ret_min, &buf2); + gss_release_oid(&ret_min, &type1); + gss_release_oid(&ret_min, &type2); + return ret_maj; +} diff --git a/proxy/src/client/gssapi_gpm.h b/proxy/src/client/gssapi_gpm.h index fa998fc..8451f5f 100644 --- a/proxy/src/client/gssapi_gpm.h +++ b/proxy/src/client/gssapi_gpm.h @@ -158,6 +158,10 @@ OM_uint32 gpm_inquire_name(OM_uint32 *minor_status, int *name_is_NM, gss_OID *NM_mech, gss_buffer_set_t *attrs); +OM_uint32 gpm_compare_name(OM_uint32 *minor_status, + gssx_name *name1, + gssx_name *name2, + int *name_equal); OM_uint32 gpm_init_sec_context(OM_uint32 *minor_status, gss_cred_id_t claimant_cred_handle, |