1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-01 04:58:35 +03:00

s3:torture: make use of cli_session_creds_init() in masktest.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Stefan Metzmacher 2016-10-28 12:42:01 +02:00 committed by Andreas Schneider
parent 045bab521a
commit 2aaf3c5ea5

View File

@ -27,6 +27,7 @@
static fstring password;
static fstring username;
static int got_pass;
static struct cli_credentials *test_creds;
static int max_protocol = -1;
static bool showall = False;
static bool old_list = False;
@ -197,19 +198,7 @@ static struct cli_state *connect_one(char *share)
return NULL;
}
if (!got_pass) {
char pwd[256] = {0};
int rc;
rc = samba_getpass("Password: ", pwd, sizeof(pwd), false, false);
if (rc == 0) {
fstrcpy(password, pass);
}
}
status = cli_session_setup(c, username,
password,
lp_workgroup());
status = cli_session_setup_creds(c, test_creds);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("session setup failed: %s\n", nt_errstr(status)));
return NULL;
@ -549,6 +538,30 @@ static void usage(void)
max_protocol = lp_client_max_protocol();
if (!got_pass) {
char pwd[256] = {0};
int rc;
rc = samba_getpass("Password: ", pwd, sizeof(pwd), false, false);
if (rc == 0) {
fstrcpy(password, pass);
}
}
test_creds = cli_session_creds_init(frame,
username,
lp_workgroup(),
NULL, /* realm */
password,
false, /* use_kerberos */
false, /* fallback_after_kerberos */
false, /* use_ccache */
false); /* password_is_nt_hash */
if (test_creds == NULL) {
d_printf("cli_session_creds_init() failed.\n");
exit(1);
}
cli = connect_one(share);
if (!cli) {
DEBUG(0,("Failed to connect to %s\n", share));