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

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