*/
#include "includes.h"
+#include "system/filesys.h"
#include "dynconfig.h"
#include "system/time.h"
#define NASTY_POSIX_LOCK_HACK 0
-static struct {
- char *username;
- char *password;
-} servers[NSERVERS];
+static struct cli_credentials *servers[NSERVERS];
enum lock_op {OP_LOCK, OP_UNLOCK, OP_REOPEN};
{
struct smbcli_state *c;
fstring server, myname;
- uint_t flags = 0;
NTSTATUS status;
int retries = 10;
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]);
if (!NT_STATUS_IS_OK(status)) {
sleep(2);
}
ZERO_STRUCT(fnum);
ZERO_STRUCT(cli);
- recorded = (struct record *)malloc(sizeof(*recorded) * numops);
+ recorded = malloc_array_p(struct record, numops);
for (n=0; n<numops; n++) {
#if PRESETS
int opt;
int seed, server, i;
- locktest_init_subsystems;
-
setlinebuf(stdout);
setup_logging("locktest", DEBUG_STDOUT);
lp_load(dyn_CONFIGFILE,True,False,False);
load_interfaces();
+ servers[0] = cli_credentials_init(talloc_autofree_context());
+ servers[1] = cli_credentials_init(talloc_autofree_context());
+
seed = time(NULL);
while ((opt = getopt(argc, argv, "U:s:ho:aAW:OR:B:M:EZW:")) != EOF) {
switch (opt) {
case 'U':
- i = servers[0].username?1:0;
- if (!split_username(optarg,
- &servers[i].username,
- &servers[i].password)) {
- printf("Must supply USER%%PASS\n");
- return -1;
- }
+ i = servers[0]->username?1:0;
+ cli_credentials_parse_string(servers[i], optarg, CRED_SPECIFIED);
+
break;
case 'R':
lock_range = strtol(optarg, NULL, 0);
}
}
- if (!servers[0].username) {
+ if (!servers[0]->username) {
usage();
return -1;
}
- if (!servers[1].username) {
- servers[1].username = servers[0].username;
- servers[1].password = servers[0].password;
+ if (!servers[1]->username) {
+ servers[1]->username = servers[0]->username;
+ servers[1]->password = servers[0]->password;
}
+ locktest_init_subsystems;
+
argc -= optind;
argv += optind;