Tk Library Source Code

View Ticket
Login
Ticket UUID: 1060353
Title: ldap::search problem with spaces in filter specs
Type: Bug Version: None
Submitter: andreas_kupries Created on: 2004-11-04 16:59:32
Subsystem: ldap Assigned To: loewerj
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2006-09-24 19:07:20
Resolution: Invalid Closed By: mic42
    Closed on: 2006-09-24 12:07:20
Description:
The original report is
http://bugs.activestate.com/show_bug.cgi?id=34774

Running Active State Tcl 8.4.7 on Windows 2000 server.

Problem with ldap package in tcllib 1.6. Ldap search
does not pick up CNs with space in the CN name.

% set tcl_version
8.4

% info patchlevel
8.4.7

% package require ldap
1.2

Ldap search does not pick up CNs with space in the name.

TestCase.

Search with "General*" works.

% ldap::search $donnelly "o=HBF" "cn=General*" {cn}
{{CN=General Management,O=HBF} {}}

Search with "General Managemernt" fails.

% ldap::search $donnelly "o=HBF" "cn=General Management" {}
% 

The filter string needs to be enclosed in "{}" or a list.

% set f [ list "cn=General Management" ]
{cn=General Management}

(bin) 244 % ldap::search $donnellyServer "o=HBF" $f {cn}
{{CN=General Management,O=HBF} {}}

Doco may need to be updated.
User Comments: mic42 added on 2006-09-24 19:06:48:
Logged In: YES 
user_id=302287

Basically this is user error, the correct filter would be:
(cn=General Management) and not "cn=General Management". The
parsing code replaces () with {} which may not really be
robust enough for corner cases, so i may revisit it, but
this bug is invalid.

nobody added on 2004-11-05 13:29:13:
Logged In: NO 

A LDAP search string has always consist of filter
expressions in parenthesis.

See http://www.faqs.org/rfcs/rfc1960.html :

     <filter> ::= '(' <filtercomp> ')'
     <filtercomp> ::= <and> | <or> | <not> | <item>
     <and> ::= '&' <filterlist>
     <or> ::= '|' <filterlist>
     <not> ::= '!' <filter>
     <filterlist> ::= <filter> | <filter> <filterlist> 
     ....

    4.  Examples

    This section gives a few examples of search filters
written using
    this notation.

       (cn=Babs Jensen)
       (!(cn=Tim Howes))
       (&(objectClass=Person)(|(sn=Jensen)(cn=Babs J*)))
       (o=univ*of*mich*)