Path: blob/main/crypto/krb5/src/lib/gssapi/mechglue/g_context_time.c
39586 views
/* #pragma ident "@(#)g_context_time.c 1.12 98/01/22 SMI" */12/*3* Copyright 1996 by Sun Microsystems, Inc.4*5* Permission to use, copy, modify, distribute, and sell this software6* and its documentation for any purpose is hereby granted without fee,7* provided that the above copyright notice appears in all copies and8* that both that copyright notice and this permission notice appear in9* supporting documentation, and that the name of Sun Microsystems not be used10* in advertising or publicity pertaining to distribution of the software11* without specific, written prior permission. Sun Microsystems makes no12* representations about the suitability of this software for any13* purpose. It is provided "as is" without express or implied warranty.14*15* SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,16* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO17* EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR18* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF19* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR20* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR21* PERFORMANCE OF THIS SOFTWARE.22*/2324/*25* glue routines for gss_context_time26*/2728#include "mglueP.h"2930OM_uint32 KRB5_CALLCONV31gss_context_time(OM_uint32 * minor_status, gss_ctx_id_t context_handle,32OM_uint32 * time_rec)33{34OM_uint32 status;35gss_union_ctx_id_t ctx;36gss_mechanism mech;3738if (minor_status == NULL)39return (GSS_S_CALL_INACCESSIBLE_WRITE);40*minor_status = 0;4142if (time_rec == NULL)43return (GSS_S_CALL_INACCESSIBLE_WRITE);4445if (context_handle == GSS_C_NO_CONTEXT)46return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT);4748/*49* select the approprate underlying mechanism routine and50* call it.51*/5253ctx = (gss_union_ctx_id_t) context_handle;54if (ctx->internal_ctx_id == GSS_C_NO_CONTEXT)55return (GSS_S_NO_CONTEXT);56mech = gssint_get_mechanism (ctx->mech_type);5758if (mech) {5960if (mech->gss_context_time) {61status = mech->gss_context_time(62minor_status,63ctx->internal_ctx_id,64time_rec);65if (status != GSS_S_COMPLETE)66map_error(minor_status, mech);67} else68status = GSS_S_UNAVAILABLE;6970return(status);71}7273return (GSS_S_BAD_MECH);74}757677