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 <https://www.eyrie.org/~eagle/software/rra-c-util/>. 10 * 11 * Written by Russ Allbery <eagle@eyrie.org> 12 * Copyright 2015 Russ Allbery <eagle@eyrie.org> 13 * Copyright 2011, 2013 14 * The Board of Trustees of the Leland Stanford Junior University 15 * 16 * Copying and distribution of this file, with or without modification, are 17 * permitted in any medium without royalty provided the copyright notice and 18 * this notice are preserved. This file is offered as-is, without any 19 * warranty. 20 * 21 * SPDX-License-Identifier: FSFAP 22 */ 23 24 #ifndef PORTABLE_KADMIN_H 25 #define PORTABLE_KADMIN_H 1 26 27 #include <config.h> 28 29 #include <kadm5/admin.h> 30 #ifdef HAVE_KADM5_KADM5_ERR_H 31 # include <kadm5/kadm5_err.h> 32 #else 33 # include <kadm5/kadm_err.h> 34 #endif 35 36 /* 37 * MIT as of 1.10 supports version 3. Heimdal as of 1.5 has a maximum version 38 * of 2. Define a KADM5_API_VERSION symbol that holds the maximum version. 39 * (Heimdal does this for us, so we only have to do that with MIT, but be 40 * general just in case.) 41 */ 42 #ifndef KADM5_API_VERSION 43 # ifdef KADM5_API_VERSION_3 44 # define KADM5_API_VERSION KADM5_API_VERSION_3 45 # else 46 # define KADM5_API_VERSION KADM5_API_VERSION_2 47 # endif 48 #endif 49 50 /* Heimdal doesn't define KADM5_PASS_Q_GENERIC. */ 51 #ifndef KADM5_PASS_Q_GENERIC 52 # define KADM5_PASS_Q_GENERIC KADM5_PASS_Q_DICT 53 #endif 54 55 /* Heimdal doesn't define KADM5_MISSING_KRB5_CONF_PARAMS. */ 56 #ifndef KADM5_MISSING_KRB5_CONF_PARAMS 57 # define KADM5_MISSING_KRB5_CONF_PARAMS KADM5_MISSING_CONF_PARAMS 58 #endif 59 60 /* 61 * MIT Kerberos provides this function for pure kadmin clients to get a 62 * Kerberos context. With Heimdal, just use krb5_init_context. 63 */ 64 #ifndef HAVE_KADM5_INIT_KRB5_CONTEXT 65 # define kadm5_init_krb5_context(c) krb5_init_context(c) 66 #endif 67 68 /* 69 * Heimdal provides _ctx functions that take an existing context. MIT always 70 * requires the context be passed in. Code should use the _ctx variant, and 71 * the below will fix it up if built against MIT. 72 * 73 * MIT also doesn't have a const prototype for the server argument, so cast it 74 * so that we can use the KADM5_ADMIN_SERVICE define. 75 */ 76 #ifndef HAVE_KADM5_INIT_WITH_SKEY_CTX 77 # define kadm5_init_with_skey_ctx(c, u, k, s, p, sv, av, h) \ 78 kadm5_init_with_skey((c), (u), (k), (char *) (s), (p), (sv), (av), \ 79 NULL, (h)) 80 #endif 81 82 #endif /* !PORTABLE_KADMIN_H */ 83