Blame SOURCES/0036-Ticket-7662-db2index-not-properly-evalauating-argume.patch

6f51e1
From 0ac013079796cafb119379e40f24559187935851 Mon Sep 17 00:00:00 2001
6f51e1
From: Mark Reynolds <mreynolds@redhat.com>
6f51e1
Date: Wed, 3 May 2017 14:50:15 -0400
6f51e1
Subject: [PATCH] Ticket 7662 - db2index not properly evalauating arguments
6f51e1
6f51e1
Description:  Fix a regression where the argument count gets adjusted
6f51e1
              before it is checked for errors.  The fix is to copy the
6f51e1
              number before we shift the arguments, and use that copy
6f51e1
              for the usage check.
6f51e1
6f51e1
https://pagure.io/389-ds-base/issue/47662
6f51e1
6f51e1
Reviewed by: firstyear(Thanks!)
6f51e1
6f51e1
(cherry picked from commit 46011e24580fcee2f438506f91b9fc119306defc)
6f51e1
---
6f51e1
 ldap/admin/src/scripts/db2index.in       | 11 ++++++-----
6f51e1
 ldap/servers/slapd/back-ldbm/ldif2ldbm.c |  2 +-
6f51e1
 2 files changed, 7 insertions(+), 6 deletions(-)
6f51e1
6f51e1
diff --git a/ldap/admin/src/scripts/db2index.in b/ldap/admin/src/scripts/db2index.in
6f51e1
index fec082e..04183d3 100755
6f51e1
--- a/ldap/admin/src/scripts/db2index.in
6f51e1
+++ b/ldap/admin/src/scripts/db2index.in
6f51e1
@@ -52,6 +52,7 @@ do
6f51e1
     esac
6f51e1
 done
6f51e1
 
6f51e1
+argnum=$#
6f51e1
 shift $(($OPTIND - 1))
6f51e1
 if [ $1 ]
6f51e1
 then
6f51e1
@@ -71,18 +72,18 @@ fi
6f51e1
 
6f51e1
 idxall=0
6f51e1
 print_usage=0
6f51e1
-if [ -z $servid ] && [ $# -eq 0 ]; then
6f51e1
+if [ -z $servid ] && [ $argnum -eq 0 ]; then
6f51e1
     idxall=1
6f51e1
-elif [ "$servid" ] && [ $# -eq 2 ]; then
6f51e1
+elif [ "$servid" ] && [ $argnum -eq 2 ]; then
6f51e1
     idxall=1
6f51e1
 elif [ -z $benameopt ] && [ -z $includeSuffix ]; then
6f51e1
     print_usage=1
6f51e1
 fi
6f51e1
-if [ -z $servid ] && [ $# -lt 2 ]; then
6f51e1
+if [ -z $servid ] && [ $argnum -lt 2 ]; then
6f51e1
     print_usage=1
6f51e1
-elif [ -n "$servid" ] && [ $# -lt 4 ]; then
6f51e1
+elif [ -n "$servid" ] && [ $argnum -lt 4 ]; then
6f51e1
     print_usage=1
6f51e1
-elif [ -n "$servid" ] && [ $# -eq 4 ]; then
6f51e1
+elif [ -n "$servid" ] && [ $argnum -eq 4 ]; then
6f51e1
     idxall=1
6f51e1
 fi
6f51e1
 
6f51e1
diff --git a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
6f51e1
index f8fed7c..a0710f7 100644
6f51e1
--- a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
6f51e1
+++ b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
6f51e1
@@ -3225,7 +3225,7 @@ upgradedb_core(Slapi_PBlock *pb, ldbm_instance *inst)
6f51e1
     run_from_cmdline = (task_flags & SLAPI_TASK_RUNNING_FROM_COMMANDLINE);
6f51e1
 
6f51e1
     be = inst->inst_be;
6f51e1
-    slapi_log_err(SLAPI_LOG_ERR, "upgradedb_core",
6f51e1
+    slapi_log_err(SLAPI_LOG_INFO, "upgradedb_core",
6f51e1
                     "%s: Start upgradedb.\n", inst->inst_name);
6f51e1
 
6f51e1
     if (!run_from_cmdline)
6f51e1
-- 
6f51e1
2.9.3
6f51e1