Package: ldapvi Version: 1.7-9 Severity: normal Tags: upstream Hi,
the following bug report comes from a co-worker of mine who tried to edit cn=config with ldapvi: Summary: -------- ldapvi seems to sort entries alphabetically, which may break specific modifications where the order of the definitions is important. Instructions to reproduce the bug: ---------------------------------- Install slapd on Debian Jessie. Create `import.ldif` with the following contents: dn: cn={4}dummy,cn=schema,cn=config changetype: add objectClass: olcSchemaConfig olcObjectClasses: {0}( 7.16.840.1.113730.3.2.0 NAME 'objClass0' DESC 'Dummy Object Class 0' ) olcObjectClasses: {1}( 7.16.840.1.113730.3.2.1 NAME 'dummyParent' DESC 'Dummy Parent' SUP posixAccount AUXILIARY ) olcObjectClasses: {2}( 7.16.840.1.113730.3.2.2 NAME 'objClass2' DESC 'Dummy Object Class 2') olcObjectClasses: {3}( 7.16.840.1.113730.3.2.3 NAME 'objClass3' DESC 'Dummy Object Class 3') olcObjectClasses: {4}( 7.16.840.1.113730.3.2.4 NAME 'objClass4' DESC 'Dummy Object Class 4') olcObjectClasses: {5}( 7.16.840.1.113730.3.2.5 NAME 'objClass5' DESC 'Dummy Object Class 5') olcObjectClasses: {6}( 7.16.840.1.113730.3.2.6 NAME 'objClass6' DESC 'Dummy Object Class 6') olcObjectClasses: {7}( 7.16.840.1.113730.3.2.7 NAME 'objClass7' DESC 'Dummy Object Class 7') olcObjectClasses: {8}( 7.16.840.1.113730.3.2.8 NAME 'objClass8' DESC 'Dummy Object Class 8') olcObjectClasses: {9}( 7.16.840.1.113730.3.2.9 NAME 'objClass9' DESC 'Dummy Object Class 9') then add it to ldap ldapadd -Y EXTERNAL -H ldapi:/// -f import.ldif Next use ldapvi to edit the config ldapvi -Y EXTERNAL -h ldapi:/// -b "cn=config" and add a 10th Objectclass at the end of the newly added cn={4}dummy after objClass9 olcObjectClasses: {10}( 7.16.840.1.113730.3.2.10 NAME 'dummyChild' DESC 'Dummy Child' SUP dummyParent AUXILIARY ) when saving and quitting vi, stdout shows SASL/EXTERNAL authentication started SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth SASL SSF: 0 12 entries read add: 0, rename: 0, modify: 1, delete: 0 Action? [yYqQvVebB*rsf+?] confirming the action with y produces the following error message: ldap_modify: Other (e.g., implementation specific) error (80) additional info: olcObjectClasses: ObjectClass not found: "dummyParent" Error at: cn={4}dummy,cn=schema,cn=config Abort with q, which saves the ldif to a local file named like ",ldapvi-hostname-xxxxx.ldif" Inspect the file to see that the elements are in alphabetical, instead of numerical order version: 1 # to apply these changes using ldapvi, run: # ldapvi --ldapmodify -h ldapi:/// ,ldapvi-hostname-xxxxx.ldif dn: cn={4}dummy,cn=schema,cn=config changetype: modify replace: olcObjectClasses olcObjectClasses: {0}( 7.16.840.1.113730.3.2.0 NAME 'objClass0' DESC 'Dummy Object Class 0' ) olcObjectClasses: {10}( 7.16.840.1.113730.3.2.10 NAME 'dummyChild' DESC 'Dummy Child' SUP dummyParent AUXILIARY ) olcObjectClasses: {1}( 7.16.840.1.113730.3.2.1 NAME 'dummyParent' DESC 'Dummy Parent' SUP posixAccount AUXILIARY ) olcObjectClasses: {2}( 7.16.840.1.113730.3.2.2 NAME 'objClass2' DESC 'Dummy Object Class 2') olcObjectClasses: {3}( 7.16.840.1.113730.3.2.3 NAME 'objClass3' DESC 'Dummy Object Class 3') olcObjectClasses: {4}( 7.16.840.1.113730.3.2.4 NAME 'objClass4' DESC 'Dummy Object Class 4') olcObjectClasses: {5}( 7.16.840.1.113730.3.2.5 NAME 'objClass5' DESC 'Dummy Object Class 5') olcObjectClasses: {6}( 7.16.840.1.113730.3.2.6 NAME 'objClass6' DESC 'Dummy Object Class 6') olcObjectClasses: {7}( 7.16.840.1.113730.3.2.7 NAME 'objClass7' DESC 'Dummy Object Class 7') olcObjectClasses: {8}( 7.16.840.1.113730.3.2.8 NAME 'objClass8' DESC 'Dummy Object Class 8') olcObjectClasses: {9}( 7.16.840.1.113730.3.2.9 NAME 'objClass9' DESC 'Dummy Object Class 9') - Adding it with ldapadd fails with the same error message ldapadd -Y EXTERNAL -H ldapi:/// -f ,ldapvi-hostname-xxxxx.ldif as it tries to add the dummyChild before knowing the dummyParent. Edit it to put the elements into correct order, ie putting the 10th element at the end version: 1 # to apply these changes using ldapvi, run: # ldapvi --ldapmodify -h ldapi:/// ,ldapvi-hostname-xxxxx.ldif dn: cn={4}dummy,cn=schema,cn=config changetype: modify replace: olcObjectClasses olcObjectClasses: {0}( 7.16.840.1.113730.3.2.0 NAME 'objClass0' DESC 'Dummy Object Class 0' ) olcObjectClasses: {1}( 7.16.840.1.113730.3.2.1 NAME 'dummyParent' DESC 'Dummy Parent' SUP posixAccount AUXILIARY ) olcObjectClasses: {2}( 7.16.840.1.113730.3.2.2 NAME 'objClass2' DESC 'Dummy Object Class 2') olcObjectClasses: {3}( 7.16.840.1.113730.3.2.3 NAME 'objClass3' DESC 'Dummy Object Class 3') olcObjectClasses: {4}( 7.16.840.1.113730.3.2.4 NAME 'objClass4' DESC 'Dummy Object Class 4') olcObjectClasses: {5}( 7.16.840.1.113730.3.2.5 NAME 'objClass5' DESC 'Dummy Object Class 5') olcObjectClasses: {6}( 7.16.840.1.113730.3.2.6 NAME 'objClass6' DESC 'Dummy Object Class 6') olcObjectClasses: {7}( 7.16.840.1.113730.3.2.7 NAME 'objClass7' DESC 'Dummy Object Class 7') olcObjectClasses: {8}( 7.16.840.1.113730.3.2.8 NAME 'objClass8' DESC 'Dummy Object Class 8') olcObjectClasses: {9}( 7.16.840.1.113730.3.2.9 NAME 'objClass9' DESC 'Dummy Object Class 9') olcObjectClasses: {10}( 7.16.840.1.113730.3.2.10 NAME 'dummyChild' DESC 'Dummy Child' SUP dummyParent AUXILIARY ) - Then import the correctly sorted ldif ldapadd -Y EXTERNAL -H ldapi:/// -f ,ldapvi-hostname-xxxxx.ldif which works. -- System Information: Debian Release: 8.4 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'proposed-updates'), (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores) Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: sysvinit (via /sbin/init) Versions of packages ldapvi depends on: ii libc6 2.19-18+deb8u4 ii libglib2.0-0 2.42.1-1+b1 ii libldap-2.4-2 2.4.40+dfsg-1+deb8u2 ii libncurses5 5.9+20140913-1+b1 ii libpopt0 1.16-10 ii libreadline6 6.3-8+b3 ii libtinfo5 5.9+20140913-1+b1 ldapvi recommends no packages. ldapvi suggests no packages. -- no debconf information