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"
35 OM_uint32
*minor_status
,
36 gss_ctx_id_t context_handle
,
38 gss_name_t
*targ_name
,
42 /* Initialize outputs. */
44 if (minor_status
!= NULL
)
48 *src_name
= GSS_C_NO_NAME
;
50 if (targ_name
!= NULL
)
51 *targ_name
= GSS_C_NO_NAME
;
53 if (mech_type
!= NULL
)
54 *mech_type
= GSS_C_NO_OID
;
56 /* Validate arguments. */
58 if (minor_status
== NULL
)
59 return (GSS_S_CALL_INACCESSIBLE_WRITE
);
61 if (context_handle
== GSS_C_NO_CONTEXT
)
62 return (GSS_S_CALL_INACCESSIBLE_READ
| GSS_S_NO_CONTEXT
);
64 return (GSS_S_COMPLETE
);
67 /* Last argument new for V2 */
70 OM_uint32
*minor_status
,
71 gss_ctx_id_t context_handle
,
73 gss_name_t
*targ_name
,
74 OM_uint32
*lifetime_rec
,
77 int *locally_initiated
,
80 gss_union_ctx_id_t ctx
;
82 OM_uint32 status
, temp_minor
;
83 gss_name_t localTargName
= NULL
, localSourceName
= NULL
;
85 status
= val_inq_ctx_args(minor_status
,
90 if (status
!= GSS_S_COMPLETE
)
94 * select the approprate underlying mechanism routine and
98 ctx
= (gss_union_ctx_id_t
)context_handle
;
99 mech
= __gss_get_mechanism(ctx
->mech_type
);
101 if (!mech
|| !mech
->gss_inquire_context
|| !mech
->gss_display_name
||
102 !mech
->gss_release_name
) {
103 return (GSS_S_UNAVAILABLE
);
106 status
= mech
->gss_inquire_context(
109 ctx
->internal_ctx_id
,
110 (src_name
? &localSourceName
: NULL
),
111 (targ_name
? &localTargName
: NULL
),
118 if (status
!= GSS_S_COMPLETE
) {
119 map_error(minor_status
, mech
);
123 /* need to convert names */
125 status
= __gss_convert_name_to_union_name(minor_status
, mech
,
126 localSourceName
, src_name
);
127 if (status
!= GSS_S_COMPLETE
) {
129 mech
->gss_release_name(mech
->context
,
130 &temp_minor
, &localTargName
);
136 status
= __gss_convert_name_to_union_name(minor_status
, mech
,
137 localTargName
, targ_name
);
139 if (status
!= GSS_S_COMPLETE
) {
141 (void) gss_release_name(&temp_minor
, src_name
);
147 /* spec says mech type must point to static storage */
149 *mech_type
= &mech
->mech_type
;
150 return (GSS_S_COMPLETE
);