-: 0:Source:g_inq_names.c -: 0:Graph:/var/tsitkova/Sources/v10/trunk/src/lib/gssapi/mechglue/g_inq_names.so.gcno -: 0:Data:/var/tsitkova/Sources/v10/trunk/src/lib/gssapi/mechglue/g_inq_names.so.gcda -: 0:Runs:1069 -: 0:Programs:1 -: 1:/* #pragma ident "@(#)g_inquire_names.c 1.16 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: -: 31:#define MAX_MECH_OID_PAIRS 32 -: 32: -: 33:/* Last argument new for V2 */ -: 34:OM_uint32 KRB5_CALLCONV 48: 35:gss_inquire_names_for_mech(minor_status, mechanism, name_types) -: 36: -: 37:OM_uint32 * minor_status; -: 38:gss_OID mechanism; -: 39:gss_OID_set * name_types; -: 40: -: 41:{ -: 42: OM_uint32 status; -: 43: gss_mechanism mech; -: 44: -: 45: /* Initialize outputs. */ -: 46: 48: 47: if (minor_status != NULL) 48: 48: *minor_status = 0; -: 49: 48: 50: if (name_types != NULL) 48: 51: *name_types = GSS_C_NO_OID_SET; -: 52: -: 53: /* Validate arguments. */ -: 54: 48: 55: if (minor_status == NULL) #####: 56: return (GSS_S_CALL_INACCESSIBLE_WRITE); -: 57: 48: 58: if (name_types == NULL) #####: 59: return (GSS_S_CALL_INACCESSIBLE_WRITE); -: 60: -: 61: /* -: 62: * select the approprate underlying mechanism routine and -: 63: * call it. -: 64: */ -: 65: 48: 66: mech = gssint_get_mechanism (mechanism); -: 67: 48: 68: if (mech) { -: 69: 48: 70: if (mech->gss_inquire_names_for_mech) { 48: 71: status = mech->gss_inquire_names_for_mech( -: 72: minor_status, -: 73: mechanism, -: 74: name_types); 48: 75: if (status != GSS_S_COMPLETE) #####: 76: map_error(minor_status, mech); -: 77: } else #####: 78: status = GSS_S_UNAVAILABLE; -: 79: 48: 80: return(status); -: 81: } -: 82: #####: 83: return (GSS_S_BAD_MECH); -: 84:} -: 85: -: 86:static OM_uint32 #####: 87:val_inq_mechs4name_args( -: 88: OM_uint32 *minor_status, -: 89: const gss_name_t input_name, -: 90: gss_OID_set *mech_set) -: 91:{ -: 92: -: 93: /* Initialize outputs. */ #####: 94: if (minor_status != NULL) #####: 95: *minor_status = 0; -: 96: #####: 97: if (mech_set != NULL) #####: 98: *mech_set = GSS_C_NO_OID_SET; -: 99: -: 100: /* Validate arguments.e -: 101: */ #####: 102: if (minor_status == NULL) #####: 103: return (GSS_S_CALL_INACCESSIBLE_WRITE); -: 104: #####: 105: if (input_name == GSS_C_NO_NAME) #####: 106: return (GSS_S_BAD_NAME); -: 107: #####: 108: return (GSS_S_COMPLETE); -: 109:} -: 110: -: 111: -: 112:OM_uint32 KRB5_CALLCONV #####: 113:gss_inquire_mechs_for_name(minor_status, input_name, mech_set) -: 114: -: 115: OM_uint32 * minor_status; -: 116: const gss_name_t input_name; -: 117: gss_OID_set * mech_set; -: 118: -: 119:{ -: 120: OM_uint32 status; -: 121: static char *mech_list[MAX_MECH_OID_PAIRS+1]; -: 122: gss_OID_set mech_name_types; -: 123: int present; -: 124: char *mechanism; -: 125: gss_OID mechOid; -: 126: gss_OID name_type; -: 127: gss_buffer_desc name_buffer; -: 128: int i; -: 129: #####: 130: status = val_inq_mechs4name_args(minor_status, input_name, mech_set); #####: 131: if (status != GSS_S_COMPLETE) #####: 132: return (status); -: 133: #####: 134: status = gss_create_empty_oid_set(minor_status, mech_set); #####: 135: if (status != GSS_S_COMPLETE) #####: 136: return (status); #####: 137: *mech_list = NULL; #####: 138: status = gssint_get_mechanisms(mech_list, MAX_MECH_OID_PAIRS+1); #####: 139: if (status != GSS_S_COMPLETE) #####: 140: return (status); #####: 141: for (i = 0; i < MAX_MECH_OID_PAIRS && mech_list[i] != NULL; i++) { #####: 142: mechanism = mech_list[i]; #####: 143: if (gssint_mech_to_oid(mechanism, &mechOid) == GSS_S_COMPLETE) { #####: 144: status = gss_inquire_names_for_mech( -: 145: minor_status, -: 146: mechOid, -: 147: &mech_name_types); #####: 148: if (status == GSS_S_COMPLETE) { #####: 149: status = gss_display_name(minor_status, -: 150: input_name, -: 151: &name_buffer, -: 152: &name_type); -: 153: #####: 154: (void) gss_release_buffer(NULL, &name_buffer); -: 155: #####: 156: if (status == GSS_S_COMPLETE && name_type) { #####: 157: status = gss_test_oid_set_member( -: 158: minor_status, -: 159: name_type, -: 160: mech_name_types, -: 161: &present); #####: 162: if (status == GSS_S_COMPLETE && #####: 163: present) { #####: 164: status = gss_add_oid_set_member( -: 165: minor_status, -: 166: mechOid, -: 167: mech_set); #####: 168: if (status != GSS_S_COMPLETE) { #####: 169: (void) gss_release_oid_set( -: 170: minor_status, -: 171: &mech_name_types); #####: 172: (void) gss_release_oid_set( -: 173: minor_status, -: 174: mech_set); #####: 175: return (status); -: 176: } -: 177: } -: 178: } #####: 179: (void) gss_release_oid_set( -: 180: minor_status, -: 181: &mech_name_types); -: 182: } -: 183: } else { #####: 184: (void) gss_release_oid_set( -: 185: minor_status, -: 186: mech_set); #####: 187: return (GSS_S_FAILURE); -: 188: } -: 189: } #####: 190: return (GSS_S_COMPLETE); -: 191:}