Path: blob/main/crypto/heimdal/lib/gssapi/mech/gss_inquire_name.c
34907 views
/*1* Copyright (c) 2010, PADL Software Pty Ltd.2* All rights reserved.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7*8* 1. Redistributions of source code must retain the above copyright9* notice, this list of conditions and the following disclaimer.10*11* 2. Redistributions in binary form must reproduce the above copyright12* notice, this list of conditions and the following disclaimer in the13* documentation and/or other materials provided with the distribution.14*15* 3. Neither the name of PADL Software nor the names of its contributors16* may be used to endorse or promote products derived from this software17* without specific prior written permission.18*19* THIS SOFTWARE IS PROVIDED BY PADL SOFTWARE AND CONTRIBUTORS ``AS IS'' AND20* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE21* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE22* ARE DISCLAIMED. IN NO EVENT SHALL PADL SOFTWARE OR CONTRIBUTORS BE LIABLE23* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL24* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS25* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)26* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT27* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY28* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF29* SUCH DAMAGE.30*/3132#include "mech_locl.h"3334GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL35gss_inquire_name(OM_uint32 *minor_status,36gss_name_t input_name,37int *name_is_MN,38gss_OID *MN_mech,39gss_buffer_set_t *attrs)40{41OM_uint32 major_status = GSS_S_UNAVAILABLE;42struct _gss_name *name = (struct _gss_name *) input_name;43struct _gss_mechanism_name *mn;4445*minor_status = 0;46if (name_is_MN != NULL)47*name_is_MN = 0;48if (MN_mech != NULL)49*MN_mech = GSS_C_NO_OID;50if (attrs != NULL)51*attrs = GSS_C_NO_BUFFER_SET;5253if (input_name == GSS_C_NO_NAME)54return GSS_S_BAD_NAME;5556HEIM_SLIST_FOREACH(mn, &name->gn_mn, gmn_link) {57gssapi_mech_interface m = mn->gmn_mech;5859if (!m->gm_inquire_name)60continue;6162major_status = m->gm_inquire_name(minor_status,63mn->gmn_name,64NULL,65MN_mech,66attrs);67if (major_status == GSS_S_COMPLETE) {68if (name_is_MN != NULL)69*name_is_MN = 1;70if (MN_mech != NULL && *MN_mech == GSS_C_NO_OID)71*MN_mech = &m->gm_mech_oid;72break;73}74_gss_mg_error(m, major_status, *minor_status);75}7677return major_status;78}798081