1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /* lib/krb5/os/accessor.c */
3 /*
4 * Copyright 1990, 2008 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 #include "k5-int.h"
28 #include "os-proto.h"
29 #include "../krb/int-proto.h"
30
31 /* If this trick gets used elsewhere, move it to k5-platform.h. */
32 #ifndef DESIGNATED_INITIALIZERS
33 /* ANSI/ISO C 1999 supports this... */
34 #if __STDC_VERSION__ >= 199901L \
35 /* ...as does GCC, since version 2.something. */ \
36 || (!defined __cplusplus && __GNUC__ >= 3)
37 #define DESIGNATED_INITIALIZERS 1
38 #else
39 #define DESIGNATED_INITIALIZERS 0
40 #endif
41 #endif
42
43 krb5_error_code KRB5_CALLCONV
krb5int_accessor(krb5int_access * internals,krb5_int32 version)44 krb5int_accessor(krb5int_access *internals, krb5_int32 version)
45 {
46 if (version == KRB5INT_ACCESS_VERSION) {
47 #if DESIGNATED_INITIALIZERS
48 #define S(FIELD, VAL) .FIELD = VAL
49 #if defined __GNUC__ && __STDC_VERSION__ < 199901L
50 __extension__
51 #endif
52 static const krb5int_access internals_temp = {
53 #else
54 #define S(FIELD, VAL) internals_temp.FIELD = VAL
55 krb5int_access internals_temp;
56 #endif
57 S (auth_con_get_subkey_enctype, krb5_auth_con_get_subkey_enctype),
58
59 #ifndef LEAN_CLIENT
60 #define SC(FIELD, VAL) S(FIELD, VAL)
61 #else /* disable */
62 #define SC(FIELD, VAL) S(FIELD, 0)
63 #endif
64 SC (ser_pack_int64, krb5_ser_pack_int64),
65 SC (ser_unpack_int64, krb5_ser_unpack_int64),
66 #undef SC
67
68 #ifdef ENABLE_LDAP
69 #define SC(FIELD, VAL) S(FIELD, VAL)
70 #else
71 #define SC(FIELD, VAL) S(FIELD, 0)
72 #endif
73 SC (asn1_ldap_encode_sequence_of_keys, krb5int_ldap_encode_sequence_of_keys),
74 SC (asn1_ldap_decode_sequence_of_keys, krb5int_ldap_decode_sequence_of_keys),
75 #undef SC
76
77 #ifndef DISABLE_PKINIT
78 #define SC(FIELD, VAL) S(FIELD, VAL)
79 #else /* disable */
80 #define SC(FIELD, VAL) S(FIELD, 0)
81 #endif
82 SC (encode_krb5_pa_pk_as_req, encode_krb5_pa_pk_as_req),
83 SC (encode_krb5_pa_pk_as_rep, encode_krb5_pa_pk_as_rep),
84 SC (encode_krb5_auth_pack, encode_krb5_auth_pack),
85 SC (encode_krb5_kdc_dh_key_info, encode_krb5_kdc_dh_key_info),
86 SC (encode_krb5_reply_key_pack, encode_krb5_reply_key_pack),
87 SC (encode_krb5_td_trusted_certifiers, encode_krb5_td_trusted_certifiers),
88 SC (encode_krb5_td_dh_parameters, encode_krb5_td_dh_parameters),
89 SC (decode_krb5_pa_pk_as_req, decode_krb5_pa_pk_as_req),
90 SC (decode_krb5_pa_pk_as_rep, decode_krb5_pa_pk_as_rep),
91 SC (decode_krb5_auth_pack, decode_krb5_auth_pack),
92 SC (decode_krb5_kdc_dh_key_info, decode_krb5_kdc_dh_key_info),
93 SC (decode_krb5_principal_name, decode_krb5_principal_name),
94 SC (decode_krb5_reply_key_pack, decode_krb5_reply_key_pack),
95 SC (decode_krb5_td_trusted_certifiers, decode_krb5_td_trusted_certifiers),
96 SC (decode_krb5_td_dh_parameters, decode_krb5_td_dh_parameters),
97 SC (encode_krb5_kdc_req_body, encode_krb5_kdc_req_body),
98 SC (free_kdc_req, krb5_free_kdc_req),
99 SC (set_prompt_types, k5_set_prompt_types),
100 #undef SC
101
102 #if DESIGNATED_INITIALIZERS
103 };
104 #else
105 0;
106 #endif
107 *internals = internals_temp;
108 return 0;
109 }
110 return KRB5_OBSOLETE_FN;
111 }
112