]> git.sur5r.net Git - openldap/commitdiff
ITS#7256 Allow deletes with slapmodify
authorOndrej Kuznik <ondrej.kuznik@acision.com>
Thu, 19 Apr 2012 13:58:27 +0000 (15:58 +0200)
committerHoward Chu <hyc@openldap.org>
Wed, 9 Jul 2014 00:28:06 +0000 (17:28 -0700)
servers/slapd/slapmodify.c

index 878188eb1a92835333411ad3be1a7a86d14ed2d1..791751687baa3713ade2b0db8af6712fcc93f219 100644 (file)
@@ -178,8 +178,15 @@ slapmodify( int argc, char **argv )
                        request = "modify";
                        break;
 
-               case LDAP_REQ_MODRDN:
                case LDAP_REQ_DELETE:
+                       if ( be->be_entry_delete )
+                       {
+                               request = "delete";
+                               break;
+                       }
+                       /* backend does not support delete, fallthrough */
+
+               case LDAP_REQ_MODRDN:
                        fprintf( stderr, "%s: request 0x%lx not supported (line=%lu)\n",
                                progname, (unsigned long)lr.lr_op, lineno );
                        rc = EXIT_FAILURE;
@@ -554,15 +561,21 @@ slapmodify( int argc, char **argv )
                        switch ( lr.lr_op ) {
                        case LDAP_REQ_ADD:
                                id = be->be_entry_put( be, e, &bvtext );
+                               rc = (id == NOID);
                                break;
 
                        case LDAP_REQ_MODIFY:
                                id = be->be_entry_modify( be, e, &bvtext );
+                               rc = (id == NOID);
+                               break;
+
+                       case LDAP_REQ_DELETE:
+                               rc = be->be_entry_delete( be, id, &bvtext );
                                break;
 
                        }
 
-                       if( id == NOID ) {
+                       if( rc != LDAP_SUCCESS ) {
                                fprintf( stderr, "%s: could not %s entry dn=\"%s\" "
                                        "(line=%lu): %s\n", progname, request, e->e_dn,
                                        lineno, bvtext.bv_val );