summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/libcli/raw/rawnegotiate.c2
-rw-r--r--source4/torture/config.mk3
-rw-r--r--source4/torture/gentest.c8
-rw-r--r--source4/torture/locktest.c62
-rw-r--r--source4/torture/masktest.c9
5 files changed, 36 insertions, 48 deletions
diff --git a/source4/libcli/raw/rawnegotiate.c b/source4/libcli/raw/rawnegotiate.c
index 9b00aa6121..dab7b38939 100644
--- a/source4/libcli/raw/rawnegotiate.c
+++ b/source4/libcli/raw/rawnegotiate.c
@@ -86,7 +86,7 @@ NTSTATUS smb_raw_negotiate(struct smbcli_transport *transport)
struct smbcli_request *req;
int protocol;
- req = smb_negprot_send(transport, PROTOCOL_NT1);
+ req = smb_negprot_send(transport, lp_maxprotocol());
if (!req) {
return NT_STATUS_UNSUCCESSFUL;
}
diff --git a/source4/torture/config.mk b/source4/torture/config.mk
index 77d01f75c0..c520ef755b 100644
--- a/source4/torture/config.mk
+++ b/source4/torture/config.mk
@@ -151,7 +151,8 @@ REQUIRED_SUBSYSTEMS = \
# Start BINARY locktest
[BINARY::locktest]
OBJ_FILES = \
- torture/locktest.o
+ torture/locktest.o \
+ torture/torture_util.o
REQUIRED_SUBSYSTEMS = \
LIBSMB \
CONFIG \
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index 53dd83ac15..d414863d82 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -2068,7 +2068,7 @@ static void usage(void)
"Usage:\n\
gentest2 //server1/share1 //server2/share2 [options..]\n\
options:\n\
- -U user%%pass (must be specified twice)\n\
+ -U user%%pass (can be specified twice)\n\
-s seed\n\
-o numops\n\
-a (show all ops)\n\
@@ -2179,10 +2179,14 @@ static void usage(void)
}
}
- if (!servers[0].username || !servers[1].username) {
+ if (!servers[0].username) {
usage();
return -1;
}
+ if (!servers[1].username) {
+ servers[1].username = servers[0].username;
+ servers[1].password = servers[0].password;
+ }
printf("seed=%u\n", options.seed);
diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c
index e56684a5a4..494688dfb5 100644
--- a/source4/torture/locktest.c
+++ b/source4/torture/locktest.c
@@ -20,11 +20,6 @@
#include "includes.h"
-static fstring password[2];
-static fstring username[2];
-static int got_user;
-static int got_pass;
-static BOOL use_kerberos;
static int numops = 1000;
static BOOL showall;
static BOOL analyze;
@@ -49,6 +44,11 @@ static BOOL zero_zero;
#define NASTY_POSIX_LOCK_HACK 0
+static struct {
+ char *username;
+ char *password;
+} servers[NSERVERS];
+
enum lock_op {OP_LOCK, OP_UNLOCK, OP_REOPEN};
struct record {
@@ -118,15 +118,12 @@ static struct smbcli_state *connect_one(char *share, int snum)
slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), snum);
- if (use_kerberos)
- flags |= SMBCLI_FULL_CONNECTION_USE_KERBEROS;
-
do {
status = smbcli_full_connection(&c, myname,
server, NULL,
share, "?????",
- username[snum], lp_workgroup(),
- password[snum], flags, NULL);
+ servers[snum].username, lp_workgroup(),
+ servers[snum].password, flags, NULL);
if (!NT_STATUS_IS_OK(status)) {
sleep(2);
}
@@ -437,7 +434,6 @@ static void usage(void)
locktest //server1/share1 //server2/share2 [options..]\n\
options:\n\
-U user%%pass (may be specified twice)\n\
- -k use kerberos\n\
-s seed\n\
-o numops\n\
-u hide unlock fails\n\
@@ -459,8 +455,7 @@ static void usage(void)
{
char *share[NSERVERS];
int opt;
- char *p;
- int seed, server;
+ int seed, server, i;
setlinebuf(stdout);
@@ -484,35 +479,17 @@ static void usage(void)
lp_load(dyn_CONFIGFILE,True,False,False);
load_interfaces();
- if (getenv("USER")) {
- fstrcpy(username[0],getenv("USER"));
- fstrcpy(username[1],getenv("USER"));
- }
-
seed = time(NULL);
- while ((opt = getopt(argc, argv, "U:s:ho:aAW:OkR:B:M:EZW:")) != EOF) {
+ while ((opt = getopt(argc, argv, "U:s:ho:aAW:OR:B:M:EZW:")) != EOF) {
switch (opt) {
- case 'k':
-#ifdef HAVE_KRB5
- use_kerberos = True;
-#else
- d_printf("No kerberos support compiled in\n");
- exit(1);
-#endif
- break;
case 'U':
- got_user = 1;
- if (got_pass == 2) {
- d_printf("Max of 2 usernames\n");
- exit(1);
- }
- fstrcpy(username[got_pass],optarg);
- p = strchr_m(username[got_pass],'%');
- if (p) {
- *p = 0;
- fstrcpy(password[got_pass], p+1);
- got_pass++;
+ i = servers[0].username?1:0;
+ if (!split_username(optarg,
+ &servers[i].username,
+ &servers[i].password)) {
+ printf("Must supply USER%%PASS\n");
+ return -1;
}
break;
case 'R':
@@ -560,7 +537,14 @@ static void usage(void)
}
}
- if(use_kerberos && !got_user) got_pass = True;
+ if (!servers[0].username) {
+ usage();
+ return -1;
+ }
+ if (!servers[1].username) {
+ servers[1].username = servers[0].username;
+ servers[1].password = servers[0].password;
+ }
argc -= optind;
argv += optind;
diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c
index 4c219c630e..ee7e25ebbd 100644
--- a/source4/torture/masktest.c
+++ b/source4/torture/masktest.c
@@ -22,7 +22,6 @@
static fstring password;
static fstring username;
-static int max_protocol = PROTOCOL_NT1;
static BOOL showall = False;
static BOOL old_list = False;
static const char *maskchars = "<>\"?*abc.";
@@ -130,7 +129,7 @@ static BOOL reg_match_one(struct smbcli_state *cli, const char *pattern, const c
if (strcmp(pattern,".") == 0) return False;
- if (max_protocol <= PROTOCOL_LANMAN2) {
+ if (cli->transport->negotiate.protocol <= PROTOCOL_LANMAN1) {
return ms_fnmatch_lanman(pattern, file)==0;
}
@@ -208,7 +207,7 @@ static void get_real_name(struct smbcli_state *cli,
pstring long_name, fstring short_name)
{
const char *mask;
- if (max_protocol <= PROTOCOL_LANMAN1) {
+ if (cli->transport->negotiate.protocol <= PROTOCOL_LANMAN1) {
mask = "\\masktest\\*.*";
} else {
mask = "\\masktest\\*";
@@ -410,7 +409,7 @@ static void usage(void)
verbose++;
break;
case 'M':
- max_protocol = interpret_protocol(optarg, max_protocol);
+ lp_set_cmdline("max protocol", optarg);
break;
case 'U':
fstrcpy(username,optarg);
@@ -455,7 +454,7 @@ static void usage(void)
}
/* need to init seed after connect as clientgen uses random numbers */
- DEBUG(0,("seed=%d\n", seed));
+ DEBUG(0,("seed=%d format --- --- (server, correct)\n", seed));
srandom(seed);
test_mask(argc, argv, cli);