]> git.sur5r.net Git - openldap/blob - servers/slapd/back-shell/unbind.c
Add reference to slapd.conf(5) and recommendation to avoid cleartext passwords.
[openldap] / servers / slapd / back-shell / unbind.c
1 /* unbind.c - shell backend unbind function */
2
3 #include "portable.h"
4
5 #include <stdio.h>
6
7 #include <ac/socket.h>
8 #include <ac/string.h>
9
10 #include "slap.h"
11 #include "shell.h"
12
13 void
14 shell_back_unbind(
15     Backend             *be,
16     Connection          *conn,
17     Operation           *op
18 )
19 {
20         struct shellinfo        *si = (struct shellinfo *) be->be_private;
21         FILE                    *rfp, *wfp;
22
23         if ( si->si_unbind == NULL ) {
24                 send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM, NULL,
25                     "unbind not implemented" );
26                 return;
27         }
28
29         if ( (op->o_private = forkandexec( si->si_unbind, &rfp, &wfp ))
30             == -1 ) {
31                 send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL,
32                     "could not fork/exec" );
33                 return;
34         }
35
36         /* write out the request to the unbind process */
37         fprintf( wfp, "UNBIND\n" );
38         fprintf( wfp, "msgid: %ld\n", op->o_msgid );
39         print_suffixes( wfp, be );
40         fprintf( wfp, "dn: %s\n", (conn->c_dn ? conn->c_dn : "") );
41         fclose( wfp );
42
43         /* no response to unbind */
44         fclose( rfp );
45 }