1 /* add.c - shell backend add function */
4 * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
12 #include <ac/string.h>
13 #include <ac/socket.h>
26 struct shellinfo *si = (struct shellinfo *) be->be_private;
30 if ( si->si_add == NULL ) {
31 send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM, NULL,
32 "add not implemented", NULL, NULL );
36 if ( (op->o_private = (void *) forkandexec( si->si_add, &rfp, &wfp )) == (void *) -1 ) {
37 send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL,
38 "could not fork/exec", NULL, NULL );
42 /* write out the request to the add process */
43 fprintf( wfp, "ADD\n" );
44 fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
45 print_suffixes( wfp, be );
46 ldap_pvt_thread_mutex_lock( &entry2str_mutex );
47 fprintf( wfp, "%s", entry2str( e, &len ) );
48 ldap_pvt_thread_mutex_unlock( &entry2str_mutex );
51 /* read in the result and send it along */
52 read_and_send_results( be, conn, op, rfp, NULL, 0 );