]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-sock/modify.c
Merge remote-tracking branch 'origin/mdb.master' into OPENLDAP_REL_ENG_2_4
[openldap] / servers / slapd / back-sock / modify.c
index 4905a92d7a3e65cf493f34b9702e690e4b6133a0..73e1be978870f27c5c8d8c45a0c816a2bba1c891 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2007-2008 The OpenLDAP Foundation.
+ * Copyright 2007-2013 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,6 +27,7 @@
 
 #include "slap.h"
 #include "back-sock.h"
+#include "ldif.h"
 
 int
 sock_back_modify(
@@ -72,8 +73,6 @@ sock_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( fp, "add: %s\n", mod->sm_desc->ad_cname.bv_val );
@@ -90,8 +89,16 @@ sock_back_modify(
 
                if( mod->sm_values != NULL ) {
                        for ( i = 0; mod->sm_values[i].bv_val != NULL; i++ ) {
-                               fprintf( fp, "%s: %s\n", mod->sm_desc->ad_cname.bv_val,
-                                       mod->sm_values[i].bv_val /* binary! */ );
+                               char *text = ldif_put_wrap( LDIF_PUT_VALUE,
+                                       mod->sm_desc->ad_cname.bv_val,
+                                       mod->sm_values[i].bv_val,
+                                       mod->sm_values[i].bv_len, LDIF_LINE_WIDTH_MAX );
+                               if ( text ) {
+                                       fprintf( fp, "%s", text );
+                                       ber_memfree( text );
+                               } else {
+                                       break;
+                               }
                        }
                }