X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=support%2Fgssapi%2Fg_mechname.c;fp=support%2Fgssapi%2Fg_mechname.c;h=0000000000000000000000000000000000000000;hp=4f0a013c70f3d425dc034fa7981b7f371ecd125b;hb=1d0397894463e507e9f5d92442ac3b09e29310a3;hpb=53c5bd65c74e032947d8fb5b140024be008aaa6b diff --git a/support/gssapi/g_mechname.c b/support/gssapi/g_mechname.c deleted file mode 100644 index 4f0a013..0000000 --- a/support/gssapi/g_mechname.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * g_mechname.c --- registry of mechanism-specific name types - * - * This file contains a registry of mechanism-specific name types. It - * is used to determine which name types not should be lazy evaluated, - * but rather evaluated on the spot. - */ - -#include "mglueP.h" -#ifdef HAVE_STDLIB_H -#include -#endif - -#include -#include -#include - -#define g_OID_equal(o1,o2) \ - (((o1)->length == (o2)->length) && \ - (memcmp((o1)->elements,(o2)->elements,(int) (o1)->length) == 0)) - -static gss_mech_spec_name name_list = NULL; - -/* - * generic searching helper function. - */ -static gss_mech_spec_name search_mech_spec(name_type) - gss_OID name_type; -{ - gss_mech_spec_name p; - - for (p = name_list; p; p = p->next) { - if (g_OID_equal(name_type, p->name_type)) - return p; - } - return NULL; -} - -/* - * Given a name_type, if it is specific to a mechanism, return the - * mechanism OID. Otherwise, return NULL. - */ -gss_OID gss_find_mechanism_from_name_type(name_type) - gss_OID name_type; -{ - gss_mech_spec_name p; - - p = search_mech_spec(name_type); - if (!p) - return NULL; - return p->mech; -} - -/* - * This function adds a (name_type, mechanism) pair to the - * mechanism-specific name type registry. If an entry for the - * name_type already exists, then zero out the mechanism entry. - * Otherwise, enter the pair into the registry. - */ -OM_uint32 -gss_add_mech_name_type(minor_status, name_type, mech) - OM_uint32 *minor_status; - gss_OID name_type; - gss_OID mech; -{ - OM_uint32 major_status, tmp; - gss_mech_spec_name p; - - p = search_mech_spec(name_type); - if (p) { - /* - * We found an entry for this name type; mark it as not being - * a mechanism-specific name type. - */ - if (p->mech) { - if (!g_OID_equal(mech, p->mech)) { - generic_gss_release_oid(minor_status, &p->mech); - p->mech = 0; - } - } - return GSS_S_COMPLETE; - } - p = malloc(sizeof(gss_mech_spec_name_desc)); - if (!p) { - *minor_status = ENOMEM; - goto allocation_failure; - } - p->name_type = 0; - p->mech = 0; - - major_status = generic_gss_copy_oid(minor_status, name_type, - &p->name_type); - if (major_status) - goto allocation_failure; - major_status = generic_gss_copy_oid(minor_status, mech, - &p->mech); - if (major_status) - goto allocation_failure; - - p->next = name_list; - p->prev = 0; - name_list = p; - - return GSS_S_COMPLETE; - -allocation_failure: - if (p) { - if (p->mech) - generic_gss_release_oid(&tmp, &p->mech); - if (p->name_type) - generic_gss_release_oid(&tmp, &p->name_type); - free(p); - } - return GSS_S_FAILURE; -} -