xref: /titanic_52/usr/src/lib/libgss/g_context_time.c (revision 25cf1a301a396c38e8adf52c15f537b80d2483f7)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1996,1997, by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 /*
30  *  glue routines for gss_context_time
31  */
32 
33 #include <mechglueP.h>
34 
35 OM_uint32
36 gss_context_time(minor_status,
37 			context_handle,
38 			time_rec)
39 
40 OM_uint32 *			minor_status;
41 const gss_ctx_id_t		context_handle;
42 OM_uint32 *			time_rec;
43 {
44 	OM_uint32			status;
45 	gss_union_ctx_id_t		ctx;
46 	gss_mechanism		mech;
47 
48 	if (minor_status == NULL)
49 		return (GSS_S_CALL_INACCESSIBLE_WRITE);
50 	*minor_status = 0;
51 
52 	if (time_rec == NULL)
53 		return (GSS_S_CALL_INACCESSIBLE_WRITE);
54 
55 	if (context_handle == GSS_C_NO_CONTEXT)
56 		return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT);
57 
58 	/*
59 	 * select the approprate underlying mechanism routine and
60 	 * call it.
61 	 */
62 
63 	ctx = (gss_union_ctx_id_t) context_handle;
64 	mech = __gss_get_mechanism(ctx->mech_type);
65 
66 	if (mech) {
67 
68 		if (mech->gss_context_time)
69 			status = mech->gss_context_time(
70 							mech->context,
71 							minor_status,
72 							ctx->internal_ctx_id,
73 							time_rec);
74 		else
75 			status = GSS_S_UNAVAILABLE;
76 
77 		return (status);
78 	}
79 
80 	return (GSS_S_BAD_MECH);
81 }
82