This is an automated email from the git hooks/post-receive script.
mreynolds pushed a commit to branch master
in repository 389-ds-base.
commit 406084847f29aa44ffd81de746770aeff6b67c61
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Tue Oct 3 09:51:53 2017 -0400
Ticket 49320 - Activating already active role returns error 16
Bug Description: ns-activate.pl returns error 16 when trying to activate an
already active role.
Fix Description: Check for error 16 (no such attr), and return error 100.
Also added a "redirect"otion to the ldapmod function to
hide any errors printed to STDERR, so that the script can
display its own error message.
https://pagure.io/389-ds-base/issue/49320
Reviewed by: firstyear(Thanks!)
---
ldap/admin/src/scripts/DSUtil.pm.in | 18 +++++++++++-------
ldap/admin/src/scripts/ns-activate.pl.in | 9 ++++++++-
2 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/ldap/admin/src/scripts/DSUtil.pm.in b/ldap/admin/src/scripts/DSUtil.pm.in
index 805a9b9..791464d 100644
--- a/ldap/admin/src/scripts/DSUtil.pm.in
+++ b/ldap/admin/src/scripts/DSUtil.pm.in
@@ -1447,6 +1447,10 @@ sub ldapmod {
close (FILE);
}
+ if ($info{redirect} eq ""){
+ $info{redirect} = "> /dev/null";
+ }
+
#
# Check the protocol, and reset it if it's invalid
#
@@ -1470,9 +1474,9 @@ sub ldapmod {
print "STARTTLS)\n";
}
if($info{openldap} eq "yes"){
- system "ldapmodify -x -ZZ -h $info{host} -p $info{port} -D
\"$info{rootdn}\" -w $myrootdnpw $info{args} -f \"$file\" >
/dev/null";
+ system "ldapmodify -x -ZZ -h $info{host} -p $info{port} -D
\"$info{rootdn}\" -w $myrootdnpw $info{args} -f \"$file\"
$info{redirect}";
} else {
- system "ldapmodify -ZZZ -P \"$info{certdir}\" -h $info{host}
-p $info{port} -D \"$info{rootdn}\" -w $myrootdnpw $info{args} -f
\"$file\" > /dev/null";
+ system "ldapmodify -ZZZ -P \"$info{certdir}\" -h $info{host}
-p $info{port} -D \"$info{rootdn}\" -w $myrootdnpw $info{args} -f
\"$file\" $info{redirect}";
}
} elsif (($info{security} eq "on" && $info{protocol} eq
"") || ($info{security} eq "on" && $info{protocol} =~
m/LDAPS/i) ){
#
@@ -1482,9 +1486,9 @@ sub ldapmod {
print "LDAPS)\n";
}
if($info{openldap} eq "yes"){
- system "ldapmodify -x -H
\"ldaps://$info{host}:$info{secure_port}\" -D \"$info{rootdn}\" -w
$myrootdnpw $info{args} -f \"$file\" > /dev/null";
+ system "ldapmodify -x -H
\"ldaps://$info{host}:$info{secure_port}\" -D \"$info{rootdn}\" -w
$myrootdnpw $info{args} -f \"$file\" $info{redirect}";
} else {
- system "ldapmodify -Z -P \"$info{certdir}\" -p
$info{secure_port} -D \"$info{rootdn}\" -w $myrootdnpw $info{args} -f
\"$file\" > /dev/null";
+ system "ldapmodify -Z -P \"$info{certdir}\" -p
$info{secure_port} -D \"$info{rootdn}\" -w $myrootdnpw $info{args} -f
\"$file\" $info{redirect}";
}
} elsif (($info{openldap} eq "yes") && (($info{ldapi} eq
"on" && $info{protocol} eq "") || ($info{ldapi} eq
"on" && $info{protocol} =~ m/LDAPI/i)) ){
#
@@ -1499,7 +1503,7 @@ sub ldapmod {
if($protocol_error eq "yes"){
print "LDAPI)\n";
}
- system "ldapmodify -x -H \"$info{ldapiURL}\" -D
\"$info{rootdn}\" -w $myrootdnpw $info{args} -f \"$file\" >
/dev/null";
+ system "ldapmodify -x -H \"$info{ldapiURL}\" -D
\"$info{rootdn}\" -w $myrootdnpw $info{args} -f \"$file\"
$info{redirect}";
}
} else {
#
@@ -1509,9 +1513,9 @@ sub ldapmod {
print "LDAP)\n";
}
if($info{openldap} eq "yes"){
- system "ldapmodify -x -h $info{host} -p $info{port} -D
\"$info{rootdn}\" -w $myrootdnpw $info{args} -f \"$file\" >
/dev/null";
+ system "ldapmodify -x -h $info{host} -p $info{port} -D
\"$info{rootdn}\" -w $myrootdnpw $info{args} -f \"$file\"
$info{redirect}";
} else {
- system "ldapmodify -h $info{host} -p $info{port} -D
\"$info{rootdn}\" -w $myrootdnpw $info{args} -f \"$file\" >
/dev/null";
+ system "ldapmodify -h $info{host} -p $info{port} -D
\"$info{rootdn}\" -w $myrootdnpw $info{args} -f \"$file\"
$info{redirect}";
}
}
unlink ($file);
diff --git a/ldap/admin/src/scripts/ns-activate.pl.in
b/ldap/admin/src/scripts/ns-activate.pl.in
index 5922c9a..bec19c8 100644
--- a/ldap/admin/src/scripts/ns-activate.pl.in
+++ b/ldap/admin/src/scripts/ns-activate.pl.in
@@ -731,11 +731,18 @@ if ( $single == 1 ){
}
$info{args} = "-c";
+$info{redirect} = "> /dev/null 2>&1";
DSUtil::ldapmod($record, %info);
if( $? != 0 ){
debug("delete, $entry\n");
$retCode=$?>>8;
- exit $retCode;
+ if ($retCode == "16") { # Error 16 (no such attr) - already activated
+ out("$entry already $state.\n");
+ exit 100;
+ } else {
+ out("Failed to activate $entry, error $retCode\n");
+ exit $retCode;
+ }
}
out("$entry $state.\n");
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.