1 /*
2 * lib/gssapi/krb5/inq_names.c
3 *
4 * Copyright 1995 by the Massachusetts Institute of Technology.
5 * All Rights Reserved.
6 *
7 * Export of this software from the United States of America may
8 * require a specific license from the United States Government.
9 * It is the responsibility of any person or organization contemplating
10 * export to obtain such a license before exporting.
11 *
12 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
13 * distribute this software and its documentation for any purpose and
14 * without fee is hereby granted, provided that the above copyright
15 * notice appear in all copies and that both that copyright notice and
16 * this permission notice appear in supporting documentation, and that
17 * the name of M.I.T. not be used in advertising or publicity pertaining
18 * to distribution of the software without specific, written prior
19 * permission. Furthermore if you modify this software you must label
20 * your software as modified software and not distribute it in such a
21 * fashion that it might be confused with the original M.I.T. software.
22 * M.I.T. makes no representations about the suitability of
23 * this software for any purpose. It is provided "as is" without express
24 * or implied warranty.
25 *
26 */
27
28 /*
29 * inq_names.c - Return set of nametypes supported by the KRB5 mechanism.
30 */
31 #include "gssapiP_krb5.h"
32 #include "mglueP.h"
33
34 OM_uint32
krb5_gss_inquire_names_for_mech(minor_status,mechanism,name_types)35 krb5_gss_inquire_names_for_mech(minor_status, mechanism, name_types)
36 OM_uint32 *minor_status;
37 gss_OID mechanism;
38 gss_OID_set *name_types;
39 {
40 OM_uint32 major, minor;
41
42 /*
43 * We only know how to handle our own mechanism.
44 */
45 if ((mechanism != GSS_C_NULL_OID) &&
46 !g_OID_equal(gss_mech_krb5, mechanism) &&
47 !g_OID_equal(gss_mech_krb5_old, mechanism)) {
48 *minor_status = 0;
49 return(GSS_S_BAD_MECH);
50 }
51
52 /* We're okay. Create an empty OID set */
53 major = gss_create_empty_oid_set(minor_status, name_types);
54 if (major == GSS_S_COMPLETE) {
55 /* Now add our members. */
56 if (
57 ((major = generic_gss_add_oid_set_member(minor_status,
58 gss_nt_user_name,
59 name_types)
60 ) == GSS_S_COMPLETE) &&
61 ((major = generic_gss_add_oid_set_member(minor_status,
62 gss_nt_machine_uid_name,
63 name_types)
64 ) == GSS_S_COMPLETE) &&
65 ((major = generic_gss_add_oid_set_member(minor_status,
66 gss_nt_string_uid_name,
67 name_types)
68 ) == GSS_S_COMPLETE) &&
69 ((major = generic_gss_add_oid_set_member(minor_status,
70 gss_nt_service_name,
71 name_types)
72 ) == GSS_S_COMPLETE) &&
73 ((major = generic_gss_add_oid_set_member(minor_status,
74 gss_nt_service_name_v2,
75 name_types)
76 ) == GSS_S_COMPLETE) &&
77 ((major = generic_gss_add_oid_set_member(minor_status,
78 gss_nt_exported_name,
79 name_types)
80 ) == GSS_S_COMPLETE) &&
81 ((major = generic_gss_add_oid_set_member(minor_status,
82 (const gss_OID) gss_nt_krb5_name, /* Solaris Kerberos */
83 name_types)
84 ) == GSS_S_COMPLETE)
85 ) {
86 /* Solaris Kerberos */
87 major = generic_gss_add_oid_set_member(minor_status,
88 (const gss_OID) gss_nt_krb5_principal,
89 name_types);
90 }
91
92 /*
93 * If we choked, then release the set, but don't overwrite the minor
94 * status with the release call.
95 */
96 if (major != GSS_S_COMPLETE)
97 (void) gss_release_oid_set(&minor,
98 name_types);
99 }
100 return(major);
101 }
102