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

Re: Blank Attribute - further question

In reference to the previous question from August:

At 07:22 AM 8/11/2005, Ivan.Garcia@leroymerlin.es wrote:

adding new entry "uid=30000001,ou=people,ou=es- lm,o=corp.happyparty.com"

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

this appears when the mail attribute is blank, but when the mail


is writted that´s all OK.

If you example the technical specification for the LDAP syntax of the 'mail' attribute you will find that it doesn't allow empty values. Hence, slapd(8)'s response.


I am having trouble figuring out what it is about the mail attribute that indicates "can not be blank".

See Section 9.3.3 (RFC 822 Mailbox) of RFC 1274 (also known in as the 'mail' attribute in LDAP). Note the SIZE restriction. slapd(8) is coded to enforce this restriction.

Also note that a valid RFC 882 Mailbox [RFC 2822] cannot be
zero-length.  If the object has no mailbox associated with it,
the 'mail' attribute should not be present.  Providing a
'mail' attribute (or any other attribute for that matter)
with garbage values will lead to interoperability problems.

Right, but that doesn't look the same as what I'm seeing in the OpenLDAP schema files.

     rfc822Mailbox ATTRIBUTE
             (SIZE (1 .. ub-rfc822-mailbox))
     ::= {pilotAttributeType 3}

Just to make sure we are on the same page, I assure you that I am not planning on trying to set the actual 'mail' attribute to 0 length. I simply used that as an example. I'm actually creating an entirely new custom attribute but have been unable to figure out how to make it permit a 0 length string. The SIZE restriction in the OpenLDAP schema file looks like 256 max to me. Am I reading that wrong?

attributetype ( 0.9.2342.19200300.100.1.3
        NAME ( 'mail' 'rfc822Mailbox' )
        DESC 'RFC1274: RFC822 Mailbox'
    EQUALITY caseIgnoreIA5Match
    SUBSTR caseIgnoreIA5SubstringsMatch
    SYNTAX{256} )

{256} is the SIZE, is it not? And it looks like a maximum (as that is obviously not the minimum). But lets say I have something like this:

attributetype (
        NAME 'ncsuPreferredMiddleName'
        DESC 'Preferred middle name for display'
        EQUALITY caseIgnoreMatch
        SUBSTR caseIgnoreSubstringsMatch

Now, this can be blank if you want your middle name to not be listed at all. We have a ncsuMiddleName as well, which is your legal middle name. The theoretical check would go like this:

if (ncsuPreferredMiddleName) { use that}
else { use ncsuMiddleName }

Well, the user might want to specify an empty preferred middle name, thereby saying "I don't want you to list the middle name". Whereas if I simply did not have the ncsuPreferredMiddleName there, one might assume "ok, they don't have a preference, stick with legal".

So how would I indicate that it's permissible to have a 0 length string for ncsuPreferredMiddleName? =/

Is it possible to do something like this?

attributetype (
        NAME 'ncsuPreferredMiddleName'
        DESC 'Preferred middle name for display'
        EQUALITY caseIgnoreMatch
        SUBSTR caseIgnoreSubstringsMatch
        SYNTAX{0..} SINGLE-VALUE )
       SYNTAX{0..256} SINGLE-VALUE )


Daniel Henninger <daniel@ncsu.edu>
Systems Programmer
Information Technology Division