0

I have a user defined schema ,which is to be added into the existing LDAP server. Its ldif format is:

dn: cn=userControl,cn=schema,cn=config
objectClass: olcSchemaConfig
cn: userControl
olcAttributeTypes: ( 1.3.6.1.4.1.xxxxx.1.1.1 
    NAME 'genderAttr'
    DESC 'gender'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )

olcAttributeTypes: ( 1.3.6.1.4.1.xxxxx.1.1.2
    NAME 'dobAttr'
    DESC 'dateOfBirth'
    EQUALITY generalizedTimeMatch
    ORDERING generalizedTimeOrderingMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )

olcAttributeTypes: (1.3.6.1.4.1.xxxxx.1.1.3
    NAME 'languageAttr'
    DESC 'languages known'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
    SINGLE-VALUE )

olcAttributeTypes: (  1.3.6.1.4.1.xxxxx.1.1.4
    NAME 'mTongueAttr'
    DESC 'motherTongue'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
    SINGLE-VALUE )


olcAttributeTypes: ( 1.3.6.1.4.1.xxxxx.1.1.5
    NAME 'nationalityAttr
    DESC 'nationality'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )

olcAttributeTypes: ( 1.3.6.1.4.1.xxxxx.1.1.6
    NAME 'worksAtAttr'
    DESC 'worksAt'
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )

olcAttributeTypes: ( 1.3.6.1.4.1.xxxxx.1.1.7
    NAME 'qualificationAttr'
    DESC 'qualification'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )

olcAttributeTypes: ( 1.3.6.1.4.1.xxxxx.1.1.8
    NAME 'schoolAttr'
    DESC 'school'
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )

olcAttributeTypes: ( 1.3.6.1.4.1.xxxxx.1.1.9
    NAME 'collegeAttr'
    DESC 'college'
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )


olcAttributeTypes: ( 1.3.6.1.4.1.xxxxx.1.1.10
    NAME 'addressAttr'
    DESC 'address'
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )


olcAttributeTypes: ( 1.3.6.1.4.1.xxxxx.1.1.11
    NAME 'zipAttr'
    DESC 'pinCode'
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )

objectclass ( 1.3.6.1.4.1.xxxxx.1.2.1
    NAME 'userControl'
    DESC 'RFC2798: New Customized Schema'
    SUP organizationalPerson
    STRUCTURAL
    MAY (
        gender $ dateOfBirth $ languagesKnown $ motherTongue $ nationality $ worksAt $ qualification $ school $ college $ address $ pinCode $ contactNumber $ interestedIn )
    )

and the .schema format is

# userControl.schema
attributetype ( 1.3.6.1.4.1.xxxxx.1.1.1 
    NAME 'genderAttr'
    DESC 'gender'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )

attributetype ( 1.3.6.1.4.1.xxxxx.1.1.2
    NAME 'dobAttr'
    DESC 'dateOfBirth'
    EQUALITY generalizedTimeMatch
    ORDERING generalizedTimeOrderingMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )

attributetype (1.3.6.1.4.1.xxxxx.1.1.3
    NAME 'languageAttr'
    DESC 'languages known'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
    SINGLE-VALUE )

attributetype (  1.3.6.1.4.1.xxxxx.1.1.4
    NAME 'mTongueAttr'
    DESC 'motherTongue'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
    SINGLE-VALUE )


attributetype ( 1.3.6.1.4.1.xxxxx.1.1.5
    NAME 'nationalityAttr
    DESC 'nationality'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )

attributetype ( 1.3.6.1.4.1.xxxxx.1.1.6
    NAME 'worksAtAttr'
    DESC 'worksAt'
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )

attributetype ( 1.3.6.1.4.1.xxxxx.1.1.7
    NAME 'qualificationAttr'
    DESC 'qualification'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )

attributetype ( 1.3.6.1.4.1.xxxxx.1.1.8
    NAME 'schoolAttr'
    DESC 'school'
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )

attributetype ( 1.3.6.1.4.1.xxxxx.1.1.9
    NAME 'collegeAttr'
    DESC 'college'
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )


attributetype ( 1.3.6.1.4.1.xxxxx.1.1.10
    NAME 'addressAttr'
    DESC 'address'
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )


attributetype ( 1.3.6.1.4.1.xxxxx.1.1.11
    NAME 'zipAttr'
    DESC 'pinCode'
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )

