]> git.sur5r.net Git - openldap/blob - servers/slapd/back-shell/delete.c
merged with autoconf branch
[openldap] / servers / slapd / back-shell / delete.c
1 /* delete.c - shell backend delete function */
2
3 #include "portable.h"
4
5 #include <stdio.h>
6
7 #include <ac/string.h>
8 #include <ac/socket.h>
9
10 #include "slap.h"
11 #include "shell.h"
12
13 void
14 shell_back_delete(
15     Backend     *be,
16     Connection  *conn,
17     Operation   *op,
18     char        *dn
19 )
20 {
21         struct shellinfo        *si = (struct shellinfo *) be->be_private;
22         FILE                    *rfp, *wfp;
23
24         if ( si->si_delete == NULL ) {
25                 send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM, NULL,
26                     "delete not implemented" );
27                 return;
28         }
29
30         if ( (op->o_private = forkandexec( si->si_delete, &rfp, &wfp ))
31             == -1 ) {
32                 send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL,
33                     "could not fork/exec" );
34                 return;
35         }
36
37         /* write out the request to the delete process */
38         fprintf( wfp, "DELETE\n" );
39         fprintf( wfp, "msgid: %d\n", op->o_msgid );
40         print_suffixes( wfp, be );
41         fprintf( wfp, "dn: %s\n", dn );
42         fclose( wfp );
43
44         /* read in the results and send them along */
45         read_and_send_results( be, conn, op, rfp, NULL, 0 );
46         fclose( rfp );
47 }