9162 libpp: this statement may fall through
[unleashed.git] / usr / src / lib / libgss / g_process_context.c
blobc2383761a3cf59e5999d2a9a3b6ba3f6c2ddd13f
1 /*
2 * CDDL HEADER START
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]
19 * CDDL HEADER END
22 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
26 * glue routine gss_process_context
29 #include <mechglueP.h>
30 #include "gssapiP_generic.h"
32 OM_uint32
33 gss_process_context_token(minor_status,
34 context_handle,
35 token_buffer)
37 OM_uint32 * minor_status;
38 const gss_ctx_id_t context_handle;
39 gss_buffer_t token_buffer;
42 OM_uint32 status;
43 gss_union_ctx_id_t ctx;
44 gss_mechanism mech;
46 if (minor_status == NULL)
47 return (GSS_S_CALL_INACCESSIBLE_WRITE);
48 *minor_status = 0;
50 if (context_handle == GSS_C_NO_CONTEXT)
51 return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT);
53 if (token_buffer == GSS_C_NO_BUFFER)
54 return (GSS_S_CALL_INACCESSIBLE_READ);
56 if (GSS_EMPTY_BUFFER(token_buffer))
57 return (GSS_S_CALL_INACCESSIBLE_READ);
60 * select the approprate underlying mechanism routine and
61 * call it.
64 ctx = (gss_union_ctx_id_t) context_handle;
65 mech = __gss_get_mechanism(ctx->mech_type);
67 if (mech) {
69 if (mech->gss_process_context_token) {
70 status = mech->gss_process_context_token(
71 mech->context,
72 minor_status,
73 ctx->internal_ctx_id,
74 token_buffer);
75 if (status != GSS_S_COMPLETE)
76 map_error(minor_status, mech);
77 } else
78 status = GSS_S_UNAVAILABLE;
80 return (status);
83 return (GSS_S_BAD_MECH);