1 #pragma ident "%Z%%M% %I% %E% SMI" 2 3 /* 4 * lib/krb5/os/accessor.c 5 * 6 * Copyright 1990 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 #include "k5-int.h" 31 #include "os-proto.h" 32 33 /* If this trick gets used elsewhere, move it to k5-platform.h. */ 34 #ifndef DESIGNATED_INITIALIZERS 35 #define DESIGNATED_INITIALIZERS \ 36 /* ANSI/ISO C 1999 supports this... */ \ 37 (__STDC_VERSION__ >= 199901L \ 38 /* ...as does GCC, since version 2.something. */ \ 39 || (!defined __cplusplus && __GNUC__ >= 3)) 40 #endif 41 42 krb5_error_code KRB5_CALLCONV 43 krb5int_accessor(krb5int_access *internals, krb5_int32 version) 44 { 45 if (version == KRB5INT_ACCESS_VERSION) { 46 #if DESIGNATED_INITIALIZERS 47 #define S(FIELD, VAL) .FIELD = VAL 48 static const krb5int_access internals_temp = { 49 #else 50 #define S(FIELD, VAL) internals_temp.FIELD = VAL 51 krb5int_access internals_temp; 52 #endif 53 S (free_addrlist, krb5int_free_addrlist), 54 S (krb5_hmac, krb5_hmac), 55 S (md5_hash_provider, &krb5int_hash_md5), 56 S (arcfour_enc_provider, &krb5int_enc_arcfour), 57 S (sendto_udp, &krb5int_sendto), 58 S (add_host_to_list, krb5int_add_host_to_list), 59 #ifdef KRB5_DNS_LOOKUP 60 S (make_srv_query_realm, krb5int_make_srv_query_realm), 61 S (free_srv_dns_data, krb5int_free_srv_dns_data), 62 S (use_dns_kdc, _krb5_use_dns_kdc), 63 #else 64 S (make_srv_query_realm, 0), 65 S (free_srv_dns_data, 0), 66 S (use_dns_kdc, 0), 67 #endif 68 #ifdef KRB5_KRB4_COMPAT 69 S (krb_life_to_time, krb5int_krb_life_to_time), 70 S (krb_time_to_life, krb5int_krb_time_to_life), 71 S (krb524_encode_v4tkt, krb5int_encode_v4tkt), 72 #else 73 S (krb_life_to_time, 0), 74 S (krb_time_to_life, 0), 75 S (krb524_encode_v4tkt, 0), 76 #endif 77 S (krb5int_c_mandatory_cksumtype, krb5int_c_mandatory_cksumtype), 78 S (krb5_ser_pack_int64, krb5_ser_pack_int64), 79 S (krb5_ser_unpack_int64, krb5_ser_unpack_int64), 80 S (asn1_ldap_encode_sequence_of_keys, krb5int_ldap_encode_sequence_of_keys), 81 S (asn1_ldap_decode_sequence_of_keys, krb5int_ldap_decode_sequence_of_keys), 82 #if DESIGNATED_INITIALIZERS 83 }; 84 #else 85 /*LINTED*/ 86 0; 87 #endif 88 *internals = internals_temp; 89 return 0; 90 } 91 return KRB5_OBSOLETE_FN; 92 } 93