summaryrefslogtreecommitdiffstats
path: root/ldap/servers/slapd/back-ldbm/index.c
diff options
context:
space:
mode:
authorNoriko Hosoi <nhosoi@redhat.com>2010-06-24 16:34:01 -0700
committerNoriko Hosoi <nhosoi@redhat.com>2010-06-24 16:34:01 -0700
commit7482698b041e4882b4d0ca66d06dfd833657b6f3 (patch)
tree515bcee725c964b623de1da7ee1c8ea6686aeb3b /ldap/servers/slapd/back-ldbm/index.c
parent7094777b00a7310ce966fd9e237b9cab69c9329a (diff)
downloadds-7482698b041e4882b4d0ca66d06dfd833657b6f3.tar.gz
ds-7482698b041e4882b4d0ca66d06dfd833657b6f3.tar.xz
ds-7482698b041e4882b4d0ca66d06dfd833657b6f3.zip
578296 - Attribute type entrydn needs to be added when subtree
rename switch is on https://bugzilla.redhat.com/show_bug.cgi?id=578296 Change Description: 1) ldbm_back_next_search_entry_ext (ldbm_search.c) When getting an entry from ID using id2entry_ext, pass a flag ID2ENTRY_ADD_ENTRYDN to add entrydn to the entry. 2) id2entry_ext (id2entry.c) Added id2entry_ext to handle the flag ID2ENTRY_ADD_ENTRYDN. If ID2ENTRY_ADD_ENTRYDN is set in the flags variable and entryrdn switch is enabled, entrydn is added to the entry. 3) index_read_ext (index.c) If entryrdn switch is on and the attribute type is entrydn and the search type is equality, then call entryrdn_index_read to get the ID directly.
Diffstat (limited to 'ldap/servers/slapd/back-ldbm/index.c')
-rw-r--r--ldap/servers/slapd/back-ldbm/index.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/ldap/servers/slapd/back-ldbm/index.c b/ldap/servers/slapd/back-ldbm/index.c
index f26e3d37..da22648c 100644
--- a/ldap/servers/slapd/back-ldbm/index.c
+++ b/ldap/servers/slapd/back-ldbm/index.c
@@ -817,7 +817,7 @@ index_read_ext(
DB *db = NULL;
DB_TXN *db_txn = NULL;
DBT key = {0};
- IDList *idl;
+ IDList *idl = NULL;
char *prefix;
char *tmpbuf = NULL;
char buf[BUFSIZ];
@@ -850,6 +850,35 @@ index_read_ext(
LDAPDebug( LDAP_DEBUG_ARGS, " indextype: \"%s\" indexmask: 0x%x\n",
indextype, ai->ai_indexmask, 0 );
+ /* If entryrdn switch is on AND the type is entrydn AND the prefix is '=',
+ * use the entryrdn index directly */
+ if (entryrdn_get_switch() && (*prefix == '=') &&
+ (0 == PL_strcasecmp(basetype, LDBM_ENTRYDN_STR))) {
+ int rc = 0;
+ ID id = 0;
+ Slapi_DN sdn = {0};
+
+ /* We don't need these values... */
+ index_free_prefix( prefix );
+ slapi_ch_free_string( &basetmp );
+ if (NULL == val || NULL == val->bv_val) {
+ /* entrydn value was not given */
+ return NULL;
+ }
+ slapi_sdn_init_dn_byval(&sdn, val->bv_val);
+ rc = entryrdn_index_read(be, &sdn, &id, txn);
+ slapi_sdn_done(&sdn);
+ if (rc) { /* failure */
+ return NULL;
+ } else { /* success */
+ rc = idl_append_extend(&idl, id);
+ if (rc) { /* failure */
+ return NULL;
+ }
+ return idl;
+ }
+ }
+
if ( !is_indexed( indextype, ai->ai_indexmask, ai->ai_index_rules ) ) {
idl = idl_allids( be );
if (unindexed != NULL) *unindexed = 1;