1 /* 2 * lib/krb5/os/accessor.c 3 * 4 * Copyright 1990 by the Massachusetts Institute of Technology. 5 * All Rights Reserved. 6 * 7 * Export of this software from the United States of America may 8 * require a specific license from the United States Government. 9 * It is the responsibility of any person or organization contemplating 10 * export to obtain such a license before exporting. 11 * 12 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and 13 * distribute this software and its documentation for any purpose and 14 * without fee is hereby granted, provided that the above copyright 15 * notice appear in all copies and that both that copyright notice and 16 * this permission notice appear in supporting documentation, and that 17 * the name of M.I.T. not be used in advertising or publicity pertaining 18 * to distribution of the software without specific, written prior 19 * permission. Furthermore if you modify this software you must label 20 * your software as modified software and not distribute it in such a 21 * fashion that it might be confused with the original M.I.T. software. 22 * M.I.T. makes no representations about the suitability of 23 * this software for any purpose. It is provided "as is" without express 24 * or implied warranty. 25 * 26 */ 27 28 #include "k5-int.h" 29 #include "os-proto.h" 30 31 /* If this trick gets used elsewhere, move it to k5-platform.h. */ 32 #ifndef DESIGNATED_INITIALIZERS 33 #define DESIGNATED_INITIALIZERS \ 34 /* ANSI/ISO C 1999 supports this... */ \ 35 (__STDC_VERSION__ >= 199901L \ 36 /* ...as does GCC, since version 2.something. */ \ 37 || (!defined __cplusplus && __GNUC__ >= 3)) 38 #endif 39 40 krb5_error_code KRB5_CALLCONV 41 krb5int_accessor(krb5int_access *internals, krb5_int32 version) 42 { 43 if (version == KRB5INT_ACCESS_VERSION) { 44 #if DESIGNATED_INITIALIZERS 45 #define S(FIELD, VAL) .FIELD = VAL 46 static const krb5int_access internals_temp = { 47 #else 48 #define S(FIELD, VAL) internals_temp.FIELD = VAL 49 krb5int_access internals_temp; 50 #endif 51 S (free_addrlist, krb5int_free_addrlist), 52 S (krb5_hmac, krb5_hmac), 53 S (md5_hash_provider, &krb5int_hash_md5), 54 S (arcfour_enc_provider, &krb5int_enc_arcfour), 55 S (sendto_udp, &krb5int_sendto), 56 S (add_host_to_list, krb5int_add_host_to_list), 57 #ifdef KRB5_DNS_LOOKUP 58 S (make_srv_query_realm, krb5int_make_srv_query_realm), 59 S (free_srv_dns_data, krb5int_free_srv_dns_data), 60 S (use_dns_kdc, _krb5_use_dns_kdc), 61 #else 62 S (make_srv_query_realm, 0), 63 S (free_srv_dns_data, 0), 64 S (use_dns_kdc, 0), 65 #endif 66 S (clean_hostname, krb5int_clean_hostname), 67 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 S (encode_krb5_pa_pk_as_req, encode_krb5_pa_pk_as_req), 83 S (encode_krb5_pa_pk_as_req_draft9, encode_krb5_pa_pk_as_req_draft9), 84 S (encode_krb5_pa_pk_as_rep, encode_krb5_pa_pk_as_rep), 85 S (encode_krb5_pa_pk_as_rep_draft9, encode_krb5_pa_pk_as_rep_draft9), 86 S (encode_krb5_auth_pack, encode_krb5_auth_pack), 87 S (encode_krb5_auth_pack_draft9, encode_krb5_auth_pack_draft9), 88 S (encode_krb5_kdc_dh_key_info, encode_krb5_kdc_dh_key_info), 89 S (encode_krb5_reply_key_pack, encode_krb5_reply_key_pack), 90 S (encode_krb5_reply_key_pack_draft9, encode_krb5_reply_key_pack_draft9), 91 S (encode_krb5_typed_data, encode_krb5_typed_data), 92 S (encode_krb5_td_trusted_certifiers, encode_krb5_td_trusted_certifiers), 93 S (encode_krb5_td_dh_parameters, encode_krb5_td_dh_parameters), 94 S (decode_krb5_pa_pk_as_req, decode_krb5_pa_pk_as_req), 95 S (decode_krb5_pa_pk_as_req_draft9, decode_krb5_pa_pk_as_req_draft9), 96 S (decode_krb5_pa_pk_as_rep, decode_krb5_pa_pk_as_rep), 97 S (decode_krb5_pa_pk_as_rep_draft9, decode_krb5_pa_pk_as_rep_draft9), 98 S (decode_krb5_auth_pack, decode_krb5_auth_pack), 99 S (decode_krb5_auth_pack_draft9, decode_krb5_auth_pack_draft9), 100 S (decode_krb5_kdc_dh_key_info, decode_krb5_kdc_dh_key_info), 101 S (decode_krb5_principal_name, decode_krb5_principal_name), 102 S (decode_krb5_reply_key_pack, decode_krb5_reply_key_pack), 103 S (decode_krb5_reply_key_pack_draft9, decode_krb5_reply_key_pack_draft9), 104 S (decode_krb5_typed_data, decode_krb5_typed_data), 105 S (decode_krb5_td_trusted_certifiers, decode_krb5_td_trusted_certifiers), 106 S (decode_krb5_td_dh_parameters, decode_krb5_td_dh_parameters), 107 S (decode_krb5_as_req, decode_krb5_as_req), 108 S (encode_krb5_kdc_req_body, encode_krb5_kdc_req_body), 109 S (krb5_free_kdc_req, krb5_free_kdc_req), 110 S (krb5int_set_prompt_types, krb5int_set_prompt_types), 111 S (encode_krb5_authdata_elt, encode_krb5_authdata_elt), 112 #if DESIGNATED_INITIALIZERS 113 }; 114 #else 115 /*LINTED*/ 116 0; 117 #endif 118 *internals = internals_temp; 119 return 0; 120 } 121 return KRB5_OBSOLETE_FN; 122 } 123