[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Fri Mar 18 07:57:02 MDT 2011


The branch, master has been updated
       via  3e4879f s3: Cope with 192.168.1.1/24 in smbcontrol ip-dropped
      from  9d81340 s4-libcli/rap: add NDR_RAP dependency to LIBCLI_RAP.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 3e4879f3bddd9c9934bddeccfca65b3e8f678c26
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 9 11:00:00 2011 +0100

    s3: Cope with 192.168.1.1/24 in smbcontrol ip-dropped
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Fri Mar 18 14:56:38 CET 2011 on sn-devel-104

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

Summary of changes:
 source3/winbindd/winbindd_cm.c |   36 ++++++++++++++++++++++++++++++++----
 1 files changed, 32 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c
index 8a21f47..55e9266 100644
--- a/source3/winbindd/winbindd_cm.c
+++ b/source3/winbindd/winbindd_cm.c
@@ -2680,15 +2680,42 @@ void winbind_msg_ip_dropped(struct messaging_context *msg_ctx,
 			    DATA_BLOB *data)
 {
 	struct winbindd_domain *domain;
+	char *freeit = NULL;
+	char *addr;
 
 	if ((data == NULL)
 	    || (data->data == NULL)
 	    || (data->length == 0)
-	    || (data->data[data->length-1] != '\0')
-	    || !is_ipaddress((char *)data->data)) {
-		DEBUG(1, ("invalid msg_ip_dropped message\n"));
+	    || (data->data[data->length-1] != '\0')) {
+		DEBUG(1, ("invalid msg_ip_dropped message: not a valid "
+			  "string\n"));
 		return;
 	}
+
+	addr = (char *)data->data;
+	DEBUG(10, ("IP %s dropped\n", addr));
+
+	if (!is_ipaddress(addr)) {
+		char *slash;
+		/*
+		 * Some code sends us ip addresses with the /netmask
+		 * suffix
+		 */
+		slash = strchr(addr, '/');
+		if (slash == NULL) {
+			DEBUG(1, ("invalid msg_ip_dropped message: %s",
+				  addr));
+			return;
+		}
+		freeit = talloc_strndup(talloc_tos(), addr, slash-addr);
+		if (freeit == NULL) {
+			DEBUG(1, ("talloc failed\n"));
+			return;
+		}
+		addr = freeit;
+		DEBUG(10, ("Stripped /netmask to IP %s\n", addr));
+	}
+
 	for (domain = domain_list(); domain != NULL; domain = domain->next) {
 		char sockaddr[INET6_ADDRSTRLEN];
 		if (domain->conn.cli == NULL) {
@@ -2699,9 +2726,10 @@ void winbind_msg_ip_dropped(struct messaging_context *msg_ctx,
 		}
 		client_socket_addr(domain->conn.cli->fd, sockaddr,
 				   sizeof(sockaddr));
-		if (strequal(sockaddr, (char *)data->data)) {
+		if (strequal(sockaddr, addr)) {
 			close(domain->conn.cli->fd);
 			domain->conn.cli->fd = -1;
 		}
 	}
+	TALLOC_FREE(freeit);
 }


-- 
Samba Shared Repository


More information about the samba-cvs mailing list