ldap/ldif/template-dse.ldif.in | 2 +-
ldap/servers/slapd/log.c | 28 +++++++++++++---------------
m4/systemd.m4 | 2 +-
rpm/389-ds-base.spec.in | 5 +++++
4 files changed, 20 insertions(+), 17 deletions(-)
New commits:
commit 42a3a68dc144f483e1dfbdc837193345b6d0fe22
Author: William Brown <firstyear(a)redhat.com>
Date: Thu Feb 11 10:31:01 2016 +1000
Ticket 47968 - When systemd libs not found, error instead of continuing.
Bug Description: Systemd-devel isn't installed, we still build and weird
things happen.
Fix Description: Make sure to error if we have --with-systemd and no
systemd-devel package
https://fedorahosted.org/389/ticket/47968
Author: wibrown
Review by: One line patch
diff --git a/m4/systemd.m4 b/m4/systemd.m4
index 4f9533b..1c62076 100644
--- a/m4/systemd.m4
+++ b/m4/systemd.m4
@@ -30,7 +30,7 @@ if test "$with_systemd" = yes; then
systemd_lib=`$PKG_CONFIG --libs-only-l systemd libsystemd-journal
libsystemd-daemon`
systemd_defs="-DWITH_SYSTEMD"
else
- AC_MSG_RESULT([no Systemd pkg-config files])
+ AC_MSG_ERROR([no Systemd pkg-config files])
fi
fi
commit ef53e0c70c6e67da971c0a1d999fa47730b0ce4f
Author: William Brown <firstyear(a)redhat.com>
Date: Tue Feb 9 11:47:17 2016 +1030
Ticket 47968 - Fix for issues with multiple log backends
Bug Description:
* Did not correctly use str formats in the output to journald_print
* Due to a change strcmp api, the values were not checked properly
* The default template did not have the correct backend value
Fix Description:
* Correctly use string formats to avoid compilation errors
* Fix the check for values of strcmp
* Fix the template to include dirsrv-log
* The rpm spec to include the correct systemd libraries
https://fedorahosted.org/389/ticket/47968
Author: wibrown
Review by: nhosoi (Thanks!)
diff --git a/ldap/ldif/template-dse.ldif.in b/ldap/ldif/template-dse.ldif.in
index 6c62aaa..f18c082 100644
--- a/ldap/ldif/template-dse.ldif.in
+++ b/ldap/ldif/template-dse.ldif.in
@@ -62,7 +62,7 @@ nsslapd-ndn-cache-enabled: on
nsslapd-sasl-mapping-fallback: off
nsslapd-dynamic-plugins: off
nsslapd-allow-hashed-passwords: off
-nsslapd-logging-backend: 1
+nsslapd-logging-backend: dirsrv-log
dn: cn=features,cn=config
objectclass: top
diff --git a/ldap/servers/slapd/log.c b/ldap/servers/slapd/log.c
index 07bc762..8b22297 100644
--- a/ldap/servers/slapd/log.c
+++ b/ldap/servers/slapd/log.c
@@ -393,21 +393,18 @@ log_set_logging(const char *attrname, char *value, int logtype, char
*errorbuf,
int
log_set_backend(const char *attrname, char *value, int logtype, char *errorbuf, int
apply) {
- int retval = LDAP_SUCCESS;
int backend = 0;
char *backendstr = NULL; /* The backend we are looking at */
char *token = NULL; /* String to tokenise, need to dup value */
char *next = NULL; /* The next value */
-
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
/* We don't need to bother checking log type ... */
- if ( !apply || !value || !*value ) {
- return retval;
+ if ( !value || !*value ) {
+ return LDAP_OPERATIONS_ERROR;
}
-
/* We have a comma seperated list. So split it up */
token = slapi_ch_strdup(value);
for (backendstr = ldap_utf8strtok_r(token, ",", &next);
@@ -417,12 +414,12 @@ log_set_backend(const char *attrname, char *value, int logtype, char
*errorbuf,
if(strlen(backendstr) == 0) {
/* Probably means someone did ",,"*/
continue;
- } else if (slapi_UTF8NCASECMP(backendstr, "dirsrv-log", 10) ) {
+ } else if (slapi_UTF8NCASECMP(backendstr, "dirsrv-log", 10) == 0 ) {
backend |= LOGGING_BACKEND_INTERNAL;
- } else if (slapi_UTF8NCASECMP(backendstr, "syslog", 6) ) {
+ } else if (slapi_UTF8NCASECMP(backendstr, "syslog", 6) == 0) {
backend |= LOGGING_BACKEND_SYSLOG;
#ifdef WITH_SYSTEMD
- } else if (slapi_UTF8NCASECMP(backendstr, "journald", 8) ) {
+ } else if (slapi_UTF8NCASECMP(backendstr, "journald", 8) == 0 ) {
backend |= LOGGING_BACKEND_JOURNALD;
#endif
}
@@ -436,20 +433,21 @@ log_set_backend(const char *attrname, char *value, int logtype, char
*errorbuf,
#endif
) {
/* There is probably a better error here .... */
- retval = LDAP_OPERATIONS_ERROR;
- } else {
+ return LDAP_OPERATIONS_ERROR;
+ }
+ if ( apply ) {
/* We have a valid backend, set it */
/*
* We just need to use any lock here, doesn't matter which.
*/
- LOG_ACCESS_LOCK_WRITE( );
+ LOG_ACCESS_LOCK_WRITE( );
loginfo.log_backend = backend;
slapi_ch_free_string(&(slapdFrontendConfig->logging_backend));
slapdFrontendConfig->logging_backend = slapi_ch_strdup(value);
- LOG_ACCESS_UNLOCK_WRITE( );
+ LOG_ACCESS_UNLOCK_WRITE( );
}
- return retval;
+ return LDAP_SUCCESS;
}
/******************************************************************************
* Tell me the access log file name inc path
@@ -1985,7 +1983,7 @@ slapd_log_audit (
}
#ifdef WITH_SYSTEMD
if (lbackend & LOGGING_BACKEND_JOURNALD) {
- retval = sd_journal_print(LOG_NOTICE, buffer);
+ retval = sd_journal_print(LOG_NOTICE, "%s", buffer);
}
#endif
return retval;
@@ -2044,7 +2042,7 @@ slapd_log_auditfail (
}
#ifdef WITH_SYSTEMD
if (lbackend & LOGGING_BACKEND_JOURNALD) {
- retval = sd_journal_print(LOG_NOTICE, buffer);
+ retval = sd_journal_print(LOG_NOTICE, "%s", buffer);
}
#endif
return retval;
diff --git a/rpm/389-ds-base.spec.in b/rpm/389-ds-base.spec.in
index 8cc2818..9adc6f0 100644
--- a/rpm/389-ds-base.spec.in
+++ b/rpm/389-ds-base.spec.in
@@ -78,6 +78,7 @@ BuildRequires: tcp_wrappers
# the following is for the pam passthru auth plug-in
BuildRequires: pam-devel
BuildRequires: systemd-units
+BuildRequires: systemd-devel
# this is needed for using semanage from our setup scripts
Requires: policycoreutils-python
@@ -122,6 +123,7 @@ Requires: perl-Socket6
Requires: perl-Socket
%endif
Requires: perl-NetAddr-IP
+Requires: systemd-libs
Source0:
http://port389.org/sources/%{name}-%{version}%{?prerel}.tar.bz2
# 389-ds-git.sh should be used to generate the source tarball from git
@@ -169,6 +171,7 @@ BuildRequires: /usr/bin/xsltproc
BuildRequires: valgrind-devel
%endif
%endif
+BuildRequires: systemd-devel
%description libs
Core libraries for the 389 Directory Server base package. These libraries
@@ -193,6 +196,8 @@ Requires: libtalloc
Requires: libevent
Requires: libtevent
%endif
+Requires: systemd-libs
+
%description devel
Development Libraries and headers for the 389 Directory Server base package.