andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone

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

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