[Pkg-openldap-devel] [openldap] 02/03: fix slapd.d ldifs with commented lines (#723957)

Ryan Tandy rtandy-guest at moszumanska.debian.org
Tue Apr 8 17:16:21 UTC 2014


This is an automated email from the git hooks/post-receive script.

rtandy-guest pushed a commit to branch master
in repository openldap.

commit 57b0cc5ae377b00219e73be87e0c3a151b5eda99
Author: Ryan Tandy <ryan at nardis.ca>
Date:   Mon Apr 7 19:59:58 2014 -0700

    fix slapd.d ldifs with commented lines (#723957)
---
 debian/changelog            | 4 ++++
 debian/slapd.scripts-common | 6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 7b2ab3c..4301dcd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,10 @@ openldap (2.4.39-2) UNRELEASED; urgency=low
 
   * 0001-ITS-7723-fix-reference-counting.patch: import upstream fix for 
     CVE-2013-4449. Thanks to Hideki Yamane for the patch. (Closes: #729367)
+  * slapd.scripts-common:
+    - Anchor grep patterns to avoid matching commented lines in ldif files 
+      under cn=config. (Closes: #723957)
+    - Don't silently ignore nonexistent directories that should be dumped.
 
  -- Ryan Tandy <ryan at nardis.ca>  Mon, 07 Apr 2014 19:36:18 -0700
 
diff --git a/debian/slapd.scripts-common b/debian/slapd.scripts-common
index 7bce0ae..5f32f85 100644
--- a/debian/slapd.scripts-common
+++ b/debian/slapd.scripts-common
@@ -165,7 +165,7 @@ dump_databases() {							# {{{
 	echo >&2 "  Dumping to $dir: "
 	(get_suffix | while read suffix; do
 		dbdir=`get_directory "$suffix"`
-		if [ -n "$dbdir" ] && [ -d "$dbdir" ]; then
+		if [ -n "$dbdir" ]; then
 			file="$dir/$suffix.ldif"
 			echo -n "  - directory $suffix... " >&2
 			# Need to support slapd.d migration from preinst
@@ -275,14 +275,14 @@ get_suffix() {
 			sed -n -e's/^suffix[[:space:]]\+"*\([^"]\+\)"*/\1/p' $f
 		done
 	else
-		grep -h olcSuffix ${SLAPD_CONF}/cn\=config/olcDatabase*.ldif | cut -d: -f 2
+		grep -h ^olcSuffix ${SLAPD_CONF}/cn\=config/olcDatabase*.ldif | cut -d: -f 2
 	fi
 }
 # }}}
 get_directory() {							# {{{
 # Returns the db directory for a given suffix
 	if [ -d "${SLAPD_CONF}" ] && get_suffix | grep -q "$1" ; then
-		grep "olcDbDirectory:" `grep -l "olcSuffix: $1" ${SLAPD_CONF}/cn\=config/olcDatabase*.ldif` | cut -d: -f 2 | sed 's/^  *//g'
+		grep "^olcDbDirectory:" `grep -l "^olcSuffix: $1" ${SLAPD_CONF}/cn\=config/olcDatabase*.ldif` | cut -d: -f 2 | sed 's/^  *//g'
 	elif [ -f "${SLAPD_CONF}" ]; then
 		# Extract the directory for the given suffix ($1)
 		for f in `get_all_slapd_conf_files`; do

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-openldap/openldap.git



More information about the Pkg-openldap-devel mailing list