17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*5e01956fSGlenn Barry  * Common Development and Distribution License (the "License").
6*5e01956fSGlenn Barry  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*5e01956fSGlenn Barry  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
237c478bd9Sstevel@tonic-gate  */
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate /*
267c478bd9Sstevel@tonic-gate  *  glue routines for gss_context_time
277c478bd9Sstevel@tonic-gate  */
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #include <mechglueP.h>
30*5e01956fSGlenn Barry #include "gssapiP_generic.h"
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate OM_uint32
gss_context_time(minor_status,context_handle,time_rec)337c478bd9Sstevel@tonic-gate gss_context_time(minor_status,
347c478bd9Sstevel@tonic-gate 			context_handle,
357c478bd9Sstevel@tonic-gate 			time_rec)
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate OM_uint32 *			minor_status;
387c478bd9Sstevel@tonic-gate const gss_ctx_id_t		context_handle;
397c478bd9Sstevel@tonic-gate OM_uint32 *			time_rec;
407c478bd9Sstevel@tonic-gate {
417c478bd9Sstevel@tonic-gate 	OM_uint32			status;
427c478bd9Sstevel@tonic-gate 	gss_union_ctx_id_t		ctx;
437c478bd9Sstevel@tonic-gate 	gss_mechanism		mech;
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate 	if (minor_status == NULL)
467c478bd9Sstevel@tonic-gate 		return (GSS_S_CALL_INACCESSIBLE_WRITE);
477c478bd9Sstevel@tonic-gate 	*minor_status = 0;
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate 	if (time_rec == NULL)
507c478bd9Sstevel@tonic-gate 		return (GSS_S_CALL_INACCESSIBLE_WRITE);
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate 	if (context_handle == GSS_C_NO_CONTEXT)
537c478bd9Sstevel@tonic-gate 		return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT);
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate 	/*
567c478bd9Sstevel@tonic-gate 	 * select the approprate underlying mechanism routine and
577c478bd9Sstevel@tonic-gate 	 * call it.
587c478bd9Sstevel@tonic-gate 	 */
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate 	ctx = (gss_union_ctx_id_t) context_handle;
617c478bd9Sstevel@tonic-gate 	mech = __gss_get_mechanism(ctx->mech_type);
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate 	if (mech) {
647c478bd9Sstevel@tonic-gate 
65*5e01956fSGlenn Barry 		if (mech->gss_context_time) {
667c478bd9Sstevel@tonic-gate 			status = mech->gss_context_time(
677c478bd9Sstevel@tonic-gate 							mech->context,
687c478bd9Sstevel@tonic-gate 							minor_status,
697c478bd9Sstevel@tonic-gate 							ctx->internal_ctx_id,
707c478bd9Sstevel@tonic-gate 							time_rec);
71*5e01956fSGlenn Barry 			if (status != GSS_S_COMPLETE)
72*5e01956fSGlenn Barry 				map_error(minor_status, mech);
73*5e01956fSGlenn Barry 		} else
747c478bd9Sstevel@tonic-gate 			status = GSS_S_UNAVAILABLE;
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate 		return (status);
777c478bd9Sstevel@tonic-gate 	}
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate 	return (GSS_S_BAD_MECH);
807c478bd9Sstevel@tonic-gate }
81