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