*/
#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"
#define NSERVERS 2
#define NINSTANCES 2
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,
}
smbcli_oplock_handler(servers[i].cli[j]->transport, oplock_handler, NULL);
- smbcli_transport_idle_handler(servers[i].cli[j]->transport, idle_func, 1, NULL);
+ smbcli_transport_idle_handler(servers[i].cli[j]->transport, idle_func, 50000, NULL);
}
}
*/
static uint32_t gen_access_mask(void)
{
- if (gen_chance(50)) return SEC_RIGHT_MAXIMUM_ALLOWED;
- if (gen_chance(20)) return GENERIC_RIGHTS_FILE_ALL_ACCESS;
+ if (gen_chance(50)) return SEC_FLAG_MAXIMUM_ALLOWED;
+ if (gen_chance(20)) return SEC_FILE_ALL;
return gen_bits_mask(0xFFFFFFFF);
}
union smb_open parm[NSERVERS];
NTSTATUS status[NSERVERS];
- parm[0].open.level = RAW_OPEN_OPEN;
- parm[0].open.in.flags = gen_bits_mask2(0xF, 0xFFFF);
- parm[0].open.in.search_attrs = gen_attrib();
- parm[0].open.in.fname = gen_fname_open(instance);
+ parm[0].openold.level = RAW_OPEN_OPEN;
+ parm[0].openold.in.open_mode = gen_bits_mask2(0xF, 0xFFFF);
+ parm[0].openold.in.search_attrs = gen_attrib();
+ parm[0].openold.in.fname = gen_fname_open(instance);
if (!options.use_oplocks) {
/* mask out oplocks */
- parm[0].open.in.flags &= ~(OPENX_FLAGS_REQUEST_OPLOCK|
- OPENX_FLAGS_REQUEST_BATCH_OPLOCK);
+ parm[0].openold.in.open_mode &= ~(OPENX_FLAGS_REQUEST_OPLOCK|
+ OPENX_FLAGS_REQUEST_BATCH_OPLOCK);
}
GEN_COPY_PARM;
GEN_CALL(smb_raw_open(tree, current_op.mem_ctx, &parm[i]));
- CHECK_EQUAL(open.out.attrib);
- CHECK_TIMES_EQUAL(open.out.write_time);
- CHECK_EQUAL(open.out.size);
- CHECK_EQUAL(open.out.rmode);
+ CHECK_EQUAL(openold.out.attrib);
+ CHECK_TIMES_EQUAL(openold.out.write_time);
+ CHECK_EQUAL(openold.out.size);
+ CHECK_EQUAL(openold.out.rmode);
/* open creates a new file handle */
- ADD_HANDLE(parm[0].open.in.fname, open.out.fnum);
+ ADD_HANDLE(parm[0].openold.in.fname, openold.out.fnum);
return True;
}
parm[0].readx.in.mincnt = gen_io_count();
parm[0].readx.in.maxcnt = gen_io_count();
parm[0].readx.in.remaining = gen_io_count();
- parm[0].readx.out.data = talloc(current_op.mem_ctx,
- MAX(parm[0].readx.in.mincnt, parm[0].readx.in.maxcnt));
+ parm[0].readx.out.data = talloc_size(current_op.mem_ctx,
+ MAX(parm[0].readx.in.mincnt, parm[0].readx.in.maxcnt));
GEN_COPY_PARM;
GEN_SET_FNUM(readx.in.fnum);
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(current_op.mem_ctx,
- sizeof(parm[0].lockx.in.locks[0]) * nlocks);
+ parm[0].lockx.in.locks = talloc_array(current_op.mem_ctx,
+ struct smb_lock_entry,
+ nlocks);
for (n=0;n<nlocks;n++) {
parm[0].lockx.in.locks[n].pid = gen_pid();
parm[0].lockx.in.locks[n].offset = gen_offset();
info->standard.in.access_time = gen_timet();
info->standard.in.write_time = gen_timet();
break;
- case RAW_SFILEINFO_EA_SET:
- info->ea_set.in.ea = gen_ea_struct();
+ case RAW_SFILEINFO_EA_SET: {
+ static struct ea_struct ea;
+ info->ea_set.in.num_eas = 1;
+ info->ea_set.in.eas = &ea;
+ info->ea_set.in.eas[0] = gen_ea_struct();
+ }
break;
case RAW_SFILEINFO_BASIC_INFO:
case RAW_SFILEINFO_BASIC_INFORMATION:
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);
}
}
- if (!servers[0].username) {
+ gentest_init_subsystems;
+
+ 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);