Path: blob/main/crypto/krb5/src/lib/gssapi/mechglue/g_inq_name.c
39586 views
/* -*- mode: c; indent-tabs-mode: nil -*- */1/*2* Copyright 2009 by the Massachusetts Institute of Technology.3* All Rights Reserved.4*5* Export of this software from the United States of America may6* require a specific license from the United States Government.7* It is the responsibility of any person or organization contemplating8* export to obtain such a license before exporting.9*10* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and11* distribute this software and its documentation for any purpose and12* without fee is hereby granted, provided that the above copyright13* notice appear in all copies and that both that copyright notice and14* this permission notice appear in supporting documentation, and that15* the name of M.I.T. not be used in advertising or publicity pertaining16* to distribution of the software without specific, written prior17* permission. Furthermore if you modify this software you must label18* your software as modified software and not distribute it in such a19* fashion that it might be confused with the original M.I.T. software.20* M.I.T. makes no representations about the suitability of21* this software for any purpose. It is provided "as is" without express22* or implied warranty.23*/2425/* Glue routine for gss_inquire_name */2627#include "mglueP.h"2829OM_uint32 KRB5_CALLCONV30gss_inquire_name(OM_uint32 *minor_status,31gss_name_t name,32int *name_is_MN,33gss_OID *MN_mech,34gss_buffer_set_t *attrs)35{36OM_uint32 status, tmp;37gss_union_name_t union_name;38gss_mechanism mech;3940if (minor_status != NULL)41*minor_status = 0;4243if (MN_mech != NULL)44*MN_mech = GSS_C_NO_OID;4546if (attrs != NULL)47*attrs = GSS_C_NO_BUFFER_SET;4849if (minor_status == NULL)50return GSS_S_CALL_INACCESSIBLE_WRITE;5152if (name == GSS_C_NO_NAME)53return GSS_S_CALL_INACCESSIBLE_READ | GSS_S_BAD_NAME;5455union_name = (gss_union_name_t)name;5657if (union_name->mech_type == GSS_C_NO_OID) {58/* We don't yet support non-mechanism attributes */59if (name_is_MN != NULL)60*name_is_MN = 0;61*minor_status = 0;62return GSS_S_COMPLETE;63}6465if (name_is_MN != NULL)66*name_is_MN = 1;6768if (MN_mech != NULL) {69status = generic_gss_copy_oid(minor_status,70union_name->mech_type,71MN_mech);72if (GSS_ERROR(status))73return status;74}7576mech = gssint_get_mechanism(name->mech_type);77if (mech == NULL) {78gss_release_oid(&tmp, MN_mech);79return GSS_S_BAD_NAME;80}8182if (mech->gss_inquire_name == NULL) {83gss_release_oid(&tmp, MN_mech);84return GSS_S_UNAVAILABLE;85}8687status = (*mech->gss_inquire_name)(minor_status,88union_name->mech_name,89NULL,90NULL,91attrs);92if (status != GSS_S_COMPLETE) {93generic_gss_release_oid(&tmp, MN_mech);94map_error(minor_status, mech);95}9697return status;98}99100101