From e8e07a26eb1365d195c0345ad075ff828517fe53 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 6 Jun 2001 22:04:26 +0000 Subject: Changes to use new genrand code that got missed while I was in Japan. Jeremy. (This used to be commit 5a15831b9ae79ce1ce34d5574fe5da114d184e45) --- source3/lib/util_sock.c | 21 --------------------- source3/passdb/secrets.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 21 deletions(-) (limited to 'source3') diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index b59debe929..144498138a 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -942,27 +942,6 @@ connect_again: return res; } - -/******************************************************************* - Reset the 'done' variables so after a client process is created - from a fork call these calls will be re-done. This should be - expanded if more variables need reseting. - ******************************************************************/ - - -void reset_globals_after_fork(void) -{ - /* - * Re-seed the random crypto generator, so all smbd's - * started from the same parent won't generate the same - * sequence. - */ - { - unsigned char dummy; - generate_random_buffer( &dummy, 1, True); - } -} - /* the following 3 client_*() functions are nasty ways of allowing some generic functions to get info that really should be hidden in particular modules */ diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c index 7c65da0264..4a8a363923 100644 --- a/source3/passdb/secrets.c +++ b/source3/passdb/secrets.c @@ -176,3 +176,32 @@ BOOL trust_password_delete(char *domain) { return secrets_delete(trust_keystr(domain)); } + +/******************************************************************* + Reset the 'done' variables so after a client process is created + from a fork call these calls will be re-done. This should be + expanded if more variables need reseting. + ******************************************************************/ + +void reset_globals_after_fork(void) +{ + unsigned char dummy; + + /* + * Increment the global seed value to ensure every smbd starts + * with a new random seed. + */ + + if (tdb) { + uint32 initial_val = sys_getpid(); + tdb_change_int_atomic(tdb, "INFO/random_seed", &initial_val, 1); + set_rand_reseed_data((unsigned char *)&initial_val, sizeof(initial_val)); + } + + /* + * Re-seed the random crypto generator, so all smbd's + * started from the same parent won't generate the same + * sequence. + */ + generate_random_buffer( &dummy, 1, True); +} -- cgit