Re: Fwd: Net::LDAP::FilterMatch issue

Peter Marschall <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.ldap
Organization ADPM
Message-ID <[email protected]>
Hi Graham,

Adam is right.
There were issues in FilterMatch.pm

Please find attached a patch (created with git format-patch)
that fixes this issue
 (003-FilterMatch.pm-fix-regex-treatment-in-_-cis-exact-_.patch)
together with 3 other patches (which I had lying around here, 
or fix issues I found when fixing Adam's issue):

* 0001-fix-typo.patch
  fix a typo in the CREDITS file

* 0002-use-current-IO-Socket-SSL-s-method-start_SSL-inste.patch
  use a non-outdated method of IO::Socket::SSL, raising the
  minimally required version of I::S::S a bit.

* 0003-FilterMatch.pm-fix-regex-treatment-in-_-cis-exact-_.patch
  the issue at hand
   
* 0004-FilterMatch.pm-correct-of-args-in-function-declar.patch
  fix # of args in function declarations/definitions

Please add them to your repo.

Thanks in advance 
Peter
-- 
Peter Marschall
[email protected]
0001-fix-typo.patch (text/x-diff, 775 B)
From 64194a7d46cc5dd665678346c42e80a2918eae35 Mon Sep 17 00:00:00 2001
From: Peter Marschall <[email protected]>
Date: Sun, 21 Sep 2008 19:56:32 +0200
Subject: [PATCH] fix typo


Signed-off-by: Peter Marschall <[email protected]>
---
 CREDITS |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git CREDITS CREDITS
index 75472db..11830d9 100644
--- CREDITS
+++ CREDITS
@@ -13,7 +13,7 @@ counting :)
 			   ---------------
 
 To give due honor to those who have made perl-ldap what is is today, here
-are some of the people who have contributed, either in code, documentaion
+are some of the people who have contributed, either in code, documentation
 or just ideas/feedback. If I have missed anyone, please let me know.
 
 Graham Barr		<[email protected]>
-- 
1.6.2.4
0003-FilterMatch.pm-fix-regex-treatment-in-_-cis-exact-_.patch (text/x-diff, 1.1 KB)
From ef9f226fa8e9a1e29bd44599913830295de088f7 Mon Sep 17 00:00:00 2001
From: Peter Marschall <[email protected]>
Date: Wed, 13 May 2009 17:35:54 +0200
Subject: [PATCH] FilterMatch.pm: fix regex treatment in _{cis,exact}_substrings().


Signed-off-by: Peter Marschall <[email protected]>
---
 lib/Net/LDAP/FilterMatch.pm |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git lib/Net/LDAP/FilterMatch.pm lib/Net/LDAP/FilterMatch.pm
index 307fa99..40c6550 100644
--- lib/Net/LDAP/FilterMatch.pm
+++ lib/Net/LDAP/FilterMatch.pm
@@ -17,7 +17,7 @@ use Net::LDAP::Filter;
 use Net::LDAP::Schema;
 
 use vars qw($VERSION);
