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

idra at samba.org idra at samba.org
Tue Jul 3 13:11:57 GMT 2007


Author: idra
Date: 2007-07-03 13:11:56 +0000 (Tue, 03 Jul 2007)
New Revision: 23683

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

Log:

Check ports are in the correct range (1-65535)


Modified:
   branches/SAMBA_3_0/source/smbd/sockinit.c
   branches/SAMBA_3_0_26/source/smbd/server.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/sockinit.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/sockinit.c	2007-07-03 13:07:56 UTC (rev 23682)
+++ branches/SAMBA_3_0/source/smbd/sockinit.c	2007-07-03 13:11:56 UTC (rev 23683)
@@ -63,7 +63,7 @@
 
 			for (ptr=ports; next_token(&ptr, tok, " \t,", sizeof(tok)); ) {
 				unsigned port = atoi(tok);
-				if (port == 0) {
+				if (port == 0 || port > 0xffff) {
 					continue;
 				}
 				s = listenset[num_sockets] = open_socket_in(SOCK_STREAM, port, 0, ifip->s_addr, True);
@@ -101,7 +101,7 @@
 		
 		for (ptr=ports; next_token(&ptr, tok, " \t,", sizeof(tok)); ) {
 			unsigned port = atoi(tok);
-			if (port == 0) continue;
+			if (port == 0  || port > 0xffff) continue;
 			/* open an incoming socket */
 			s = open_socket_in(SOCK_STREAM, port, 0,
 					   interpret_addr(lp_socket_address()),True);

Modified: branches/SAMBA_3_0_26/source/smbd/server.c
===================================================================
--- branches/SAMBA_3_0_26/source/smbd/server.c	2007-07-03 13:07:56 UTC (rev 23682)
+++ branches/SAMBA_3_0_26/source/smbd/server.c	2007-07-03 13:11:56 UTC (rev 23683)
@@ -381,7 +381,7 @@
 
 			for (ptr=ports; next_token(&ptr, tok, " \t,", sizeof(tok)); ) {
 				unsigned port = atoi(tok);
-				if (port == 0) {
+				if (port == 0 || port > 0xffff) {
 					continue;
 				}
 				s = fd_listenset[num_sockets] = open_socket_in(SOCK_STREAM, port, 0, ifip->s_addr, True);
@@ -421,7 +421,7 @@
 		
 		for (ptr=ports; next_token(&ptr, tok, " \t,", sizeof(tok)); ) {
 			unsigned port = atoi(tok);
-			if (port == 0) continue;
+			if (port == 0 || port > 0xffff) continue;
 			/* open an incoming socket */
 			s = open_socket_in(SOCK_STREAM, port, 0,
 					   interpret_addr(lp_socket_address()),True);



More information about the samba-cvs mailing list