1 /* modify.c - shell backend modify function */
6 #include <sys/socket.h>
19 struct shellinfo *si = (struct shellinfo *) be->be_private;
23 if ( si->si_modify == NULL ) {
24 send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM, NULL,
25 "modify not implemented" );
29 if ( (op->o_private = forkandexec( si->si_modify, &rfp, &wfp ))
31 send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL,
32 "could not fork/exec" );
36 /* write out the request to the modify process */
37 fprintf( wfp, "MODIFY\n" );
38 fprintf( wfp, "msgid: %d\n", op->o_msgid );
39 print_suffixes( wfp, be );
40 fprintf( wfp, "dn: %s\n", dn );
41 for ( ; mods != NULL; mods = mods->mod_next ) {
42 switch ( mods->mod_op & ~LDAP_MOD_BVALUES ) {
44 fprintf( wfp, "add: %s", mods->mod_type );
48 fprintf( wfp, "delete: %s", mods->mod_type );
51 case LDAP_MOD_REPLACE:
52 fprintf( wfp, "replace: %s", mods->mod_type );
56 for ( i = 0; mods->mod_bvalues != NULL && mods->mod_bvalues[i]
58 fprintf( wfp, "%s: %s\n", mods->mod_type,
59 mods->mod_bvalues[i]->bv_val );
64 /* read in the results and send them along */
65 read_and_send_results( be, conn, op, rfp, NULL, 0 );