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

Re: Updating schema with ldapmodify




On 08/07/2014 01:02 PM, Howard Chu wrote:
Dieter Klünter wrote:
Am Thu, 07 Aug 2014 09:24:47 -0400
schrieb Katherine Faella <kmf@uri.edu>:

I am running openldap on Redhat 6 at 2.4.23.  I am using cn=config.

I have a schema called uri was added during the initial setup of this
server a few years ago.  In this schema I have an

dn: cn={12}uri,cn=schema,cn=config
objectClass: olcSchemaConfig
cn: {12}uri
olcAttributeTypes: {0}( 1.3.6.1.4.1.14092.2.1.1 NAME 'uriid' EQUALITY
caseIgno
   reMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} )
olcAttributeTypes: {1}( 1.3.6.1.4.1.14092.2.1.2 NAME 'dept' EQUALITY
caseIgnor
   eMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX
1.3.6.1.4.1.1466.115.121.1.15{
   256} )
....
*olcObjectClasses: {7}( 1.3.6.1.4.1.14092.2.2.8 NAME 'URIEducmanager'
DESC 'URI**
** Educmanager' STRUCTURAL MAY ( uid $ userPassword $ employeeNumber
$ cn $ sn $**
**  givenname $ telephoneNumber $ dc ) )*
olcObjectClasses: {8}( 1.3.6.1.4.1.14092.2.2.9 NAME
'URIEdusakaiperson' DESC'
   URIEdusakaiperson' STRUCTURAL MUST ( URIEduemplid $ URIEduecampusid
$ URIEdus
   n $ URIEdustatus $ userPassword ) MAY ( mail $ URIEdugn ) )


I need to update the URIEducmanager objectclass to include the mail
object so it will be:

olcObjectClasses: {7}( 1.3.6.1.4.1.14092.2.2.8 NAME 'URIEducmanager'
DESC 'URI
   Educmanager' STRUCTURAL MAY ( uid $ userPassword $ employeeNumber $
cn $ sn $
    givenname $ mail $ telephoneNumber $ dc ) )

I have tried many combinations the last of which is
ldapmodify -D "cn=admin,cn=config" -x -W -f
/root/ldapscripts/updatecmanager.ldif -v -H ldap://locumtenens.uri.edu

where updatecmanager.ldif contains:

dn: cn={12}uri,cn=schema,cn=config
changetype: modify
delete: objectclass
objectclass: ( 1.3.6.1.4.1.14092.2.2.8 NAME 'URIEducmanager'
   DESC 'URIEducmanager'
   STRUCTURAL MAY ( uid $ userPassword $ employeeNumber $
   cn $ sn $givenname $  telephoneNumber $ dc ) )
-
add: objectclass
objectclass:  ( 1.3.6.1.4.1.14092.2.2.8 NAME 'URIEducmanager'
   DESC 'URIEducmanager' SUP top AUXILIARY
   STRUCTURAL MAY ( uid $ userPassword $ employeeNumber $
   cn $ sn $givenname $ mail $ telephoneNumber $ dc ) )

I don't think that this ancient version ( released 2010/06/30) will
support runtime modification of schemas. But you may try

ldapmodify -b cn={12}uri,cn=schema,cn=config
changetype: modify
replace: objectClasses
objectClasses: {0}(1.3.6.1.4.1.14092 .....

Use the correct attributeType - "olcObjectClasses" - pay attention to what you're doing, this should have been obvious.

Don't use replace, that will delete all the values. Use delete/add of the specific value.

ldapmodify -b cn={12}uri,cn=schema,cn=config
changetype: modify
delete: olcObjectClasses
olcObjectClasses: {7}
-
add: olcObjectClasses
olcObjectClasses: {7}(1.3.6.1.4.1.14092...
-

Howard and all,

Thanks so much for your help!! I had not realized that I should delete/add the ObjectClass with the syntax you provided (ie the {7}). It was the key. I was able to successfully update the schema. I can't thank you enough!

Kathy

--
Katherine Faella                        tel: (401) 874-4469
Sr. Technical Programmer                kmf@uri.edu
University of Rhode Island
University Computing Systems(UCS)
210 Flagg Road
Kingston, Rhode Island  02881