1 /* delete.c - shell backend delete function */
4 * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
12 #include <ac/string.h>
13 #include <ac/socket.h>
23 struct shellinfo *si = (struct shellinfo *) op->o_bd->be_private;
24 AttributeDescription *entry = slap_schema.si_ad_entry;
28 if ( si->si_delete == NULL ) {
29 send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
30 "delete not implemented" );
35 e.e_name = op->o_req_dn;
36 e.e_nname = op->o_req_ndn;
43 if ( ! access_allowed( op, &e,
44 entry, NULL, ACL_WRITE, NULL ) )
46 send_ldap_error( op, rs, LDAP_INSUFFICIENT_ACCESS, NULL );
50 if ( forkandexec( si->si_delete, &rfp, &wfp ) == (pid_t)-1 ) {
51 send_ldap_error( op, rs, LDAP_OTHER,
52 "could not fork/exec" );
56 /* write out the request to the delete process */
57 fprintf( wfp, "DELETE\n" );
58 fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
59 print_suffixes( wfp, op->o_bd );
60 fprintf( wfp, "dn: %s\n", op->o_req_dn.bv_val );
63 /* read in the results and send them along */
64 read_and_send_results( op, rs, rfp );