]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-shell/delete.c
Don't reeval expression
[openldap] / servers / slapd / back-shell / delete.c
index 6d3b27908d6437ee9996729887d0e747a2b7ba13..da6c04a0c41109f03747fd382dfcdb782740ae4e 100644 (file)
@@ -25,17 +25,36 @@ shell_back_delete(
 )
 {
        struct shellinfo        *si = (struct shellinfo *) be->be_private;
+       AttributeDescription *entry = slap_schema.si_ad_entry;
+       Entry e;
        FILE                    *rfp, *wfp;
 
-       if ( IS_NULLCMD( si->si_delete ) ) {
+       if ( si->si_delete == NULL ) {
                send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM, NULL,
                    "delete not implemented", NULL, NULL );
                return( -1 );
        }
 
+       e.e_id = NOID;
+       e.e_name = *dn;
+       e.e_nname = *ndn;
+       e.e_attrs = NULL;
+       e.e_ocflags = 0;
+       e.e_bv.bv_len = 0;
+       e.e_bv.bv_val = NULL;
+       e.e_private = NULL;
+
+       if ( ! access_allowed( be, conn, op, &e,
+               entry, NULL, ACL_WRITE, NULL ) )
+       {
+               send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
+                       NULL, NULL, NULL, NULL );
+               return -1;
+       }
+
        if ( (op->o_private = (void *) forkandexec( si->si_delete, &rfp, &wfp ))
            == (void *) -1 ) {
-               send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL,
+               send_ldap_result( conn, op, LDAP_OTHER, NULL,
                    "could not fork/exec", NULL, NULL );
                return( -1 );
        }