1267843Sdelphij/*- 2267843Sdelphij * Copyright (c) 2005 Doug Rabson 3267843Sdelphij * All rights reserved. 4267843Sdelphij * 5267843Sdelphij * Redistribution and use in source and binary forms, with or without 6267843Sdelphij * modification, are permitted provided that the following conditions 7267843Sdelphij * are met: 8267843Sdelphij * 1. Redistributions of source code must retain the above copyright 9267843Sdelphij * notice, this list of conditions and the following disclaimer. 10267843Sdelphij * 2. Redistributions in binary form must reproduce the above copyright 11267843Sdelphij * notice, this list of conditions and the following disclaimer in the 12267843Sdelphij * documentation and/or other materials provided with the distribution. 13267843Sdelphij * 14267843Sdelphij * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15267843Sdelphij * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16267843Sdelphij * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17267843Sdelphij * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18267843Sdelphij * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19267843Sdelphij * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20267843Sdelphij * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21267843Sdelphij * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22267843Sdelphij * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23267843Sdelphij * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24267843Sdelphij * SUCH DAMAGE. 25267843Sdelphij * 26267843Sdelphij * $FreeBSD: src/lib/libgssapi/gss_inquire_names_for_mech.c,v 1.1 2005/12/29 14:40:20 dfr Exp $ 27267843Sdelphij */ 28267843Sdelphij 29267843Sdelphij#include "mech_locl.h" 30267843Sdelphij 31267843SdelphijGSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL 32267843Sdelphijgss_inquire_names_for_mech(OM_uint32 *minor_status, 33267843Sdelphij const gss_OID mechanism, 34267843Sdelphij gss_OID_set *name_types) 35267843Sdelphij{ 36267843Sdelphij OM_uint32 major_status; 37267843Sdelphij gssapi_mech_interface m = __gss_get_mechanism(mechanism); 38267843Sdelphij 39267843Sdelphij *minor_status = 0; 40267843Sdelphij *name_types = GSS_C_NO_OID_SET; 41267843Sdelphij if (!m) 42267843Sdelphij return (GSS_S_BAD_MECH); 43267843Sdelphij 44267843Sdelphij /* 45267843Sdelphij * If the implementation can do it, ask it for a list of 46267843Sdelphij * names, otherwise fake it. 47267843Sdelphij */ 48267843Sdelphij if (m->gm_inquire_names_for_mech) { 49267843Sdelphij return (m->gm_inquire_names_for_mech(minor_status, 50267843Sdelphij mechanism, name_types)); 51267843Sdelphij } else { 52267843Sdelphij major_status = gss_create_empty_oid_set(minor_status, 53267843Sdelphij name_types); 54267843Sdelphij if (major_status) 55267843Sdelphij return (major_status); 56267843Sdelphij major_status = gss_add_oid_set_member(minor_status, 57267843Sdelphij GSS_C_NT_HOSTBASED_SERVICE, name_types); 58267843Sdelphij if (major_status) { 59267843Sdelphij OM_uint32 junk; 60267843Sdelphij gss_release_oid_set(&junk, name_types); 61267843Sdelphij return (major_status); 62267843Sdelphij } 63267843Sdelphij major_status = gss_add_oid_set_member(minor_status, 64267843Sdelphij GSS_C_NT_USER_NAME, name_types); 65267843Sdelphij if (major_status) { 66267843Sdelphij OM_uint32 junk; 67267843Sdelphij gss_release_oid_set(&junk, name_types); 68267843Sdelphij return (major_status); 69267843Sdelphij } 70267843Sdelphij } 71267843Sdelphij 72267843Sdelphij return (GSS_S_COMPLETE); 73267843Sdelphij} 74267843Sdelphij