1 /* modify.c - shell backend modify 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>
28 struct shellinfo *si = (struct shellinfo *) be->be_private;
32 if ( si->si_modify == NULL ) {
33 send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM, NULL,
34 "modify not implemented", NULL, NULL );
38 if ( (op->o_private = (void *) forkandexec( si->si_modify, &rfp, &wfp ))
40 send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL,
41 "could not fork/exec", NULL, NULL );
45 /* write out the request to the modify process */
46 fprintf( wfp, "MODIFY\n" );
47 fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
48 print_suffixes( wfp, be );
49 fprintf( wfp, "dn: %s\n", dn );
50 for ( ; ml != NULL; ml = ml->ml_next ) {
51 switch ( ml->ml_op ) {
53 fprintf( wfp, "add: %s\n", ml->ml_type );
57 fprintf( wfp, "delete: %s\n", ml->ml_type );
60 case LDAP_MOD_REPLACE:
61 fprintf( wfp, "replace: %s\n", ml->ml_type );
65 for ( i = 0; ml->ml_bvalues != NULL && ml->ml_bvalues[i]
67 fprintf( wfp, "%s: %s\n", ml->ml_type,
68 ml->ml_bvalues[i]->bv_val );
73 /* read in the results and send them along */
74 read_and_send_results( be, conn, op, rfp, NULL, 0 );