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