[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: dhcp.schema attribute dhcpStatements value in filter



On Tue, 2014-04-01 at 17:21 +0300, Zeus Panchenko wrote:
> (...)
> attributetype ( 2.16.840.1.113719.1.203.4.3 
>         NAME 'dhcpStatements' 
>         EQUALITY caseIgnoreIA5Match
>         DESC 'Flexible storage for specific data depending on what
>               object this exists in. Like conditional statements, server
>               parameters, etc. This allows the standard to evolve
>               without needing to adjust the schema.'
>         SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
> ...
> - ---[ quotation end   ]-------------------------------------------
> 
> so, when I use filter "(&(objectClass=dhcpHost)(dhcpStatements=*))"
> I successfully receive all objects
> but lets say I need to find this object:
> - ---[ quotation start ]-------------------------------------------
> dn: cn=ap01,cn=10.0.0.0,cn=officeXXX DHCP Config,ou=officeXXX,ou=DHCP,
>  dc=allstuff
> cn: ap01
> objectClass: top
> objectClass: dhcpHost
> dhcpHWAddress: ethernet 20:cf:30:88:5d:18
> dhcpStatements: fixed-address 10.0.0.222
> - ---[ quotation end   ]-------------------------------------------
> 
> I use filter:
> "(&(objectClass=dhcpHost)(dhcpStatements=fixed-address 10.0.0.222))"
> 
> and receive empty result ...

If you've given dhcpStatements an index in slapd.conf when
the attribute already existed in LDAP tree, you also need to
stop slapd and run sbin/slapindex.  Otherwise the index is
empty, and tells slapd there are no matches for your filter.
OTOH using cn=config to add an index does this automatically.

> it is the same picture for anything except dhcpStatements=* ...
> 
> so, how is it correct to write the filter to get all objects with IP
> like 10.0.0.2* ?

Doesn't look like you can.  The dhcpStatements attribute
description you showed has no SUBSTR(ing) matching rule, so
you can't use substring search.  "(attrname=*)" is a special
case: it's presence search, not substring search.