/* modify.c - shell backend modify function */
/* $OpenLDAP$ */
/*
- * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
Backend *be,
Connection *conn,
Operation *op,
- const char *dn,
- const char *ndn,
+ struct berval *dn,
+ struct berval *ndn,
Modifications *ml
)
{
FILE *rfp, *wfp;
int i;
- if ( si->si_modify == NULL ) {
+ if ( IS_NULLCMD( si->si_modify ) ) {
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM, NULL,
"modify not implemented", NULL, NULL );
return( -1 );
if ( (op->o_private = (void *) forkandexec( si->si_modify, &rfp, &wfp ))
== (void *) -1 ) {
- send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL,
+ send_ldap_result( conn, op, LDAP_OTHER, NULL,
"could not fork/exec", NULL, NULL );
return( -1 );
}
fprintf( wfp, "MODIFY\n" );
fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
print_suffixes( wfp, be );
- fprintf( wfp, "dn: %s\n", dn );
+ fprintf( wfp, "dn: %s\n", dn->bv_val );
for ( ; ml != NULL; ml = ml->sml_next ) {
mod = &ml->sml_mod;
switch ( mod->sm_op ) {
case LDAP_MOD_ADD:
- fprintf( wfp, "add: %s\n", mod->sm_desc->ad_cname->bv_val );
+ fprintf( wfp, "add: %s\n", mod->sm_desc->ad_cname.bv_val );
break;
case LDAP_MOD_DELETE:
- fprintf( wfp, "delete: %s\n", mod->sm_desc->ad_cname->bv_val );
+ fprintf( wfp, "delete: %s\n", mod->sm_desc->ad_cname.bv_val );
break;
case LDAP_MOD_REPLACE:
- fprintf( wfp, "replace: %s\n", mod->sm_desc->ad_cname->bv_val );
+ fprintf( wfp, "replace: %s\n", mod->sm_desc->ad_cname.bv_val );
break;
}
if( mod->sm_bvalues != NULL ) {
- for ( i = 0; mod->sm_bvalues[i] != NULL; i++ ) {
- fprintf( wfp, "%s: %s\n", mod->sm_desc->ad_cname->bv_val,
- mod->sm_bvalues[i]->bv_val /* binary! */ );
+ for ( i = 0; mod->sm_bvalues[i].bv_val != NULL; i++ ) {
+ fprintf( wfp, "%s: %s\n", mod->sm_desc->ad_cname.bv_val,
+ mod->sm_bvalues[i].bv_val /* binary! */ );
}
}