[SCM] Samba Shared Repository - branch v3-5-test updated

Karolin Seeger kseeger at samba.org
Thu Oct 18 03:58:24 MDT 2012


The branch, v3-5-test has been updated
       via  fce3a18 Revert "s3-smbd: Don't segfault if user specified ports out for range."
      from  31518a6 s3: fix compile of krb5 locator on Solaris

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-test


- Log -----------------------------------------------------------------
commit fce3a18d3d5ed46f8e0d1653f862e46b5dff0e03
Author: Karolin Seeger <kseeger at samba.org>
Date:   Thu Oct 18 11:48:16 2012 +0200

    Revert "s3-smbd: Don't segfault if user specified ports out for range."
    
    This reverts commit 60b15f3b646d10e027e8288132db5b942261de8f.
    
    This commit seems to break 'make test' on my system, so reverting it for now.
    (Bug report has been re-opened, see
    https://bugzilla.samba.org/show_bug.cgi?id=9218
    for details).

-----------------------------------------------------------------------

Summary of changes:
 source3/smbd/server.c |   23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index f34d9f6..63a9869 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -560,8 +560,6 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent,
 	int num_interfaces = iface_count();
 	int i;
 	char *ports;
-	char *tok;
-	const char *ptr;
 	unsigned dns_port = 0;
 
 #ifdef HAVE_ATEXIT
@@ -583,16 +581,6 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent,
 		ports = talloc_strdup(talloc_tos(), smb_ports);
 	}
 
-	for (ptr = ports;
-	     next_token_talloc(talloc_tos(),&ptr, &tok, " \t,");) {
-		unsigned port = atoi(tok);
-
-		if (port == 0 || port > 0xffff) {
-			exit_server_cleanly("Invalid port in the config or on "
-					    "the commandline specified!");
-		}
-	}
-
 	if (lp_interfaces() && lp_bind_interfaces_only()) {
 		/* We have been given an interfaces line, and been
 		   told to only bind to those interfaces. Create a
@@ -604,6 +592,8 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent,
 		for(i = 0; i < num_interfaces; i++) {
 			const struct sockaddr_storage *ifss =
 					iface_n_sockaddr_storage(i);
+			char *tok;
+			const char *ptr;
 
 			if (ifss == NULL) {
 				DEBUG(0,("open_sockets_smbd: "
@@ -615,6 +605,9 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent,
 			for (ptr=ports;
 			     next_token_talloc(talloc_tos(),&ptr, &tok, " \t,");) {
 				unsigned port = atoi(tok);
+				if (port == 0 || port > 0xffff) {
+					continue;
+				}
 
 				/* Keep the first port for mDNS service
 				 * registration.
@@ -632,6 +625,8 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent,
 		/* Just bind to 0.0.0.0 - accept connections
 		   from anywhere. */
 
+		char *tok;
+		const char *ptr;
 		const char *sock_addr = lp_socket_address();
 		char *sock_tok;
 		const char *sock_ptr;
@@ -649,7 +644,11 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent,
 		     next_token_talloc(talloc_tos(), &sock_ptr, &sock_tok, " \t,"); ) {
 			for (ptr=ports; next_token_talloc(talloc_tos(), &ptr, &tok, " \t,"); ) {
 				struct sockaddr_storage ss;
+
 				unsigned port = atoi(tok);
+				if (port == 0 || port > 0xffff) {
+					continue;
+				}
 
 				/* Keep the first port for mDNS service
 				 * registration.


-- 
Samba Shared Repository


More information about the samba-cvs mailing list