diff options
author | Simo Sorce <simo@redhat.com> | 2012-08-22 17:08:44 +0200 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2012-09-14 16:09:29 -0400 |
commit | cad073f22f162e92984d3bf02be6f35951958cc9 (patch) | |
tree | ca8e977eaee39c5a7168895db8dd2b99f0ff4cc0 /proxy | |
parent | f36d814f2f87cd8eee057bf8426eb3dd40c443f1 (diff) | |
download | gss-proxy-cad073f22f162e92984d3bf02be6f35951958cc9.tar.gz gss-proxy-cad073f22f162e92984d3bf02be6f35951958cc9.tar.xz gss-proxy-cad073f22f162e92984d3bf02be6f35951958cc9.zip |
Implement gpm_compare_name
Diffstat (limited to 'proxy')
-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, |