X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fback-sock%2Fmodify.c;h=73e1be978870f27c5c8d8c45a0c816a2bba1c891;hb=6f6ee3eada75d0ea8bee306c7953417f601c5bb8;hp=4905a92d7a3e65cf493f34b9702e690e4b6133a0;hpb=c890c96d13c53cf0fa1d9580fea2ab47a2c8caa9;p=openldap diff --git a/servers/slapd/back-sock/modify.c b/servers/slapd/back-sock/modify.c index 4905a92d7a..73e1be9788 100644 --- a/servers/slapd/back-sock/modify.c +++ b/servers/slapd/back-sock/modify.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * 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; + } } }