Package: libldap-ruby1.8
Severity: normal
Version: 0.9.5-1

Hi there,

coming from 0.9.0-1, which worked fine, I upgraded to 0.9.5-1, which
broke schema processing in my script:

invalid regular expression; can't use character class as an end value of
range: /MUST\s+\(([\w\d_-\s\$]+)\)/

 in /usr/lib/ruby/1.8/ldap/schema.rb:38

To invoke the bug I basically use this source:
 @conn = ::LDAP::Conn.new('bts2ldap.debian.net', 10101)
 s = @conn.schema
 s.attr("debbugsBug", "MUST")

Ruby does not seem to cope with dashes within a regular expression, it
needs to be put at the end. \w also already matches \d and _, so those
character sets could be removed.

I applied the attached patch (which truncates the expression down to
`[\w\s\$-]' instead of `[\w\d_-\s\$]') to make it work for me. I am not
entirely sure if the fix is right, but it looks to me like it.

Kind regards,
Philipp Kern
diff -Nru /tmp/Z3SbBTRcn0/libldap-ruby-0.9.5/lib/ldap/schema.rb /tmp/zp26PVdEtw/libldap-ruby-0.9.5/lib/ldap/schema.rb
--- /tmp/Z3SbBTRcn0/libldap-ruby-0.9.5/lib/ldap/schema.rb	2006-02-09 00:15:17.000000000 +0100
+++ /tmp/zp26PVdEtw/libldap-ruby-0.9.5/lib/ldap/schema.rb	2006-09-04 03:02:30.000000000 +0200
@@ -35,7 +35,7 @@
       self['objectClasses'].each{|s|
 	if( s =~ /NAME\s+'#{oc}'/ )
 	  case s
-	  when /#{at}\s+\(([\w\d_-\s\$]+)\)/i
+	  when /#{at}\s+\(([\w\s\$-]+)\)/i
 	    return $1.split("$").collect{|attr| attr.strip}
 	  when /#{at}\s+([\w\d_-]+)/i
 	    return $1.split("$").collect{|attr| attr.strip}

Reply via email to