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 ( (op->o_private = (void *) forkandexec( si->si_bind, &rfp, &wfp ))
53 send_ldap_error( op, rs, LDAP_OTHER,
54 "could not fork/exec" );
58 /* write out the request to the bind process */
59 fprintf( wfp, "BIND\n" );
60 fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
61 print_suffixes( wfp, op->o_bd );
62 fprintf( wfp, "dn: %s\n", op->o_req_dn.bv_val );
63 fprintf( wfp, "method: %d\n", op->oq_bind.rb_method );
64 fprintf( wfp, "credlen: %lu\n", op->oq_bind.rb_cred.bv_len );
65 fprintf( wfp, "cred: %s\n", op->oq_bind.rb_cred.bv_val ); /* XXX */
68 /* read in the results and send them along */
69 rc = read_and_send_results( op, rs, rfp );