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_delete_sec_context
29 #include <mechglueP.h>
30 #include "gssapiP_generic.h"
38 OM_uint32
*minor_status
,
39 gss_ctx_id_t
*context_handle
,
40 gss_buffer_t output_token
)
43 /* Initialize outputs. */
45 if (minor_status
!= NULL
)
48 if (output_token
!= GSS_C_NO_BUFFER
) {
49 output_token
->length
= 0;
50 output_token
->value
= NULL
;
53 /* Validate arguments. */
55 if (minor_status
== NULL
)
56 return (GSS_S_CALL_INACCESSIBLE_WRITE
);
58 if (context_handle
== NULL
|| *context_handle
== GSS_C_NO_CONTEXT
)
59 return (GSS_S_CALL_INACCESSIBLE_WRITE
| GSS_S_NO_CONTEXT
);
61 return (GSS_S_COMPLETE
);
65 gss_delete_sec_context(minor_status
,
69 OM_uint32
* minor_status
;
70 gss_ctx_id_t
* context_handle
;
71 gss_buffer_t output_token
;
75 gss_union_ctx_id_t ctx
;
77 status
= val_del_sec_ctx_args(minor_status
,
80 if (status
!= GSS_S_COMPLETE
)
84 * select the approprate underlying mechanism routine and
88 ctx
= (gss_union_ctx_id_t
) *context_handle
;
89 if (GSSINT_CHK_LOOP(ctx
))
90 return (GSS_S_CALL_INACCESSIBLE_READ
| GSS_S_NO_CONTEXT
);
92 status
= gssint_delete_internal_sec_context(minor_status
,
94 &ctx
->internal_ctx_id
,
99 /* now free up the space for the union context structure */
100 free(ctx
->mech_type
->elements
);
101 free(ctx
->mech_type
);
102 free(*context_handle
);
103 *context_handle
= GSS_C_NO_CONTEXT
;
105 return (GSS_S_COMPLETE
);