-: 0:Source:g_inq_context.c -: 0:Graph:/var/tsitkova/Sources/v10/trunk/src/lib/gssapi/mechglue/g_inq_context.so.gcno -: 0:Data:/var/tsitkova/Sources/v10/trunk/src/lib/gssapi/mechglue/g_inq_context.so.gcda -: 0:Runs:1069 -: 0:Programs:1 -: 1:/* #pragma ident "@(#)g_inquire_context.c 1.15 04/02/23 SMI" */ -: 2: -: 3:/* -: 4: * Copyright 1996 by Sun Microsystems, Inc. -: 5: * -: 6: * Permission to use, copy, modify, distribute, and sell this software -: 7: * and its documentation for any purpose is hereby granted without fee, -: 8: * provided that the above copyright notice appears in all copies and -: 9: * that both that copyright notice and this permission notice appear in -: 10: * supporting documentation, and that the name of Sun Microsystems not be used -: 11: * in advertising or publicity pertaining to distribution of the software -: 12: * without specific, written prior permission. Sun Microsystems makes no -: 13: * representations about the suitability of this software for any -: 14: * purpose. It is provided "as is" without express or implied warranty. -: 15: * -: 16: * SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -: 17: * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -: 18: * EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR -: 19: * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF -: 20: * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -: 21: * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -: 22: * PERFORMANCE OF THIS SOFTWARE. -: 23: */ -: 24: -: 25:/* -: 26: * glue routine for gss_inquire_context -: 27: */ -: 28: -: 29:#include "mglueP.h" -: 30:#ifdef HAVE_STDLIB_H -: 31:#include -: 32:#endif -: 33: -: 34:static OM_uint32 97: 35:val_inq_ctx_args( -: 36: OM_uint32 *minor_status, -: 37: gss_ctx_id_t context_handle, -: 38: gss_name_t *src_name, -: 39: gss_name_t *targ_name, -: 40: OM_uint32 *lifetime_rec, -: 41: gss_OID *mech_type, -: 42: OM_uint32 *ctx_flags, -: 43: int *locally_initiated, -: 44: int *opened) -: 45:{ -: 46: -: 47: /* Initialize outputs. */ -: 48: 97: 49: if (minor_status != NULL) 97: 50: *minor_status = 0; -: 51: 97: 52: if (src_name != NULL) 60: 53: *src_name = GSS_C_NO_NAME; -: 54: 97: 55: if (targ_name != NULL) 97: 56: *targ_name = GSS_C_NO_NAME; -: 57: 97: 58: if (mech_type != NULL) 48: 59: *mech_type = GSS_C_NO_OID; -: 60: -: 61: /* Validate arguments. */ -: 62: 97: 63: if (minor_status == NULL) #####: 64: return (GSS_S_CALL_INACCESSIBLE_WRITE); -: 65: 97: 66: if (context_handle == GSS_C_NO_CONTEXT) #####: 67: return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT); -: 68: 97: 69: return (GSS_S_COMPLETE); -: 70:} -: 71: -: 72: -: 73:/* Last argument new for V2 */ -: 74:OM_uint32 KRB5_CALLCONV 97: 75:gss_inquire_context( -: 76: OM_uint32 *minor_status, -: 77: gss_ctx_id_t context_handle, -: 78: gss_name_t *src_name, -: 79: gss_name_t *targ_name, -: 80: OM_uint32 *lifetime_rec, -: 81: gss_OID *mech_type, -: 82: OM_uint32 *ctx_flags, -: 83: int *locally_initiated, -: 84: int *opened) -: 85:{ -: 86: gss_union_ctx_id_t ctx; -: 87: gss_mechanism mech; -: 88: OM_uint32 status, temp_minor; 97: 89: gss_name_t localTargName = NULL, localSourceName = NULL; -: 90: 97: 91: status = val_inq_ctx_args(minor_status, -: 92: context_handle, -: 93: src_name, targ_name, -: 94: lifetime_rec, -: 95: mech_type, ctx_flags, -: 96: locally_initiated, opened); 97: 97: if (status != GSS_S_COMPLETE) #####: 98: return (status); -: 99: -: 100: /* -: 101: * select the approprate underlying mechanism routine and -: 102: * call it. -: 103: */ -: 104: 97: 105: ctx = (gss_union_ctx_id_t) context_handle; 97: 106: mech = gssint_get_mechanism (ctx->mech_type); -: 107: 194: 108: if (!mech || !mech->gss_inquire_context || !mech->gss_display_name || 97: 109: !mech->gss_release_name) { #####: 110: return (GSS_S_UNAVAILABLE); -: 111: } -: 112: 97: 113: status = mech->gss_inquire_context( -: 114: minor_status, -: 115: ctx->internal_ctx_id, -: 116: (src_name ? &localSourceName : NULL), -: 117: (targ_name ? &localTargName : NULL), -: 118: lifetime_rec, -: 119: NULL, -: 120: ctx_flags, -: 121: locally_initiated, -: 122: opened); -: 123: 97: 124: if (status != GSS_S_COMPLETE) { #####: 125: map_error(minor_status, mech); #####: 126: return status; -: 127: } -: 128: -: 129: /* need to convert names */ -: 130: 97: 131: if (src_name) { 60: 132: status = gssint_convert_name_to_union_name(minor_status, mech, -: 133: localSourceName, src_name); -: 134: 60: 135: if (status != GSS_S_COMPLETE) { #####: 136: if (localTargName) #####: 137: mech->gss_release_name(&temp_minor, &localTargName); #####: 138: return (status); -: 139: } -: 140: -: 141: } -: 142: 97: 143: if (targ_name) { 97: 144: if (localTargName) { 97: 145: status = gssint_convert_name_to_union_name(minor_status, mech, -: 146: localTargName, targ_name); -: 147: 97: 148: if (status != GSS_S_COMPLETE) { #####: 149: if (src_name) #####: 150: (void) gss_release_name(&temp_minor, src_name); -: 151: #####: 152: return (status); -: 153: } -: 154: } -: 155: else { #####: 156: *targ_name = GSS_C_NO_NAME; -: 157: } -: 158: } -: 159: -: 160: /* spec says mech type must point to static storage */ 97: 161: if (mech_type) 48: 162: *mech_type = &mech->mech_type; 97: 163: return(GSS_S_COMPLETE); -: 164:}