-: 0:Source:delete_sec_context.c -: 0:Graph:/var/tsitkova/Sources/v10/trunk/src/lib/gssapi/krb5/delete_sec_context.so.gcno -: 0:Data:/var/tsitkova/Sources/v10/trunk/src/lib/gssapi/krb5/delete_sec_context.so.gcda -: 0:Runs:1069 -: 0:Programs:1 -: 1:/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -: 2:/* -: 3: * Copyright 1993 by OpenVision Technologies, Inc. -: 4: * -: 5: * Permission to use, copy, modify, distribute, and sell this software -: 6: * and its documentation for any purpose is hereby granted without fee, -: 7: * provided that the above copyright notice appears in all copies and -: 8: * that both that copyright notice and this permission notice appear in -: 9: * supporting documentation, and that the name of OpenVision not be used -: 10: * in advertising or publicity pertaining to distribution of the software -: 11: * without specific, written prior permission. OpenVision makes no -: 12: * representations about the suitability of this software for any -: 13: * purpose. It is provided "as is" without express or implied warranty. -: 14: * -: 15: * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -: 16: * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -: 17: * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR -: 18: * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF -: 19: * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -: 20: * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -: 21: * PERFORMANCE OF THIS SOFTWARE. -: 22: */ -: 23: -: 24:#include "gssapiP_krb5.h" -: 25: -: 26:/* -: 27: * $Id: delete_sec_context.c 25116 2011-08-29 17:20:37Z ghudson $ -: 28: */ -: 29: -: 30:OM_uint32 KRB5_CALLCONV 172: 31:krb5_gss_delete_sec_context(minor_status, context_handle, output_token) -: 32: OM_uint32 *minor_status; -: 33: gss_ctx_id_t *context_handle; -: 34: gss_buffer_t output_token; -: 35:{ -: 36: krb5_context context; -: 37: krb5_gss_ctx_id_rec *ctx; -: 38: 172: 39: if (output_token) { 48: 40: output_token->length = 0; 48: 41: output_token->value = NULL; -: 42: } -: 43: -: 44: /*SUPPRESS 29*/ 172: 45: if (*context_handle == GSS_C_NO_CONTEXT) { 12: 46: *minor_status = 0; 12: 47: return(GSS_S_COMPLETE); -: 48: } -: 49: 160: 50: ctx = (krb5_gss_ctx_id_t) *context_handle; 160: 51: context = ctx->k5_context; -: 52: -: 53: /* construct a delete context token if necessary */ -: 54: 160: 55: if (output_token) { -: 56: OM_uint32 major; -: 57: gss_buffer_desc empty; 48: 58: empty.length = 0; empty.value = NULL; -: 59: 48: 60: if ((major = kg_seal(minor_status, *context_handle, 0, -: 61: GSS_C_QOP_DEFAULT, -: 62: &empty, NULL, output_token, KG_TOK_DEL_CTX))) { #####: 63: save_error_info(*minor_status, context); #####: 64: return(major); -: 65: } -: 66: } -: 67: -: 68: /* free all the context state */ -: 69: 160: 70: if (ctx->seqstate) 160: 71: g_order_free(&(ctx->seqstate)); -: 72: 160: 73: if (ctx->enc) 54: 74: krb5_k_free_key(context, ctx->enc); -: 75: 160: 76: if (ctx->seq) 54: 77: krb5_k_free_key(context, ctx->seq); -: 78: 160: 79: if (ctx->here) 160: 80: kg_release_name(context, &ctx->here); 160: 81: if (ctx->there) 160: 82: kg_release_name(context, &ctx->there); 160: 83: if (ctx->subkey) 160: 84: krb5_k_free_key(context, ctx->subkey); 160: 85: if (ctx->acceptor_subkey) 66: 86: krb5_k_free_key(context, ctx->acceptor_subkey); -: 87: 160: 88: if (ctx->auth_context) { 160: 89: if (ctx->cred_rcache) 6: 90: (void)krb5_auth_con_setrcache(context, ctx->auth_context, NULL); -: 91: 160: 92: krb5_auth_con_free(context, ctx->auth_context); -: 93: } -: 94: 160: 95: if (ctx->mech_used) 160: 96: krb5_gss_release_oid(minor_status, &ctx->mech_used); -: 97: 160: 98: if (ctx->authdata) 56: 99: krb5_free_authdata(context, ctx->authdata); -: 100: 160: 101: if (ctx->k5_context) 160: 102: krb5_free_context(ctx->k5_context); -: 103: -: 104: /* Zero out context */ 160: 105: memset(ctx, 0, sizeof(*ctx)); 160: 106: xfree(ctx); -: 107: -: 108: /* zero the handle itself */ -: 109: 160: 110: *context_handle = GSS_C_NO_CONTEXT; -: 111: 160: 112: *minor_status = 0; 160: 113: return(GSS_S_COMPLETE); -: 114:}