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