4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
33 #include <mechglueP.h>
34 #include <gssapi/gssapi.h>
35 #include <gssapi/gssapi_ext.h>
39 compare_names(OM_uint32
*minor
,
40 const gss_OID mech_type
,
41 const gss_name_t name
,
46 OM_uint32 status
, tmpMinor
;
47 gss_name_t imported_name
;
48 gss_name_t canon_name
;
49 gss_buffer_desc gss_user
;
54 gss_user
.value
= (void *)user
;
55 if (!gss_user
.value
|| !name
|| !mech_type
)
56 return (GSS_S_BAD_NAME
);
57 gss_user
.length
= strlen(gss_user
.value
);
59 status
= gss_import_name(minor
,
63 if (status
!= GSS_S_COMPLETE
) {
67 status
= gss_canonicalize_name(minor
,
71 if (status
!= GSS_S_COMPLETE
) {
72 (void) gss_release_name(&tmpMinor
, &imported_name
);
76 status
= gss_compare_name(minor
,
80 (void) gss_release_name(&tmpMinor
, &canon_name
);
81 (void) gss_release_name(&tmpMinor
, &imported_name
);
82 if (status
== GSS_S_COMPLETE
) {
84 *user_ok
= 1; /* remote user is a-ok */
93 __gss_userok(OM_uint32
*minor
,
94 const gss_name_t name
,
100 gss_union_name_t intName
;
101 gss_name_t mechName
= NULL
;
104 if (minor
== NULL
|| user_ok
== NULL
)
105 return (GSS_S_CALL_INACCESSIBLE_WRITE
);
107 if (name
== NULL
|| user
== NULL
)
108 return (GSS_S_CALL_INACCESSIBLE_READ
);
111 *minor
= GSS_S_COMPLETE
;
113 intName
= (gss_union_name_t
)name
;
115 mech
= __gss_get_mechanism(intName
->mech_type
);
117 return (GSS_S_UNAVAILABLE
);
119 /* may need to import the name if this is not MN */
120 if (intName
->mech_type
== NULL
) {
121 return (GSS_S_FAILURE
);
123 mechName
= intName
->mech_name
;
125 if (mech
->__gss_userok
)
126 major
= mech
->__gss_userok(mech
->context
, minor
, mechName
,
129 major
= compare_names(minor
, intName
->mech_type
,
130 name
, user
, user_ok
);