From 4be9b65d770c891e821ba35fa6a2d146a4d50e5a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 3 Jun 2005 13:37:23 +0000 Subject: r7230: use socket_pending() to get rid of the max packet size limits in the cldap code (This used to be commit 9da5379048784524eee213d8609f1d96f0058e39) --- source4/libcli/cldap/cldap.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'source4/libcli/cldap') diff --git a/source4/libcli/cldap/cldap.c b/source4/libcli/cldap/cldap.c index b52b2f53f0..a96906cf4c 100644 --- a/source4/libcli/cldap/cldap.c +++ b/source4/libcli/cldap/cldap.c @@ -40,8 +40,6 @@ #include "lib/socket/socket.h" #include "include/asn_1.h" -#define CLDAP_MAX_PACKET_SIZE 2048 - /* destroy a pending request */ @@ -68,12 +66,18 @@ static void cldap_socket_recv(struct cldap_socket *cldap) const char *src_addr; int src_port; DATA_BLOB blob; - size_t nread; + size_t nread, dsize; struct asn1_data asn1; struct ldap_message ldap_msg; struct cldap_request *req; - blob = data_blob_talloc(tmp_ctx, NULL, CLDAP_MAX_PACKET_SIZE); + status = socket_pending(cldap->sock, &dsize); + if (!NT_STATUS_IS_OK(status)) { + talloc_free(tmp_ctx); + return; + } + + blob = data_blob_talloc(tmp_ctx, NULL, dsize); if (blob.data == NULL) { talloc_free(tmp_ctx); return; -- cgit