1 /* add.c - shell backend add function */
8 #include <sys/socket.h>
12 extern pthread_mutex_t entry2str_mutex;
13 extern char *entry2str();
23 struct shellinfo *si = (struct shellinfo *) be->be_private;
27 if ( si->si_add == NULL ) {
28 send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM, NULL,
29 "add not implemented" );
33 if ( (op->o_private = forkandexec( si->si_add, &rfp, &wfp )) == -1 ) {
34 send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL,
35 "could not fork/exec" );
39 /* write out the request to the add process */
40 fprintf( wfp, "ADD\n" );
41 fprintf( wfp, "msgid: %d\n", op->o_msgid );
42 print_suffixes( wfp, be );
43 pthread_mutex_lock( &entry2str_mutex );
44 fprintf( wfp, "%s", entry2str( e, &len, 0 ) );
45 pthread_mutex_unlock( &entry2str_mutex );
48 /* read in the result and send it along */
49 read_and_send_results( be, conn, op, rfp, NULL, 0 );