summaryrefslogtreecommitdiffstats
path: root/ldap/servers/slapd/back-ldbm/id2entry.c
diff options
context:
space:
mode:
authorNoriko Hosoi <nhosoi@redhat.com>2010-10-19 09:58:27 -0700
committerNoriko Hosoi <nhosoi@redhat.com>2010-10-19 09:58:27 -0700
commitf0e4ce1965c5be37c5535febf06e5051f281f862 (patch)
treeaa8391cb44cb0e61fc3bb8ac126bb21fcb52654a /ldap/servers/slapd/back-ldbm/id2entry.c
parent6160200187b5b5f7ee662762b997c5c55401fe77 (diff)
downloadds-f0e4ce1965c5be37c5535febf06e5051f281f862.tar.gz
ds-f0e4ce1965c5be37c5535febf06e5051f281f862.tar.xz
ds-f0e4ce1965c5be37c5535febf06e5051f281f862.zip
Bug 592397 - Upgrade tool dn2rdn: it does not clean up
the entrydn in id2entry https://bugzilla.redhat.com/show_bug.cgi?id=592397 Description: If entries created by the 389 v1.2.5 or older, the primary db (id2entry.db4) contains "entrydn: <normalized dn>". Upgrading from the old version to v1.2.6 keeps the entrydn attribute type and its value even though v1.2.6 is not supposed to store the entrydn in the database. 1) This patch drops the entrydn attribute and value in upgrading the db. 2) If an ldif file contains entrydn attribute type and value, import (ldif2db[.pl]) ignores it. 3) A leak was found in the export (db2ldif[.pl]) which is fixed. 4) When nsslapd-subtree-rename-switch configuration attribute has the value "on", entrydn is not used nor created. But the server accepted reindexing entrydn request and generated an entrydn index file. This patch rejects it. 5) Entry and dn cache clear calls (cache_clear) are added to dblayer_instance_close in "#if defined(_USE_VALGRIND)", which is not defined. To enable the code, the server needs to be rebuilt with defining the macro. This is purely for debugging.
Diffstat (limited to 'ldap/servers/slapd/back-ldbm/id2entry.c')
-rw-r--r--ldap/servers/slapd/back-ldbm/id2entry.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/ldap/servers/slapd/back-ldbm/id2entry.c b/ldap/servers/slapd/back-ldbm/id2entry.c
index b58591e8..71ea940e 100644
--- a/ldap/servers/slapd/back-ldbm/id2entry.c
+++ b/ldap/servers/slapd/back-ldbm/id2entry.c
@@ -359,7 +359,7 @@ id2entry( backend *be, ID id, back_txn *txn, int *err )
rc = get_value_from_string((const char *)data.dptr, "rdn", &rdn);
if (rc) {
/* data.dptr may not include rdn: ..., try "dn: ..." */
- ee = slapi_str2entry( data.dptr, 0 );
+ ee = slapi_str2entry( data.dptr, SLAPI_STR2ENTRY_NO_ENTRYDN );
} else {
char *dn = NULL;
struct backdn *bdn = dncache_find_id(&inst->inst_dncache, id);
@@ -380,13 +380,19 @@ id2entry( backend *be, ID id, back_txn *txn, int *err )
}
sdn = slapi_sdn_new_dn_byval((const char *)dn);
bdn = backdn_init(sdn, id, 0);
- CACHE_ADD( &inst->inst_dncache, bdn, NULL );
- CACHE_RETURN(&inst->inst_dncache, &bdn);
- slapi_log_error(SLAPI_LOG_CACHE, ID2ENTRY,
- "entryrdn_lookup_dn returned: %s, "
- "and set to dn cache (id %d)\n", dn, id);
+ if (CACHE_ADD( &inst->inst_dncache, bdn, NULL )) {
+ backdn_free(&bdn);
+ slapi_log_error(SLAPI_LOG_CACHE, ID2ENTRY,
+ "%s is already in the dn cache\n", dn);
+ } else {
+ CACHE_RETURN(&inst->inst_dncache, &bdn);
+ slapi_log_error(SLAPI_LOG_CACHE, ID2ENTRY,
+ "entryrdn_lookup_dn returned: %s, "
+ "and set to dn cache (id %d)\n", dn, id);
+ }
}
- ee = slapi_str2entry_ext( (const char *)dn, data.dptr, 0 );
+ ee = slapi_str2entry_ext( (const char *)dn, data.dptr,
+ SLAPI_STR2ENTRY_NO_ENTRYDN );
slapi_ch_free_string(&rdn);
slapi_ch_free_string(&dn);
}