diff options
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/basic/secleak.c | 10 | ||||
-rw-r--r-- | source4/torture/gentest.c | 4 | ||||
-rw-r--r-- | source4/torture/ldap/basic.c | 9 | ||||
-rw-r--r-- | source4/torture/ldap/common.c | 5 | ||||
-rw-r--r-- | source4/torture/locktest.c | 3 | ||||
-rw-r--r-- | source4/torture/masktest.c | 4 | ||||
-rw-r--r-- | source4/torture/raw/composite.c | 6 | ||||
-rw-r--r-- | source4/torture/raw/context.c | 20 | ||||
-rw-r--r-- | source4/torture/rpc/netlogon.c | 9 | ||||
-rw-r--r-- | source4/torture/rpc/schannel.c | 9 | ||||
-rw-r--r-- | source4/torture/rpc/xplogin.c | 23 | ||||
-rw-r--r-- | source4/torture/torture.c | 6 |
12 files changed, 52 insertions, 56 deletions
diff --git a/source4/torture/basic/secleak.c b/source4/torture/basic/secleak.c index 31c23ff5f7..50d5c40d07 100644 --- a/source4/torture/basic/secleak.c +++ b/source4/torture/basic/secleak.c @@ -34,9 +34,13 @@ static BOOL try_failed_login(struct smbcli_state *cli) session = smbcli_session_init(cli->transport, cli, False); setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; - setup.in.password = "INVALID-PASSWORD"; - setup.in.user = "INVALID-USERNAME"; - setup.in.domain = "INVALID-DOMAIN"; + setup.in.workgroup = lp_workgroup(); + + setup.in.credentials = cli_credentials_init(NULL); + cli_credentials_set_conf(setup.in.credentials); + cli_credentials_set_domain(setup.in.credentials, "INVALID-DOMAIN", CRED_SPECIFIED); + cli_credentials_set_username(setup.in.credentials, "INVALID-USERNAME", CRED_SPECIFIED); + cli_credentials_set_password(setup.in.credentials, "INVALID-PASSWORD", CRED_SPECIFIED); status = smb_composite_sesssetup(session, &setup); talloc_free(session); diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index 5f036910b6..3e13bf12c0 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -177,8 +177,10 @@ static BOOL connect_servers(void) servers[i].server_name, servers[i].share_name, servers[i].credentials->username, j); + cli_credentials_set_workstation(servers[i].credentials, + "gentest", CRED_SPECIFIED); + status = smbcli_full_connection(NULL, &servers[i].cli[j], - "gentest", servers[i].server_name, servers[i].share_name, NULL, servers[i].credentials); diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index d0255abe01..b53515fdbc 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -38,14 +38,14 @@ BOOL test_bind_simple(struct ldap_connection *conn, const char *userdn, const ch return ret; } -BOOL test_bind_sasl(struct ldap_connection *conn, const char *username, const char *domain, const char *password) +BOOL test_bind_sasl(struct ldap_connection *conn, struct cli_credentials *creds) { NTSTATUS status; BOOL ret = True; printf("Testing sasl bind as user\n"); - status = torture_ldap_bind_sasl(conn, username, domain, password); + status = torture_ldap_bind_sasl(conn, creds); if (!NT_STATUS_IS_OK(status)) { ret = False; } @@ -189,9 +189,6 @@ BOOL torture_ldap_basic(void) TALLOC_CTX *mem_ctx; BOOL ret = True; const char *host = lp_parm_string(-1, "torture", "host"); - const char *username = cli_credentials_get_username(cmdline_credentials); - const char *domain = cli_credentials_get_domain(cmdline_credentials); - const char *password = cli_credentials_get_password(cmdline_credentials); const char *userdn = lp_parm_string(-1, "torture", "ldap_userdn"); /*const char *basedn = lp_parm_string(-1, "torture", "ldap_basedn");*/ const char *secret = lp_parm_string(-1, "torture", "ldap_secret"); @@ -217,7 +214,7 @@ BOOL torture_ldap_basic(void) ret = False; } - if (!test_bind_sasl(conn, username, domain, password)) { + if (!test_bind_sasl(conn, cmdline_credentials)) { ret = False; } diff --git a/source4/torture/ldap/common.c b/source4/torture/ldap/common.c index f421565cbd..9dbe2557eb 100644 --- a/source4/torture/ldap/common.c +++ b/source4/torture/ldap/common.c @@ -46,7 +46,8 @@ NTSTATUS torture_ldap_bind(struct ldap_connection *conn, const char *userdn, con return NT_STATUS_OK; } -NTSTATUS torture_ldap_bind_sasl(struct ldap_connection *conn, const char *username, const char *domain, const char *password) +NTSTATUS torture_ldap_bind_sasl(struct ldap_connection *conn, + struct cli_credentials *creds) { NTSTATUS status = NT_STATUS_UNSUCCESSFUL; int result; @@ -56,7 +57,7 @@ NTSTATUS torture_ldap_bind_sasl(struct ldap_connection *conn, const char *userna return status; } - result = ldap_bind_sasl(conn, username, domain, password); + result = ldap_bind_sasl(conn, creds); if (result != LDAP_SUCCESS) { printf("Failed to bind with provided credentials and SASL mechanism\n"); /* FIXME: what abut actually implementing an ldap_connection_free() function ? diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c index 4051f9c411..fe5dfe5178 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -116,9 +116,10 @@ static struct smbcli_state *connect_one(char *share, int snum) share++; slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), snum); + cli_credentials_set_workstation(servers[snum], myname, CRED_SPECIFIED); do { - status = smbcli_full_connection(NULL, &c, myname, + status = smbcli_full_connection(NULL, &c, server, share, NULL, servers[snum]); diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c index d760934334..21e22e91d8 100644 --- a/source4/torture/masktest.c +++ b/source4/torture/masktest.c @@ -77,7 +77,9 @@ static struct smbcli_state *connect_one(char *share) *share = 0; share++; - status = smbcli_full_connection(NULL, &c, "masktest", + cli_credentials_set_workstation(credentials, "masktest", CRED_SPECIFIED); + + status = smbcli_full_connection(NULL, &c, server, share, NULL, credentials); diff --git a/source4/torture/raw/composite.c b/source4/torture/raw/composite.c index b9c7609b5f..f836e1eb4b 100644 --- a/source4/torture/raw/composite.c +++ b/source4/torture/raw/composite.c @@ -147,13 +147,11 @@ static BOOL test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io2.in.dest_host = lp_parm_string(-1, "torture", "host"); io2.in.port = 0; io2.in.called_name = lp_parm_string(-1, "torture", "host"); - io2.in.calling_name = lp_netbios_name(); io2.in.service = lp_parm_string(-1, "torture", "share"); io2.in.service_type = "A:"; - io2.in.user = cli_credentials_get_username(cmdline_credentials); - io2.in.domain = cli_credentials_get_domain(cmdline_credentials); - io2.in.password = cli_credentials_get_password(cmdline_credentials); + io2.in.credentials = cmdline_credentials; + io2.in.workgroup = lp_workgroup(); io2.in.filename = fname; printf("testing parallel fetchfile with %d ops\n", torture_numops); diff --git a/source4/torture/raw/context.c b/source4/torture/raw/context.c index 3eb848eebd..a610eaa79e 100644 --- a/source4/torture/raw/context.c +++ b/source4/torture/raw/context.c @@ -81,9 +81,9 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */ - setup.in.password = cli_credentials_get_password(cmdline_credentials); - setup.in.user = cli_credentials_get_username(cmdline_credentials); - setup.in.domain = cli_credentials_get_domain(cmdline_credentials); + setup.in.workgroup = lp_workgroup(); + + setup.in.credentials = cmdline_credentials; status = smb_composite_sesssetup(session, &setup); CHECK_STATUS(status, NT_STATUS_OK); @@ -96,10 +96,9 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) session2->vuid = session->vuid; setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */ + setup.in.workgroup = lp_workgroup(); - setup.in.password = cli_credentials_get_password(cmdline_credentials); - setup.in.user = cli_credentials_get_username(cmdline_credentials); - setup.in.domain = cli_credentials_get_domain(cmdline_credentials); + setup.in.credentials = cmdline_credentials; status = smb_composite_sesssetup(session2, &setup); CHECK_STATUS(status, NT_STATUS_OK); @@ -117,11 +116,10 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) session3->vuid = session->vuid; setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = 0; /* force a non extended security login (should fail) */ - - - setup.in.password = cli_credentials_get_password(cmdline_credentials); - setup.in.user = cli_credentials_get_username(cmdline_credentials); - setup.in.domain = cli_credentials_get_domain(cmdline_credentials); + setup.in.workgroup = lp_workgroup(); + + setup.in.credentials = cmdline_credentials; + status = smb_composite_sesssetup(session3, &setup); CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED); diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c index d9ce350428..c12560ad53 100644 --- a/source4/torture/rpc/netlogon.c +++ b/source4/torture/rpc/netlogon.c @@ -116,9 +116,6 @@ BOOL test_SetupCredentials(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, a.out.credentials = &credentials3; creds_client_init(creds, &credentials1, &credentials2, - machine_name, - lp_workgroup(), - a.in.account_name, &mach_password, &credentials3, 0); @@ -185,9 +182,6 @@ BOOL test_SetupCredentials2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, a.out.credentials = &credentials3; creds_client_init(creds, &credentials1, &credentials2, - machine_name, - lp_workgroup(), - a.in.account_name, &mach_password, &credentials3, negotiate_flags); @@ -258,9 +252,6 @@ BOOL test_SetupCredentials3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, a.out.rid = &rid; creds_client_init(creds, &credentials1, &credentials2, - machine_name, - lp_workgroup(), - a.in.account_name, &mach_password, &credentials3, negotiate_flags); diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c index d60a8bb60b..7bc184f42e 100644 --- a/source4/torture/rpc/schannel.c +++ b/source4/torture/rpc/schannel.c @@ -194,10 +194,11 @@ static BOOL test_schannel(TALLOC_CTX *mem_ctx, goto failed; } - status = dcerpc_bind_auth_schannel_withkey(p_netlogon, - DCERPC_NETLOGON_UUID, - DCERPC_NETLOGON_VERSION, - creds); + status = dcerpc_bind_auth_password(p_netlogon, + DCERPC_NETLOGON_UUID, + DCERPC_NETLOGON_VERSION, + credentials, DCERPC_AUTH_TYPE_SCHANNEL, + NULL); if (!NT_STATUS_IS_OK(status)) { goto failed; diff --git a/source4/torture/rpc/xplogin.c b/source4/torture/rpc/xplogin.c index cf42f938c1..f55f6684bc 100644 --- a/source4/torture/rpc/xplogin.c +++ b/source4/torture/rpc/xplogin.c @@ -118,11 +118,11 @@ static NTSTATUS anon_ipc(struct smbcli_transport *transport, /* prepare a session setup to establish a security context */ setup.in.sesskey = transport->negotiate.sesskey; setup.in.capabilities = transport->negotiate.capabilities; - setup.in.password = NULL; - setup.in.user = ""; - setup.in.domain = ""; setup.in.capabilities &= ~CAP_EXTENDED_SECURITY; + setup.in.credentials = cli_credentials_init(mem_ctx); + cli_credentials_set_anonymous(setup.in.credentials); + status = smb_composite_sesssetup(session, &setup); if (!NT_STATUS_IS_OK(status)) { talloc_free(session); @@ -479,9 +479,6 @@ static NTSTATUS setup_netlogon_creds(struct smbcli_transport *transport, a.out.credentials = &credentials3; creds_client_init(creds, &credentials1, &credentials2, - machine_name, - domain, - a.in.account_name, &mach_password, &credentials3, negotiate_flags); @@ -978,6 +975,7 @@ static NTSTATUS test_remoteTOD(struct smbcli_transport *transport) return status; } +#if 0 static BOOL xp_login(const char *dcname, const char *wksname, const char *domain, const char *wkspwd, const char *user1name, const char *user1pw, @@ -1033,10 +1031,10 @@ static BOOL xp_login(const char *dcname, const char *wksname, netlogon_schannel_pipe->conn->flags |= DCERPC_SEAL; - status = dcerpc_bind_auth_schannel_withkey(netlogon_schannel_pipe, - DCERPC_NETLOGON_UUID, - DCERPC_NETLOGON_VERSION, - netlogon_creds); + status = dcerpc_bind_auth_password(netlogon_schannel_pipe, + DCERPC_NETLOGON_UUID, + DCERPC_NETLOGON_VERSION, + creds, NULL); if (!NT_STATUS_IS_OK(status)) return False; @@ -1096,6 +1094,8 @@ static BOOL xp_login(const char *dcname, const char *wksname, return True; } +#endif + struct user_pw { const char *username; const char *password; @@ -1124,10 +1124,13 @@ BOOL torture_rpc_login(void) users[useridx1].username, users[useridx2].username); +#if 0 return xp_login(pdcname, machines[machidx].username, domainname, machines[machidx].password, users[useridx1].username, users[useridx1].password, users[useridx2].username, users[useridx2].password); +#endif + return False; } diff --git a/source4/torture/torture.c b/source4/torture/torture.c index 4fca36a9ae..eb4dd0b84a 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -82,8 +82,7 @@ BOOL torture_open_connection_share(struct smbcli_state **c, NTSTATUS status; status = smbcli_full_connection(NULL, - c, lp_netbios_name(), - hostname, + c, hostname, sharename, NULL, cmdline_credentials); if (!NT_STATUS_IS_OK(status)) { @@ -725,8 +724,7 @@ static BOOL run_tcon_devtype_test(void) const char *share = lp_parm_string(-1, "torture", "share"); status = smbcli_full_connection(NULL, - &cli1, lp_netbios_name(), - host, + &cli1, host, share, NULL, cmdline_credentials); |