1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

s4:torture: Remove trailing spaces from gentest.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
This commit is contained in:
Andreas Schneider 2024-06-21 13:37:46 +02:00 committed by Martin Schwenke
parent b11cf72c1b
commit f52e7fd3c0

View File

@ -1,20 +1,20 @@
/* /*
Unix SMB/CIFS implementation. Unix SMB/CIFS implementation.
generic testing tool - version with both SMB and SMB2 support generic testing tool - version with both SMB and SMB2 support
Copyright (C) Andrew Tridgell 2003-2008 Copyright (C) Andrew Tridgell 2003-2008
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or the Free Software Foundation; either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -150,7 +150,7 @@ static bool ignore_pattern(const char *str)
return false; return false;
} }
/***************************************************** /*****************************************************
connect to the servers connect to the servers
*******************************************************/ *******************************************************/
static bool connect_servers_fast(void) static bool connect_servers_fast(void)
@ -182,7 +182,7 @@ static bool connect_servers_fast(void)
/***************************************************** /*****************************************************
connect to the servers connect to the servers
*******************************************************/ *******************************************************/
static bool connect_servers(struct tevent_context *ev, static bool connect_servers(struct tevent_context *ev,
@ -221,15 +221,15 @@ static bool connect_servers(struct tevent_context *ev,
lpcfg_smbcli_session_options(lp_ctx, &smb_session_options); lpcfg_smbcli_session_options(lp_ctx, &smb_session_options);
printf("Connecting to \\\\%s\\%s as %s - instance %d\n", printf("Connecting to \\\\%s\\%s as %s - instance %d\n",
servers[i].server_name, servers[i].share_name, servers[i].server_name, servers[i].share_name,
cli_credentials_get_username(servers[i].credentials), cli_credentials_get_username(servers[i].credentials),
j); j);
cli_credentials_set_workstation(servers[i].credentials, cli_credentials_set_workstation(servers[i].credentials,
"gentest", CRED_SPECIFIED); "gentest", CRED_SPECIFIED);
if (options.smb2) { if (options.smb2) {
status = smb2_connect(NULL, servers[i].server_name, status = smb2_connect(NULL, servers[i].server_name,
lpcfg_smb_ports(lp_ctx), lpcfg_smb_ports(lp_ctx),
servers[i].share_name, servers[i].share_name,
lpcfg_resolve_context(lp_ctx), lpcfg_resolve_context(lp_ctx),
@ -241,8 +241,8 @@ static bool connect_servers(struct tevent_context *ev,
); );
} else { } else {
status = smbcli_tree_full_connection(NULL, status = smbcli_tree_full_connection(NULL,
&servers[i].smb_tree[j], &servers[i].smb_tree[j],
servers[i].server_name, servers[i].server_name,
lpcfg_smb_ports(lp_ctx), lpcfg_smb_ports(lp_ctx),
servers[i].share_name, "A:", servers[i].share_name, "A:",
lpcfg_socket_options(lp_ctx), lpcfg_socket_options(lp_ctx),
@ -262,12 +262,12 @@ static bool connect_servers(struct tevent_context *ev,
if (options.smb2) { if (options.smb2) {
servers[i].smb2_tree[j]->session->transport->oplock.handler = oplock_handler_smb2; servers[i].smb2_tree[j]->session->transport->oplock.handler = oplock_handler_smb2;
servers[i].smb2_tree[j]->session->transport->oplock.private_data = (void *)(uintptr_t)((i<<8)|j); servers[i].smb2_tree[j]->session->transport->oplock.private_data = (void *)(uintptr_t)((i<<8)|j);
smb2_transport_idle_handler(servers[i].smb2_tree[j]->session->transport, smb2_transport_idle_handler(servers[i].smb2_tree[j]->session->transport,
idle_func_smb2, 50000, NULL); idle_func_smb2, 50000, NULL);
} else { } else {
smbcli_oplock_handler(servers[i].smb_tree[j]->session->transport, oplock_handler_smb, smbcli_oplock_handler(servers[i].smb_tree[j]->session->transport, oplock_handler_smb,
(void *)(uintptr_t)((i<<8)|j)); (void *)(uintptr_t)((i<<8)|j));
smbcli_transport_idle_handler(servers[i].smb_tree[j]->session->transport, idle_func_smb, smbcli_transport_idle_handler(servers[i].smb_tree[j]->session->transport, idle_func_smb,
50000, (void *)(uintptr_t)((i<<8)|j)); 50000, (void *)(uintptr_t)((i<<8)|j));
} }
} }
@ -324,7 +324,7 @@ static unsigned int fnum_to_handle_smb2(int server, int instance, struct smb2_ha
return i; return i;
} }
} }
printf("Invalid server handle in fnum_to_handle on server %d instance %d\n", printf("Invalid server handle in fnum_to_handle on server %d instance %d\n",
server, instance); server, instance);
return BAD_HANDLE; return BAD_HANDLE;
} }
@ -342,7 +342,7 @@ static unsigned int fnum_to_handle_smb(int server, int instance, uint16_t server
return i; return i;
} }
} }
printf("Invalid server handle in fnum_to_handle on server %d instance %d\n", printf("Invalid server handle in fnum_to_handle on server %d instance %d\n",
server, instance); server, instance);
return BAD_HANDLE; return BAD_HANDLE;
} }
@ -361,7 +361,7 @@ static void gen_add_handle_smb2(int instance, const char *name, struct smb2_hand
h = random() % options.max_open_handles; h = random() % options.max_open_handles;
for (i=0;i<NSERVERS;i++) { for (i=0;i<NSERVERS;i++) {
NTSTATUS status; NTSTATUS status;
status = smb2_util_close(servers[i].smb2_tree[open_handles[h].instance], status = smb2_util_close(servers[i].smb2_tree[open_handles[h].instance],
open_handles[h].smb2_handle[i]); open_handles[h].smb2_handle[i]);
if (NT_STATUS_IS_ERR(status)) { if (NT_STATUS_IS_ERR(status)) {
printf("INTERNAL ERROR: Close failed when recovering handle! - %s\n", printf("INTERNAL ERROR: Close failed when recovering handle! - %s\n",
@ -379,7 +379,7 @@ static void gen_add_handle_smb2(int instance, const char *name, struct smb2_hand
} }
num_open_handles++; num_open_handles++;
printf("OPEN num_open_handles=%d h=%d (%s)\n", printf("OPEN num_open_handles=%d h=%d (%s)\n",
num_open_handles, h, name); num_open_handles, h, name);
} }
@ -397,7 +397,7 @@ static void gen_add_handle_smb(int instance, const char *name, uint16_t handles[
h = random() % options.max_open_handles; h = random() % options.max_open_handles;
for (i=0;i<NSERVERS;i++) { for (i=0;i<NSERVERS;i++) {
NTSTATUS status; NTSTATUS status;
status = smbcli_close(servers[i].smb_tree[open_handles[h].instance], status = smbcli_close(servers[i].smb_tree[open_handles[h].instance],
open_handles[h].smb_handle[i]); open_handles[h].smb_handle[i]);
if (NT_STATUS_IS_ERR(status)) { if (NT_STATUS_IS_ERR(status)) {
printf("INTERNAL ERROR: Close failed when recovering handle! - %s\n", printf("INTERNAL ERROR: Close failed when recovering handle! - %s\n",
@ -415,7 +415,7 @@ static void gen_add_handle_smb(int instance, const char *name, uint16_t handles[
} }
num_open_handles++; num_open_handles++;
printf("OPEN num_open_handles=%d h=%d (%s)\n", printf("OPEN num_open_handles=%d h=%d (%s)\n",
num_open_handles, h, name); num_open_handles, h, name);
} }
@ -429,10 +429,10 @@ static void gen_remove_handle_smb2(int instance, struct smb2_handle handles[NSER
for (h=0;h<options.max_open_handles;h++) { for (h=0;h<options.max_open_handles;h++) {
if (instance == open_handles[h].instance && if (instance == open_handles[h].instance &&
smb2_handle_equal(&open_handles[h].smb2_handle[0], &handles[0])) { smb2_handle_equal(&open_handles[h].smb2_handle[0], &handles[0])) {
open_handles[h].active = false; open_handles[h].active = false;
num_open_handles--; num_open_handles--;
printf("CLOSE num_open_handles=%d h=%d (%s)\n", printf("CLOSE num_open_handles=%d h=%d (%s)\n",
num_open_handles, h, num_open_handles, h,
open_handles[h].name); open_handles[h].name);
return; return;
} }
@ -450,10 +450,10 @@ static void gen_remove_handle_smb(int instance, uint16_t handles[NSERVERS])
for (h=0;h<options.max_open_handles;h++) { for (h=0;h<options.max_open_handles;h++) {
if (instance == open_handles[h].instance && if (instance == open_handles[h].instance &&
open_handles[h].smb_handle[0] == handles[0]) { open_handles[h].smb_handle[0] == handles[0]) {
open_handles[h].active = false; open_handles[h].active = false;
num_open_handles--; num_open_handles--;
printf("CLOSE num_open_handles=%d h=%d (%s)\n", printf("CLOSE num_open_handles=%d h=%d (%s)\n",
num_open_handles, h, num_open_handles, h,
open_handles[h].name); open_handles[h].name);
return; return;
} }
@ -500,7 +500,7 @@ static uint16_t gen_fnum(int instance)
while (num_open_handles > 0 && count++ < 10*options.max_open_handles) { while (num_open_handles > 0 && count++ < 10*options.max_open_handles) {
h = random() % options.max_open_handles; h = random() % options.max_open_handles;
if (open_handles[h].active && if (open_handles[h].active &&
open_handles[h].instance == instance) { open_handles[h].instance == instance) {
return h; return h;
} }
@ -565,28 +565,28 @@ static int gen_io_count(void)
*/ */
static const char *gen_fname(void) static const char *gen_fname(void)
{ {
const char *names[] = {"gentest\\gentest.dat", const char *names[] = {"gentest\\gentest.dat",
"gentest\\foo", "gentest\\foo",
"gentest\\foo2.sym", "gentest\\foo2.sym",
"gentest\\foo3.dll", "gentest\\foo3.dll",
"gentest\\foo4", "gentest\\foo4",
"gentest\\foo4:teststream1", "gentest\\foo4:teststream1",
"gentest\\foo4:teststream2", "gentest\\foo4:teststream2",
"gentest\\foo5.exe", "gentest\\foo5.exe",
"gentest\\foo5.exe:teststream3", "gentest\\foo5.exe:teststream3",
"gentest\\foo5.exe:teststream4", "gentest\\foo5.exe:teststream4",
"gentest\\foo6.com", "gentest\\foo6.com",
"gentest\\blah", "gentest\\blah",
"gentest\\blah\\blergh.txt", "gentest\\blah\\blergh.txt",
"gentest\\blah\\blergh2", "gentest\\blah\\blergh2",
"gentest\\blah\\blergh3.txt", "gentest\\blah\\blergh3.txt",
"gentest\\blah\\blergh4", "gentest\\blah\\blergh4",
"gentest\\blah\\blergh5.txt", "gentest\\blah\\blergh5.txt",
"gentest\\blah\\blergh5", "gentest\\blah\\blergh5",
"gentest\\blah\\.", "gentest\\blah\\.",
"gentest\\blah\\..", "gentest\\blah\\..",
"gentest\\a_very_long_name.bin", "gentest\\a_very_long_name.bin",
"gentest\\x.y", "gentest\\x.y",
"gentest\\blah"}; "gentest\\blah"};
int i; int i;
@ -598,7 +598,7 @@ static const char *gen_fname(void)
} }
/* /*
generate a filename with a higher chance of choosing an already generate a filename with a higher chance of choosing an already
open file open file
*/ */
static const char *gen_fname_open(int instance) static const char *gen_fname_open(int instance)
@ -617,11 +617,11 @@ static const char *gen_fname_open(int instance)
static const char *gen_pattern(void) static const char *gen_pattern(void)
{ {
int i; int i;
const char *names[] = {"gentest\\*.dat", const char *names[] = {"gentest\\*.dat",
"gentest\\*", "gentest\\*",
"gentest\\*.*", "gentest\\*.*",
"gentest\\blah\\*.*", "gentest\\blah\\*.*",
"gentest\\blah\\*", "gentest\\blah\\*",
"gentest\\?"}; "gentest\\?"};
if (gen_chance(50)) return gen_fname(); if (gen_chance(50)) return gen_fname();
@ -720,7 +720,7 @@ static uint16_t gen_rename_flags(void)
} }
/* /*
generate a pid generate a pid
*/ */
static uint16_t gen_pid(void) static uint16_t gen_pid(void)
{ {
@ -736,8 +736,8 @@ static uint16_t gen_lock_flags_smb2(void)
if (!options.valid && gen_chance(5)) return gen_bits_mask(0xFFFF); if (!options.valid && gen_chance(5)) return gen_bits_mask(0xFFFF);
if (gen_chance(20)) return gen_bits_mask(0x1F); if (gen_chance(20)) return gen_bits_mask(0x1F);
if (gen_chance(50)) return SMB2_LOCK_FLAG_UNLOCK; if (gen_chance(50)) return SMB2_LOCK_FLAG_UNLOCK;
return gen_bits_mask(SMB2_LOCK_FLAG_SHARED | return gen_bits_mask(SMB2_LOCK_FLAG_SHARED |
SMB2_LOCK_FLAG_EXCLUSIVE | SMB2_LOCK_FLAG_EXCLUSIVE |
SMB2_LOCK_FLAG_FAIL_IMMEDIATELY); SMB2_LOCK_FLAG_FAIL_IMMEDIATELY);
} }
@ -904,17 +904,17 @@ static unsigned int gen_alloc_size(void)
static struct ea_struct gen_ea_struct(void) static struct ea_struct gen_ea_struct(void)
{ {
struct ea_struct ea; struct ea_struct ea;
const char *names[] = {"EAONE", const char *names[] = {"EAONE",
"", "",
"FOO!", "FOO!",
" WITH SPACES ", " WITH SPACES ",
".", ".",
"AVERYLONGATTRIBUTENAME"}; "AVERYLONGATTRIBUTENAME"};
const char *values[] = {"VALUE1", const char *values[] = {"VALUE1",
"", "",
"NOT MUCH FOO", "NOT MUCH FOO",
" LEADING SPACES ", " LEADING SPACES ",
":", ":",
"ASOMEWHATLONGERATTRIBUTEVALUE"}; "ASOMEWHATLONGERATTRIBUTEVALUE"};
int i; int i;
@ -1087,7 +1087,7 @@ static void oplock_handler_ack_callback_smb2(struct smb2_request *req)
} }
} }
static bool send_oplock_ack_smb2(struct smb2_tree *tree, struct smb2_handle handle, static bool send_oplock_ack_smb2(struct smb2_tree *tree, struct smb2_handle handle,
uint8_t level) uint8_t level)
{ {
struct smb2_break br; struct smb2_break br;
@ -1109,7 +1109,7 @@ static bool send_oplock_ack_smb2(struct smb2_tree *tree, struct smb2_handle hand
/* /*
the oplock handler will either ack the break or close the file the oplock handler will either ack the break or close the file
*/ */
static bool oplock_handler_smb2(struct smb2_transport *transport, const struct smb2_handle *handle, static bool oplock_handler_smb2(struct smb2_transport *transport, const struct smb2_handle *handle,
uint8_t level, void *private_data) uint8_t level, void *private_data)
{ {
struct smb2_close io; struct smb2_close io;
@ -1209,8 +1209,8 @@ static bool compare_status(NTSTATUS status1, NTSTATUS status2)
/* also support ignore patterns of the form NT_STATUS_XX:NT_STATUS_YY /* also support ignore patterns of the form NT_STATUS_XX:NT_STATUS_YY
meaning that the first server returns NT_STATUS_XX and the 2nd meaning that the first server returns NT_STATUS_XX and the 2nd
returns NT_STATUS_YY */ returns NT_STATUS_YY */
s = talloc_asprintf(current_op.mem_ctx, "%s:%s", s = talloc_asprintf(current_op.mem_ctx, "%s:%s",
nt_errstr(status1), nt_errstr(status1),
nt_errstr(status2)); nt_errstr(status2));
if (ignore_pattern(s)) { if (ignore_pattern(s)) {
return true; return true;
@ -1233,7 +1233,7 @@ static void check_pending(void)
for (i=0;i<NSERVERS;i++) { for (i=0;i<NSERVERS;i++) {
// smb2_transport_process(servers[i].smb2_tree[j]->session->transport); // smb2_transport_process(servers[i].smb2_tree[j]->session->transport);
} }
} }
} }
/* /*
@ -1259,11 +1259,11 @@ again:
oplocks[0][j].level != oplocks[i][j].level) { oplocks[0][j].level != oplocks[i][j].level) {
if (tries++ < 10) goto again; if (tries++ < 10) goto again;
printf("oplock break inconsistent - %d/%d/%d vs %d/%d/%d\n", printf("oplock break inconsistent - %d/%d/%d vs %d/%d/%d\n",
oplocks[0][j].got_break, oplocks[0][j].got_break,
oplocks[0][j].handle, oplocks[0][j].handle,
oplocks[0][j].level, oplocks[0][j].level,
oplocks[i][j].got_break, oplocks[i][j].got_break,
oplocks[i][j].handle, oplocks[i][j].handle,
oplocks[i][j].level); oplocks[i][j].level);
current_op.mismatch = "oplock break"; current_op.mismatch = "oplock break";
return false; return false;
@ -1282,7 +1282,7 @@ again:
gen_remove_handle_smb(j, fnums); gen_remove_handle_smb(j, fnums);
break; break;
} }
} }
return true; return true;
} }
@ -1336,7 +1336,7 @@ again:
not2 = notifies[i][j].notify; not2 = notifies[i][j].notify;
for (n=0;n<not1.nttrans.out.num_changes;n++) { for (n=0;n<not1.nttrans.out.num_changes;n++) {
if (not1.nttrans.out.changes[n].action != if (not1.nttrans.out.changes[n].action !=
not2.nttrans.out.changes[n].action) { not2.nttrans.out.changes[n].action) {
printf("Notify action %d inconsistent %d %d\n", n, printf("Notify action %d inconsistent %d %d\n", n,
not1.nttrans.out.changes[n].action, not1.nttrans.out.changes[n].action,
@ -1533,7 +1533,7 @@ again:
/* /*
compare returned fileinfo structures compare returned fileinfo structures
*/ */
static bool cmp_fileinfo(int instance, static bool cmp_fileinfo(int instance,
union smb_fileinfo parm[NSERVERS], union smb_fileinfo parm[NSERVERS],
NTSTATUS status[NSERVERS]) NTSTATUS status[NSERVERS])
{ {
@ -1594,7 +1594,7 @@ static bool cmp_fileinfo(int instance,
case RAW_FILEINFO_IS_NAME_VALID: case RAW_FILEINFO_IS_NAME_VALID:
break; break;
case RAW_FILEINFO_BASIC_INFO: case RAW_FILEINFO_BASIC_INFO:
case RAW_FILEINFO_BASIC_INFORMATION: case RAW_FILEINFO_BASIC_INFORMATION:
CHECK_NTTIMES_EQUAL(basic_info.out.create_time); CHECK_NTTIMES_EQUAL(basic_info.out.create_time);
@ -1774,7 +1774,7 @@ static bool handler_smb_openx(int instance)
parm[0].openx.in.flags &= ~(OPENX_FLAGS_REQUEST_OPLOCK| parm[0].openx.in.flags &= ~(OPENX_FLAGS_REQUEST_OPLOCK|
OPENX_FLAGS_REQUEST_BATCH_OPLOCK); OPENX_FLAGS_REQUEST_BATCH_OPLOCK);
} }
GEN_COPY_PARM; GEN_COPY_PARM;
GEN_CALL_SMB(smb_raw_open(tree, current_op.mem_ctx, &parm[i])); GEN_CALL_SMB(smb_raw_open(tree, current_op.mem_ctx, &parm[i]));
@ -1813,7 +1813,7 @@ static bool handler_smb_open(int instance)
parm[0].openold.in.open_mode &= ~(OPENX_FLAGS_REQUEST_OPLOCK| parm[0].openold.in.open_mode &= ~(OPENX_FLAGS_REQUEST_OPLOCK|
OPENX_FLAGS_REQUEST_BATCH_OPLOCK); OPENX_FLAGS_REQUEST_BATCH_OPLOCK);
} }
GEN_COPY_PARM; GEN_COPY_PARM;
GEN_CALL_SMB(smb_raw_open(tree, current_op.mem_ctx, &parm[i])); GEN_CALL_SMB(smb_raw_open(tree, current_op.mem_ctx, &parm[i]));
@ -1855,7 +1855,7 @@ static bool handler_smb_ntcreatex(int instance)
parm[0].ntcreatex.in.flags &= ~(NTCREATEX_FLAGS_REQUEST_OPLOCK| parm[0].ntcreatex.in.flags &= ~(NTCREATEX_FLAGS_REQUEST_OPLOCK|
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK); NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK);
} }
GEN_COPY_PARM; GEN_COPY_PARM;
if (parm[0].ntcreatex.in.root_fid.fnum != 0) { if (parm[0].ntcreatex.in.root_fid.fnum != 0) {
GEN_SET_FNUM_SMB(ntcreatex.in.root_fid.fnum); GEN_SET_FNUM_SMB(ntcreatex.in.root_fid.fnum);
@ -2140,13 +2140,13 @@ static void gen_setfileinfo(int instance, union smb_setfileinfo *info)
} levels[] = { } levels[] = {
#if 0 #if 0
/* disabled until win2003 can handle them ... */ /* disabled until win2003 can handle them ... */
LVL(EA_SET), LVL(BASIC_INFO), LVL(DISPOSITION_INFO), LVL(EA_SET), LVL(BASIC_INFO), LVL(DISPOSITION_INFO),
LVL(STANDARD), LVL(ALLOCATION_INFO), LVL(END_OF_FILE_INFO), LVL(STANDARD), LVL(ALLOCATION_INFO), LVL(END_OF_FILE_INFO),
#endif #endif
LVL(SETATTR), LVL(SETATTRE), LVL(BASIC_INFORMATION), LVL(SETATTR), LVL(SETATTRE), LVL(BASIC_INFORMATION),
LVL(RENAME_INFORMATION), LVL(DISPOSITION_INFORMATION), LVL(RENAME_INFORMATION), LVL(DISPOSITION_INFORMATION),
LVL(POSITION_INFORMATION), LVL(MODE_INFORMATION), LVL(POSITION_INFORMATION), LVL(MODE_INFORMATION),
LVL(ALLOCATION_INFORMATION), LVL(END_OF_FILE_INFORMATION), LVL(ALLOCATION_INFORMATION), LVL(END_OF_FILE_INFORMATION),
LVL(1023), LVL(1025), LVL(1029), LVL(1032), LVL(1039), LVL(1040) LVL(1023), LVL(1025), LVL(1029), LVL(1032), LVL(1039), LVL(1040)
}; };
do { do {
@ -2243,22 +2243,22 @@ static void gen_setfileinfo(int instance, union smb_setfileinfo *info)
const char *name; const char *name;
}; };
struct levels smb_levels[] = { struct levels smb_levels[] = {
LVL(EA_SET), LVL(BASIC_INFO), LVL(DISPOSITION_INFO), LVL(EA_SET), LVL(BASIC_INFO), LVL(DISPOSITION_INFO),
LVL(STANDARD), LVL(ALLOCATION_INFO), LVL(END_OF_FILE_INFO), LVL(STANDARD), LVL(ALLOCATION_INFO), LVL(END_OF_FILE_INFO),
LVL(SETATTR), LVL(SETATTRE), LVL(BASIC_INFORMATION), LVL(SETATTR), LVL(SETATTRE), LVL(BASIC_INFORMATION),
LVL(RENAME_INFORMATION), LVL(DISPOSITION_INFORMATION), LVL(RENAME_INFORMATION), LVL(DISPOSITION_INFORMATION),
LVL(POSITION_INFORMATION), LVL(FULL_EA_INFORMATION), LVL(MODE_INFORMATION), LVL(POSITION_INFORMATION), LVL(FULL_EA_INFORMATION), LVL(MODE_INFORMATION),
LVL(ALLOCATION_INFORMATION), LVL(END_OF_FILE_INFORMATION), LVL(ALLOCATION_INFORMATION), LVL(END_OF_FILE_INFORMATION),
LVL(PIPE_INFORMATION), LVL(VALID_DATA_INFORMATION), LVL(SHORT_NAME_INFORMATION), LVL(PIPE_INFORMATION), LVL(VALID_DATA_INFORMATION), LVL(SHORT_NAME_INFORMATION),
LVL(1025), LVL(1027), LVL(1029), LVL(1030), LVL(1031), LVL(1032), LVL(1036), LVL(1025), LVL(1027), LVL(1029), LVL(1030), LVL(1031), LVL(1032), LVL(1036),
LVL(1041), LVL(1042), LVL(1043), LVL(1044), LVL(1041), LVL(1042), LVL(1043), LVL(1044),
}; };
struct levels smb2_levels[] = { struct levels smb2_levels[] = {
LVL(BASIC_INFORMATION), LVL(BASIC_INFORMATION),
LVL(RENAME_INFORMATION), LVL(DISPOSITION_INFORMATION), LVL(RENAME_INFORMATION), LVL(DISPOSITION_INFORMATION),
LVL(POSITION_INFORMATION), LVL(FULL_EA_INFORMATION), LVL(MODE_INFORMATION), LVL(POSITION_INFORMATION), LVL(FULL_EA_INFORMATION), LVL(MODE_INFORMATION),
LVL(ALLOCATION_INFORMATION), LVL(END_OF_FILE_INFORMATION), LVL(ALLOCATION_INFORMATION), LVL(END_OF_FILE_INFORMATION),
LVL(PIPE_INFORMATION), LVL(VALID_DATA_INFORMATION), LVL(SHORT_NAME_INFORMATION), LVL(PIPE_INFORMATION), LVL(VALID_DATA_INFORMATION), LVL(SHORT_NAME_INFORMATION),
LVL(1025), LVL(1027), LVL(1029), LVL(1030), LVL(1031), LVL(1032), LVL(1036), LVL(1025), LVL(1027), LVL(1029), LVL(1030), LVL(1031), LVL(1032), LVL(1036),
LVL(1041), LVL(1042), LVL(1043), LVL(1044), LVL(1041), LVL(1042), LVL(1043), LVL(1044),
}; };
@ -2489,8 +2489,8 @@ static void async_notify_smb(struct smbcli_request *req)
notify.nttrans.level = RAW_NOTIFY_NTTRANS; notify.nttrans.level = RAW_NOTIFY_NTTRANS;
status = smb_raw_changenotify_recv(req, current_op.mem_ctx, &notify); status = smb_raw_changenotify_recv(req, current_op.mem_ctx, &notify);
if (NT_STATUS_IS_OK(status) && notify.nttrans.out.num_changes > 0) { if (NT_STATUS_IS_OK(status) && notify.nttrans.out.num_changes > 0) {
printf("notify tid=%d num_changes=%d action=%d name=%s\n", printf("notify tid=%d num_changes=%d action=%d name=%s\n",
tid, tid,
notify.nttrans.out.num_changes, notify.nttrans.out.num_changes,
notify.nttrans.out.changes[0].action, notify.nttrans.out.changes[0].action,
notify.nttrans.out.changes[0].name.s); notify.nttrans.out.changes[0].name.s);
@ -2696,7 +2696,7 @@ static bool handler_smb2_lock(int instance)
parm[0].in.file.handle.data[0] = gen_fnum(instance); parm[0].in.file.handle.data[0] = gen_fnum(instance);
parm[0].in.lock_count = gen_lock_count(); parm[0].in.lock_count = gen_lock_count();
parm[0].in.lock_sequence = gen_reserved32(); parm[0].in.lock_sequence = gen_reserved32();
parm[0].in.locks = talloc_array(current_op.mem_ctx, parm[0].in.locks = talloc_array(current_op.mem_ctx,
struct smb2_lock_element, struct smb2_lock_element,
parm[0].in.lock_count); parm[0].in.lock_count);
@ -2704,7 +2704,7 @@ static bool handler_smb2_lock(int instance)
parm[0].in.locks[n].offset = gen_offset(); parm[0].in.locks[n].offset = gen_offset();
parm[0].in.locks[n].length = gen_io_count(); parm[0].in.locks[n].length = gen_io_count();
/* don't yet cope with async replies */ /* don't yet cope with async replies */
parm[0].in.locks[n].flags = gen_lock_flags_smb2() | parm[0].in.locks[n].flags = gen_lock_flags_smb2() |
SMB2_LOCK_FLAG_FAIL_IMMEDIATELY; SMB2_LOCK_FLAG_FAIL_IMMEDIATELY;
parm[0].in.locks[n].reserved = gen_bits_mask2(0x0, 0xFFFFFFFF); parm[0].in.locks[n].reserved = gen_bits_mask2(0x0, 0xFFFFFFFF);
} }
@ -3088,7 +3088,7 @@ static int run_test(struct tevent_context *ev, struct loadparm_context *lp_ctx)
gen_ops[which_op].count++; gen_ops[which_op].count++;
if (NT_STATUS_IS_OK(current_op.status)) { if (NT_STATUS_IS_OK(current_op.status)) {
gen_ops[which_op].success_count++; gen_ops[which_op].success_count++;
} }
if (!ret) { if (!ret) {
@ -3103,7 +3103,7 @@ static int run_test(struct tevent_context *ev, struct loadparm_context *lp_ctx)
} }
for (i=0;i<ARRAY_SIZE(gen_ops);i++) { for (i=0;i<ARRAY_SIZE(gen_ops);i++) {
printf("Op %-10s got %d/%d success\n", printf("Op %-10s got %d/%d success\n",
gen_ops[i].name, gen_ops[i].name,
gen_ops[i].success_count, gen_ops[i].success_count,
gen_ops[i].count); gen_ops[i].count);
@ -3112,7 +3112,7 @@ static int run_test(struct tevent_context *ev, struct loadparm_context *lp_ctx)
return op; return op;
} }
/* /*
perform a backtracking analysis of the minimal set of operations perform a backtracking analysis of the minimal set of operations
to generate an error to generate an error
*/ */
@ -3126,7 +3126,7 @@ static void backtrack_analyze(struct tevent_context *ev,
do { do {
int base; int base;
for (base=0; for (base=0;
chunk > 0 && base+chunk < options.numops && options.numops > 1; ) { chunk > 0 && base+chunk < options.numops && options.numops > 1; ) {
int i, max; int i, max;
@ -3137,7 +3137,7 @@ static void backtrack_analyze(struct tevent_context *ev,
for (i=base;i<max; i++) { for (i=base;i<max; i++) {
op_parms[i].disabled = true; op_parms[i].disabled = true;
} }
printf("Testing %d ops with %d-%d disabled\n", printf("Testing %d ops with %d-%d disabled\n",
options.numops, base, max-1); options.numops, base, max-1);
ret = run_test(ev, lp_ctx); ret = run_test(ev, lp_ctx);
printf("Completed %d of %d ops\n", ret, options.numops); printf("Completed %d of %d ops\n", ret, options.numops);
@ -3157,7 +3157,7 @@ static void backtrack_analyze(struct tevent_context *ev,
base = 0; base = 0;
} else { } else {
/* it failed - this chunk isn't needed for a failure */ /* it failed - this chunk isn't needed for a failure */
memmove(&op_parms[base], &op_parms[max], memmove(&op_parms[base], &op_parms[max],
sizeof(op_parms[0]) * (options.numops - max)); sizeof(op_parms[0]) * (options.numops - max));
options.numops = (ret+1) - (max - base); options.numops = (ret+1) - (max - base);
} }
@ -3181,7 +3181,7 @@ static void backtrack_analyze(struct tevent_context *ev,
} }
} }
/* /*
start the main gentest process start the main gentest process
*/ */
static bool start_gentest(struct tevent_context *ev, static bool start_gentest(struct tevent_context *ev,
@ -3269,7 +3269,7 @@ static bool split_unc_name(const char *unc, char **server, char **share)
*p = 0; *p = 0;
(*share) = p+1; (*share) = p+1;
return true; return true;
} }