From 5a800b1f6c62a25cc219cf11942ebcc9bbd07e3d Mon Sep 17 00:00:00 2001 From: Ivan Rako Date: Wed, 7 Dec 2011 13:31:40 +0100 Subject: [PATCH] sredjene cp_get_ldap_suffix i cp_get_ldap_realm za slapd.d --- carnet-tools.7 | 4 ++-- debian/changelog | 8 ++++++++ functions.sh | 27 ++++++++++++++++----------- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/carnet-tools.7 b/carnet-tools.7 index 6847069..a590d7c 100644 --- a/carnet-tools.7 +++ b/carnet-tools.7 @@ -142,10 +142,10 @@ Funkcija je namijenjena koristenju na mjestu gdje se inace poziva predradnje, od \fB. /usr/share/debconf/confmodule\fR nadalje. .TP \fBcp_get_ldap_suffix\fR -Funkcija vraca LDAP suffix kojeg cita iz \fI/etc/ldap/slapd.conf\fR. +Funkcija vraca LDAP suffix kojeg cita iz \fI/etc/ldap/slapd.d/\fR. .TP \fBcp_get_ldap_realm\fR -Funkcija vraca LDAP realm kojeg cita iz \fI/etc/ldap/slapd.conf\fR. +Funkcija vraca LDAP realm kojeg cita iz \fI/etc/ldap/slapd.d/\fR. .TP \fBcp_get_mx_domain\fR Funkcija vraca najopcenitiju domenu ciji MX zapis pokazuje diff --git a/debian/changelog b/debian/changelog index 9431ae2..a6af08c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +carnet-tools-cn (3.0.1) stable; urgency=low + + * Ispravke u cp_get_ldap_suffix (u squeezeu je konfiguracija u + /etc/ldap/slap.d) + * Izmijenjen manpage + + -- Ivan Rako Wed, 07 Dec 2011 13:23:11 +0100 + carnet-tools-cn (3.0.0) stable; urgency=low * Prvo izdanje za squeeze diff --git a/functions.sh b/functions.sh index 24c7cf9..96d132f 100644 --- a/functions.sh +++ b/functions.sh @@ -438,7 +438,7 @@ cp_db_get() { fi } -# by ico, Wed, 20 Apr 2005 21:09:54 +0200 +# by ico, Wed, 07 Dec 2011 13:30:02 +0100 cp_get_ldap_suffix() { [ "$CP_SCRIPT_DEBUG" ] && set -vx @@ -448,22 +448,25 @@ cp_get_ldap_suffix() { # but preserving initial state so it could be used afterwards CP_ECHO_RETURN="" - if [ ! -f /etc/ldap/slapd.conf ]; then - echo "cp_get_ldap_suffix: /etc/ldap/slapd.conf: No such file" >&2 + if [ ! -d /etc/ldap/slapd.d/ ]; then + echo "cp_get_ldap_suffix: /etc/ldap/slapd.d/: No such directory" >&2 return 2 fi - RET="`awk '/^suffix/ { exit } - END { gsub(/"/, "", $2); print $2 }' \ - < /etc/ldap/slapd.conf`" + #RET="`awk '/^suffix/ { exit } + # END { gsub(/"/, "", $2); print $2 }' \ + # < /etc/ldap/slapd.conf`" + + RET="`grep -r olcSuffix /etc/ldap/slapd.d/|awk '{print $2}'`" if [ "`echo $RET | sed 's/,/ /g' | wc -w`" -gt 2 ]; then RET="" - echo "cp_get_ldap_suffix: Invalid LDAP suffix in /etc/ldap/slapd.conf" >&2 + echo "cp_get_ldap_suffix: Invalid LDAP suffix in /etc/ldap/slapd.d/" >&2 return 2 fi + - [ -z "$RET" ] && echo "cp_get_ldap_suffix: No LDAP suffix in /etc/ldap/slapd.conf" >&2 + [ -z "$RET" ] && echo "cp_get_ldap_suffix: No LDAP suffix in /etc/ldap/slapd.d/" >&2 [ -z "$echo_return" ] || echo $RET CP_ECHO_RETURN="$echo_return" } @@ -478,15 +481,17 @@ cp_get_ldap_realm() { # but preserving initial state so it could be used afterwards CP_ECHO_RETURN="" - if [ ! -f /etc/ldap/slapd.conf ]; then - echo "cp_get_ldap_realm: /etc/ldap/slapd.conf: No such file" >&2 + if [ ! -f /etc/ldap/slapd.d/ ]; then + echo "cp_get_ldap_realm: /etc/ldap/slapd.d/: No such directory" >&2 return 2 fi cp_get_ldap_suffix || true RET="`echo $RET | awk -F, '{print $1}' | awk -F= '{print $2}'`" - [ -z "$RET" ] && echo "cp_get_ldap_realm: No LDAP REALM in /etc/ldap/slapd.conf" >&2 + [ -z "$RET" ] && echo "cp_get_ldap_realm: No LDAP REALM in /etc/ldap/slapd.d/" >&2 + [ -z "$echo_return" ] || echo $RET + CP_ECHO_RETURN="$echo_return" } # if fqdn is name.dom3.dom2.dom1.hr, check if this host is MX for -- 1.7.10.4