Update of /cvsroot/perl-ldap/ldap/lib/Net/LDAP
In directory usw-pr-cvs1:/tmp/cvs-serv19453/lib/Net/LDAP
Modified Files:
Util.pm
Log Message:
move some logic from canonical_dn into explode_dn and add some more
tests for DNs
Index: Util.pm
===================================================================
RCS file: /cvsroot/perl-ldap/ldap/lib/Net/LDAP/Util.pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- Util.pm 2001/11/10 06:29:54 1.13
+++ Util.pm 2002/01/31 15:25:52 1.14
@@ -40,7 +40,7 @@
canonical_dn
ldap_explode_dn
);
-$VERSION = "0.07";
+$VERSION = "0.08";
=item ldap_error_name ( NUM )
@@ -286,13 +286,7 @@
my @t = sort keys %$h;
join($plus,
map {
- my $val = $h->{$_};
- if ($val !~ /^#/) {
- $val =~ s/([\\",=+<>#;])/\\$1/g;
- $val =~ s/([\x00-\x1f\x7f-\xff])/sprintf("\\%02x",ord($1))/eg;
- $val =~ s/(^\s+|\s+$)/"\\20" x length $1/ge;
- }
- "$_=$val";
+ "$_=$h->{$_}";
} $rev ? reverse(@t) : @t)
} $rev ? reverse(@dn) : @dn);
@@ -326,6 +320,16 @@
Removes the leading OID. characters if the type is an OID instead
of a name.
+=item *
+
+Escapes all RFC 2253 special characters, and any other character
+where the ASCII code is <32 or >= 127, with a backslash and a two
+digit hex code.
+
+=item *
+
+Converts all leading and trailing spaces in values to be \20.
+
=back
B<Note> values that are hex encoded (ie start with a #) are not
@@ -365,6 +369,9 @@
$val =~ s/\\([\\ ",=+<>#;]|[0-9a-fA-F]{2})
/length($1)==1 ? $1 : chr(hex($1))
/xeg;
+ $val =~ s/([\\",=+<>#;])/\\$1/g;
+ $val =~ s/([\x00-\x1f\x7f-\xff])/sprintf("\\%02x",ord($1))/eg;
+ $val =~ s/(^\s+|\s+$)/"\\20" x length $1/ge;
}
$rdn{uc $type} = $val;
|