Skip to content
Commits on Source (2)
  • Ryan Tandy's avatar
    More fixes for unusual suffixes (#864719) · 2fae4458
    Ryan Tandy authored
    * Fix get_suffix and get_directory with slapd.conf backslashes.
      - Note that backslash escapes in slapd.conf must themselves be escaped.
    * Use printf instead of echo to print suffixes or paths containing them.
    * Quote the result from compute_backup_path.
    2fae4458
  • Ryan Tandy's avatar
    Release 2.4.46+dfsg-1 · 52adea77
    Ryan Tandy authored
    52adea77
openldap (2.4.46+dfsg-1) UNRELEASED; urgency=medium
openldap (2.4.46+dfsg-1) unstable; urgency=medium
* Move the repository to Salsa.
Update debian/control Vcs-* fields.
......@@ -19,7 +19,7 @@ openldap (2.4.46+dfsg-1) UNRELEASED; urgency=medium
* Override the binary-or-shlib-defines-rpath Lintian tag for slapd-smbk5pwd.
The rpath is set by krb5-config.heimdal; see bug #868840.
-- Ryan Tandy <ryan@nardis.ca> Mon, 26 Mar 2018 02:47:39 +0000
-- Ryan Tandy <ryan@nardis.ca> Thu, 03 May 2018 07:03:30 -0700
openldap (2.4.45+dfsg-1) unstable; urgency=medium
......
......@@ -186,7 +186,7 @@ dump_databases() { # {{{
dbdir=`get_directory "$suffix"`
if [ -n "$dbdir" ]; then
file="$dir/$suffix.ldif"
echo -n " - directory $suffix... " >&2
printf ' - directory %s... ' "$suffix" >&2
# Need to support slapd.d migration from preinst
if [ -f "${SLAPD_CONF}" ]; then
slapcat_opts="-g -f ${SLAPD_CONF}"
......@@ -227,11 +227,11 @@ load_databases() { # {{{
fi
file="$dir/$suffix.ldif"
echo -n " - directory $suffix... " >&2
printf ' - directory %s... ' "$suffix" >&2
# If there is an old DB_CONFIG file, restore it before
# running slapadd
backupdir=`compute_backup_path -n "$dbdir" "$suffix"`
backupdir="$(compute_backup_path -n "$dbdir" "$suffix")"
if [ -e "$backupdir"/DB_CONFIG ]; then
cp -a "$backupdir"/DB_CONFIG "$dbdir"/
fi
......@@ -287,7 +287,7 @@ move_incompatible_databases_away() { # {{{
get_suffix() { # {{{
if [ -f "${SLAPD_CONF}" ]; then
for f in `get_all_slapd_conf_files`; do
sed -n -e's/^suffix[[:space:]]\+"*\([^"]\+\)"*/\1/p' $f
sed -n -e '/^suffix[[:space:]]/ { s/^suffix[[:space:]]\+"*\([^"]\+\)"*/\1/; s/\\\\/\\/g; p }' $f
done
else
grep -h ^olcSuffix ${SLAPD_CONF}/cn\=config/olcDatabase*.ldif | cut -d: -f 2
......@@ -300,10 +300,12 @@ get_directory() { # {{{
sed -n 's/^olcDbDirectory: *//p' `grep -Flx "olcSuffix: $1" ${SLAPD_CONF}/cn\=config/olcDatabase*.ldif`
elif [ -f "${SLAPD_CONF}" ]; then
# Extract the directory for the given suffix ($1)
# Quote backslashes once for slapd.conf parser, again for awk
quoted="$(printf '%s' "$1" | sed 's/\\/\\\\\\\\/g')"
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]+"?'"$quoted"'"?$/ { SUF=$2 ; } ;
DB==1 && /^directory/ { DIR=$2 ;} ;
DB==1 && SUF!="" && DIR!="" { sub(/^"/,"",DIR) ; sub(/"$/,"",DIR) ; print DIR; SUF=""; DIR="" }' "${f}" | \
sed -e's/\([^\\]\|^\)"/\1/g; s/\\"/"/g; s/\\\\/\\/g'
......@@ -369,7 +371,7 @@ compute_backup_path() { # {{{
exit 1
fi
echo "$target"
printf '%s' "$target"
}
# }}}
......@@ -397,8 +399,8 @@ move_old_database_away() { # {{{
# include mount points as well anyway, but it's much less likely.
db_get slapd/move_old_database
if [ "$RET" = true ]; then
backupdir=`compute_backup_path "$databasedir" "$suffix"`
echo -n " - directory $suffix... " >&2
backupdir="$(compute_backup_path "$databasedir" "$suffix")"
printf ' - directory %s... ' "$suffix" >&2
mkdir -p "$backupdir"
find -H "$databasedir" -mindepth 1 -maxdepth 1 -type f \
-exec mv {} "$backupdir" \;
......