1 #pragma ident "%Z%%M% %I% %E% SMI" 2 3 /* 4 * lib/gssapi/krb5/inq_names.c 5 * 6 * Copyright 1995 by the Massachusetts Institute of Technology. 7 * All Rights Reserved. 8 * 9 * Export of this software from the United States of America may 10 * require a specific license from the United States Government. 11 * It is the responsibility of any person or organization contemplating 12 * export to obtain such a license before exporting. 13 * 14 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and 15 * distribute this software and its documentation for any purpose and 16 * without fee is hereby granted, provided that the above copyright 17 * notice appear in all copies and that both that copyright notice and 18 * this permission notice appear in supporting documentation, and that 19 * the name of M.I.T. not be used in advertising or publicity pertaining 20 * to distribution of the software without specific, written prior 21 * permission. Furthermore if you modify this software you must label 22 * your software as modified software and not distribute it in such a 23 * fashion that it might be confused with the original M.I.T. software. 24 * M.I.T. makes no representations about the suitability of 25 * this software for any purpose. It is provided "as is" without express 26 * or implied warranty. 27 * 28 */ 29 30 /* 31 * inq_names.c - Return set of nametypes supported by the KRB5 mechanism. 32 */ 33 #include "gssapiP_krb5.h" 34 #include "mglueP.h" 35 36 OM_uint32 37 krb5_gss_inquire_names_for_mech(minor_status, mechanism, name_types) 38 OM_uint32 *minor_status; 39 gss_OID mechanism; 40 gss_OID_set *name_types; 41 { 42 OM_uint32 major, minor; 43 44 /* 45 * We only know how to handle our own mechanism. 46 */ 47 if ((mechanism != GSS_C_NULL_OID) && 48 !g_OID_equal(gss_mech_krb5, mechanism) && 49 !g_OID_equal(gss_mech_krb5_old, mechanism)) { 50 *minor_status = 0; 51 return(GSS_S_BAD_MECH); 52 } 53 54 /* We're okay. Create an empty OID set */ 55 major = gss_create_empty_oid_set(minor_status, name_types); 56 if (major == GSS_S_COMPLETE) { 57 /* Now add our members. */ 58 if ( 59 ((major = generic_gss_add_oid_set_member(minor_status, 60 gss_nt_user_name, 61 name_types) 62 ) == GSS_S_COMPLETE) && 63 ((major = generic_gss_add_oid_set_member(minor_status, 64 gss_nt_machine_uid_name, 65 name_types) 66 ) == GSS_S_COMPLETE) && 67 ((major = generic_gss_add_oid_set_member(minor_status, 68 gss_nt_string_uid_name, 69 name_types) 70 ) == GSS_S_COMPLETE) && 71 ((major = generic_gss_add_oid_set_member(minor_status, 72 gss_nt_service_name, 73 name_types) 74 ) == GSS_S_COMPLETE) && 75 ((major = generic_gss_add_oid_set_member(minor_status, 76 gss_nt_service_name_v2, 77 name_types) 78 ) == GSS_S_COMPLETE) && 79 ((major = generic_gss_add_oid_set_member(minor_status, 80 gss_nt_exported_name, 81 name_types) 82 ) == GSS_S_COMPLETE) && 83 ((major = generic_gss_add_oid_set_member(minor_status, 84 (const gss_OID) gss_nt_krb5_name, 85 name_types) 86 ) == GSS_S_COMPLETE) 87 ) { 88 major = generic_gss_add_oid_set_member(minor_status, 89 (const gss_OID) gss_nt_krb5_principal, 90 name_types); 91 } 92 93 /* 94 * If we choked, then release the set, but don't overwrite the minor 95 * status with the release call. 96 */ 97 if (major != GSS_S_COMPLETE) 98 (void) gss_release_oid_set(&minor, 99 name_types); 100 } 101 return(major); 102 } 103