937546
From 349014688322df67509f44d51f232237e2a7ca7d Mon Sep 17 00:00:00 2001
937546
From: Robbie Harwood <rharwood@redhat.com>
937546
Date: Fri, 2 Aug 2019 15:55:20 -0400
937546
Subject: [PATCH] Log INFO message when LDAP connection fails on startup
937546
937546
Since krb5_klog_syslog() always needs parameters from syslog.h, move the
937546
include into ipa_krb5.h.
937546
937546
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
937546
Reviewed-By: Christian Heimes <cheimes@redhat.com>
937546
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
937546
---
937546
 daemons/ipa-kdb/ipa_kdb.c          | 6 ++++--
937546
 daemons/ipa-kdb/ipa_kdb_audit_as.c | 1 -
937546
 daemons/ipa-kdb/ipa_kdb_certauth.c | 1 -
937546
 daemons/ipa-kdb/ipa_kdb_mspac.c    | 1 -
937546
 util/ipa_krb5.h                    | 1 +
937546
 5 files changed, 5 insertions(+), 5 deletions(-)
937546
937546
diff --git a/daemons/ipa-kdb/ipa_kdb.c b/daemons/ipa-kdb/ipa_kdb.c
937546
index c90f8d9caf247874c6bda58eb33c7733c4709b02..0dcc74263263423da6b1f4d8441ee149bce24c58 100644
937546
--- a/daemons/ipa-kdb/ipa_kdb.c
937546
+++ b/daemons/ipa-kdb/ipa_kdb.c
937546
@@ -24,6 +24,7 @@
937546
 #include <sys/utsname.h>
937546
 
937546
 #include "ipa_kdb.h"
937546
+#include "ipa_krb5.h"
937546
 
937546
 #define IPADB_GLOBAL_CONFIG_CACHE_TIME 60
937546
 
937546
@@ -586,8 +587,9 @@ static krb5_error_code ipadb_init_module(krb5_context kcontext,
937546
 
937546
     ret = ipadb_get_connection(ipactx);
937546
     if (ret != 0) {
937546
-        /* not a fatal failure, as the LDAP server may be temporarily down */
937546
-        /* TODO: spam syslog with this error */
937546
+        /* Not a fatal failure, as the LDAP server may be temporarily down. */
937546
+        krb5_klog_syslog(LOG_INFO,
937546
+                         "Didn't connect to LDAP on startup: %d", ret);
937546
     }
937546
 
937546
     kerr = krb5_db_set_context(kcontext, ipactx);
937546
diff --git a/daemons/ipa-kdb/ipa_kdb_audit_as.c b/daemons/ipa-kdb/ipa_kdb_audit_as.c
937546
index c68a67aa2a0ca9a2dc9e7a2d39c60d8b105fcc06..77748a75d6b16ee4d080a5f53213cc58c81660dc 100644
937546
--- a/daemons/ipa-kdb/ipa_kdb_audit_as.c
937546
+++ b/daemons/ipa-kdb/ipa_kdb_audit_as.c
937546
@@ -20,7 +20,6 @@
937546
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
937546
  */
937546
 
937546
-#include <syslog.h>
937546
 #include "ipa_kdb.h"
937546
 #include "ipa_pwd.h"
937546
 
937546
diff --git a/daemons/ipa-kdb/ipa_kdb_certauth.c b/daemons/ipa-kdb/ipa_kdb_certauth.c
937546
index 82589f2f92096400b2f586a65eec962229c3daf7..47911aa3ded56efe4d47acb78d94ccdbcdca7339 100644
937546
--- a/daemons/ipa-kdb/ipa_kdb_certauth.c
937546
+++ b/daemons/ipa-kdb/ipa_kdb_certauth.c
937546
@@ -39,7 +39,6 @@
937546
 
937546
 #include <errno.h>
937546
 //#include <krb5/certauth_plugin.h>
937546
-#include <syslog.h>
937546
 #include <sss_certmap.h>
937546
 
937546
 #include "ipa_krb5.h"
937546
diff --git a/daemons/ipa-kdb/ipa_kdb_mspac.c b/daemons/ipa-kdb/ipa_kdb_mspac.c
937546
index 329a5c11586ccd7004dd17e503133f9fda7e8395..74cbb77cccb45188f7bd8a1a33085f8ef964930f 100644
937546
--- a/daemons/ipa-kdb/ipa_kdb_mspac.c
937546
+++ b/daemons/ipa-kdb/ipa_kdb_mspac.c
937546
@@ -25,7 +25,6 @@
937546
 #include "ipa_kdb.h"
937546
 #include "ipa_mspac.h"
937546
 #include <talloc.h>
937546
-#include <syslog.h>
937546
 #include <unicase.h>
937546
 #include "util/time.h"
937546
 #include "gen_ndr/ndr_krb5pac.h"
937546
diff --git a/util/ipa_krb5.h b/util/ipa_krb5.h
937546
index 60a8ced5d8a63532254b3703801d2aeb9ff45892..b039c1a7f3d0bc215376f8f1dd2ac93e75a0c626 100644
937546
--- a/util/ipa_krb5.h
937546
+++ b/util/ipa_krb5.h
937546
@@ -3,6 +3,7 @@
937546
 #include <lber.h>
937546
 #include <krb5/krb5.h>
937546
 #include <kdb.h>
937546
+#include <syslog.h>
937546
 
937546
 struct krb_key_salt {
937546
     krb5_enctype enctype;
937546
-- 
937546
2.20.1
937546