From: Ondřej Kuzník Date: Tue, 30 Mar 2021 07:43:48 +0000 (+0100) Subject: ITS#7786 Try to synthesize missing attribute types X-Git-Tag: OPENLDAP_REL_ENG_2_5_3BETA~3^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80cfd8117b23ee0c780538227bc5f1bfc72e220d;p=thirdparty%2Fopenldap.git ITS#7786 Try to synthesize missing attribute types --- diff --git a/servers/slapd/slapmodify.c b/servers/slapd/slapmodify.c index a22fb6443d..78d64b05f1 100644 --- a/servers/slapd/slapmodify.c +++ b/servers/slapd/slapmodify.c @@ -309,6 +309,16 @@ slapmodify( int argc, char **argv ) int normalize = 0; local_rc = slap_str2ad( mod->mod_type, &mods.sm_desc, &text ); + /* + * Usually this would be a bad idea (way too dangerous, risks + * corrupting the DB), but ITS#7786 documents this as a last + * resort to fix cn=config and missing attributes are one of + * the possible issues we might encounter. + */ + if ( local_rc == LDAP_UNDEFINED_TYPE && + (slapMode & SLAP_TOOL_NO_SCHEMA_CHECK) ) { + local_rc = slap_str2undef_ad( mod->mod_type, &mods.sm_desc, &text, 0 ); + } if ( local_rc != LDAP_SUCCESS ) { fprintf( stderr, "%s: slap_str2ad(\"%s\") failed for entry \"%s\" (%d: %s, lineno=%lu)\n", progname, mod->mod_type, lr.lr_dn.bv_val, local_rc, text, lineno );