svn commit: samba r7229 - in branches/SAMBA_4_0/source/libcli: dgram nbt

tridge at samba.org tridge at samba.org
Fri Jun 3 13:31:28 GMT 2005


Author: tridge
Date: 2005-06-03 13:31:27 +0000 (Fri, 03 Jun 2005)
New Revision: 7229

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7229

Log:
use socket_pending() to get rid of the max packet size limits in the
nbt and dgram layers

Modified:
   branches/SAMBA_4_0/source/libcli/dgram/dgramsocket.c
   branches/SAMBA_4_0/source/libcli/nbt/nbtsocket.c


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/dgram/dgramsocket.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/dgram/dgramsocket.c	2005-06-03 13:20:45 UTC (rev 7228)
+++ branches/SAMBA_4_0/source/libcli/dgram/dgramsocket.c	2005-06-03 13:31:27 UTC (rev 7229)
@@ -27,9 +27,7 @@
 #include "libcli/dgram/libdgram.h"
 #include "lib/socket/socket.h"
 
-#define DGRAM_MAX_PACKET_SIZE 2048
 
-
 /*
   handle recv events on a nbt dgram socket
 */
@@ -40,11 +38,17 @@
 	const char *src_addr;
 	int src_port;
 	DATA_BLOB blob;
-	size_t nread;
+	size_t nread, dsize;
 	struct nbt_dgram_packet *packet;
 	const char *mailslot_name;
 
-	blob = data_blob_talloc(tmp_ctx, NULL, DGRAM_MAX_PACKET_SIZE);
+	status = socket_pending(dgmsock->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;

Modified: branches/SAMBA_4_0/source/libcli/nbt/nbtsocket.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/nbt/nbtsocket.c	2005-06-03 13:20:45 UTC (rev 7228)
+++ branches/SAMBA_4_0/source/libcli/nbt/nbtsocket.c	2005-06-03 13:31:27 UTC (rev 7229)
@@ -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 @@
 	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;



More information about the samba-cvs mailing list