You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@directory.apache.org by david jones <jo...@gmail.com> on 2011/10/17 14:29:14 UTC
search not working as expected
can anyone tell me why this search is not working for name=USERID (or any
other search on name i've tried. I thought initially it might have something
to do with case, but does not appear to be)
code (1.5.5):
filter = FilterParser.parse("(&(ou=bofmusers)(name="+name+"))");
cursor = service.getAdminSession().search(new
LdapDN("ou=system") , SearchScope.SUBTREE , filter,
AliasDerefMode.DEREF_ALWAYS, null);
// Find a matching entry by name
while ( cursor.next() )
.......
exported ldif:
dn: uid=6eaae748-92c3-43d7-8e46-1c5f805d70ff,ou=bofmusers,ou=system
objectClass: bofmUsers
objectClass: top
cn: 6eaae748-92c3-43d7-8e46-1c5f805d70ff
member: ou=bofmusers,ou=system
name: USERID
ou: ou=bofmusers,ou=system
ou: bofmusers
uid: 6eaae748-92c3-43d7-8e46-1c5f805d70ff
I've got the ldap debug trace, but i think its too long to append.
Thanks,
David
Re: search not working as expected
Posted by david jones <jo...@gmail.com>.
Which release? ie. least amount of code rework, but stable and filters
working etc?
On Mon, Oct 17, 2011 at 9:12 AM, Emmanuel Lecharny <el...@gmail.com>wrote:
> On 10/17/11 2:29 PM, david jones wrote:
>
>> can anyone tell me why this search is not working for name=USERID (or any
>> other search on name i've tried. I thought initially it might have
>> something
>> to do with case, but does not appear to be)
>>
>> code (1.5.5):
>>
>> filter = FilterParser.parse("(&(ou=**bofmusers)(name="+name+"))");
>> cursor = service.getAdminSession().**search(new
>> LdapDN("ou=system") , SearchScope.SUBTREE , filter,
>> AliasDerefMode.DEREF_ALWAYS, null);
>>
>> // Find a matching entry by name
>> while ( cursor.next() )
>> .......
>>
>>
>> exported ldif:
>>
>> dn: uid=6eaae748-92c3-43d7-8e46-**1c5f805d70ff,ou=bofmusers,ou=**system
>>
>> objectClass: bofmUsers
>>
>> objectClass: top
>>
>> cn: 6eaae748-92c3-43d7-8e46-**1c5f805d70ff
>>
>> member: ou=bofmusers,ou=system
>>
>> name: USERID
>>
>> ou: ou=bofmusers,ou=system
>>
>> ou: bofmusers
>>
>> uid: 6eaae748-92c3-43d7-8e46-**1c5f805d70ff
>>
>>
>>
>> I've got the ldap debug trace, but i think its too long to append.
>>
>
> Sorry, my bad. The '+name+' is a String concatenation. I didn't saw the "
> around.
>
> It should work. You should also test the filter on a more recent version,
> 1.5.5 is buggy...
>
>
>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>
>
--
David Jones
jonesda24@gmail.com
c) 302-5648
Re: search not working as expected
Posted by Emmanuel Lecharny <el...@gmail.com>.
On 10/17/11 2:29 PM, david jones wrote:
> can anyone tell me why this search is not working for name=USERID (or any
> other search on name i've tried. I thought initially it might have something
> to do with case, but does not appear to be)
>
> code (1.5.5):
>
> filter = FilterParser.parse("(&(ou=bofmusers)(name="+name+"))");
> cursor = service.getAdminSession().search(new
> LdapDN("ou=system") , SearchScope.SUBTREE , filter,
> AliasDerefMode.DEREF_ALWAYS, null);
>
> // Find a matching entry by name
> while ( cursor.next() )
> .......
>
>
> exported ldif:
>
> dn: uid=6eaae748-92c3-43d7-8e46-1c5f805d70ff,ou=bofmusers,ou=system
>
> objectClass: bofmUsers
>
> objectClass: top
>
> cn: 6eaae748-92c3-43d7-8e46-1c5f805d70ff
>
> member: ou=bofmusers,ou=system
>
> name: USERID
>
> ou: ou=bofmusers,ou=system
>
> ou: bofmusers
>
> uid: 6eaae748-92c3-43d7-8e46-1c5f805d70ff
>
>
>
> I've got the ldap debug trace, but i think its too long to append.
Sorry, my bad. The '+name+' is a String concatenation. I didn't saw the
" around.
It should work. You should also test the filter on a more recent
version, 1.5.5 is buggy...
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com
Re: search not working as expected
Posted by Kiran Ayyagari <ka...@apache.org>.
call cursor.beforeFirst() right after getting the cursor and see
On Mon, Oct 17, 2011 at 8:29 AM, david jones <jo...@gmail.com> wrote:
> can anyone tell me why this search is not working for name=USERID (or any
> other search on name i've tried. I thought initially it might have something
> to do with case, but does not appear to be)
>
> code (1.5.5):
>
> filter = FilterParser.parse("(&(ou=bofmusers)(name="+name+"))");
> cursor = service.getAdminSession().search(new
> LdapDN("ou=system") , SearchScope.SUBTREE , filter,
> AliasDerefMode.DEREF_ALWAYS, null);
>
> // Find a matching entry by name
> while ( cursor.next() )
> .......
>
>
> exported ldif:
>
> dn: uid=6eaae748-92c3-43d7-8e46-1c5f805d70ff,ou=bofmusers,ou=system
>
> objectClass: bofmUsers
>
> objectClass: top
>
> cn: 6eaae748-92c3-43d7-8e46-1c5f805d70ff
>
> member: ou=bofmusers,ou=system
>
> name: USERID
>
> ou: ou=bofmusers,ou=system
>
> ou: bofmusers
>
> uid: 6eaae748-92c3-43d7-8e46-1c5f805d70ff
>
>
>
> I've got the ldap debug trace, but i think its too long to append.
>
> Thanks,
> David
>
--
Kiran Ayyagari
Re: search not working as expected
Posted by Emmanuel Lecharny <el...@gmail.com>.
On 10/17/11 2:29 PM, david jones wrote:
> can anyone tell me why this search is not working for name=USERID (or any
> other search on name i've tried. I thought initially it might have something
> to do with case, but does not appear to be)
>
> code (1.5.5):
>
> filter = FilterParser.parse("(&(ou=bofmusers)(name="+name+"))");
> cursor = service.getAdminSession().search(new
> LdapDN("ou=system") , SearchScope.SUBTREE , filter,
> AliasDerefMode.DEREF_ALWAYS, null);
>
> // Find a matching entry by name
> while ( cursor.next() )
> .......
>
>
> exported ldif:
>
> dn: uid=6eaae748-92c3-43d7-8e46-1c5f805d70ff,ou=bofmusers,ou=system
>
> objectClass: bofmUsers
>
> objectClass: top
>
> cn: 6eaae748-92c3-43d7-8e46-1c5f805d70ff
>
> member: ou=bofmusers,ou=system
>
> name: USERID
>
> ou: ou=bofmusers,ou=system
>
> ou: bofmusers
>
> uid: 6eaae748-92c3-43d7-8e46-1c5f805d70ff
>
>
>
> I've got the ldap debug trace, but i think its too long to append.
(name="+name+") will not match anything. The server will try to fin the
exact '+name+' string into the name Attribute, and obviosuly won't find it.
I don't know what you are trying to do with the '+name+' notation, but
this is invalid.
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com