]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldbm/modrdn.c
Plug memory leak
[openldap] / servers / slapd / back-ldbm / modrdn.c
index e9fd151fcc711fcd6d72ce043ca0b00ac08b9d8f..c8ef1e5446379e24ead8ebfcf2f54773354fcc16 100644 (file)
@@ -52,7 +52,6 @@ ldbm_back_modrdn(
        int             isroot = -1;
        int             rc_id = 0;
        ID              id = NOID;
-       const char      *text = NULL;
        char            textbuf[SLAP_TEXT_BUFLEN];
        size_t          textlen = sizeof textbuf;
        /* Added to support newSuperior */ 
@@ -101,8 +100,7 @@ ldbm_back_modrdn(
        }
 
        /* check entry for "entry" acl */
-       if ( ! access_allowed( op, e,
-               entry, NULL, ACL_WRITE, NULL ) )
+       if ( ! access_allowed( op, e, entry, NULL, ACL_WRITE, NULL ) )
        {
                Debug( LDAP_DEBUG_TRACE,
                        "<=- ldbm_back_modrdn: no write access to entry\n", 0,
@@ -163,8 +161,10 @@ ldbm_back_modrdn(
                }
 
                /* check parent for "children" acl */
-               if ( ! access_allowed( op, p,
-                       children, NULL, ACL_WRITE, NULL ) )
+               if ( ! access_allowed( op, p, children, NULL,
+                               op->oq_modrdn.rs_newSup != NULL ?
+                                       ACL_WDEL : ACL_WRITE,
+                               NULL ) )
                {
                        Debug( LDAP_DEBUG_TRACE, "no access to parent\n", 0,
                                0, 0 );
@@ -197,7 +197,10 @@ ldbm_back_modrdn(
                                p = (Entry *)&slap_entry_root;
                                
                                can_access = access_allowed( op, p,
-                                               children, NULL, ACL_WRITE, NULL );
+                                               children, NULL,
+                                               op->oq_modrdn.rs_newSup ?
+                                                       ACL_WDEL : ACL_WRITE,
+                                               NULL );
                                p = NULL;
                                                                
                                /* check parent for "children" acl */
@@ -270,7 +273,7 @@ ldbm_back_modrdn(
 
                        /* check newSuperior for "children" acl */
                        if ( !access_allowed( op, np, children, NULL,
-                                             ACL_WRITE, NULL ) )
+                                             ACL_WADD, NULL ) )
                        {
                                Debug( LDAP_DEBUG_TRACE,
                                       "ldbm_back_modrdn: no wr to newSup children\n",
@@ -316,7 +319,7 @@ ldbm_back_modrdn(
                                        np = (Entry *)&slap_entry_root;
                                
                                        can_access = access_allowed( op, np,
-                                                       children, NULL, ACL_WRITE, NULL );
+                                                       children, NULL, ACL_WADD, NULL );
                                        np = NULL;
                                                                
                                        /* check parent for "children" acl */
@@ -361,6 +364,7 @@ ldbm_back_modrdn(
 
        /* check for abandon */
        if ( op->o_abandon ) {
+               rs->sr_err = SLAPD_ABANDON;
                goto return_results;
        }
 
@@ -420,6 +424,7 @@ ldbm_back_modrdn(
 
        /* check for abandon */
        if ( op->o_abandon ) {
+               rs->sr_err = SLAPD_ABANDON;
                goto return_results;
        }
 
@@ -524,7 +529,7 @@ return_results:
                        tmp = mod->sml_next;
                        free( mod );
                }
-               slap_mods_free( mod );
+               slap_mods_free( mod, 1 );
        }
 
        /* LDAP v3 Support */