On Sat, Apr 02, 2005 at 04:36:49AM +0200, Torsten Landschoff wrote:
> > 2) error in parsing the saved ldif file:
> >     Setting up slapd (2.2.23-1) ...
> >       Enabling LDAPv2 support... already enabled.
> >       Updating config access directives... done.
> >       Moving old database directories to /var/backups:
> >       Loading from /var/backups/slapd-2.1.30-3: 
> >       - directory dc=cavein,dc=org... slapadd: could not parse entry
> >         (line=316) failed.

> That's quite known an issue. If you consider this grave, we can't put
> slapd 2.2 in Debian as 2.2 fails on a lot of 2.1 and even more of 2.0
> directories. I am working on a README type upgrade document which tells
> the user.

I think it's worth a lot to provide as smooth of an upgrade path as
possible, and leave the README for cases we can't reasonably handle.  Can
this particular LDIF incompatibility be dealt with in fix_ldif?

> >     Well, that was a helpful message (I know, not your fault) :)

> I think it is - at least you got the line number...

> >     The issue seems to be that slapcat created the root entry like this:
> >             uidNumber: 0000
> >             gidNumber: 0000

> >     but slapadd barfs on that, saying it is an invalid number!  Changing
> >     the 0000 to 0 for the user and group settings worked fine

> ... and another incompatibility.

It would be better if fix_ldif knew about schemas and could therefore know
which entries to automatically change; but even without that, we could
safely edit the LDIF for this when it's a known attrib like uidNumber or
gidNumber, couldn't we?  

A naive patch for this might look like the one attached.

Cheers,
-- 
Steve Langasek
postmodern programmer
Index: debian/fix_ldif
===================================================================
--- debian/fix_ldif     (revision 516)
+++ debian/fix_ldif     (working copy)
@@ -361,7 +361,13 @@
 }
 
 #
-# Check required attributes.
+# Check required attributes, and fix up known attributes for which the
+# syntax has changed
+# Bad hack: the "fix up" should be replaced by something which knows
+# about schemas and can fix all instances for all attributes of the
+# relevant attribute syntax (1.3.6.1.4.1.1466.115.121.1.27).  For now,
+# we only check the most commonly affected attributes, which we also
+# happen to know are SINGLE-VALUE.
 #
 sub checkattrs
 {
@@ -386,6 +392,10 @@
            print STDERR "\n\n";
        }
     }
+    ${$entries{$dn}{'uidnumber'}}[0] = 0)
+       if (${$entries{$dn}{'uidnumber'}}[0] eq '0000');
+    ${$entries{$dn}{'gidnumber'}}[0] = 0)
+       if (${$entries{$dn}{'gidnumber'}}[0] eq '0000');
 }
 
 #

Attachment: signature.asc
Description: Digital signature

Reply via email to