svn commit: samba r17668 - in branches: SAMBA_3_0/source/nmbd SAMBA_3_0_23/source/nmbd

jra at samba.org jra at samba.org
Mon Aug 21 20:03:33 GMT 2006


Author: jra
Date: 2006-08-21 20:03:32 +0000 (Mon, 21 Aug 2006)
New Revision: 17668

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

Log:
Fix the miscalculations in pushing announces. Fixes
problems Kukks reported.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/nmbd/nmbd_sendannounce.c
   branches/SAMBA_3_0_23/source/nmbd/nmbd_sendannounce.c


Changeset:
Modified: branches/SAMBA_3_0/source/nmbd/nmbd_sendannounce.c
===================================================================
--- branches/SAMBA_3_0/source/nmbd/nmbd_sendannounce.c	2006-08-21 17:58:41 UTC (rev 17667)
+++ branches/SAMBA_3_0/source/nmbd/nmbd_sendannounce.c	2006-08-21 20:03:32 UTC (rev 17668)
@@ -35,7 +35,7 @@
 
 void send_browser_reset(int reset_type, const char *to_name, int to_type, struct in_addr to_ip)
 {
-	pstring outbuf;
+	char outbuf[PSTRING_LEN];
 	char *p;
 
 	DEBUG(3,("send_browser_reset: sending reset request type %d to %s<%02x> IP %s.\n",
@@ -60,7 +60,7 @@
 
 void broadcast_announce_request(struct subnet_record *subrec, struct work_record *work)
 {
-	pstring outbuf;
+	char outbuf[PSTRING_LEN];
 	char *p;
 
 	work->needannounce = True;
@@ -91,7 +91,7 @@
                               time_t announce_interval,
                               const char *server_name, int server_type, const char *server_comment)
 {
-	pstring outbuf;
+	char outbuf[PSTRING_LEN];
 	unstring upper_server_name;
 	char *p;
 
@@ -116,7 +116,7 @@
 	SSVAL(p,27,BROWSER_ELECTION_VERSION);
 	SSVAL(p,29,BROWSER_CONSTANT); /* Browse signature. */
 
-	p += 31 + push_string(NULL, p+31, server_comment, -1, STR_ASCII|STR_TERMINATE);
+	p += 31 + push_string(NULL, p+31, server_comment, sizeof(outbuf) - (p + 31 - outbuf), STR_ASCII|STR_TERMINATE);
 
 	send_mailslot(False,BROWSE_MAILSLOT, outbuf, PTR_DIFF(p,outbuf),
 			from_name, 0x0, to_name, to_type, to_ip, subrec->myip,
@@ -132,7 +132,7 @@
                               time_t announce_interval,
                               char *server_name, int server_type, char *server_comment)
 {
-	pstring outbuf;
+	char outbuf[PSTRING_LEN];
 	char *p=outbuf;
 
 	memset(outbuf,'\0',sizeof(outbuf));
@@ -145,7 +145,7 @@
 
 	p += 10;
 	p += push_string(NULL, p, server_name, 15, STR_ASCII|STR_UPPER|STR_TERMINATE);
-	p += push_string(NULL, p, server_comment, sizeof(pstring)-15, STR_ASCII|STR_UPPER|STR_TERMINATE);
+	p += push_string(NULL, p, server_comment, sizeof(outbuf)- (p - outbuf), STR_ASCII|STR_UPPER|STR_TERMINATE);
 
 	send_mailslot(False,LANMAN_MAILSLOT, outbuf, PTR_DIFF(p,outbuf),
 		from_name, 0x0, to_name, to_type, to_ip, subrec->myip,

Modified: branches/SAMBA_3_0_23/source/nmbd/nmbd_sendannounce.c
===================================================================
--- branches/SAMBA_3_0_23/source/nmbd/nmbd_sendannounce.c	2006-08-21 17:58:41 UTC (rev 17667)
+++ branches/SAMBA_3_0_23/source/nmbd/nmbd_sendannounce.c	2006-08-21 20:03:32 UTC (rev 17668)
@@ -35,7 +35,7 @@
 
 void send_browser_reset(int reset_type, const char *to_name, int to_type, struct in_addr to_ip)
 {
-	pstring outbuf;
+	char outbuf[PSTRING_LEN];
 	char *p;
 
 	DEBUG(3,("send_browser_reset: sending reset request type %d to %s<%02x> IP %s.\n",
@@ -60,7 +60,7 @@
 
 void broadcast_announce_request(struct subnet_record *subrec, struct work_record *work)
 {
-	pstring outbuf;
+	char outbuf[PSTRING_LEN];
 	char *p;
 
 	work->needannounce = True;
@@ -91,7 +91,7 @@
                               time_t announce_interval,
                               const char *server_name, int server_type, const char *server_comment)
 {
-	pstring outbuf;
+	char outbuf[PSTRING_LEN];
 	unstring upper_server_name;
 	char *p;
 
@@ -116,7 +116,7 @@
 	SSVAL(p,27,BROWSER_ELECTION_VERSION);
 	SSVAL(p,29,BROWSER_CONSTANT); /* Browse signature. */
 
-	p += 31 + push_string(NULL, p+31, server_comment, -1, STR_ASCII|STR_TERMINATE);
+	p += 31 + push_string(NULL, p+31, server_comment, sizeof(outbuf) - (p + 31 - outbuf), STR_ASCII|STR_TERMINATE);
 
 	send_mailslot(False,BROWSE_MAILSLOT, outbuf, PTR_DIFF(p,outbuf),
 			from_name, 0x0, to_name, to_type, to_ip, subrec->myip,
@@ -132,7 +132,7 @@
                               time_t announce_interval,
                               char *server_name, int server_type, char *server_comment)
 {
-	pstring outbuf;
+	char outbuf[PSTRING_LEN];
 	char *p=outbuf;
 
 	memset(outbuf,'\0',sizeof(outbuf));
@@ -145,7 +145,7 @@
 
 	p += 10;
 	p += push_string(NULL, p, server_name, 15, STR_ASCII|STR_UPPER|STR_TERMINATE);
-	p += push_string(NULL, p, server_comment, sizeof(pstring)-15, STR_ASCII|STR_UPPER|STR_TERMINATE);
+	p += push_string(NULL, p, server_comment, sizeof(outbuf)- (p - outbuf), STR_ASCII|STR_UPPER|STR_TERMINATE);
 
 	send_mailslot(False,LANMAN_MAILSLOT, outbuf, PTR_DIFF(p,outbuf),
 		from_name, 0x0, to_name, to_type, to_ip, subrec->myip,



More information about the samba-cvs mailing list