1/*
2 * CDDL HEADER START
3 *
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.
7 *
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.
12 *
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]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
23 */
24
25/*
26 *  glue routines for gss_context_time
27 */
28
29#include <mechglueP.h>
30#include "gssapiP_generic.h"
31
32OM_uint32
33gss_context_time(minor_status,
34			context_handle,
35			time_rec)
36
37OM_uint32 *			minor_status;
38const gss_ctx_id_t		context_handle;
39OM_uint32 *			time_rec;
40{
41	OM_uint32			status;
42	gss_union_ctx_id_t		ctx;
43	gss_mechanism		mech;
44
45	if (minor_status == NULL)
46		return (GSS_S_CALL_INACCESSIBLE_WRITE);
47	*minor_status = 0;
48
49	if (time_rec == NULL)
50		return (GSS_S_CALL_INACCESSIBLE_WRITE);
51
52	if (context_handle == GSS_C_NO_CONTEXT)
53		return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT);
54
55	/*
56	 * select the approprate underlying mechanism routine and
57	 * call it.
58	 */
59
60	ctx = (gss_union_ctx_id_t) context_handle;
61	mech = __gss_get_mechanism(ctx->mech_type);
62
63	if (mech) {
64
65		if (mech->gss_context_time) {
66			status = mech->gss_context_time(
67							mech->context,
68							minor_status,
69							ctx->internal_ctx_id,
70							time_rec);
71			if (status != GSS_S_COMPLETE)
72				map_error(minor_status, mech);
73		} else
74			status = GSS_S_UNAVAILABLE;
75
76		return (status);
77	}
78
79	return (GSS_S_BAD_MECH);
80}
81