Removing/modifying LDAP objectclasses/attributes using olc
Posted
by
Foezjie
on Server Fault
See other posts from Server Fault
or by Foezjie
Published on 2012-09-10T09:33:00Z
Indexed on
2012/09/10
9:39 UTC
Read the original article
Hit count: 299
I'm having trouble using openldap's olc to modify a schema without shutting down the server. To test some things out, I made the following schema:
objectIdentifier tests orgUlyssisOID:4
objectIdentifier testAttribute tests:1
objectIdentifier testObjectClass tests:2
attributeType ( testAttribute:1 NAME 'attr1'
DESC 'attribuut 1'
SYNTAX '1.3.6.1.4.1.1466.115.121.1.40' )
attributeType ( testAttribute:2 NAME 'attr2'
DESC 'attribuut 2'
SUP userPassword
SINGLE-VALUE )
objectclass ( testObjectClass:1 NAME 'class1'
DESC 'objectclass 1'
SUP top
STRUCTURAL
MUST (attr1 $ attr2 ) )
And added it to a new schema called test. (cn={9}test.ldif in cn=schema). Now I can't seem to figure out how to delete class1 from that schema. I use the following LDIF (and tried lots of variations too, to no avail)
dn : cn={9}test,cn=schema,cn=config
changetype: modify
delete: olcObjectClasses
olcObjectClasses: ( testObjectClass:1 NAME 'class1' DESC 'objectclass 1' SUP top STRUCTURAL MUST ( attr1 $ attr2 ) )
Running ldapmodify -x -W -D cn=admin,cn=config -f test.ldif -d 0 gives no output. -d 1 gives this:
ldap_create
ldap_sasl_bind
ldap_send_initial_request
ldap_new_connection 1 1 0
ldap_int_open_connection
ldap_connect_to_host: TCP localhost:389
ldap_new_socket: 4
ldap_prepare_socket: 4
ldap_connect_to_host: Trying 127.0.0.1:389
ldap_pvt_connect: fd: 4 tm: -1 async: 0
ldap_open_defconn: successful
ldap_send_server_request
ber_scanf fmt ({it) ber:
ber_scanf fmt ({i) ber:
ber_flush2: 38 bytes to sd 4
ldap_result ld 0x7f2a8ccf3430 msgid 1
wait4msg ld 0x7f2a8ccf3430 msgid 1 (infinite timeout)
wait4msg continue ld 0x7f2a8ccf3430 msgid 1 all 1
** ld 0x7f2a8ccf3430 Connections:
* host: localhost port: 389 (default)
refcnt: 2 status: Connected
last used: Mon Sep 10 11:29:57 2012
** ld 0x7f2a8ccf3430 Outstanding Requests:
* msgid 1, origid 1, status InProgress
outstanding referrals 0, parent count 0
ld 0x7f2a8ccf3430 request count 1 (abandoned 0)
** ld 0x7f2a8ccf3430 Response Queue:
Empty
ld 0x7f2a8ccf3430 response count 0
ldap_chkResponseList ld 0x7f2a8ccf3430 msgid 1 all 1
ldap_chkResponseList returns ld 0x7f2a8ccf3430 NULL
ldap_int_select
read1msg: ld 0x7f2a8ccf3430 msgid 1 all 1
ber_get_next
ber_get_next: tag 0x30 len 12 contents:
read1msg: ld 0x7f2a8ccf3430 msgid 1 message type bind
ber_scanf fmt ({eAA) ber:
read1msg: ld 0x7f2a8ccf3430 0 new referrals
read1msg: mark request completed, ld 0x7f2a8ccf3430 msgid 1
request done: ld 0x7f2a8ccf3430 msgid 1
res_errno: 0, res_error: <>, res_matched: <>
ldap_free_request (origid 1, msgid 1)
ldap_parse_result
ber_scanf fmt ({iAA) ber:
ber_scanf fmt (}) ber:
ldap_msgfree
ldap_free_connection 1 1
ldap_send_unbind
ber_flush2: 7 bytes to sd 4
ldap_free_connection: actually freed
So no real indication of an error. Where am I doing it wrong? Bonus question: If I have some entries of a certain objectclass, can I modify it (add/remove attributeTypes) without removing the entries?
Thanks in advance for all help.
© Server Fault or respective owner