X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fback-sock%2Fcompare.c;h=bb02fae58474f8f8ad3a893c7f7f826fa402208c;hb=b905811d3c800b6f4031d541e424e5de871aa0c7;hp=11175ad6e00ae10ec9d25d67d0c8d46fd5c8dc3a;hpb=3dadeb3efe31c72dacc2e0e11ee25c271dffe44d;p=openldap diff --git a/servers/slapd/back-sock/compare.c b/servers/slapd/back-sock/compare.c index 11175ad6e0..bb02fae584 100644 --- a/servers/slapd/back-sock/compare.c +++ b/servers/slapd/back-sock/compare.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1998-2010 The OpenLDAP Foundation. + * Copyright 1998-2011 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_compare( @@ -37,6 +38,7 @@ sock_back_compare( AttributeDescription *entry = slap_schema.si_ad_entry; Entry e; FILE *fp; + char *text; e.e_id = NOID; e.e_name = op->o_req_dn; @@ -60,21 +62,23 @@ sock_back_compare( return( -1 ); } - /* - * FIX ME: This should use LDIF routines so that binary - * values are properly dealt with - */ - /* write out the request to the compare process */ fprintf( fp, "COMPARE\n" ); fprintf( fp, "msgid: %ld\n", (long) op->o_msgid ); sock_print_conn( fp, op->o_conn, si ); sock_print_suffixes( fp, op->o_bd ); fprintf( fp, "dn: %s\n", op->o_req_dn.bv_val ); - fprintf( fp, "%s: %s\n", - op->oq_compare.rs_ava->aa_desc->ad_cname.bv_val, - op->oq_compare.rs_ava->aa_value.bv_val /* could be binary! */ ); - fclose( fp ); + /* could be binary */ + text = ldif_put_wrap( LDIF_PUT_VALUE, + op->orc_ava->aa_desc->ad_cname.bv_val, + op->orc_ava->aa_value.bv_val, + op->orc_ava->aa_value.bv_len, LDIF_LINE_WIDTH_MAX ); + if ( text ) { + fprintf( fp, "%s\n", text ); + ber_memfree( text ); + } else { + fprintf( fp, "\n\n" ); + } /* read in the result and send it along */ sock_read_and_send_results( op, rs, fp );