ac7d03
From 1c421b3874488c0021a5e0d344be31c84c2b4bd0 Mon Sep 17 00:00:00 2001
ac7d03
From: Sumit Bose <sbose@redhat.com>
ac7d03
Date: Mon, 27 Mar 2017 13:19:57 +0200
ac7d03
Subject: [PATCH] ipa-kdb: do not depend on certauth_plugin.h
ac7d03
ac7d03
Related to https://pagure.io/freeipa/issue/4905
ac7d03
ac7d03
Reviewed-By: Christian Heimes <cheimes@redhat.com>
ac7d03
---
ac7d03
 configure.ac              | 2 ++
ac7d03
 daemons/ipa-kdb/ipa_kdb.c | 2 ++
ac7d03
 daemons/ipa-kdb/ipa_kdb.h | 8 ++++++++
ac7d03
 3 files changed, 12 insertions(+)
ac7d03
ac7d03
diff --git a/configure.ac b/configure.ac
ac7d03
index 8d4b82e4590e9e122f7aa5684fd78834c4b6a204..ded1d71fd079a5f6947ef0627fb699783c8cc109 100644
ac7d03
--- a/configure.ac
ac7d03
+++ b/configure.ac
ac7d03
@@ -231,6 +231,8 @@ dnl ---------------------------------------------------------------------------
ac7d03
 AM_CONDITIONAL([BUILD_IPA_CERTAUTH_PLUGIN],
ac7d03
                [test x$have_certauth_plugin = xyes -a x"$SSSCERTMAP_LIBS" != x])
ac7d03
 AM_COND_IF([BUILD_IPA_CERTAUTH_PLUGIN], [
ac7d03
+    AC_DEFINE([HAVE_KRB5_CERTAUTH_PLUGIN], [1],
ac7d03
+        [MIT Kerberos version supports certauth plugin])
ac7d03
     AM_COND_IF([ENABLE_SERVER],
ac7d03
                [AC_MSG_NOTICE([Build IPA KDB certauth plugin])],
ac7d03
                [AC_MSG_WARN([Cannot build IPA KDB certauth plugin])])
ac7d03
diff --git a/daemons/ipa-kdb/ipa_kdb.c b/daemons/ipa-kdb/ipa_kdb.c
ac7d03
index a961e4e57cf5379eb237551d56e3bc8dc82d952d..050bfc90cef1bce4c932f54bb6050438c60ca79f 100644
ac7d03
--- a/daemons/ipa-kdb/ipa_kdb.c
ac7d03
+++ b/daemons/ipa-kdb/ipa_kdb.c
ac7d03
@@ -67,7 +67,9 @@ static void ipadb_context_free(krb5_context kcontext,
ac7d03
         }
ac7d03
         free(cfg->authz_data);
ac7d03
 
ac7d03
+#ifdef HAVE_KRB5_CERTAUTH_PLUGIN
ac7d03
         ipa_certauth_free_moddata(&((*ctx)->certauth_moddata));
ac7d03
+#endif
ac7d03
 
ac7d03
         free(*ctx);
ac7d03
         *ctx = NULL;
ac7d03
diff --git a/daemons/ipa-kdb/ipa_kdb.h b/daemons/ipa-kdb/ipa_kdb.h
ac7d03
index 632c1979d15e88aec86d5e408ed6c7017d8362b8..72573a61adecfae152796d61b88b6c43b3a975a3 100644
ac7d03
--- a/daemons/ipa-kdb/ipa_kdb.h
ac7d03
+++ b/daemons/ipa-kdb/ipa_kdb.h
ac7d03
@@ -30,6 +30,8 @@
ac7d03
  * filtering purposes */
ac7d03
 #define SECURID 1
ac7d03
 
ac7d03
+#include "config.h"
ac7d03
+
ac7d03
 #include <errno.h>
ac7d03
 #include <kdb.h>
ac7d03
 #include <ldap.h>
ac7d03
@@ -40,7 +42,9 @@
ac7d03
 #include <arpa/inet.h>
ac7d03
 #include <endian.h>
ac7d03
 #include <unistd.h>
ac7d03
+#ifdef HAVE_KRB5_CERTAUTH_PLUGIN
ac7d03
 #include <krb5/certauth_plugin.h>
ac7d03
+#endif
ac7d03
 
ac7d03
 #include "ipa_krb5.h"
ac7d03
 #include "ipa_pwd.h"
ac7d03
@@ -112,7 +116,9 @@ struct ipadb_context {
ac7d03
     krb5_key_salt_tuple *def_encs;
ac7d03
     int n_def_encs;
ac7d03
     struct ipadb_mspac *mspac;
ac7d03
+#ifdef HAVE_KRB5_CERTAUTH_PLUGIN
ac7d03
     krb5_certauth_moddata certauth_moddata;
ac7d03
+#endif
ac7d03
 
ac7d03
     /* Don't access this directly, use ipadb_get_global_config(). */
ac7d03
     struct ipadb_global_config config;
ac7d03
@@ -334,5 +340,7 @@ int ipadb_get_enc_salt_types(struct ipadb_context *ipactx, LDAPMessage *entry,
ac7d03
                              char *attr, krb5_key_salt_tuple **enc_salt_types,
ac7d03
                              int *n_enc_salt_types);
ac7d03
 
ac7d03
+#ifdef HAVE_KRB5_CERTAUTH_PLUGIN
ac7d03
 /* CERTAUTH PLUGIN */
ac7d03
 void ipa_certauth_free_moddata(krb5_certauth_moddata *moddata);
ac7d03
+#endif
ac7d03
-- 
ac7d03
2.12.1
ac7d03