From 88ead90b1d6f7e32181b5e9bf2b48cf0ef0b7c95 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 29 Sep 2004 12:18:06 +0000 Subject: r2747: use DATA_BLOB for attribute values en/decode CompareRequest/Response correct metze (This used to be commit 72dfea2b07aea83d0965a585f6e388eb88a7c6d1) --- source4/libcli/ldap/ldap.c | 20 ++++++++++++++++---- source4/libcli/ldap/ldap.h | 2 +- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'source4/libcli') diff --git a/source4/libcli/ldap/ldap.c b/source4/libcli/ldap/ldap.c index af21962265..a2f8e91b6c 100644 --- a/source4/libcli/ldap/ldap.c +++ b/source4/libcli/ldap/ldap.c @@ -589,14 +589,15 @@ BOOL ldap_encode(struct ldap_message *msg, DATA_BLOB *result) asn1_push_tag(&data, ASN1_SEQUENCE(0)); asn1_write_OctetString(&data, r->attribute, strlen(r->attribute)); - asn1_write_OctetString(&data, r->value, - strlen(r->value)); + asn1_write_OctetString(&data, r->value.data, + r->value.length); asn1_pop_tag(&data); asn1_pop_tag(&data); break; } case LDAP_TAG_CompareResponse: { -/* struct ldap_Result *r = &msg->r.CompareResponse; */ + struct ldap_Result *r = &msg->r.ModifyDNResponse; + ldap_encode_response(msg->type, r, &data); break; } case LDAP_TAG_AbandonRequest: { @@ -1070,8 +1071,19 @@ BOOL ldap_decode(ASN1_DATA *data, struct ldap_message *msg) } case ASN1_APPLICATION(LDAP_TAG_CompareRequest): { -/* struct ldap_CompareRequest *r = &msg->r.CompareRequest; */ + struct ldap_CompareRequest *r = &msg->r.CompareRequest; msg->type = LDAP_TAG_CompareRequest; + asn1_start_tag(data, + ASN1_APPLICATION(LDAP_TAG_CompareRequest)); + asn1_read_OctetString_talloc(msg->mem_ctx, data, &r->dn); + asn1_start_tag(data, ASN1_SEQUENCE(0)); + asn1_read_OctetString_talloc(msg->mem_ctx, data, &r->attribute); + asn1_read_OctetString(data, &r->value); + if (r->value.data) { + talloc_steal(msg->mem_ctx, r->value.data); + } + asn1_end_tag(data); + asn1_end_tag(data); break; } diff --git a/source4/libcli/ldap/ldap.h b/source4/libcli/ldap/ldap.h index ca546e11e1..c0d16e67a3 100644 --- a/source4/libcli/ldap/ldap.h +++ b/source4/libcli/ldap/ldap.h @@ -169,7 +169,7 @@ struct ldap_ModifyDNRequest { struct ldap_CompareRequest { const char *dn; const char *attribute; - const char *value; + DATA_BLOB value; }; struct ldap_AbandonRequest { -- cgit