diff options
author | Andrew Bartlett <abartlet@samba.org> | 2004-07-14 12:14:07 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:57:35 -0500 |
commit | f607197054436a8195e3d0a695fe31574b418059 (patch) | |
tree | 90efd6698cf4cf7a499d7b3307c513b8c85d3690 /source4/torture | |
parent | 71d28b8265726a50b6f077115e7dacdb8c4b06f8 (diff) | |
download | samba-f607197054436a8195e3d0a695fe31574b418059.tar.gz samba-f607197054436a8195e3d0a695fe31574b418059.tar.bz2 samba-f607197054436a8195e3d0a695fe31574b418059.zip |
r1498: (merge from 3.0)
Rework our random number generation system.
On systems with /dev/urandom, this avoids a change to secrets.tdb for every fork().
For other systems, we now only re-seed after a fork, and on startup.
No need to do it per-operation. This removes the 'need_reseed'
parameter from generate_random_buffer().
This also requires that we start the secrets subsystem, as that is
where the reseed value is stored, for systems without /dev/urandom.
In order to aviod identical streams in forked children, the random
state is re-initialised after the fork(), at the same point were we do
that to the tdbs.
Andrew Bartlett
(This used to be commit b97d3cb2efd68310b1aea8a3ac40a64979c8cdae)
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/rpc/netlogon.c | 9 | ||||
-rw-r--r-- | source4/torture/rpc/samr.c | 4 | ||||
-rw-r--r-- | source4/torture/torture.c | 2 |
3 files changed, 7 insertions, 8 deletions
diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c index 427701d2c9..f668c17d89 100644 --- a/source4/torture/rpc/netlogon.c +++ b/source4/torture/rpc/netlogon.c @@ -88,7 +88,7 @@ static BOOL test_SetupCredentials(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r.in.credentials = &credentials1; r.out.credentials = &credentials2; - generate_random_buffer(credentials1.data, sizeof(credentials1.data), False); + generate_random_buffer(credentials1.data, sizeof(credentials1.data)); status = dcerpc_netr_ServerReqChallenge(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { @@ -148,7 +148,7 @@ static BOOL test_SetupCredentials2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r.in.credentials = &credentials1; r.out.credentials = &credentials2; - generate_random_buffer(credentials1.data, sizeof(credentials1.data), False); + generate_random_buffer(credentials1.data, sizeof(credentials1.data)); status = dcerpc_netr_ServerReqChallenge(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { @@ -214,7 +214,7 @@ static BOOL test_SetupCredentials3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r.in.credentials = &credentials1; r.out.credentials = &credentials2; - generate_random_buffer(credentials1.data, sizeof(credentials1.data), False); + generate_random_buffer(credentials1.data, sizeof(credentials1.data)); status = dcerpc_netr_ServerReqChallenge(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { @@ -893,8 +893,7 @@ static BOOL test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) samlogon_state.chall = data_blob_talloc(mem_ctx, NULL, 8); - generate_random_buffer(samlogon_state.chall.data, - 8, False); + generate_random_buffer(samlogon_state.chall.data, 8); if (!test_SetupCredentials2(p, mem_ctx, NETLOGON_NEG_AUTH2_FLAGS, &samlogon_state.creds)) { return False; diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c index e6a22a6921..bd5c44a732 100644 --- a/source4/torture/rpc/samr.c +++ b/source4/torture/rpc/samr.c @@ -452,7 +452,7 @@ static BOOL test_SetUserPassEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return False; } - generate_random_buffer((uint8_t *)confounder, 16, False); + generate_random_buffer((uint8_t *)confounder, 16); MD5Init(&ctx); MD5Update(&ctx, confounder, 16); @@ -506,7 +506,7 @@ static BOOL test_SetUserPass_25(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return False; } - generate_random_buffer((uint8_t *)confounder, 16, False); + generate_random_buffer((uint8_t *)confounder, 16); MD5Init(&ctx); MD5Update(&ctx, confounder, 16); diff --git a/source4/torture/torture.c b/source4/torture/torture.c index 8f72b63e6c..804dd34f2a 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -458,7 +458,7 @@ static BOOL rw_torture2(struct cli_state *c1, struct cli_state *c2) printf("%d\r", i); fflush(stdout); } - generate_random_buffer(buf, buf_size, False); + generate_random_buffer(buf, buf_size); if ((bytes_written = cli_write(c1->tree, fnum1, 0, buf, 0, buf_size)) != buf_size) { printf("write failed (%s)\n", cli_errstr(c1->tree)); |