1240116Smarcel/*
2240116Smarcel * Copyright (c) 2003 Kungliga Tekniska H��gskolan
3240116Smarcel * (Royal Institute of Technology, Stockholm, Sweden).
4240116Smarcel * All rights reserved.
5240116Smarcel *
6240116Smarcel * Redistribution and use in source and binary forms, with or without
7240116Smarcel * modification, are permitted provided that the following conditions
8240116Smarcel * are met:
9240116Smarcel *
10240116Smarcel * 1. Redistributions of source code must retain the above copyright
11240116Smarcel *    notice, this list of conditions and the following disclaimer.
12240116Smarcel *
13240116Smarcel * 2. Redistributions in binary form must reproduce the above copyright
14240116Smarcel *    notice, this list of conditions and the following disclaimer in the
15240116Smarcel *    documentation and/or other materials provided with the distribution.
16240116Smarcel *
17240116Smarcel * 3. Neither the name of the Institute nor the names of its contributors
18240116Smarcel *    may be used to endorse or promote products derived from this software
19240116Smarcel *    without specific prior written permission.
20240116Smarcel *
21240116Smarcel * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22240116Smarcel * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23240116Smarcel * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24240116Smarcel * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25240116Smarcel * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26240116Smarcel * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27240116Smarcel * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28240116Smarcel * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29240116Smarcel * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30240116Smarcel * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31240116Smarcel * SUCH DAMAGE.
32240116Smarcel */
33240116Smarcel
34240116Smarcel#include "gsskrb5_locl.h"
35240116Smarcel
36240116Smarcelstatic gss_OID name_list[] = {
37240116Smarcel    GSS_C_NT_HOSTBASED_SERVICE,
38240116Smarcel    GSS_C_NT_USER_NAME,
39240116Smarcel    GSS_KRB5_NT_PRINCIPAL_NAME,
40240116Smarcel    GSS_C_NT_EXPORT_NAME,
41240116Smarcel    NULL
42240116Smarcel};
43240116Smarcel
44240116SmarcelOM_uint32 GSSAPI_CALLCONV _gsskrb5_inquire_names_for_mech (
45240116Smarcel            OM_uint32 * minor_status,
46240116Smarcel            const gss_OID mechanism,
47240116Smarcel            gss_OID_set * name_types
48240116Smarcel           )
49240116Smarcel{
50240116Smarcel    OM_uint32 ret;
51240116Smarcel    int i;
52240116Smarcel
53240116Smarcel    *minor_status = 0;
54240116Smarcel
55240116Smarcel    if (gss_oid_equal(mechanism, GSS_KRB5_MECHANISM) == 0 &&
56240116Smarcel	gss_oid_equal(mechanism, GSS_C_NULL_OID) == 0) {
57240116Smarcel	*name_types = GSS_C_NO_OID_SET;
58240116Smarcel	return GSS_S_BAD_MECH;
59240116Smarcel    }
60240116Smarcel
61240116Smarcel    ret = gss_create_empty_oid_set(minor_status, name_types);
62240116Smarcel    if (ret != GSS_S_COMPLETE)
63240116Smarcel	return ret;
64240116Smarcel
65240116Smarcel    for (i = 0; name_list[i] != NULL; i++) {
66240116Smarcel	ret = gss_add_oid_set_member(minor_status,
67240116Smarcel				     name_list[i],
68240116Smarcel				     name_types);
69240116Smarcel	if (ret != GSS_S_COMPLETE)
70240116Smarcel	    break;
71240116Smarcel    }
72240116Smarcel
73240116Smarcel    if (ret != GSS_S_COMPLETE)
74240116Smarcel	gss_release_oid_set(NULL, name_types);
75240116Smarcel
76240116Smarcel    return GSS_S_COMPLETE;
77240116Smarcel}
78240116Smarcel