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