]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-shell/modify.c
Cleanup up LDAP_CLIENT_UPDATE code... including some bug fixing.
[openldap] / servers / slapd / back-shell / modify.c
index 0f6d66fd4bc65383fa20108fa60928ce631b2bbf..69ad41d740ab6d5f9939ecd017e081d77e11e9b6 100644 (file)
@@ -1,7 +1,7 @@
 /* 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
  */
 
@@ -20,8 +20,8 @@ shell_back_modify(
     Backend    *be,
     Connection *conn,
     Operation  *op,
-    const char *dn,
-    const char *ndn,
+    struct berval *dn,
+    struct berval *ndn,
     Modifications      *ml
 )
 {
@@ -30,7 +30,7 @@ shell_back_modify(
        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 );
@@ -38,7 +38,7 @@ shell_back_modify(
 
        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 );
        }
@@ -47,7 +47,7 @@ shell_back_modify(
        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;
 
@@ -55,22 +55,22 @@ shell_back_modify(
 
                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! */ );
                        }
                }