]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-shell/modify.c
Merge remote-tracking branch 'origin/mdb.RE/0.9'
[openldap] / servers / slapd / back-shell / modify.c
index ecf05450bf2d5db342de738b4ab9b9105d507791..425db3a13baff752199609c35b271fcc6279009f 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2012 The OpenLDAP Foundation.
+ * Copyright 1998-2015 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -37,6 +37,7 @@
 
 #include "slap.h"
 #include "shell.h"
+#include "ldif.h"
 
 int
 shell_back_modify(
@@ -87,8 +88,6 @@ shell_back_modify(
        for ( ; ml != NULL; ml = ml->sml_next ) {
                mod = &ml->sml_mod;
 
-               /* FIXME: should use LDIF routines to deal with binary data */
-
                switch ( mod->sm_op ) {
                case LDAP_MOD_ADD:
                        fprintf( wfp, "add: %s\n", mod->sm_desc->ad_cname.bv_val );
@@ -105,8 +104,14 @@ shell_back_modify(
 
                if( mod->sm_values != NULL ) {
                        for ( i = 0; mod->sm_values[i].bv_val != NULL; i++ ) {
-                               fprintf( wfp, "%s: %s\n", mod->sm_desc->ad_cname.bv_val,
-                                       mod->sm_values[i].bv_val /* binary! */ );
+                               char *out = ldif_put( LDIF_PUT_VALUE,
+                                       mod->sm_desc->ad_cname.bv_val,
+                                       mod->sm_values[i].bv_val,
+                                       mod->sm_values[i].bv_len );
+                               if ( out ) {
+                                       fprintf( wfp, "%s", out );
+                                       ber_memfree( out );
+                               }
                        }
                }