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

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