#include "includes.h"
#include "dynconfig.h"
#include "system/time.h"
+#include "system/filesys.h"
#include "request.h"
#include "libcli/raw/libcliraw.h"
#include "librpc/gen_ndr/ndr_security.h"
struct smbcli_state *cli[NINSTANCES];
char *server_name;
char *share_name;
- char *username;
- char *password;
+ struct cli_credentials *credentials;
} servers[NSERVERS];
/* the seeds and flags for each operation */
NTSTATUS status;
printf("Connecting to \\\\%s\\%s as %s - instance %d\n",
servers[i].server_name, servers[i].share_name,
- servers[i].username, j);
+ servers[i].credentials->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].credentials);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to \\\\%s\\%s - %s\n",
servers[i].server_name, servers[i].share_name,
parm[0].writex.in.wmode = gen_bits_mask(0xFFFF);
parm[0].writex.in.remaining = gen_io_count();
parm[0].writex.in.count = gen_io_count();
- parm[0].writex.in.data = talloc_zero(current_op.mem_ctx, parm[0].writex.in.count);
+ parm[0].writex.in.data = talloc_zero_size(current_op.mem_ctx, parm[0].writex.in.count);
GEN_COPY_PARM;
GEN_SET_FNUM(writex.in.fnum);
} while (nlocks == 0);
if (nlocks > 0) {
- parm[0].lockx.in.locks = talloc_array_p(current_op.mem_ctx,
+ parm[0].lockx.in.locks = talloc_array(current_op.mem_ctx,
struct smb_lock_entry,
nlocks);
for (n=0;n<nlocks;n++) {
ret = gen_ops[which_op].handler(instance);
- talloc_destroy(current_op.mem_ctx);
+ talloc_free(current_op.mem_ctx);
gen_ops[which_op].count++;
if (NT_STATUS_IS_OK(current_op.status)) {
for (i=0;i<NSERVERS;i++) {
const char *share = argv[1+i];
+ servers[i].credentials = cli_credentials_init(NULL);
if (!split_unc_name(share, &servers[i].server_name, &servers[i].share_name)) {
printf("Invalid share name '%s'\n", share);
return -1;
while ((opt = getopt(argc, argv, "U:s:o:ad:i:AOhS:LFXC")) != 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].credentials->username?1:0;
+ cli_credentials_parse_string(servers[i].credentials, optarg, CRED_SPECIFIED);
break;
case 'd':
DEBUGLEVEL = atoi(optarg);
gentest_init_subsystems;
- if (!servers[0].username) {
+ if (!servers[0].credentials->username) {
usage();
return -1;
}
- if (!servers[1].username) {
- servers[1].username = servers[0].username;
- servers[1].password = servers[0].password;
+ if (!servers[1].credentials->username) {
+ servers[1].credentials->username = servers[0].credentials->username;
+ servers[1].credentials->password = servers[0].credentials->password;
}
printf("seed=%u\n", options.seed);