X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=duplicate_name.c;h=b618b3d7ed4b247250094b5a170a70e5c6515da5;hb=refs%2Fheads%2Fjson-name;hp=6ad33a015f33838c7a4e9f968da0f11d23777df7;hpb=d4fe7ce93304facaf069792c347b01b25ab765ae;p=mech_eap.orig diff --git a/duplicate_name.c b/duplicate_name.c index 6ad33a0..b618b3d 100644 --- a/duplicate_name.c +++ b/duplicate_name.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, JANET(UK) + * Copyright (c) 2011, JANET(UK) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,6 +30,10 @@ * SUCH DAMAGE. */ +/* + * Duplicate a name. + */ + #include "gssapiP_eap.h" OM_uint32 @@ -37,53 +41,20 @@ gss_duplicate_name(OM_uint32 *minor, const gss_name_t input_name, gss_name_t *dest_name) { - OM_uint32 major, tmpMinor; - krb5_context krbContext; - gss_name_t name; + OM_uint32 major; + + *minor = 0; if (input_name == GSS_C_NO_NAME) { *minor = EINVAL; return GSS_S_CALL_INACCESSIBLE_READ | GSS_S_BAD_NAME; } - GSSEAP_KRB_INIT(&krbContext); - - major = gssEapAllocName(minor, &name); - if (GSS_ERROR(major)) { - return major; - } - - /* Lock mutex for copying mutable attributes */ GSSEAP_MUTEX_LOCK(&input_name->mutex); - *minor = krb5_copy_principal(krbContext, input_name->krbPrincipal, - &name->krbPrincipal); - if (*minor != 0) { - major = GSS_S_FAILURE; - goto cleanup; - } + major = gssEapDuplicateName(minor, input_name, dest_name); - if (input_name->avps != NULL) { - major = radiusDuplicateAVPs(minor, input_name->avps, &name->avps); - if (GSS_ERROR(major)) - goto cleanup; - } - - if (input_name->assertion != NULL) { - major = samlDuplicateAssertion(minor, input_name->assertion, - &name->assertion); - if (GSS_ERROR(major)) - goto cleanup; - } - - *dest_name = name; - -cleanup: GSSEAP_MUTEX_UNLOCK(&input_name->mutex); - if (GSS_ERROR(major)) { - gssEapReleaseName(&tmpMinor, &name); - } - return major; }