summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-02-24 15:12:17 +0100
committerStefan Metzmacher <metze@samba.org>2010-02-26 08:57:29 +0100
commit9ada48ffdb3b7ab4bc1bce0f6b2179f67292bcf8 (patch)
treebc0af443025e0b7ce6efcfb2d4ea755814361e4f /source4/torture
parent7473ca2d33e04d9b9dbb7fa56b0cb44603988036 (diff)
downloadsamba-9ada48ffdb3b7ab4bc1bce0f6b2179f67292bcf8.tar.gz
samba-9ada48ffdb3b7ab4bc1bce0f6b2179f67292bcf8.tar.bz2
samba-9ada48ffdb3b7ab4bc1bce0f6b2179f67292bcf8.zip
s4:torture/rpc: use generate_random_password()
metze
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/netlogon.c8
-rw-r--r--source4/torture/rpc/samba3rpc.c8
-rw-r--r--source4/torture/rpc/samr.c6
-rw-r--r--source4/torture/rpc/schannel.c2
-rw-r--r--source4/torture/rpc/testjoin.c2
5 files changed, 13 insertions, 13 deletions
diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c
index 2806cca52b..0270a5aea9 100644
--- a/source4/torture/rpc/netlogon.c
+++ b/source4/torture/rpc/netlogon.c
@@ -292,7 +292,7 @@ static bool test_SetPassword(struct torture_context *tctx,
r.in.new_password = &new_password;
r.out.return_authenticator = &return_authenticator;
- password = generate_random_str(tctx, 8);
+ password = generate_random_password(tctx, 8, 255);
E_md4hash(password, new_password.hash);
netlogon_creds_des_encrypt(creds, &new_password);
@@ -367,7 +367,7 @@ static bool test_SetPassword_flags(struct torture_context *tctx,
r.in.new_password = &new_password;
r.out.return_authenticator = &return_authenticator;
- password = generate_random_str(tctx, 8);
+ password = generate_random_password(tctx, 8, 255);
E_md4hash(password, new_password.hash);
netlogon_creds_des_encrypt(creds, &new_password);
@@ -460,7 +460,7 @@ static bool test_SetPassword2(struct torture_context *tctx,
r.in.new_password = &new_password;
r.out.return_authenticator = &return_authenticator;
- password = generate_random_str(tctx, 8);
+ password = generate_random_password(tctx, 8, 255);
encode_pw_buffer(password_buf.data, password, STR_UNICODE);
netlogon_creds_arcfour_crypt(creds, password_buf.data, 516);
@@ -518,7 +518,7 @@ static bool test_SetPassword2(struct torture_context *tctx,
"ServerPasswordSet failed to actually change the password");
/* now try a random password */
- password = generate_random_str(tctx, 8);
+ password = generate_random_password(tctx, 8, 255);
encode_pw_buffer(password_buf.data, password, STR_UNICODE);
netlogon_creds_arcfour_crypt(creds, password_buf.data, 516);
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
index 86f41b058b..9e7b18b4d7 100644
--- a/source4/torture/rpc/samba3rpc.c
+++ b/source4/torture/rpc/samba3rpc.c
@@ -1161,7 +1161,7 @@ static bool schan(struct smbcli_state *cli,
{
struct netr_ServerPasswordSet s;
- char *password = generate_random_str(wks_creds, 8);
+ char *password = generate_random_password(wks_creds, 8, 255);
struct netlogon_creds_CredentialState *creds_state;
struct netr_Authenticator credential, return_authenticator;
struct samr_Password new_password;
@@ -1285,7 +1285,7 @@ bool torture_netlogon_samba3(struct torture_context *torture)
cli_credentials_set_username(wks_creds, wks_name, CRED_SPECIFIED);
cli_credentials_set_workstation(wks_creds, wks_name, CRED_SPECIFIED);
cli_credentials_set_password(wks_creds,
- generate_random_str(wks_creds, 8),
+ generate_random_password(wks_creds, 8, 255),
CRED_SPECIFIED);
if (!join3(cli, torture->lp_ctx, false, cmdline_credentials, wks_creds)) {
@@ -1376,7 +1376,7 @@ static bool test_join3(struct torture_context *tctx,
cli_credentials_set_username(wks_creds, wks_name, CRED_SPECIFIED);
cli_credentials_set_workstation(wks_creds, wks_name, CRED_SPECIFIED);
cli_credentials_set_password(wks_creds,
- generate_random_str(wks_creds, 8),
+ generate_random_password(wks_creds, 8, 255),
CRED_SPECIFIED);
if (!join3(cli, tctx->lp_ctx, use_level25, samr_creds, wks_creds)) {
@@ -1804,7 +1804,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
cli_credentials_set_username(user_creds, "torture_username",
CRED_SPECIFIED);
cli_credentials_set_password(user_creds,
- generate_random_str(user_creds, 8),
+ generate_random_password(user_creds, 8, 255),
CRED_SPECIFIED);
if (!create_user(mem_ctx, cli, torture->lp_ctx, cmdline_credentials,
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index 41e12acc40..92a255e0fb 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -574,8 +574,8 @@ static bool test_SetUserInfo(struct dcerpc_pipe *p, struct torture_context *tctx
*/
static char *samr_rand_pass_silent(TALLOC_CTX *mem_ctx, int min_len)
{
- size_t len = MAX(8, min_len) + (random() % 6);
- char *s = generate_random_str(mem_ctx, len);
+ size_t len = MAX(8, min_len);
+ char *s = generate_random_password(mem_ctx, len, len+6);
return s;
}
@@ -610,7 +610,7 @@ static DATA_BLOB samr_very_rand_pass(TALLOC_CTX *mem_ctx, int len)
*/
static char *samr_rand_pass_fixed_len(TALLOC_CTX *mem_ctx, int len)
{
- char *s = generate_random_str(mem_ctx, len);
+ char *s = generate_random_password(mem_ctx, len, len);
printf("Generated password '%s'\n", s);
return s;
}
diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c
index 0ada20d888..2f9d60ad30 100644
--- a/source4/torture/rpc/schannel.c
+++ b/source4/torture/rpc/schannel.c
@@ -770,7 +770,7 @@ bool torture_rpc_schannel_bench1(struct torture_context *torture)
{
struct netr_ServerPasswordSet pwset;
- char *password = generate_random_str(s->join_ctx1, 8);
+ char *password = generate_random_password(s->join_ctx1, 8, 255);
struct netlogon_creds_CredentialState *creds_state;
struct dcerpc_pipe *net_pipe;
struct netr_Authenticator credential, return_authenticator;
diff --git a/source4/torture/rpc/testjoin.c b/source4/torture/rpc/testjoin.c
index 454912287e..00676e44b9 100644
--- a/source4/torture/rpc/testjoin.c
+++ b/source4/torture/rpc/testjoin.c
@@ -235,7 +235,7 @@ again:
policy_min_pw_len = pwp.out.info->min_password_length;
}
- random_pw = generate_random_str(join, MAX(8, policy_min_pw_len));
+ random_pw = generate_random_password(join, MAX(8, policy_min_pw_len), 255);
printf("Setting account password '%s'\n", random_pw);