Permalink
Browse files

RT#51165 Compact multiple consecutive spaces in Net::LDAP::Util::cano…

…nical_dn
  • Loading branch information...
gbarr committed Mar 12, 2010
1 parent 56781e0 commit 9118603ff9303c8a82e12c5d8dfb142bc81c70c6
Showing with 8 additions and 1 deletion.
  1. +2 −0 lib/Net/LDAP/Util.pm
  2. +6 −1 t/01canon_dn.t
View
@@ -309,6 +309,8 @@ sub canonical_dn($%) {
#escape leading and trailing whitespace
$val =~ s/(^\s+|\s+$)/
"\\20" x length $1/xeg;
+ #compact multiple spaces
+ $val =~ s/\s+/ /g;
}
# case fold attribute type and create return value
View
@@ -53,6 +53,7 @@ while(my($op,$dn) = splice(@tests,0,2)) {
print +($failed ? "not ok " : "ok "),++$testno,"\n";
}
+
__DATA__
bad OU=Sales+CN=J. Smith,O=Widget Inc.,C=US,
@@ -90,7 +91,7 @@ same cn=Clif Harden+IDNumber=a0125589\20 ,ou=tiPerson,ou=person,o=ti,c=us
same cn=Clif Harden+IDNumber="a0125589 ",ou=tiPerson,ou=person,o=ti,c=us
-ref CN=\20\20Graham Barr\20\20,OU=person,O=vc,C=us
+ref CN=\20\20Graham Barr\20\20,OU=person,O=vc,C=us
same Cn=" Graham Barr ",OU=person,O=vc,C=us
same cn=" Graham \20Barr\20 ",OU=person,O=vc,C=us
@@ -195,3 +196,7 @@ same CN=John Smith \2C III,DC=example,DC=net
ref DISTINGUISHEDNAMETABLEKEY=cn\3dDSA\2c c\3dGB,CN=bilateral table,CN=DSA,C=US
same distinguishedNameTableKey=cn\=DSA\, c\=GB, cn=bilateral table, cn=DSA, c=US
+
+# RT 51165
+ref CN=tester\2c karl,OU=test,DC=example,DC=com
+same cn=tester\, karl,ou=test,dc=example,dc=com

0 comments on commit 9118603

Please sign in to comment.