With a little side of applesauce...

Sunday, January 28, 2007

OpenLDAP - booleanMatch values TRUE/FALSE

I am creating custom objectClasses for a class project, and kept getting the following error when trying to add a new object from an ldif file:

ldap_add: Invalid syntax (21)
additional info: siteStatus: value #0 invalid per syntax

Here was my LDIF:

version: 1

dn: ou=testsite,dc=erikin,dc=com
ou: testsite
objectclass: epSite
objectclass: organizationalUnit
progLang: Perl
siteStatus: false
url: testsite.erikin.com

And, here was the attributetype from my local.schema file:

attributetype ( epSiteAttribute:4.2006.11.29.1
NAME ’siteStatus’
DESC ‘Is the site live or not (bool)’
EQUALITY booleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
)

Can you spot the problem…? I couldn’t, but thankfully this email:

http://www.openldap.org/lists/openldap-software/200109/msg00198.html

pointed me to RFC 2252:

6.4. Boolean

( 1.3.6.1.4.1.1466.115.121.1.7 DESC ‘Boolean’ )

Values in this syntax are encoded according to the following BNF:

boolean = “TRUE” / “FALSE”

Boolean values have an encoding of “TRUE” if they are logically true,
and have an encoding of “FALSE” otherwise.

http://tools.ietf.org/html/rfc2252

The boolean values (TRUE/FALSE) in the LDIF file need to be UPPERCASE :P Here is the working LDIF:

version: 1

dn: ou=testsite,dc=erikin,dc=com
ou: testsite
objectclass: epSite
objectclass: organizationalUnit
progLang: Perl
siteStatus: FALSE
url: testsite.erikin.com

No comments: