Friday, June 10, 2016

[389-commits] ldap/admin

ldap/admin/src/scripts/ns-accountstatus.pl.in | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 886a1ff0ae83b10bc8b0b45a803354fdc1d86e56
Author: Mark Reynolds <mreynolds@redhat.com>
Date: Fri Jun 10 10:07:51 2016 -0400

Ticket 48815 - ns-accountstatus.pl - fix DN normalization

Bug Description: When processing an entry DN the script breaks the entry
up into separate parts which are used in a filter.
These parts were not being normalized which leads to
the script failing.

Fix Description: First improve the DN normalize function to strip both
starting and trailing spaces, then normalize the new
DN filter when searching for the backend.

https://fedorahosted.org/389/ticket/48815

Reviewed by: nhosoi(Thanks!)

diff --git a/ldap/admin/src/scripts/ns-accountstatus.pl.in b/ldap/admin/src/scripts/ns-accountstatus.pl.in
index 0d52ec9..37fc7fa 100644
--- a/ldap/admin/src/scripts/ns-accountstatus.pl.in
+++ b/ldap/admin/src/scripts/ns-accountstatus.pl.in
@@ -620,7 +620,7 @@ sub normalizeDN
@suffix=split /([,])/,$entry;
$result="";
foreach $part (@suffix){
- $part=~s/^ +//;
+ $part =~ s/^\s+|\s+$//g;
$part=~ tr/A-Z/a-z/;
$result="$result$part";
}
@@ -641,9 +641,11 @@ sub getSuffix
# Look if suffix is the suffix of the entry
# ldapsearch -s one -b "cn=mapping tree,cn=config" "cn=\"uid=jvedder,ou=People,dc=example,dc=com\""
#
+ my $filter = normalizeDN("@suffix");
+
debug("\tSuffix from the entry: #@suffixN#\n");
$info{base} = "cn=mapping tree, cn=config";
- $info{filter} = "cn=@suffix";
+ $info{filter} = "cn=$filter";
$info{scope} = "one";
$info{attrs} = "cn";
@mapping = DSUtil::ldapsrch_ext(%info);

--
389-commits mailing list
389-commits@lists.fedoraproject.org
https://lists.fedoraproject.org/admin/lists/389-commits@lists.fedoraproject.org

No comments:

Post a Comment