]> eyrie.org Git - kerberos/krb5-strength.git/blob - portable/kadmin.h
Change my email address to eagle@eyrie.org
[kerberos/krb5-strength.git] / portable / kadmin.h
1 /*
2  * Portability wrapper around kadm5/admin.h.
3  *
4  * This header adjusts for differences between the MIT and Heimdal kadmin
5  * client libraries so that the code can be written to a consistent API
6  * (favoring the Heimdal API as the exposed one).
7  *
8  * The canonical version of this file is maintained in the rra-c-util package,
9  * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
10  *
11  * Written by Russ Allbery <eagle@eyrie.org>
12  *
13  * The authors hereby relinquish any claim to any copyright that they may have
14  * in this work, whether granted under contract or by operation of law or
15  * international treaty, and hereby commit to the public, at large, that they
16  * shall not, at any time in the future, seek to enforce any copyright in this
17  * work against any person or entity, or prevent any person or entity from
18  * copying, publishing, distributing or creating derivative works of this
19  * work.
20  */
21
22 #ifndef PORTABLE_KADMIN_H
23 #define PORTABLE_KADMIN_H 1
24
25 #include <config.h>
26
27 #include <kadm5/admin.h>
28 #ifdef HAVE_KADM5_KADM5_ERR_H
29 # include <kadm5/kadm5_err.h>
30 #else
31 # include <kadm5/kadm_err.h>
32 #endif
33
34 /*
35  * MIT as of 1.10 supports version 3.  Heimdal as of 1.5 has a maximum version
36  * of 2.  Define a KADM5_API_VERSION symbol that holds the maximum version.
37  * (Heimdal does this for us, so we only have to do that with MIT, but be
38  * general just in case.)
39  */
40 #ifndef KADM5_API_VERSION
41 # ifdef KADM5_API_VERSION_3
42 #  define KADM5_API_VERSION KADM5_API_VERSION_3
43 # else
44 #  define KADM5_API_VERSION KADM5_API_VERSION_2
45 # endif
46 #endif
47
48 /* Heimdal doesn't define KADM5_PASS_Q_GENERIC. */
49 #ifndef KADM5_PASS_Q_GENERIC
50 # define KADM5_PASS_Q_GENERIC KADM5_PASS_Q_DICT
51 #endif
52
53 /*
54  * Heimdal provides _ctx functions that take an existing context.  MIT always
55  * requires the context be passed in.  Code should use the _ctx variant, and
56  * the below will fix it up if built against MIT.
57  *
58  * MIT also doesn't have a const prototype for the server argument, so cast it
59  * so that we can use the KADM5_ADMIN_SERVICE define.
60  */
61 #ifndef HAVE_KADM5_INIT_WITH_SKEY_CTX
62 # define kadm5_init_with_skey_ctx(c, u, k, s, p, sv, av, h) \
63     kadm5_init_with_skey((c), (u), (k), (char *) (s), (p), (sv), (av), NULL, \
64                          (h))
65 #endif
66
67 #endif /* !PORTABLE_KADMIN_H */