4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
26 * glue routine for gss_inquire_context
29 #include <mechglueP.h>
30 #include "gssapiP_generic.h"
32 #define MAX_MECH_OID_PAIRS 32
34 /* Last argument new for V2 */
36 gss_inquire_names_for_mech(minor_status
, mechanism
, name_types
)
38 OM_uint32
* minor_status
;
39 const gss_OID mechanism
;
40 gss_OID_set
* name_types
;
46 /* Initialize outputs. */
48 if (minor_status
!= NULL
)
51 if (name_types
!= NULL
)
52 *name_types
= GSS_C_NO_OID_SET
;
54 /* Validate arguments. */
56 if (minor_status
== NULL
)
57 return (GSS_S_CALL_INACCESSIBLE_WRITE
);
59 if (name_types
== NULL
)
60 return (GSS_S_CALL_INACCESSIBLE_WRITE
);
63 * select the approprate underlying mechanism routine and
67 mech
= __gss_get_mechanism(mechanism
);
71 if (mech
->gss_inquire_names_for_mech
) {
72 status
= mech
->gss_inquire_names_for_mech(
77 if (status
!= GSS_S_COMPLETE
)
78 map_error(minor_status
, mech
);
80 status
= GSS_S_UNAVAILABLE
;
85 return (GSS_S_BAD_MECH
);
88 static OM_uint32
val_inq_mechs4name_args(
89 OM_uint32
*minor_status
,
90 const gss_name_t input_name
,
91 gss_OID_set
*mech_set
)
94 /* Initialize outputs. */
95 if (minor_status
!= NULL
)
99 *mech_set
= GSS_C_NO_OID_SET
;
101 /* Validate arguments. */
103 if (minor_status
== NULL
)
104 return (GSS_S_CALL_INACCESSIBLE_WRITE
);
106 if (input_name
== GSS_C_NO_NAME
)
107 return (GSS_S_BAD_NAME
);
109 return (GSS_S_COMPLETE
);
113 gss_inquire_mechs_for_name(minor_status
, input_name
, mech_set
)
115 OM_uint32
* minor_status
;
116 const gss_name_t input_name
;
117 gss_OID_set
* mech_set
;
121 static char *mech_list
[MAX_MECH_OID_PAIRS
+1];
122 gss_OID_set mech_name_types
;
127 gss_buffer_desc name_buffer
;
130 status
= val_inq_mechs4name_args(minor_status
, input_name
, mech_set
);
131 if (status
!= GSS_S_COMPLETE
)
134 status
= gss_create_empty_oid_set(minor_status
, mech_set
);
135 if (status
!= GSS_S_COMPLETE
)
138 status
= __gss_get_mechanisms(mech_list
, MAX_MECH_OID_PAIRS
+1);
139 if (status
!= GSS_S_COMPLETE
)
141 for (i
= 0; i
< MAX_MECH_OID_PAIRS
&& mech_list
[i
] != NULL
; i
++) {
142 mechanism
= mech_list
[i
];
143 if (__gss_mech_to_oid(mechanism
, &mechOid
) == GSS_S_COMPLETE
) {
144 status
= gss_inquire_names_for_mech(
148 if (status
== GSS_S_COMPLETE
) {
149 status
= gss_display_name(minor_status
,
154 (void) gss_release_buffer(NULL
, &name_buffer
);
156 if (status
== GSS_S_COMPLETE
&& name_type
) {
157 status
= gss_test_oid_set_member(
162 if (status
== GSS_S_COMPLETE
&&
164 status
= gss_add_oid_set_member(
168 if (status
!= GSS_S_COMPLETE
) {
169 (void) gss_release_oid_set(
172 (void) gss_release_oid_set(
179 (void) gss_release_oid_set(
184 (void) gss_release_oid_set(
187 return (GSS_S_FAILURE
);
190 return (GSS_S_COMPLETE
);