From: Ondřej Kuzník Date: Tue, 11 Aug 2015 12:30:47 +0000 (+0200) Subject: ITS#8215 Change BI_tool_entry_delete signature X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8b8890bddc98c1110f41c81981fc07de7fc35fa9;p=openldap ITS#8215 Change BI_tool_entry_delete signature --- diff --git a/servers/slapd/back-ldif/ldif.c b/servers/slapd/back-ldif/ldif.c index 116b9f7cd5..ef9131d5bb 100644 --- a/servers/slapd/back-ldif/ldif.c +++ b/servers/slapd/back-ldif/ldif.c @@ -1891,22 +1891,16 @@ ldif_tool_entry_modify( BackendDB *be, Entry *e, struct berval *text ) } static int -ldif_tool_entry_delete( BackendDB *be, ID id, struct berval *text ) +ldif_tool_entry_delete( BackendDB *be, struct berval *ndn, struct berval *text ) { struct ldif_tool *tl = &((struct ldif_info *) be->be_private)->li_tool; int rc = LDAP_SUCCESS; const char *errmsg = NULL; struct berval path; - Entry *e; Operation op = {0}; - id--; - if ( id >= tl->ecount || tl->entries[id] == NULL ) - return LDAP_OTHER; - e = tl->entries[id]; - op.o_bd = be; - ndn2path( &op, &e->e_nname, &path, 0 ); + ndn2path( &op, ndn, &path, 0 ); ldif2dir_len( path ); ldif2dir_name( path ); @@ -1937,8 +1931,6 @@ ldif_tool_entry_delete( BackendDB *be, ID id, struct berval *text ) } SLAP_FREE( path.bv_val ); - entry_free( e ); - tl->entries[id] = NULL; if ( errmsg == NULL && rc != LDAP_OTHER ) errmsg = ldap_err2string( rc ); diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index b7dc833da0..f14015aeee 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -2209,7 +2209,7 @@ typedef int (BI_tool_sync) LDAP_P(( BackendDB *be )); typedef ID (BI_tool_dn2id_get) LDAP_P(( BackendDB *be, struct berval *dn )); typedef ID (BI_tool_entry_modify) LDAP_P(( BackendDB *be, Entry *e, struct berval *text )); -typedef int (BI_tool_entry_delete) LDAP_P(( BackendDB *be, ID id, +typedef int (BI_tool_entry_delete) LDAP_P(( BackendDB *be, struct berval *ndn, struct berval *text )); struct BackendInfo { diff --git a/servers/slapd/slapmodify.c b/servers/slapd/slapmodify.c index 5ceec3e210..7a021b7732 100644 --- a/servers/slapd/slapmodify.c +++ b/servers/slapd/slapmodify.c @@ -564,15 +564,14 @@ slapmodify( int argc, char **argv ) break; case LDAP_REQ_DELETE: - rc = be->be_entry_delete( be, id, &bvtext ); - e_orig = NULL; + rc = be->be_entry_delete( be, &ndn, &bvtext ); break; } if( rc != LDAP_SUCCESS ) { fprintf( stderr, "%s: could not %s entry dn=\"%s\" " - "(line=%lu): %s\n", progname, request, e->e_dn, + "(line=%lu): %s\n", progname, request, ndn.bv_val, lineno, bvtext.bv_val ); rc = EXIT_FAILURE; goto cleanup; @@ -582,11 +581,11 @@ slapmodify( int argc, char **argv ) if ( verbose ) fprintf( stderr, "%s: \"%s\" (%08lx)\n", - request, e->e_dn, (long) id ); + request, ndn.bv_val, (long) id ); } else { if ( verbose ) fprintf( stderr, "%s: \"%s\"\n", - request, e->e_dn ); + request, ndn.bv_val ); } cleanup:;