xref: /onnv-gate/usr/src/lib/libgss/g_context_time.c (revision 13132:9615cdbf7b70)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*13132SGlenn.Barry@oracle.com  * Common Development and Distribution License (the "License").
6*13132SGlenn.Barry@oracle.com  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*13132SGlenn.Barry@oracle.com  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
230Sstevel@tonic-gate  */
240Sstevel@tonic-gate 
250Sstevel@tonic-gate /*
260Sstevel@tonic-gate  *  glue routines for gss_context_time
270Sstevel@tonic-gate  */
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #include <mechglueP.h>
30*13132SGlenn.Barry@oracle.com #include "gssapiP_generic.h"
310Sstevel@tonic-gate 
320Sstevel@tonic-gate OM_uint32
gss_context_time(minor_status,context_handle,time_rec)330Sstevel@tonic-gate gss_context_time(minor_status,
340Sstevel@tonic-gate 			context_handle,
350Sstevel@tonic-gate 			time_rec)
360Sstevel@tonic-gate 
370Sstevel@tonic-gate OM_uint32 *			minor_status;
380Sstevel@tonic-gate const gss_ctx_id_t		context_handle;
390Sstevel@tonic-gate OM_uint32 *			time_rec;
400Sstevel@tonic-gate {
410Sstevel@tonic-gate 	OM_uint32			status;
420Sstevel@tonic-gate 	gss_union_ctx_id_t		ctx;
430Sstevel@tonic-gate 	gss_mechanism		mech;
440Sstevel@tonic-gate 
450Sstevel@tonic-gate 	if (minor_status == NULL)
460Sstevel@tonic-gate 		return (GSS_S_CALL_INACCESSIBLE_WRITE);
470Sstevel@tonic-gate 	*minor_status = 0;
480Sstevel@tonic-gate 
490Sstevel@tonic-gate 	if (time_rec == NULL)
500Sstevel@tonic-gate 		return (GSS_S_CALL_INACCESSIBLE_WRITE);
510Sstevel@tonic-gate 
520Sstevel@tonic-gate 	if (context_handle == GSS_C_NO_CONTEXT)
530Sstevel@tonic-gate 		return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT);
540Sstevel@tonic-gate 
550Sstevel@tonic-gate 	/*
560Sstevel@tonic-gate 	 * select the approprate underlying mechanism routine and
570Sstevel@tonic-gate 	 * call it.
580Sstevel@tonic-gate 	 */
590Sstevel@tonic-gate 
600Sstevel@tonic-gate 	ctx = (gss_union_ctx_id_t) context_handle;
610Sstevel@tonic-gate 	mech = __gss_get_mechanism(ctx->mech_type);
620Sstevel@tonic-gate 
630Sstevel@tonic-gate 	if (mech) {
640Sstevel@tonic-gate 
65*13132SGlenn.Barry@oracle.com 		if (mech->gss_context_time) {
660Sstevel@tonic-gate 			status = mech->gss_context_time(
670Sstevel@tonic-gate 							mech->context,
680Sstevel@tonic-gate 							minor_status,
690Sstevel@tonic-gate 							ctx->internal_ctx_id,
700Sstevel@tonic-gate 							time_rec);
71*13132SGlenn.Barry@oracle.com 			if (status != GSS_S_COMPLETE)
72*13132SGlenn.Barry@oracle.com 				map_error(minor_status, mech);
73*13132SGlenn.Barry@oracle.com 		} else
740Sstevel@tonic-gate 			status = GSS_S_UNAVAILABLE;
750Sstevel@tonic-gate 
760Sstevel@tonic-gate 		return (status);
770Sstevel@tonic-gate 	}
780Sstevel@tonic-gate 
790Sstevel@tonic-gate 	return (GSS_S_BAD_MECH);
800Sstevel@tonic-gate }
81