python-kadmin
python-kadmin copied to clipboard
Compile fails on Fedora 22
Hello,
Great project, I've been looking for something like this for a long time.
Unfortunately, compiling fails on Fedora 22 with this:
src/PyKAdminObject.c:365:16: error: too few arguments to function ‘krb5_db_iterate’
code = krb5_db_iterate(self->context, match, kdb_iter_princs, (void *)self);
The /usr/include/kdb.h in krb5-devel-1.13.2-3 (the version that comes with Fedora 22) defines krb5_db_iterate as:
krb5_error_code krb5_db_iterate ( krb5_context kcontext,
char *match_entry,
int (*func) (krb5_pointer, krb5_db_entry *),
krb5_pointer func_arg, krb5_flags iterflags );
I assume that this was an API break that happened at a major version (not sure which one). In kdb.h, there is a #define KRB5_KDB_API_VERSION 8, so it should be fixable with something like:
#if KRB5_KDB_API_VERSION > [whatever]
// call with 5 arguments
#else
// call with 4 arguments
#endif
Unfortunately, I don't know exactly which version that change was made at.
Upon further investigation, RHEL7's libkrb5-devel uses #define KRB5_KDB_API_VERSION 7, and has the 4 argument version of krb5_db_iterate. So, the pre-processor conditional should look like:
#if (KRB5_KDB_API_VERSION > 7)
// call krb5_db_iterate with 5 arguments
#else
// call krb5_db_iterate with 4 arguments
#endif
Just ran into the same thing. Here's the commit, confirming that
- the change happened for API version 8
- and the new flags argument can just be 0
https://github.com/krb5/krb5/commit/ab009b8568d9b64b7e992ecdb98114e895b4a7ff