svn commit: samba r23728 - in branches: SAMBA_3_0/source/smbd SAMBA_3_0_25/source/smbd SAMBA_3_0_26/source/smbd

jra at samba.org jra at samba.org
Thu Jul 5 18:28:19 GMT 2007


Author: jra
Date: 2007-07-05 18:28:18 +0000 (Thu, 05 Jul 2007)
New Revision: 23728

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

Log:
First part of bugfix for #4763. Limit notify responses
to client max buf size.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/smbd/notify.c
   branches/SAMBA_3_0_25/source/smbd/notify.c
   branches/SAMBA_3_0_26/source/smbd/notify.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/notify.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/notify.c	2007-07-05 16:36:15 UTC (rev 23727)
+++ branches/SAMBA_3_0/source/smbd/notify.c	2007-07-05 18:28:18 UTC (rev 23728)
@@ -22,6 +22,9 @@
 
 #include "includes.h"
 
+/* Max size we can send to client in a notify response. */
+extern int max_send;
+
 struct notify_change_request {
 	struct notify_change_request *prev, *next;
 	struct files_struct *fsp;	/* backpointer for cancel by mid */
@@ -147,6 +150,15 @@
 
 	buflen = smb_size+38+prs_offset(&ps) + 4 /* padding */;
 
+	if (buflen > max_send) {
+		/*
+		 * We exceed what the client is willing to accept. Send
+		 * nothing.
+		 */
+		change_notify_reply_packet(request_buf, NT_STATUS_OK);
+		goto done;
+	}
+
 	if (!(outbuf = SMB_MALLOC_ARRAY(char, buflen))) {
 		change_notify_reply_packet(request_buf, NT_STATUS_NO_MEMORY);
 		goto done;

Modified: branches/SAMBA_3_0_25/source/smbd/notify.c
===================================================================
--- branches/SAMBA_3_0_25/source/smbd/notify.c	2007-07-05 16:36:15 UTC (rev 23727)
+++ branches/SAMBA_3_0_25/source/smbd/notify.c	2007-07-05 18:28:18 UTC (rev 23728)
@@ -22,6 +22,9 @@
 
 #include "includes.h"
 
+/* Max size we can send to client in a notify response. */
+extern int max_send;
+
 struct notify_change_request {
 	struct notify_change_request *prev, *next;
 	struct files_struct *fsp;	/* backpointer for cancel by mid */
@@ -146,6 +149,15 @@
 
 	buflen = smb_size+38+prs_offset(&ps) + 4 /* padding */;
 
+	if (buflen > max_send) {
+		/*
+		 * We exceed what the client is willing to accept. Send
+		 * nothing.
+		 */
+		change_notify_reply_packet(request_buf, NT_STATUS_OK);
+		goto done;
+	}
+
 	if (!(outbuf = SMB_MALLOC_ARRAY(char, buflen))) {
 		change_notify_reply_packet(request_buf, NT_STATUS_NO_MEMORY);
 		goto done;

Modified: branches/SAMBA_3_0_26/source/smbd/notify.c
===================================================================
--- branches/SAMBA_3_0_26/source/smbd/notify.c	2007-07-05 16:36:15 UTC (rev 23727)
+++ branches/SAMBA_3_0_26/source/smbd/notify.c	2007-07-05 18:28:18 UTC (rev 23728)
@@ -22,6 +22,9 @@
 
 #include "includes.h"
 
+/* Max size we can send to client in a notify response. */
+extern int max_send;
+
 struct notify_change_request {
 	struct notify_change_request *prev, *next;
 	struct files_struct *fsp;	/* backpointer for cancel by mid */
@@ -146,6 +149,15 @@
 
 	buflen = smb_size+38+prs_offset(&ps) + 4 /* padding */;
 
+	if (buflen > max_send) {
+		/*
+		 * We exceed what the client is willing to accept. Send
+		 * nothing.
+		 */
+		change_notify_reply_packet(request_buf, NT_STATUS_OK);
+		goto done;
+	}
+
 	if (!(outbuf = SMB_MALLOC_ARRAY(char, buflen))) {
 		change_notify_reply_packet(request_buf, NT_STATUS_NO_MEMORY);
 		goto done;



More information about the samba-cvs mailing list