summaryrefslogtreecommitdiff
path: root/source4/libcli/nbt/nbtsocket.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-06-03 13:31:27 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:29 -0500
commit665480ffed385abb74bc44b6f376547a6d465db9 (patch)
tree081894ed56b0c9a292a6c1cdf7717dc9afef6c25 /source4/libcli/nbt/nbtsocket.c
parenta8feef8d3647d25b3f5f572139acb1bab361055e (diff)
downloadsamba-665480ffed385abb74bc44b6f376547a6d465db9.tar.gz
samba-665480ffed385abb74bc44b6f376547a6d465db9.tar.bz2
samba-665480ffed385abb74bc44b6f376547a6d465db9.zip
r7229: use socket_pending() to get rid of the max packet size limits in the
nbt and dgram layers (This used to be commit 2a9efbdae638a655999e07a7c3da97fd20dc056c)
Diffstat (limited to 'source4/libcli/nbt/nbtsocket.c')
-rw-r--r--source4/libcli/nbt/nbtsocket.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source4/libcli/nbt/nbtsocket.c b/source4/libcli/nbt/nbtsocket.c
index 481327cc85..f600afb79f 100644
--- a/source4/libcli/nbt/nbtsocket.c
+++ b/source4/libcli/nbt/nbtsocket.c
@@ -26,7 +26,6 @@
#include "libcli/nbt/libnbt.h"
#include "lib/socket/socket.h"
-#define NBT_MAX_PACKET_SIZE 2048
#define NBT_MAX_REPLIES 1000
/*
@@ -157,11 +156,17 @@ static void nbt_name_socket_recv(struct nbt_name_socket *nbtsock)
const char *src_addr;
int src_port;
DATA_BLOB blob;
- size_t nread;
+ size_t nread, dsize;
struct nbt_name_packet *packet;
struct nbt_name_request *req;
- blob = data_blob_talloc(tmp_ctx, NULL, NBT_MAX_PACKET_SIZE);
+ status = socket_pending(nbtsock->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;