objectclass ( 1.3.6.1.4.1.xxxxx.1.2.1
    NAME 'userControl'
    DESC 'RFC2798: New Customized Schema'
    SUP organizationalPerson
    STRUCTURAL
    MAY (
        gender $ dateOfBirth $ languagesKnown $ motherTongue $ nationality $ worksAt $ qualification $ school $ college $ address $ pinCode $ contactNumber $ interestedIn )
    )

I have tried to add the ldif file into the LDAP using the code

sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/userControl.ldif

But I am getting an error

ldapadd: invalid format (line 5) entry: "cn=userControl,cn=schema,cn=config"

I have checked for solutions and applied it, but there was no use. Still I am getting errors. I have compared my schema with other schema and ldif file with other ldif files, I couldn't found any mistakes. Anyone please help me to solve this problem.

My OS is Ubuntu 12.04 LTS. Is there any need to add

# global configuration settings
        dn: cn=config
        objectClass: olcGlobal
        cn: config

in ldif file. I have tried it. But then also I got the same error.

0

Frankly, your whole schema is a singular mess.

  • To define an objectClass in your schema, you need an olcObjectClasses: line, with the : at the end.
  • The attribute list has to be a list of the NAME entries, not the DESC, so it needs to be MAY ( genderAttr $ dobAttr etc.
  • NAME 'nationalityAttr misses a closing '
  • Is zipAttr a ZIP code or a PIN?
  • contactNumber and interestedIn aren't defined at all but referenced in the olcObjectClasses line.
  • the Attr postfix after any attribute is useless. It's clear that it is an attribute because what else should it be?
  • the empty lines between the entries are invalid.

If you fix all this, you end up with something like the file below (still missing contact and interests), that is easy to import (replace 88888 with your private OID number).

dn: cn=userControl,cn=schema,cn=config
objectClass: olcSchemaConfig
cn: userControl
olcAttributeTypes: ( 1.3.6.1.4.1.88888.1.1.1 
    NAME 'genderAttr'
    DESC 'gender'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
olcAttributeTypes: ( 1.3.6.1.4.1.88888.1.1.2
    NAME 'dobAttr'
    DESC 'dateOfBirth'
    EQUALITY generalizedTimeMatch
    ORDERING generalizedTimeOrderingMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )
olcAttributeTypes: (1.3.6.1.4.1.88888.1.1.3
    NAME 'languageAttr'
    DESC 'languages known'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
    SINGLE-VALUE )
olcAttributeTypes: (  1.3.6.1.4.1.88888.1.1.4
    NAME 'mTongueAttr'
    DESC 'motherTongue'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
    SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.88888.1.1.5
    NAME 'nationalityAttr'
    DESC 'nationality'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
olcAttributeTypes: ( 1.3.6.1.4.1.88888.1.1.6
    NAME 'worksAtAttr'
    DESC 'worksAt'
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
olcAttributeTypes: ( 1.3.6.1.4.1.88888.1.1.7
    NAME 'qualificationAttr'
    DESC 'qualification'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
olcAttributeTypes: ( 1.3.6.1.4.1.88888.1.1.8
    NAME 'schoolAttr'
    DESC 'school'
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
olcAttributeTypes: ( 1.3.6.1.4.1.88888.1.1.9
    NAME 'collegeAttr'
    DESC 'college'
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
olcAttributeTypes: ( 1.3.6.1.4.1.88888.1.1.10
    NAME 'addressAttr'
    DESC 'address'
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
olcAttributeTypes: ( 1.3.6.1.4.1.88888.1.1.11
    NAME 'zipAttr'
    DESC 'pinCode'
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
olcObjectClasses: ( 1.3.6.1.4.1.88888.1.2.1
    NAME 'userControl'
    DESC 'RFC2798: New Customized Schema'
    SUP organizationalPerson
    STRUCTURAL
    MAY (
        genderAttr $ dobAttr $ languageAttr $ mTongueAttr $ nationalityAttr $ worksAtAttr $ qualificationAttr $ schoolAttr $ collegeAttr $  addressAttr $ zipAttr)
    )
  • Thank you. it is working. I have already noticed that order and all. but a simple ' was missing. anyway thanks alot – user3475398 Oct 8 '14 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.