diff options
| -rw-r--r-- | source3/passdb/pdb_ldap.c | 8 | 
1 files changed, 6 insertions, 2 deletions
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index 6a609b3670..e9c6093e26 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -519,9 +519,10 @@ static int ldapsam_retry_open(struct ldapsam_privates *ldap_state, int *attempts  	if (*attempts != 0) {  		unsigned int sleep_time; -		uint8 rand_byte = 128; /* a reasonable place to start */ +		uint8 rand_byte; -		generate_random_buffer(&rand_byte, 1, False); +		/* Sleep for a random timeout */ +		rand_byte = (char)(sys_random());  		sleep_time = (((*attempts)*(*attempts))/2)*rand_byte*2;   		/* we retry after (0.5, 1, 2, 3, 4.5, 6) seconds @@ -3157,6 +3158,9 @@ static NTSTATUS pdb_init_ldapsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_met  	(*pdb_method)->free_private_data = free_private_data; +	/* setup random, for our backoffs */ +	sys_srandom(sys_getpid() ^ time(NULL)); +  	return NT_STATUS_OK;  }  | 
