andykimpe / rpms / 389-ds-base

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

Blame 0288-Ticket-47962-perl-scripts-not-returning-expected-err.patch

dc8c34
From 55fb56e85b6ba73fe35398a53ed140c486ade500 Mon Sep 17 00:00:00 2001
dc8c34
From: Mark Reynolds <mreynolds@redhat.com>
dc8c34
Date: Wed, 17 Dec 2014 11:56:42 -0500
dc8c34
Subject: [PATCH 288/305] Ticket 47962 - perl scripts not returning expected
dc8c34
 error code
dc8c34
dc8c34
Bug Description:  WHne one o the instance perl scripts fails, it either
dc8c34
                  returns sucess, or the wrong the error code.
dc8c34
dc8c34
Fix Description:  The perl scripts need to bit shift the result code by 8,
dc8c34
                  and return the result.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47962
dc8c34
dc8c34
Reviewed by: rmeggins(Thanks!)
dc8c34
dc8c34
(cherry picked from commit d8e79122c33e619f0950503a3a3b9a4b38f20e54)
dc8c34
---
dc8c34
 ldap/admin/src/scripts/template-bak2db.pl.in                |  2 ++
dc8c34
 ldap/admin/src/scripts/template-cleanallruv.pl.in           |  2 ++
dc8c34
 ldap/admin/src/scripts/template-db2bak.pl.in                |  2 ++
dc8c34
 ldap/admin/src/scripts/template-db2index.pl.in              |  2 ++
dc8c34
 ldap/admin/src/scripts/template-db2ldif.pl.in               |  2 ++
dc8c34
 ldap/admin/src/scripts/template-fixup-linkedattrs.pl.in     |  2 ++
dc8c34
 ldap/admin/src/scripts/template-fixup-memberof.pl.in        |  2 ++
dc8c34
 ldap/admin/src/scripts/template-ldif2db.pl.in               |  2 ++
dc8c34
 ldap/admin/src/scripts/template-ns-newpwpolicy.pl.in        | 13 +++++++------
dc8c34
 ldap/admin/src/scripts/template-schema-reload.pl.in         |  2 ++
dc8c34
 ldap/admin/src/scripts/template-syntax-validate.pl.in       |  2 ++
dc8c34
 ldap/admin/src/scripts/template-usn-tombstone-cleanup.pl.in |  2 ++
dc8c34
 12 files changed, 29 insertions(+), 6 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/admin/src/scripts/template-bak2db.pl.in b/ldap/admin/src/scripts/template-bak2db.pl.in
dc8c34
index 4ab79cc..2f243ba 100644
dc8c34
--- a/ldap/admin/src/scripts/template-bak2db.pl.in
dc8c34
+++ b/ldap/admin/src/scripts/template-bak2db.pl.in
dc8c34
@@ -135,6 +135,8 @@ $ENV{'SHLIB_PATH'} = "$ENV{'LD_LIBRARY_PATH'}";
dc8c34
 open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
dc8c34
 print(FOO "$entry");
dc8c34
 close(FOO);
dc8c34
+$retcode = $?>>8;
dc8c34
+exit ($retcode);
dc8c34
 
