summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-01-15 11:58:52 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:08:50 -0500
commit61a3d370b98ca4b75cd61e22f0d6b0f3fb7561b3 (patch)
tree64923e274b14c4b238e341b2c5a54b536c80e88e /source4/torture
parente89fd49df7e63dcf37ee1aa7e2f50965851725c9 (diff)
downloadsamba-61a3d370b98ca4b75cd61e22f0d6b0f3fb7561b3.tar.gz
samba-61a3d370b98ca4b75cd61e22f0d6b0f3fb7561b3.tar.bz2
samba-61a3d370b98ca4b75cd61e22f0d6b0f3fb7561b3.zip
r4758: - added async support to the session request code
- added async support to the negprot client code - removed two unused parameters from smbcli_full_connection() code - converted smbclient to use smbcli_full_connection() rather than reinventing everything itself (This used to be commit 71cbe2873473e039b4511511302cb63f1c50bce8)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/gentest.c11
-rw-r--r--source4/torture/locktest.c9
-rw-r--r--source4/torture/locktest2.c6
-rw-r--r--source4/torture/masktest.c9
-rw-r--r--source4/torture/rpc/xplogin.c2
-rw-r--r--source4/torture/torture.c52
6 files changed, 29 insertions, 60 deletions
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index 81e2a59f34..46514a6a43 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -177,11 +177,12 @@ static BOOL connect_servers(void)
servers[i].server_name, servers[i].share_name,
servers[i].username, j);
status = smbcli_full_connection(NULL, &servers[i].cli[j],
- "gentest",
- servers[i].server_name, NULL,
- servers[i].share_name, "?????",
- servers[i].username, lp_workgroup(),
- servers[i].password, 0, NULL);
+ "gentest",
+ servers[i].server_name,
+ servers[i].share_name, NULL,
+ servers[i].username,
+ lp_workgroup(),
+ servers[i].password);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to \\\\%s\\%s - %s\n",
servers[i].server_name, servers[i].share_name,
diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c
index 9c7c363259..161f51e1da 100644
--- a/source4/torture/locktest.c
+++ b/source4/torture/locktest.c
@@ -108,7 +108,6 @@ static struct smbcli_state *connect_one(char *share, int snum)
{
struct smbcli_state *c;
fstring server, myname;
- uint_t flags = 0;
NTSTATUS status;
int retries = 10;
@@ -122,10 +121,10 @@ static struct smbcli_state *connect_one(char *share, int snum)
do {
status = smbcli_full_connection(NULL, &c, myname,
- server, NULL,
- share, "?????",
- servers[snum].username, lp_workgroup(),
- servers[snum].password, flags, NULL);
+ server,
+ share, NULL,
+ servers[snum].username, lp_workgroup(),
+ servers[snum].password);
if (!NT_STATUS_IS_OK(status)) {
sleep(2);
}
diff --git a/source4/torture/locktest2.c b/source4/torture/locktest2.c
index 46254ad5e3..3eb3398bd1 100644
--- a/source4/torture/locktest2.c
+++ b/source4/torture/locktest2.c
@@ -164,10 +164,8 @@ static struct smbcli_state *connect_one(char *share)
slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), count++);
nt_status = smbcli_full_connection(NULL,
- &c, myname, server_n, NULL, 0, share, "?????",
- username, lp_workgroup(), password, 0,
- NULL);
-
+ &c, myname, server_n, 0, share, NULL,
+ username, lp_workgroup(), password);
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0, ("smbcli_full_connection failed with error %s\n", nt_errstr(nt_status)));
return NULL;
diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c
index ee15f92d80..a560c19f44 100644
--- a/source4/torture/masktest.c
+++ b/source4/torture/masktest.c
@@ -69,7 +69,6 @@ static struct smbcli_state *connect_one(char *share)
{
struct smbcli_state *c;
fstring server;
- uint_t flags = 0;
NTSTATUS status;
fstrcpy(server,share+2);
@@ -79,10 +78,10 @@ static struct smbcli_state *connect_one(char *share)
share++;
status = smbcli_full_connection(NULL, &c, "masktest",
- server, NULL,
- share, "?????",
- username, lp_workgroup(),
- password, flags, NULL);
+ server,
+ share, NULL,
+ username, lp_workgroup(),
+ password);
if (!NT_STATUS_IS_OK(status)) {
return NULL;
diff --git a/source4/torture/rpc/xplogin.c b/source4/torture/rpc/xplogin.c
index ce16cf2b1d..d8a8a4e2e9 100644
--- a/source4/torture/rpc/xplogin.c
+++ b/source4/torture/rpc/xplogin.c
@@ -75,7 +75,7 @@ static NTSTATUS after_negprot(struct smbcli_transport **dst_transport,
}
/* negotiate protocol options with the server */
- status = smb_raw_negotiate(transport);
+ status = smb_raw_negotiate(transport, lp_maxprotocol());
if (!NT_STATUS_IS_OK(status)) {
talloc_free(transport);
return NT_STATUS_UNSUCCESSFUL;
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index d50bb9366a..f9faf21957 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -89,8 +89,6 @@ BOOL torture_open_connection_share(struct smbcli_state **c,
const char *hostname,
const char *sharename)
{
- BOOL retry;
- int flags = 0;
NTSTATUS status;
const char *username = lp_parm_string(-1, "torture", "username");
const char *userdomain = lp_parm_string(-1, "torture", "userdomain");
@@ -98,10 +96,10 @@ BOOL torture_open_connection_share(struct smbcli_state **c,
status = smbcli_full_connection(NULL,
c, lp_netbios_name(),
- hostname, NULL,
- sharename, "?????",
+ hostname,
+ sharename, NULL,
username, username[0]?userdomain:"",
- password, flags, &retry);
+ password);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to open connection - %s\n", nt_errstr(status));
return False;
@@ -745,8 +743,6 @@ static BOOL tcon_devtest(struct smbcli_state *cli,
static BOOL run_tcon_devtype_test(void)
{
struct smbcli_state *cli1 = NULL;
- BOOL retry;
- int flags = 0;
NTSTATUS status;
BOOL ret = True;
const char *host = lp_parm_string(-1, "torture", "host");
@@ -757,10 +753,10 @@ static BOOL run_tcon_devtype_test(void)
status = smbcli_full_connection(NULL,
&cli1, lp_netbios_name(),
- host, NULL,
- share, "?????",
+ host,
+ share, NULL,
username, userdomain,
- password, flags, &retry);
+ password);
if (!NT_STATUS_IS_OK(status)) {
printf("could not open connection\n");
@@ -1054,7 +1050,7 @@ static BOOL run_negprot_nowait(void)
for (i=0;i<10000;i++) {
struct smbcli_request *req;
time_t t1 = time(NULL);
- req = smb_negprot_send(cli->transport, PROTOCOL_NT1);
+ req = smb_raw_negotiate_send(cli->transport, PROTOCOL_NT1);
while (req->state == SMBCLI_REQUEST_SEND && time(NULL) < t1+5) {
smbcli_transport_process(cli->transport);
}
@@ -2155,30 +2151,6 @@ BOOL torture_chkpath_test(void)
}
-/*
- parse a //server/share type UNC name
-*/
-static BOOL parse_unc(const char *unc_name, char **hostname, char **sharename)
-{
- char *p;
-
- if (strncmp(unc_name, "//", 2)) {
- return False;
- }
-
- *hostname = strdup(&unc_name[2]);
- p = strchr_m(&(*hostname)[2],'/');
- if (!p) {
- return False;
- }
- *p = 0;
- *sharename = strdup(p+1);
-
- return True;
-}
-
-
-
static void sigcont(int sig)
{
}
@@ -2234,7 +2206,7 @@ double torture_create_procs(BOOL (*fn)(struct smbcli_state *, int), BOOL *result
procnum = i;
if (fork() == 0) {
char *myname;
- char *hostname=NULL, *sharename;
+ const char *hostname=NULL, *sharename;
pid_t mypid = getpid();
sys_srandom(((int)mypid) ^ ((int)time(NULL)));
@@ -2245,8 +2217,8 @@ double torture_create_procs(BOOL (*fn)(struct smbcli_state *, int), BOOL *result
if (unc_list) {
- if (!parse_unc(unc_list[i % num_unc_names],
- &hostname, &sharename)) {
+ if (!smbcli_parse_unc(unc_list[i % num_unc_names],
+ NULL, &hostname, &sharename)) {
printf("Failed to parse UNC name %s\n",
unc_list[i % num_unc_names]);
exit(1);
@@ -2746,9 +2718,9 @@ static BOOL is_binding_string(const char *binding_string)
lp_set_cmdline("torture:binding", argv_new[1]);
} else {
char *binding = NULL;
- char *host = NULL, *share = NULL;
+ const char *host = NULL, *share = NULL;
- if (!parse_unc(argv_new[1], &host, &share)) {
+ if (!smbcli_parse_unc(argv_new[1], NULL, &host, &share)) {
d_printf("Invalid option: %s is not a valid torture target (share or binding string)\n\n", argv_new[1]);
usage(pc);
}