[Pkg-openldap-devel] r1324 - openldap/trunk/debian

vorlon at alioth.debian.org vorlon at alioth.debian.org
Mon Sep 13 01:01:40 UTC 2010


tags 595466 pending
thanks

Author: vorlon
Date: 2010-09-13 01:01:36 +0000 (Mon, 13 Sep 2010)
New Revision: 1324

Modified:
   openldap/trunk/debian/changelog
   openldap/trunk/debian/slapd.scripts-common
Log:
debian/slapd.scripts-common: call get_suffix in a way that lets us
separate responses by newlines, to properly handle the case when a
DN has embedded spaces.  Introduces a few more stupid fd tricks to work
around possible problems with debconf.  Closes: #595466.

Modified: openldap/trunk/debian/changelog
===================================================================
--- openldap/trunk/debian/changelog	2010-09-12 22:46:27 UTC (rev 1323)
+++ openldap/trunk/debian/changelog	2010-09-13 01:01:36 UTC (rev 1324)
@@ -21,6 +21,10 @@
   * debian/slapd.scripts-common: ... and do the same in
     migrate_to_slapd_d_style, we just need to comment out the user's
     previous entry instead of blowing it away.
+  * debian/slapd.scripts-common: call get_suffix in a way that lets us
+    separate responses by newlines, to properly handle the case when a
+    DN has embedded spaces.  Introduces a few more stupid fd tricks to work
+    around possible problems with debconf.  Closes: #595466.
 
   [ Matthijs Mohlmann ]
   * Remove upgrade_supported_from_backend, implemented patch from

Modified: openldap/trunk/debian/slapd.scripts-common
===================================================================
--- openldap/trunk/debian/slapd.scripts-common	2010-09-12 22:46:27 UTC (rev 1323)
+++ openldap/trunk/debian/slapd.scripts-common	2010-09-13 01:01:36 UTC (rev 1324)
@@ -100,8 +100,8 @@
 }
 # }}}
 update_databases_permissions() {	# {{{
-	for suffix in `get_suffix`; do
-		dbdir=`get_directory $suffix`
+	get_suffix | while read suffix; do
+		dbdir=`get_directory "$suffix"`
 		update_permissions "$dbdir"
 	done
 }
@@ -157,8 +157,8 @@
 
 	dir=`database_dumping_destdir`
 	echo >&2 "  Dumping to $dir: "
-	for suffix in `get_suffix`; do
-		dbdir=`get_directory $suffix`
+	(get_suffix | while read suffix; do
+		dbdir=`get_directory "$suffix"`
 		if [ -n "$dbdir" ] && [ -d "$dbdir" ]; then
 			file="$dir/$suffix.ldif"
 			echo -n "  - directory $suffix... " >&2
@@ -172,14 +172,14 @@
 			if [ "$failed" ]; then
 				rm -f "$file"
 				echo "failed." >&2
-				db_subst slapd/upgrade_slapcat_failure location "$dir"
-				db_input critical slapd/upgrade_slapcat_failure || true
-				db_go || true
+				db_subst slapd/upgrade_slapcat_failure location "$dir" <&5
+				db_input critical slapd/upgrade_slapcat_failure <&5 || true
+				db_go <&5 || true
 				exit 1
 			fi
 			echo "done." >&2
 		fi
-	done
+	done) 5<&0 </dev/null
 }
 
 # }}}
@@ -188,8 +188,8 @@
 
 	dir=`database_dumping_destdir`
 	echo >&2 "  Loading from $dir: "
-	for suffix in `get_suffix`; do
-		dbdir=`get_directory $suffix`
+	get_suffix | while read suffix; do
+		dbdir=`get_directory "$suffix"`
 		if ! is_empty_dir "$dbdir"; then
 			echo >&2 \
 			  "  Directory $dbdir for $suffix not empty, aborting."
@@ -242,10 +242,10 @@
 # }}}
 move_incompatible_databases_away() {					# {{{
 	echo >&2 "  Moving old database directories to /var/backups:"
-	for suffix in `get_suffix`; do
-		dbdir=`get_directory $suffix`
-		move_old_database_away "$dbdir" "$suffix"
-	done
+	(get_suffix | while read suffix; do
+		dbdir=`get_directory "$suffix"`
+		move_old_database_away "$dbdir" "$suffix" <&5
+	done) 5<&0 </dev/null
 }
 # }}}
 # }}}
@@ -272,14 +272,14 @@
 # }}}
 get_directory() {							# {{{
 # Returns the db directory for a given suffix
-	if [ -d "${SLAPD_CONF}" ] && echo `get_suffix` | grep -q "$1" ; then
+	if [ -d "${SLAPD_CONF}" ] && get_suffix | grep -q "$1" ; then
 		grep "olcDbDirectory:" `grep -l "olcSuffix: $1" ${SLAPD_CONF}/cn\=config/olcDatabase*` | 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
 		awk  ' BEGIN { DB=0; SUF=""; DIR="" } ;
 		       /^database/ { DB=1; SUF=""; DIR="" } ; 
-		       DB==1 && /^suffix[ \t]+"?'$1'"?$/ { SUF=$2 ; } ; 
+		       DB==1 && /^suffix[ \t]+"?'"$1"'"?$/ { SUF=$2 ; } ; 
 		       DB==1 && /^directory/ { DIR=$2 ;} ; 
 		       DB==1 && SUF!="" && DIR!="" { sub(/^"/,"",DIR) ; sub(/"$/,"",DIR) ; print DIR; SUF=""; DIR="" }' "${f}"
 		done




More information about the Pkg-openldap-devel mailing list