Path: blob/main/crypto/krb5/src/lib/gssapi/mechglue/g_process_context.c
39586 views
/* #pragma ident "@(#)g_process_context.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 routine gss_process_context26*/2728#include "mglueP.h"2930OM_uint32 KRB5_CALLCONV31gss_process_context_token(OM_uint32 *minor_status, gss_ctx_id_t context_handle,32gss_buffer_t token_buffer)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 (context_handle == GSS_C_NO_CONTEXT)43return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT);4445if (token_buffer == GSS_C_NO_BUFFER)46return (GSS_S_CALL_INACCESSIBLE_READ);4748if (GSS_EMPTY_BUFFER(token_buffer))49return (GSS_S_CALL_INACCESSIBLE_READ);5051/*52* select the approprate underlying mechanism routine and53* call it.54*/5556ctx = (gss_union_ctx_id_t) context_handle;57if (ctx->internal_ctx_id == GSS_C_NO_CONTEXT)58return (GSS_S_NO_CONTEXT);59mech = gssint_get_mechanism (ctx->mech_type);6061if (mech) {6263if (mech->gss_process_context_token) {64status = mech->gss_process_context_token(65minor_status,66ctx->internal_ctx_id,67token_buffer);68if (status != GSS_S_COMPLETE)69map_error(minor_status, mech);70} else71status = GSS_S_UNAVAILABLE;7273return(status);74}7576return (GSS_S_BAD_MECH);77}787980