Browse files

RT#81380: in Filter.pm unescape hexpairs and ( ) \ * only

Fix long-standing bug that affects filter values containing backslashes.
Instead of unescaping all characters prefixed by a backslash, restrict
the unescaping to the characters with special meaning in filters.

While not fully conforming to the RFC [which only allows unescaping hexpairs],
this is now a lot better than the original implementation.
  • Loading branch information...
1 parent 4f2965f commit 9655f280cd18afdce622602960a55fe04aec4689 @marschap marschap committed Nov 23, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/Net/LDAP/Filter.pm
View
4 lib/Net/LDAP/Filter.pm
@@ -6,7 +6,7 @@ package Net::LDAP::Filter;
use strict;
-our $VERSION = "0.17";
+our $VERSION = "0.18";
# filter = "(" filtercomp ")"
# filtercomp = and / or / not / item
@@ -78,7 +78,7 @@ sub errstr { $ErrStr }
# \y where y is one of ( ) \ *
sub _unescape {
$_[0] =~ s/
- \\([\da-fA-F]{2}|.)
+ \\([\da-fA-F]{2}|[()\\*])
/
length($1) == 1
? $1

0 comments on commit 9655f28

Please sign in to comment.