-$VERSION   = '0.17';
+$VERSION   = '0.17_01';
 
 sub import {
   shift;
@@ -244,16 +244,18 @@ sub _cis_substrings($@)
 {
   my $regex=shift;
   my $op=shift;
+
   return 1 if ($regex =~ /^$/);
-  return grep(/\Q$regex\E/i, @_) ? 1 : 0;
+  return grep(/$regex/i, @_) ? 1 : 0;
 }
 
 sub _exact_substrings($@)
 {
   my $regex=shift;
   my $op=shift;
+
   return 1 if ($regex =~ /^$/);
-  return grep(/\Q$regex\E/, @_) ? 1 : 0;
+  return grep(/$regex/, @_) ? 1 : 0;
 }
 
 # this one is here in case we don't use schema
-- 
1.6.2.4
0002-use-current-IO-Socket-SSL-s-method-start_SSL-inste.patch (text/x-diff, 1.2 KB)
From b4c33882e03c2e3121f04e91ee77c13a45ceceed Mon Sep 17 00:00:00 2001
From: Peter Marschall <[email protected]>
Date: Tue, 6 Jan 2009 20:51:37 +0100
Subject: [PATCH] use current IO::Socket::SSL's method start_SSL instead of deprecated
 function socketToSSL; raise required IO::Socket:SSL version appropriately


Signed-off-by: Peter Marschall <[email protected]>
---
 Makefile.PL     |    2 +-
 lib/Net/LDAP.pm |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git Makefile.PL Makefile.PL
index 8b8fd96..629ccf1 100644
--- Makefile.PL
+++ Makefile.PL
@@ -39,7 +39,7 @@ features(
   ],
   'LDAPS' => [
     -default => 0,
-    'IO::Socket::SSL' => 0.81,
+    'IO::Socket::SSL' => 0.93,
   ],
   'Read/Write DSML files' => [
     -default => 0,
diff --git lib/Net/LDAP.pm lib/Net/LDAP.pm
index 9ed1339..c470088 100644
--- lib/Net/LDAP.pm
+++ lib/Net/LDAP.pm
@@ -1024,7 +1024,7 @@ sub start_tls {
   my $sock_class = ref($sock);
 
   return $mesg
-    if IO::Socket::SSL::socketToSSL($sock, {_SSL_context_init_args($arg)});
+    if IO::Socket::SSL->start_SSL($sock, {_SSL_context_init_args($arg)});
 
   my $err = $@ || $IO::Socket::SSL::SSL_ERROR || $IO::Socket::SSL::SSL_ERROR || ''; # avoid use on once warning
 
-- 
1.6.2.4
0004-FilterMatch.pm-correct-of-args-in-function-declar.patch (text/x-diff, 3.4 KB)
From c3a0fa6969b5028ddacf453758375fce07eb4a45 Mon Sep 17 00:00:00 2001
From: Peter Marschall <[email protected]>
Date: Wed, 13 May 2009 18:19:16 +0200
Subject: [PATCH] FilterMatch.pm: correct # of args in function declarations/definitions


Signed-off-by: Peter Marschall <[email protected]>
---
 lib/Net/LDAP/FilterMatch.pm |   42 +++++++++++++++++++++---------------------
 1 files changed, 21 insertions(+), 21 deletions(-)

diff --git lib/Net/LDAP/FilterMatch.pm lib/Net/LDAP/FilterMatch.pm
index 40c6550..7cbb513 100644
--- lib/Net/LDAP/FilterMatch.pm
+++ lib/Net/LDAP/FilterMatch.pm
@@ -17,7 +17,7 @@ use Net::LDAP::Filter;
 use Net::LDAP::Schema;
 
 use vars qw($VERSION);
-$VERSION   = '0.17_01';
+$VERSION   = '0.17_02';
 
 sub import {
   shift;
@@ -37,16 +37,16 @@ use vars qw(@approxMatchers);
 
 sub _filterMatch($@);
 
-sub _cis_equalityMatch($@);
-sub _exact_equalityMatch($@);
-sub _numeric_equalityMatch($@);
-sub _cis_orderingMatch($@);
-sub _numeric_orderingMatch($@);
-sub _cis_greaterOrEqual($@);
-sub _cis_lessOrEqual($@);
-sub _cis_approxMatch($@);
-sub _cis_substrings($@);
-sub _exact_substrings($@);
+sub _cis_equalityMatch($$@);
+sub _exact_equalityMatch($$@);
+sub _numeric_equalityMatch($$@);
+sub _cis_orderingMatch($$@);
+sub _numeric_orderingMatch($$@);
+sub _cis_greaterOrEqual($$@);
+sub _cis_lessOrEqual($$@);
+sub _cis_approxMatch($$@);
+sub _cis_substrings($$@);
+sub _exact_substrings($$@);
 
 # all known matches from the OL 2.2 schema,
 *_bitStringMatch = \&_exact_equalityMatch;
@@ -168,7 +168,7 @@ sub _filterMatch($@)
   return undef;	# all other filters => fail with error
 }
 
-sub _cis_equalityMatch($@)
+sub _cis_equalityMatch($$@)
 {
   my $assertion = shift;
   my $op = shift;
@@ -176,7 +176,7 @@ sub _cis_equalityMatch($@)
   return grep(/^\Q$assertion\E$/i, @_) ? 1 : 0;
 }
 
-sub _exact_equalityMatch($@)
+sub _exact_equalityMatch($$@)
 {
   my $assertion = shift;
   my $op = shift;
@@ -184,7 +184,7 @@ sub _exact_equalityMatch($@)
   return grep(/^\Q$assertion\E$/, @_) ? 1 : 0;
 }
 
-sub _numeric_equalityMatch($@)
+sub _numeric_equalityMatch($$@)
 {
   my $assertion = shift;
   my $op = shift;
@@ -192,7 +192,7 @@ sub _numeric_equalityMatch($@)
   return grep(/^\Q$assertion\E$/, @_) ? 1 : 0;
 }
 
-sub _cis_orderingMatch($@)
+sub _cis_orderingMatch($$@)
 {
   my $assertion = shift;
   my $op = shift;
@@ -208,7 +208,7 @@ sub _cis_orderingMatch($@)
   };
 }
 
-sub _exact_orderingMatch($@)
+sub _exact_orderingMatch($$@)
 {
   my $assertion = shift;
   my $op = shift;
@@ -224,7 +224,7 @@ sub _exact_orderingMatch($@)
   };
 }
 
-sub _numeric_orderingMatch($@)
+sub _numeric_orderingMatch($$@)
 {
   my $assertion = shift;
   my $op = shift;
@@ -240,7 +240,7 @@ sub _numeric_orderingMatch($@)
   };
 }
 
-sub _cis_substrings($@)
+sub _cis_substrings($$@)
 {
   my $regex=shift;
   my $op=shift;
@@ -249,7 +249,7 @@ sub _cis_substrings($@)
   return grep(/$regex/i, @_) ? 1 : 0;
 }
 
-sub _exact_substrings($@)
+sub _exact_substrings($$@)
 {
   my $regex=shift;
   my $op=shift;
@@ -260,7 +260,7 @@ sub _exact_substrings($@)
 
 # this one is here in case we don't use schema
 
-sub _cis_greaterOrEqual($@)
+sub _cis_greaterOrEqual($$@)
 {
   my $assertion=shift;
   my $op=shift;
@@ -275,7 +275,7 @@ sub _cis_greaterOrEqual($@)
 
 *_cis_lessOrEqual = \&_cis_greaterOrEqual;
 
-sub _cis_approxMatch($@)
+sub _cis_approxMatch($$@)
 {
   my $assertion=shift;
   my $op=shift;
-- 
1.6.2.4
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.