xref: /freebsd/sys/kgssapi/gss_names.c (revision 685dc743dc3b5645e34836464128e1c0558b404b)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2005 Doug Rabson
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  */
28 
29 #include <sys/cdefs.h>
30 #include <sys/param.h>
31 #include <kgssapi/gssapi.h>
32 
33 /*
34  * The implementation must reserve static storage for a
35  * gss_OID_desc object containing the value
36  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
37  * "\x01\x02\x01\x01"},
38  * corresponding to an object-identifier value of
39  * {iso(1) member-body(2) United States(840) mit(113554)
40  * infosys(1) gssapi(2) generic(1) user_name(1)}.  The constant
41  * GSS_C_NT_USER_NAME should be initialized to point
42  * to that gss_OID_desc.
43  */
44 static gss_OID_desc GSS_C_NT_USER_NAME_storage =
45 	{10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x01"};
46 gss_OID GSS_C_NT_USER_NAME = &GSS_C_NT_USER_NAME_storage;
47 
48 /*
49  * The implementation must reserve static storage for a
50  * gss_OID_desc object containing the value
51  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
52  *              "\x01\x02\x01\x02"},
53  * corresponding to an object-identifier value of
54  * {iso(1) member-body(2) United States(840) mit(113554)
55  * infosys(1) gssapi(2) generic(1) machine_uid_name(2)}.
56  * The constant GSS_C_NT_MACHINE_UID_NAME should be
57  * initialized to point to that gss_OID_desc.
58  */
59 static gss_OID_desc GSS_C_NT_MACHINE_UID_NAME_storage =
60 	{10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x02"};
61 gss_OID GSS_C_NT_MACHINE_UID_NAME = &GSS_C_NT_MACHINE_UID_NAME_storage;
62 
63 /*
64  * The implementation must reserve static storage for a
65  * gss_OID_desc object containing the value
66  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
67  *              "\x01\x02\x01\x03"},
68  * corresponding to an object-identifier value of
69  * {iso(1) member-body(2) United States(840) mit(113554)
70  * infosys(1) gssapi(2) generic(1) string_uid_name(3)}.
71  * The constant GSS_C_NT_STRING_UID_NAME should be
72  * initialized to point to that gss_OID_desc.
73  */
74 static gss_OID_desc GSS_C_NT_STRING_UID_NAME_storage =
75 	{10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x03"};
76 gss_OID GSS_C_NT_STRING_UID_NAME = &GSS_C_NT_STRING_UID_NAME_storage;
77 
78 /*
79  * The implementation must reserve static storage for a
80  * gss_OID_desc object containing the value
81  * {6, (void *)"\x2b\x06\x01\x05\x06\x02"},
82  * corresponding to an object-identifier value of
83  * {iso(1) org(3) dod(6) internet(1) security(5)
84  * nametypes(6) gss-host-based-services(2)).  The constant
85  * GSS_C_NT_HOSTBASED_SERVICE_X should be initialized to point
86  * to that gss_OID_desc.  This is a deprecated OID value, and
87  * implementations wishing to support hostbased-service names
88  * should instead use the GSS_C_NT_HOSTBASED_SERVICE OID,
89  * defined below, to identify such names;
90  * GSS_C_NT_HOSTBASED_SERVICE_X should be accepted a synonym
91  * for GSS_C_NT_HOSTBASED_SERVICE when presented as an input
92  * parameter, but should not be emitted by GSS-API
93  * implementations
94  */
95 static gss_OID_desc GSS_C_NT_HOSTBASED_SERVICE_X_storage =
96 	{6, (void *)(uintptr_t)"\x2b\x06\x01\x05\x06\x02"};
97 gss_OID GSS_C_NT_HOSTBASED_SERVICE_X = &GSS_C_NT_HOSTBASED_SERVICE_X_storage;
98 
99 /*
100  * The implementation must reserve static storage for a
101  * gss_OID_desc object containing the value
102  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
103  *              "\x01\x02\x01\x04"}, corresponding to an
104  * object-identifier value of {iso(1) member-body(2)
105  * Unites States(840) mit(113554) infosys(1) gssapi(2)
106  * generic(1) service_name(4)}.  The constant
107  * GSS_C_NT_HOSTBASED_SERVICE should be initialized
108  * to point to that gss_OID_desc.
109  */
110 static gss_OID_desc GSS_C_NT_HOSTBASED_SERVICE_storage =
111 	{10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x04"};
112 gss_OID GSS_C_NT_HOSTBASED_SERVICE = &GSS_C_NT_HOSTBASED_SERVICE_storage;
113 
114 /*
115  * The implementation must reserve static storage for a
116  * gss_OID_desc object containing the value
117  * {6, (void *)"\x2b\x06\01\x05\x06\x03"},
118  * corresponding to an object identifier value of
119  * {1(iso), 3(org), 6(dod), 1(internet), 5(security),
120  * 6(nametypes), 3(gss-anonymous-name)}.  The constant
121  * and GSS_C_NT_ANONYMOUS should be initialized to point
122  * to that gss_OID_desc.
123  */
124 static gss_OID_desc GSS_C_NT_ANONYMOUS_storage =
125 	{6, (void *)(uintptr_t)"\x2b\x06\01\x05\x06\x03"};
126 gss_OID GSS_C_NT_ANONYMOUS = &GSS_C_NT_ANONYMOUS_storage;
127 
128 /*
129  * The implementation must reserve static storage for a
130  * gss_OID_desc object containing the value
131  * {6, (void *)"\x2b\x06\x01\x05\x06\x04"},
132  * corresponding to an object-identifier value of
133  * {1(iso), 3(org), 6(dod), 1(internet), 5(security),
134  * 6(nametypes), 4(gss-api-exported-name)}.  The constant
135  * GSS_C_NT_EXPORT_NAME should be initialized to point
136  * to that gss_OID_desc.
137  */
138 static gss_OID_desc GSS_C_NT_EXPORT_NAME_storage =
139 	{6, (void *)(uintptr_t)"\x2b\x06\x01\x05\x06\x04"};
140 gss_OID GSS_C_NT_EXPORT_NAME = &GSS_C_NT_EXPORT_NAME_storage;
141 
142 /*
143  *   This name form shall be represented by the Object Identifier {iso(1)
144  *   member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)
145  *   krb5(2) krb5_name(1)}.  The recommended symbolic name for this type
146  *   is "GSS_KRB5_NT_PRINCIPAL_NAME".
147  */
148 static gss_OID_desc GSS_KRB5_NT_PRINCIPAL_NAME_storage =
149         {10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01"};
150 gss_OID GSS_KRB5_NT_PRINCIPAL_NAME = &GSS_KRB5_NT_PRINCIPAL_NAME_storage;
151 
152 /*
153  * This name form shall be represented by the Object Identifier {iso(1)
154  * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)
155  * generic(1) user_name(1)}.  The recommended symbolic name for this
156  * type is "GSS_KRB5_NT_USER_NAME".
157  */
158 gss_OID GSS_KRB5_NT_USER_NAME = &GSS_C_NT_USER_NAME_storage;
159 
160 /*
161  * This name form shall be represented by the Object Identifier {iso(1)
162  * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)
163  * generic(1) machine_uid_name(2)}.  The recommended symbolic name for
164  * this type is "GSS_KRB5_NT_MACHINE_UID_NAME".
165  */
166 gss_OID GSS_KRB5_NT_MACHINE_UID_NAME = &GSS_C_NT_MACHINE_UID_NAME_storage;
167 
168 /*
169  * This name form shall be represented by the Object Identifier {iso(1)
170  * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)
171  * generic(1) string_uid_name(3)}.  The recommended symbolic name for
172  * this type is "GSS_KRB5_NT_STRING_UID_NAME".
173  */
174 gss_OID GSS_KRB5_NT_STRING_UID_NAME = &GSS_C_NT_STRING_UID_NAME_storage;
175