andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
Blob Blame History Raw
From 6a07ebb40ee121c176f789d01937d7ceedc77776 Mon Sep 17 00:00:00 2001
From: Noriko Hosoi <nhosoi@redhat.com>
Date: Thu, 20 Aug 2015 17:01:28 -0700
Subject: [PATCH 49/52] Ticket #48254 - CLI db2index fails with usage errors

Bug Description:
1) CLI db2index had an issue in option handling, which accidentally
added '=' at the end of the previous option.
2) if a value of an option includes a white space, e.g., -T "by MCC
ou=People dc=example dc=com", the value was not passed to the program
as a string.

Fix Description:
1) Removed unnecessary '='.
2) Quote $OPTARG which could include a white space, and call ns-slapd
   command line vai eval.

https://fedorahosted.org/389/ticket/48254

Reviewed by rmeggins@redhat.com (Thank you, Rich!!)

(cherry picked from commit 3507c46c9f1156df11b6cf05eba695d81088b416)
(cherry picked from commit a6d7e3bd29eb63def170f73dc21e967df230f20a)
---
 ldap/admin/src/scripts/db2index.in | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/ldap/admin/src/scripts/db2index.in b/ldap/admin/src/scripts/db2index.in
index 2b76cd1..6a0785e 100755
--- a/ldap/admin/src/scripts/db2index.in
+++ b/ldap/admin/src/scripts/db2index.in
@@ -39,13 +39,13 @@ do
            benameopt="set";;
         s) args=$args" -s $OPTARG"
            includeSuffix="set";;
-        t) args=$args" -t $OPTARG";;
-        T) args=$args=" -T $OPTARG";;
-        d) args=$args=" -d $OPTARG";;
-        a) args=$args=" -a $OPTARG";;
-        x) args=$args=" -x $OPTARG";;
-        v) args=$args=" -v";;
-        S) args=$args=" -S";;
+        t) args=$args" -t "\"$OPTARG\";;
+        T) args=$args" -T "\"$OPTARG\";;
+        d) args=$args" -d $OPTARG";;
+        a) args=$args" -a $OPTARG";;
+        x) args=$args" -x $OPTARG";;
+        v) args=$args" -v";;
+        S) args=$args" -S";;
         D) args=$args" -D $OPTARG";;
         ?) usage
            exit 1;;
@@ -79,5 +79,5 @@ then
     usage
     exit 1
 else
-    @sbindir@/ns-slapd db2index -D $CONFIG_DIR $args
+    eval @sbindir@/ns-slapd db2index -D $CONFIG_DIR $args
 fi
-- 
1.9.3