diff --git a/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c index 7a99d8128a..d70ea0471d 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c @@ -1103,7 +1103,16 @@ entryrdn_lookup_dn(backend *be, } goto bail; } - maybesuffix = 1; + if (workid == 1) { + /* The loop (workid) iterates from the starting 'id' + * up to the suffix ID (i.e. '1'). + * A corner case (#6417) is if an entry, on the path + * 'id' -> suffix, has the same RDN than the suffix. + * In order to erroneously believe the loop hits the suffix + * we need to check that 'workid' is '1' (suffix) + */ + maybesuffix = 1; + } } else { _entryrdn_cursor_print_error("entryrdn_lookup_dn", key.data, data.size, data.ulen, rc);