When slapcat-ing a 2.4 accesslog database and slapadd-ing it to a 2.5 instance, slapd will segfault on startup (specifically logpurge) due to a missing minCSN, which was added in 2.5 [1].
Though I haven't done too much analysis on the correct fix, 2 options are: 1. Add the minCSN to your accesslog LDIF. I simply used the entryCSN of the accesslog suffix. 2. Check that li->li_mincsn is not null in log_old_lookup(). Simple patch attached. I attached a minimal slapd conf and accesslog.ldif to duplicate the issue. [1] https://git.openldap.org/openldap/openldap/-/commit/66a743f119c85ee83f2efcdd04b4e012b15eacfc
dn: cn=accesslog objectClass: auditContainer cn: accesslog structuralObjectClass: auditContainer entryUUID: 31b2fe74-f095-1036-8119-f18beb7b66d9 creatorsName: cn=manager,dc=example,dc=com createTimestamp: 20170628213339Z modifiersName: cn=manager,dc=example,dc=com modifyTimestamp: 20170628213339Z entryCSN: 20211005090948.174384Z#000000#000#000000 contextCSN: 20211012143919.183804Z#000000#000#000000 dn: reqStart=20211005122709.000000Z,cn=accesslog objectClass: auditModify structuralObjectClass: auditModify reqStart: 20211005122709.000000Z reqEnd: 20211005122710.000000Z reqType: modify reqSession: 1005 reqAuthzID: cn=manager,dc=example,dc=com reqDN: uid=test,ou=People,dc=example,dc=com reqResult: 0 reqMod: sn:= Last reqMod: entryCSN:= 20211005122710.087552Z#000000#000#000000 reqMod: modifiersName:= cn=manager,dc=example,dc=com reqMod: modifyTimestamp:= 20211005122710Z reqEntryUUID: 6870c876-76d9-1033-98dc-5bf6a0dd42b7 entryUUID: 4e67da24-ba23-103b-9300-4f64b65e55d1 creatorsName: cn=manager,dc=example,dc=com createTimestamp: 20211005122710Z entryCSN: 20211005122710.087552Z#000000#000#000000 modifiersName: cn=manager,dc=example,dc=com modifyTimestamp: 20211005122710Z
slapd.conf
Description: Binary data
--- openldap-2.5.7-orig/servers/slapd/overlays/accesslog.c 2021-08-18 13:11:41.000000000 -0400
+++ openldap-2.5.7/servers/slapd/overlays/accesslog.c 2021-10-14 10:31:09.247596777 -0400
@@ -649,11 +649,13 @@
}
/* Paranoid len check, normalized CSNs are always the same length */
- if ( len > li->li_mincsn[i].bv_len )
- len = li->li_mincsn[i].bv_len;
- if ( ber_bvcmp( &li->li_mincsn[i], &a->a_nvals[0] ) < 0 ) {
- pd->mincsn_updated = 1;
- AC_MEMCPY( li->li_mincsn[i].bv_val, a->a_nvals[0].bv_val, len );
+ if ( li->li_mincsn ) {
+ if ( len > li->li_mincsn[i].bv_len )
+ len = li->li_mincsn[i].bv_len;
+ if ( ber_bvcmp( &li->li_mincsn[i], &a->a_nvals[0] ) < 0 ) {
+ pd->mincsn_updated = 1;
+ AC_MEMCPY( li->li_mincsn[i].bv_val, a->a_nvals[0].bv_val, len );
+ }
}
}
if ( pd->used >= pd->slots ) {
