1 /* bind.c - shell backend bind function */
4 * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
12 #include <ac/socket.h>
13 #include <ac/string.h>
23 struct shellinfo *si = (struct shellinfo *) op->o_bd->be_private;
24 AttributeDescription *entry = slap_schema.si_ad_entry;
29 if ( si->si_bind == NULL ) {
30 send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
31 "bind not implemented" );
36 e.e_name = op->o_req_dn;
37 e.e_nname = op->o_req_ndn;
44 if ( ! access_allowed( op, &e,
45 entry, NULL, ACL_AUTH, NULL ) )
47 send_ldap_error( op, rs, LDAP_INSUFFICIENT_ACCESS, NULL );
51 if ( forkandexec( si->si_bind, &rfp, &wfp ) == (pid_t)-1 ) {
52 send_ldap_error( op, rs, LDAP_OTHER,
53 "could not fork/exec" );
57 /* write out the request to the bind process */
58 fprintf( wfp, "BIND\n" );
59 fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
60 print_suffixes( wfp, op->o_bd );
61 fprintf( wfp, "dn: %s\n", op->o_req_dn.bv_val );
62 fprintf( wfp, "method: %d\n", op->oq_bind.rb_method );
63 fprintf( wfp, "credlen: %lu\n", op->oq_bind.rb_cred.bv_len );
64 fprintf( wfp, "cred: %s\n", op->oq_bind.rb_cred.bv_val ); /* XXX */
67 /* read in the results and send them along */
68 rc = read_and_send_results( op, rs, rfp );