summaryrefslogtreecommitdiff
path: root/source4/torture/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r--source4/torture/rpc/bind.c7
-rw-r--r--source4/torture/rpc/samlogon.c32
-rw-r--r--source4/torture/rpc/samsync.c20
-rw-r--r--source4/torture/rpc/schannel.c10
4 files changed, 39 insertions, 30 deletions
diff --git a/source4/torture/rpc/bind.c b/source4/torture/rpc/bind.c
index 3eb02c31eb..71eaec4f92 100644
--- a/source4/torture/rpc/bind.c
+++ b/source4/torture/rpc/bind.c
@@ -23,6 +23,7 @@
#include "includes.h"
#include "librpc/gen_ndr/ndr_lsa.h"
+#include "lib/cmdline/popt_common.h"
/*
This test is 'bogus' in that it doesn't actually perform to the
@@ -37,10 +38,6 @@
BOOL torture_multi_bind(void)
{
struct dcerpc_pipe *p;
- const char *workstation = lp_netbios_name();
- const char *domain = lp_parm_string(-1, "torture", "userdomain");
- const char *username = lp_parm_string(-1, "torture", "username");
- const char *password = lp_parm_string(-1, "torture", "password");
const char *pipe_uuid = DCERPC_LSARPC_UUID;
uint32_t pipe_version = DCERPC_LSARPC_VERSION;
struct dcerpc_binding *binding;
@@ -68,7 +65,7 @@ BOOL torture_multi_bind(void)
}
status = dcerpc_pipe_auth(p, binding, pipe_uuid, pipe_version,
- workstation, domain, username, password);
+ cmdline_credentials);
if (NT_STATUS_IS_OK(status)) {
printf("(incorrectly) allowed re-bind to uuid %s - %s\n",
diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c
index e08eaca22e..1ee8f36b8e 100644
--- a/source4/torture/rpc/samlogon.c
+++ b/source4/torture/rpc/samlogon.c
@@ -26,6 +26,7 @@
#include "librpc/gen_ndr/ndr_netlogon.h"
#include "auth/auth.h"
#include "lib/crypto/crypto.h"
+#include "lib/cmdline/popt_common.h"
#define TEST_MACHINE_NAME "samlogontest"
#define TEST_USER_NAME "samlogontestuser"
@@ -1215,6 +1216,7 @@ BOOL torture_rpc_samlogon(void)
NTSTATUS status;
struct dcerpc_pipe *p;
struct dcerpc_binding *b;
+ struct cli_credentials credentials;
TALLOC_CTX *mem_ctx = talloc_init("torture_rpc_netlogon");
BOOL ret = True;
struct test_join *join_ctx;
@@ -1245,27 +1247,29 @@ BOOL torture_rpc_samlogon(void)
BOOL network_login;
} usercreds[] = {
{
- lp_parm_string(-1, "torture", "userdomain"),
- lp_parm_string(-1, "torture", "username"),
- lp_parm_string(-1, "torture", "password"),
+ cli_credentials_get_domain(cmdline_credentials),
+ cli_credentials_get_username(cmdline_credentials),
+ cli_credentials_get_password(cmdline_credentials),
True
},
{
NULL,
talloc_asprintf(mem_ctx,
"%s@%s",
- lp_parm_string(-1, "torture", "username"),
- lp_parm_string(-1, "torture", "userdomain")),
- lp_parm_string(-1, "torture", "password"),
+ cli_credentials_get_domain(cmdline_credentials),
+ cli_credentials_get_username(cmdline_credentials)
+ ),
+ cli_credentials_get_password(cmdline_credentials),
False
},
{
NULL,
talloc_asprintf(mem_ctx,
"%s@%s",
- lp_parm_string(-1, "torture", "username"),
- lp_realm()),
- lp_parm_string(-1, "torture", "password"),
+ cli_credentials_get_username(cmdline_credentials),
+ cli_credentials_get_realm(cmdline_credentials)
+ ),
+ cli_credentials_get_password(cmdline_credentials),
True
},
#if 0
@@ -1334,13 +1338,15 @@ BOOL torture_rpc_samlogon(void)
b->flags &= ~DCERPC_AUTH_OPTIONS;
b->flags |= DCERPC_SCHANNEL_WORKSTATION | DCERPC_SIGN | DCERPC_SCHANNEL_128;
+ cli_credentials_set_workstation(&credentials, TEST_MACHINE_NAME, CRED_SPECIFIED);
+ cli_credentials_set_domain(&credentials, lp_workgroup(), CRED_SPECIFIED);
+ cli_credentials_set_username(&credentials, test_machine_account, CRED_SPECIFIED);
+ cli_credentials_set_password(&credentials, machine_password, CRED_SPECIFIED);
+
status = dcerpc_pipe_connect_b(&p, b,
DCERPC_NETLOGON_UUID,
DCERPC_NETLOGON_VERSION,
- TEST_MACHINE_NAME,
- lp_workgroup(),
- test_machine_account,
- machine_password);
+ &credentials);
if (!NT_STATUS_IS_OK(status)) {
ret = False;
diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c
index 505e331d19..b92752227c 100644
--- a/source4/torture/rpc/samsync.c
+++ b/source4/torture/rpc/samsync.c
@@ -1295,6 +1295,7 @@ BOOL torture_rpc_samsync(void)
struct lsa_ObjectAttribute attr;
struct lsa_QosInfo qos;
struct lsa_OpenPolicy2 r;
+ struct cli_credentials credentials;
struct samsync_state *samsync_state;
@@ -1418,13 +1419,15 @@ BOOL torture_rpc_samsync(void)
b->flags &= ~DCERPC_AUTH_OPTIONS;
b->flags |= DCERPC_SCHANNEL_BDC | DCERPC_SIGN;
+ cli_credentials_set_workstation(&credentials, TEST_MACHINE_NAME, CRED_SPECIFIED);
+ cli_credentials_set_domain(&credentials, lp_workgroup(), CRED_SPECIFIED);
+ cli_credentials_set_username(&credentials, test_machine_account, CRED_SPECIFIED);
+ cli_credentials_set_password(&credentials, machine_password, CRED_SPECIFIED);
+
status = dcerpc_pipe_connect_b(&samsync_state->p, b,
DCERPC_NETLOGON_UUID,
DCERPC_NETLOGON_VERSION,
- TEST_MACHINE_NAME,
- lp_workgroup(),
- test_machine_account,
- machine_password);
+ &credentials);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to server as a BDC: %s\n", nt_errstr(status));
@@ -1449,14 +1452,15 @@ BOOL torture_rpc_samsync(void)
b_netlogon_wksta->flags &= ~DCERPC_AUTH_OPTIONS;
b_netlogon_wksta->flags |= DCERPC_SCHANNEL_WORKSTATION | DCERPC_SIGN;
+ cli_credentials_set_workstation(&credentials, TEST_WKSTA_MACHINE_NAME, CRED_SPECIFIED);
+ cli_credentials_set_username(&credentials, test_wksta_machine_account, CRED_SPECIFIED);
+ cli_credentials_set_password(&credentials, wksta_machine_password, CRED_SPECIFIED);
+
status = dcerpc_pipe_connect_b(&samsync_state->p_netlogon_wksta,
b_netlogon_wksta,
DCERPC_NETLOGON_UUID,
DCERPC_NETLOGON_VERSION,
- TEST_WKSTA_MACHINE_NAME,
- lp_workgroup(),
- test_wksta_machine_account,
- wksta_machine_password);
+ &credentials);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to server as a Workstation: %s\n", nt_errstr(status));
diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c
index 1b10e2a4f2..f572933bf5 100644
--- a/source4/torture/rpc/schannel.c
+++ b/source4/torture/rpc/schannel.c
@@ -127,6 +127,7 @@ static BOOL test_schannel(TALLOC_CTX *mem_ctx,
struct dcerpc_pipe *p = NULL;
struct dcerpc_pipe *p_netlogon = NULL;
struct creds_CredentialState *creds;
+ struct cli_credentials credentials;
char *test_machine_account = talloc_asprintf(NULL, "%s$", TEST_MACHINE_NAME);
join_ctx = torture_create_testuser(test_machine_account, lp_workgroup(),
@@ -145,13 +146,14 @@ static BOOL test_schannel(TALLOC_CTX *mem_ctx,
b->flags &= ~DCERPC_AUTH_OPTIONS;
b->flags |= dcerpc_flags;
+ cli_credentials_set_domain(&credentials, lp_workgroup(), CRED_SPECIFIED);
+ cli_credentials_set_workstation(&credentials, TEST_MACHINE_NAME, CRED_SPECIFIED);
+ cli_credentials_set_username(&credentials, test_machine_account, CRED_SPECIFIED);
+ cli_credentials_set_password(&credentials, machine_password, CRED_SPECIFIED);
status = dcerpc_pipe_connect_b(&p, b,
DCERPC_SAMR_UUID,
DCERPC_SAMR_VERSION,
- TEST_MACHINE_NAME,
- lp_workgroup(),
- test_machine_account,
- machine_password);
+ &credentials);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect with schannel: %s\n", nt_errstr(status));
goto failed;