dc8c34
 sub libpath_add {
dc8c34
     my $libpath = shift;
dc8c34
diff --git a/ldap/admin/src/scripts/template-cleanallruv.pl.in b/ldap/admin/src/scripts/template-cleanallruv.pl.in
dc8c34
index be95a6d..437a3c0 100644
dc8c34
--- a/ldap/admin/src/scripts/template-cleanallruv.pl.in
dc8c34
+++ b/ldap/admin/src/scripts/template-cleanallruv.pl.in
dc8c34
@@ -171,6 +171,8 @@ $entry = "${dn}${misc}${cn}${basedn}${rid}";
dc8c34
 open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
dc8c34
 print(FOO "$entry");
dc8c34
 close(FOO);
dc8c34
+$retcode = $?>>8;
dc8c34
+exit ($retcode);
dc8c34
 
dc8c34
 sub libpath_add {
dc8c34
     my $libpath = shift;
dc8c34
diff --git a/ldap/admin/src/scripts/template-db2bak.pl.in b/ldap/admin/src/scripts/template-db2bak.pl.in
dc8c34
index 8a0cb1c..329664f 100644
dc8c34
--- a/ldap/admin/src/scripts/template-db2bak.pl.in
dc8c34
+++ b/ldap/admin/src/scripts/template-db2bak.pl.in
dc8c34
@@ -125,6 +125,8 @@ print("Back up directory: $archivedir\n");
dc8c34
 open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
dc8c34
 print(FOO "$entry");
dc8c34
 close(FOO);
dc8c34
+$retcode = $?>>8;
dc8c34
+exit ($retcode);
dc8c34
 
dc8c34
 sub libpath_add {
dc8c34
     my $libpath = shift;
dc8c34
diff --git a/ldap/admin/src/scripts/template-db2index.pl.in b/ldap/admin/src/scripts/template-db2index.pl.in
dc8c34
index e598b05..39454c5 100644
dc8c34
--- a/ldap/admin/src/scripts/template-db2index.pl.in
dc8c34
+++ b/ldap/admin/src/scripts/template-db2index.pl.in
dc8c34
@@ -229,6 +229,8 @@ $entry = "${dn}${misc}${cn}${nsinstance}${attribute}${vlvattribute}";
dc8c34
 open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
dc8c34
 print(FOO "$entry");
dc8c34
 close(FOO);
dc8c34
+$retcode = $?>>8;
dc8c34
+exit ($retcode);
dc8c34
 
dc8c34
 sub libpath_add {
dc8c34
     my $libpath = shift;
dc8c34
diff --git a/ldap/admin/src/scripts/template-db2ldif.pl.in b/ldap/admin/src/scripts/template-db2ldif.pl.in
dc8c34
index a4929ba..febedd4 100644
dc8c34
--- a/ldap/admin/src/scripts/template-db2ldif.pl.in
dc8c34
+++ b/ldap/admin/src/scripts/template-db2ldif.pl.in
dc8c34
@@ -269,6 +269,8 @@ print("Exporting to ldif file: ${ldiffile}\n");
dc8c34
 open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
dc8c34
 print(FOO "$entry");
dc8c34
 close(FOO);
dc8c34
+$retcode = $?>>8;
dc8c34
+exit ($retcode);
dc8c34
 
dc8c34
 sub libpath_add {
dc8c34
     my $libpath = shift;
dc8c34
diff --git a/ldap/admin/src/scripts/template-fixup-linkedattrs.pl.in b/ldap/admin/src/scripts/template-fixup-linkedattrs.pl.in
dc8c34
index f181a7a..67f0b31 100644
dc8c34
--- a/ldap/admin/src/scripts/template-fixup-linkedattrs.pl.in
dc8c34
+++ b/ldap/admin/src/scripts/template-fixup-linkedattrs.pl.in
dc8c34
@@ -155,6 +155,8 @@ $entry = "${dn}${misc}${cn}${basedn}${linkdn}";
dc8c34
 open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
dc8c34
 print(FOO "$entry");
dc8c34
 close(FOO);
dc8c34
+$retcode = $?>>8;
dc8c34
+exit ($retcode);
dc8c34
 
dc8c34
 sub libpath_add {
dc8c34
     my $libpath = shift;
dc8c34
diff --git a/ldap/admin/src/scripts/template-fixup-memberof.pl.in b/ldap/admin/src/scripts/template-fixup-memberof.pl.in
dc8c34
index b43c21a..77a1528 100644
dc8c34
--- a/ldap/admin/src/scripts/template-fixup-memberof.pl.in
dc8c34
+++ b/ldap/admin/src/scripts/template-fixup-memberof.pl.in
dc8c34
@@ -166,6 +166,8 @@ $entry = "${dn}${misc}${cn}${basedn}${filter}";
dc8c34
 open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
dc8c34
 print(FOO "$entry");
dc8c34
 close(FOO);
dc8c34
+$retcode = $?>>8;
dc8c34
+exit ($retcode);
dc8c34
 
dc8c34
 sub libpath_add {
dc8c34
     my $libpath = shift;
dc8c34
diff --git a/ldap/admin/src/scripts/template-ldif2db.pl.in b/ldap/admin/src/scripts/template-ldif2db.pl.in
dc8c34
index 089c95d..1cf83b4 100644
dc8c34
--- a/ldap/admin/src/scripts/template-ldif2db.pl.in
dc8c34
+++ b/ldap/admin/src/scripts/template-ldif2db.pl.in
dc8c34
@@ -227,6 +227,8 @@ $ENV{'SHLIB_PATH'} = "$ENV{'LD_LIBRARY_PATH'}";
dc8c34
 open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
dc8c34
 print(FOO "$entry");
dc8c34
 close(FOO);
dc8c34
+$retcode = $?>>8;
dc8c34
+exit ($retcode);
dc8c34
 
dc8c34
 sub libpath_add {
dc8c34
     my $libpath = shift;
dc8c34
diff --git a/ldap/admin/src/scripts/template-ns-newpwpolicy.pl.in b/ldap/admin/src/scripts/template-ns-newpwpolicy.pl.in
dc8c34
index 50ce047..bd9b238 100755
dc8c34
--- a/ldap/admin/src/scripts/template-ns-newpwpolicy.pl.in
dc8c34
+++ b/ldap/admin/src/scripts/template-ns-newpwpolicy.pl.in
dc8c34
@@ -186,9 +186,9 @@ sub usage {
dc8c34
 		open(FD,"| $modifyCfg ");
dc8c34
 		print(FD $modConfig);
dc8c34
 		close(FD);
dc8c34
-		$retcode = $?;
dc8c34
+		$retcode = $?>>8;
dc8c34
 		if ( $retcode != 0 ) {
dc8c34
-			print( STDERR "Error $retcode while modifing \"cn=config\". Exiting.\n" );
dc8c34
+			print( STDERR "Error $retcode while modifying \"cn=config\". Exiting.\n" );
dc8c34
 			exit ($retcode);
dc8c34
 		}
dc8c34
 		else {
dc8c34
@@ -203,6 +203,7 @@ sub usage {
dc8c34
 		$esc_opt_U =~ s/=/\\=/g;
dc8c34
 		print (STDERR "host = $opt_h, port = $opt_p, userDN = \"$norm_opt_U\"\n\n") if $opt_v;
dc8c34
 		$retcode = `$ldapsearch -h $opt_h -p $opt_p -b \"$norm_opt_U\" -s base \"\"`;
dc8c34
+		$retcode = $retcode>>8;
dc8c34
 		if ($retcode != 0 ) {
dc8c34
 			print( STDERR "the user entry $norm_opt_U does not exist. Exiting.\n");
dc8c34
 			exit ($retcode);
dc8c34
@@ -267,9 +268,9 @@ sub usage {
dc8c34
 		open(FD,"| $modifyCfg ");
dc8c34
 		print(FD $modConfig);
dc8c34
 		close(FD);
dc8c34
-		$retcode = $?;
dc8c34
+		$retcode = $?>>8;
dc8c34
 		if ( $retcode != 0 ) {
dc8c34
-			print( STDERR "Error $retcode while modifing $norm_opt_U. Exiting.\n" );
dc8c34
+			print( STDERR "Error $retcode while modifying $norm_opt_U. Exiting.\n" );
dc8c34
 			exit ($retcode);
dc8c34
 		}
dc8c34
 		else {
dc8c34
@@ -280,9 +281,9 @@ sub usage {
dc8c34
 		open(FD,"| $modifyCfg ");
dc8c34
 		print(FD $modConfig);
dc8c34
 		close(FD);
dc8c34
-		$retcode = $?;
dc8c34
+		$retcode = $?>>8;
dc8c34
 		if ( $retcode != 0 ) {
dc8c34
-			print( STDERR "Error $retcode while modifing \"cn=config\". Exiting.\n" );
dc8c34
+			print( STDERR "Error $retcode while modifying \"cn=config\". Exiting.\n" );
dc8c34
 			exit ($retcode);
dc8c34
 		}
dc8c34
 		else {
dc8c34
diff --git a/ldap/admin/src/scripts/template-schema-reload.pl.in b/ldap/admin/src/scripts/template-schema-reload.pl.in
dc8c34
index f7a1dbb..6b64b5e 100644
dc8c34
--- a/ldap/admin/src/scripts/template-schema-reload.pl.in
dc8c34
+++ b/ldap/admin/src/scripts/template-schema-reload.pl.in
dc8c34
@@ -155,6 +155,8 @@ $entry = "${dn}${misc}${cn}${basedn}${schemadir}";
dc8c34
 open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
dc8c34
 print(FOO "$entry");
dc8c34
 close(FOO);
dc8c34
+$retcode = $?>>8;
dc8c34
+exit ($retcode);
dc8c34
 
dc8c34
 sub libpath_add {
dc8c34
     my $libpath = shift;
dc8c34
diff --git a/ldap/admin/src/scripts/template-syntax-validate.pl.in b/ldap/admin/src/scripts/template-syntax-validate.pl.in
dc8c34
index b87e12d..b40ef69 100644
dc8c34
--- a/ldap/admin/src/scripts/template-syntax-validate.pl.in
dc8c34
+++ b/ldap/admin/src/scripts/template-syntax-validate.pl.in
dc8c34
@@ -166,6 +166,8 @@ $entry = "${dn}${misc}${cn}${basedn}${filter}";
dc8c34
 open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
dc8c34
 print(FOO "$entry");
dc8c34
 close(FOO);
dc8c34
+$retcode = $?>>8;
dc8c34
+exit ($retcode);
dc8c34
 
dc8c34
 sub libpath_add {
dc8c34
     my $libpath = shift;
dc8c34
diff --git a/ldap/admin/src/scripts/template-usn-tombstone-cleanup.pl.in b/ldap/admin/src/scripts/template-usn-tombstone-cleanup.pl.in
dc8c34
index 3e17be0..92c106d 100644
dc8c34
--- a/ldap/admin/src/scripts/template-usn-tombstone-cleanup.pl.in
dc8c34
+++ b/ldap/admin/src/scripts/template-usn-tombstone-cleanup.pl.in
dc8c34
@@ -183,6 +183,8 @@ $entry = "${dn}${misc}${cn}${basedn}${args}";
dc8c34
 open(FOO, "| ldapmodify @ldaptool_opts@ $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
dc8c34
 print(FOO "$entry");
dc8c34
 close(FOO);
dc8c34
+$retcode = $?>>8;
dc8c34
+exit ($retcode);
dc8c34
 
dc8c34
 sub libpath_add {
dc8c34
     my $libpath = shift;
dc8c34
-- 
dc8c34
1.9.3
dc8c34