svn commit: samba r17239 - in branches: SAMBA_3_0/source/libads SAMBA_3_0_23/source/libads

jerry at samba.org jerry at samba.org
Tue Jul 25 19:59:35 GMT 2006


Author: jerry
Date: 2006-07-25 19:59:35 +0000 (Tue, 25 Jul 2006)
New Revision: 17239

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

Log:
BUG 3959: patch from William Charles <william at charles.name> to fix a segv in the DNS SRV lookups dur to calling rand()
Modified:
   branches/SAMBA_3_0/source/libads/dns.c
   branches/SAMBA_3_0_23/source/libads/dns.c


Changeset:
Modified: branches/SAMBA_3_0/source/libads/dns.c
===================================================================
--- branches/SAMBA_3_0/source/libads/dns.c	2006-07-25 19:43:49 UTC (rev 17238)
+++ branches/SAMBA_3_0/source/libads/dns.c	2006-07-25 19:59:35 UTC (rev 17239)
@@ -245,17 +245,11 @@
 
 static int dnssrvcmp( struct dns_rr_srv *a, struct dns_rr_srv *b )
 {
-	BOOL init = False;
-
-	if ( !init ) {
-		srand( (uint32)time(NULL) );
-	}
-
 	if ( a->priority == b->priority ) {
 
 		/* randomize entries with an equal weight and priority */
 		if ( a->weight == b->weight ) 
-			return rand() % 2 ? -1 : 1;
+			return 0;
 
 		/* higher weights should be sorted lower */ 
 		if ( a->weight > b->weight )

Modified: branches/SAMBA_3_0_23/source/libads/dns.c
===================================================================
--- branches/SAMBA_3_0_23/source/libads/dns.c	2006-07-25 19:43:49 UTC (rev 17238)
+++ branches/SAMBA_3_0_23/source/libads/dns.c	2006-07-25 19:59:35 UTC (rev 17239)
@@ -204,17 +204,11 @@
 
 static int dnssrvcmp( struct dns_rr_srv *a, struct dns_rr_srv *b )
 {
-	BOOL init = False;
-
-	if ( !init ) {
-		srand( (uint32)time(NULL) );
-	}
-
 	if ( a->priority == b->priority ) {
 
 		/* randomize entries with an equal weight and priority */
 		if ( a->weight == b->weight ) 
-			return rand() % 2 ? -1 : 1;
+			return 0;
 
 		/* higher weights should be sorted lower */ 
 		if ( a->weight > b->weight )



More information about the samba-cvs mailing list