Blame src/lib/gssapi/mechglue/g_context_time.c

Packit fd8b60
/* #pragma ident	"@(#)g_context_time.c	1.12	98/01/22 SMI" */
Packit fd8b60
Packit fd8b60
/*
Packit fd8b60
 * Copyright 1996 by Sun Microsystems, Inc.
Packit fd8b60
 *
Packit fd8b60
 * Permission to use, copy, modify, distribute, and sell this software
Packit fd8b60
 * and its documentation for any purpose is hereby granted without fee,
Packit fd8b60
 * provided that the above copyright notice appears in all copies and
Packit fd8b60
 * that both that copyright notice and this permission notice appear in
Packit fd8b60
 * supporting documentation, and that the name of Sun Microsystems not be used
Packit fd8b60
 * in advertising or publicity pertaining to distribution of the software
Packit fd8b60
 * without specific, written prior permission. Sun Microsystems makes no
Packit fd8b60
 * representations about the suitability of this software for any
Packit fd8b60
 * purpose.  It is provided "as is" without express or implied warranty.
Packit fd8b60
 *
Packit fd8b60
 * SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
Packit fd8b60
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
Packit fd8b60
 * EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
Packit fd8b60
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
Packit fd8b60
 * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
Packit fd8b60
 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
Packit fd8b60
 * PERFORMANCE OF THIS SOFTWARE.
Packit fd8b60
 */
Packit fd8b60
Packit fd8b60
/*
Packit fd8b60
 *  glue routines for gss_context_time
Packit fd8b60
 */
Packit fd8b60
Packit fd8b60
#include "mglueP.h"
Packit fd8b60
Packit fd8b60
OM_uint32 KRB5_CALLCONV
Packit fd8b60
gss_context_time (minor_status,
Packit fd8b60
                  context_handle,
Packit fd8b60
                  time_rec)
Packit fd8b60
Packit fd8b60
OM_uint32 *		minor_status;
Packit fd8b60
gss_ctx_id_t		context_handle;
Packit fd8b60
OM_uint32 *		time_rec;
Packit fd8b60
Packit fd8b60
{
Packit fd8b60
    OM_uint32		status;
Packit fd8b60
    gss_union_ctx_id_t	ctx;
Packit fd8b60
    gss_mechanism	mech;
Packit fd8b60
Packit fd8b60
    if (minor_status == NULL)
Packit fd8b60
	return (GSS_S_CALL_INACCESSIBLE_WRITE);
Packit fd8b60
    *minor_status = 0;
Packit fd8b60
Packit fd8b60
    if (time_rec == NULL)
Packit fd8b60
	return (GSS_S_CALL_INACCESSIBLE_WRITE);
Packit fd8b60
Packit fd8b60
    if (context_handle == GSS_C_NO_CONTEXT)
Packit fd8b60
	return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT);
Packit fd8b60
Packit fd8b60
    /*
Packit fd8b60
     * select the approprate underlying mechanism routine and
Packit fd8b60
     * call it.
Packit fd8b60
     */
Packit fd8b60
Packit fd8b60
    ctx = (gss_union_ctx_id_t) context_handle;
Packit fd8b60
    if (ctx->internal_ctx_id == GSS_C_NO_CONTEXT)
Packit fd8b60
	return (GSS_S_NO_CONTEXT);
Packit fd8b60
    mech = gssint_get_mechanism (ctx->mech_type);
Packit fd8b60
Packit fd8b60
    if (mech) {
Packit fd8b60
Packit fd8b60
	if (mech->gss_context_time) {
Packit fd8b60
	    status = mech->gss_context_time(
Packit fd8b60
					    minor_status,
Packit fd8b60
					    ctx->internal_ctx_id,
Packit fd8b60
					    time_rec);
Packit fd8b60
	    if (status != GSS_S_COMPLETE)
Packit fd8b60
		map_error(minor_status, mech);
Packit fd8b60
	} else
Packit fd8b60
	    status = GSS_S_UNAVAILABLE;
Packit fd8b60
Packit fd8b60
	return(status);
Packit fd8b60
    }
Packit fd8b60
Packit fd8b60
    return (GSS_S_BAD_MECH);
Packit fd8b60
}