svn commit: samba r17911 - in branches/SAMBA_3_0_RELEASE/source: include libads nmbd registry smbd

jerry at samba.org jerry at samba.org
Tue Aug 29 15:59:02 GMT 2006


Author: jerry
Date: 2006-08-29 15:59:01 +0000 (Tue, 29 Aug 2006)
New Revision: 17911

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

Log:
Mgeres from SAMBA_3_0_23:
* DNS SRV fixes
* fd leak fix in async dns lookup code (nmbd)
* krb5 sesssetup double username map fix
* NULL deref fix in reg_objects.c



Modified:
   branches/SAMBA_3_0_RELEASE/source/include/ads_dns.h
   branches/SAMBA_3_0_RELEASE/source/libads/dns.c
   branches/SAMBA_3_0_RELEASE/source/nmbd/asyncdns.c
   branches/SAMBA_3_0_RELEASE/source/registry/reg_objects.c
   branches/SAMBA_3_0_RELEASE/source/smbd/sesssetup.c


Changeset:
Modified: branches/SAMBA_3_0_RELEASE/source/include/ads_dns.h
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/include/ads_dns.h	2006-08-29 15:43:15 UTC (rev 17910)
+++ branches/SAMBA_3_0_RELEASE/source/include/ads_dns.h	2006-08-29 15:59:01 UTC (rev 17911)
@@ -47,7 +47,9 @@
 	uint16 priority;
 	uint16 weight;
 	uint16 port;
-	struct in_addr ip;
+	size_t num_ips;
+	struct in_addr *ips;    /* support multi-homed hosts */
+
 };
 
 

Modified: branches/SAMBA_3_0_RELEASE/source/libads/dns.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/libads/dns.c	2006-08-29 15:43:15 UTC (rev 17910)
+++ branches/SAMBA_3_0_RELEASE/source/libads/dns.c	2006-08-29 15:59:01 UTC (rev 17911)
@@ -334,14 +334,42 @@
 		}
 
 		/* only interested in A records as a shortcut for having to come 
-		   back later and lookup the name */
+		   back later and lookup the name.  For multi-homed hosts, the 
+		   number of additional records and exceed the number of answer 
+		   records. */
+		  
 
 		if ( (rr.type != T_A) || (rr.rdatalen != 4) ) 
 			continue;
 
 		for ( i=0; i<idx; i++ ) {
 			if ( strcmp( rr.hostname, dcs[i].hostname ) == 0 ) {
-				uint8 *buf = (uint8*)&dcs[i].ip.s_addr;
+				int num_ips = dcs[i].num_ips;
+				uint8 *buf;
+				struct in_addr *tmp_ips;
+
+				/* allocate new memory */
+				
+				if ( dcs[i].num_ips == 0 ) {
+					if ( (dcs[i].ips = TALLOC_ARRAY( dcs, 
+						struct in_addr, 1 )) == NULL ) 
+					{
+						return NT_STATUS_NO_MEMORY;
+					}
+				} else {
+					if ( (tmp_ips = TALLOC_REALLOC_ARRAY( dcs, dcs[i].ips,
+						struct in_addr, dcs[i].num_ips+1)) == NULL ) 
+					{
+						return NT_STATUS_NO_MEMORY;
+					}
+					
+					dcs[i].ips = tmp_ips;
+				}
+				dcs[i].num_ips++;
+				
+				/* copy the new IP address */
+				
+				buf = (uint8*)&dcs[i].ips[num_ips].s_addr;
 				memcpy( buf, rr.rdata, 4 );
 			}
 		}

Modified: branches/SAMBA_3_0_RELEASE/source/nmbd/asyncdns.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/nmbd/asyncdns.c	2006-08-29 15:43:15 UTC (rev 17910)
+++ branches/SAMBA_3_0_RELEASE/source/nmbd/asyncdns.c	2006-08-29 15:59:01 UTC (rev 17911)
@@ -205,6 +205,7 @@
 
 	if (!process_exists_by_pid(child_pid)) {
 		close(fd_in);
+		close(fd_out);
 		start_async_dns();
 	}
 

Modified: branches/SAMBA_3_0_RELEASE/source/registry/reg_objects.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/registry/reg_objects.c	2006-08-29 15:43:15 UTC (rev 17910)
+++ branches/SAMBA_3_0_RELEASE/source/registry/reg_objects.c	2006-08-29 15:59:01 UTC (rev 17911)
@@ -109,6 +109,10 @@
 {
 	int 	i;
 	
+	if (!ctr->subkeys) {
+		return False;
+	}
+
 	for ( i=0; i<ctr->num_subkeys; i++ ) {
 		if ( strequal( ctr->subkeys[i],keyname ) )
 			return True;
@@ -181,6 +185,7 @@
 			DEBUG(0,("dup_registry_value: memdup() failed for [%d] bytes!\n",
 				val->size));
 			SAFE_FREE( copy );
+			return NULL;
 		}
 		copy->size = val->size;
 	}

Modified: branches/SAMBA_3_0_RELEASE/source/smbd/sesssetup.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/smbd/sesssetup.c	2006-08-29 15:43:15 UTC (rev 17910)
+++ branches/SAMBA_3_0_RELEASE/source/smbd/sesssetup.c	2006-08-29 15:59:01 UTC (rev 17911)
@@ -320,10 +320,14 @@
 	
 	sub_set_smb_name( real_username );
 	reload_services(True);
+
 	if ( map_domainuser_to_guest ) {
 		make_server_info_guest(&server_info);
 	} else if (logon_info) {
-		ret = make_server_info_info3(mem_ctx, real_username, domain, 
+		/* pass the unmapped username here since map_username() 
+		   will be called again from inside make_server_info_info3() */
+		
+		ret = make_server_info_info3(mem_ctx, user, domain, 
 					     &server_info, &logon_info->info3);
 		if ( !NT_STATUS_IS_OK(ret) ) {
 			DEBUG(1,("make_server_info_info3 failed: %s!\n",



More information about the samba-cvs mailing list