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

torture4: Fix some whitespace

Review with "git show -w"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2024-05-31 21:28:50 +02:00 committed by Jeremy Allison
parent cfb81b0c31
commit 8a7aad7fe0
27 changed files with 575 additions and 576 deletions

View File

@ -1,20 +1,20 @@
/*
/*
Unix SMB/CIFS implementation.
test security descriptor operations
Copyright (C) Andrew Tridgell 2004
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -155,8 +155,8 @@ static bool test_sd(struct torture_context *tctx, struct smbcli_state *cli)
io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
io.ntcreatex.in.create_options = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
io.ntcreatex.in.share_access =
NTCREATEX_SHARE_ACCESS_READ |
io.ntcreatex.in.share_access =
NTCREATEX_SHARE_ACCESS_READ |
NTCREATEX_SHARE_ACCESS_WRITE;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE;
@ -166,10 +166,10 @@ static bool test_sd(struct torture_context *tctx, struct smbcli_state *cli)
status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.ntcreatex.out.file.fnum;
q.query_secdesc.level = RAW_FILEINFO_SEC_DESC;
q.query_secdesc.in.file.fnum = fnum;
q.query_secdesc.in.secinfo_flags =
q.query_secdesc.in.secinfo_flags =
SECINFO_OWNER |
SECINFO_GROUP |
SECINFO_DACL;
@ -251,8 +251,8 @@ static bool test_nttrans_create_ext(struct torture_context *tctx,
io.ntcreatex.in.create_options =
test_dir ? NTCREATEX_OPTIONS_DIRECTORY : 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
io.ntcreatex.in.share_access =
NTCREATEX_SHARE_ACCESS_READ |
io.ntcreatex.in.share_access =
NTCREATEX_SHARE_ACCESS_READ |
NTCREATEX_SHARE_ACCESS_WRITE;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE;
@ -272,7 +272,7 @@ static bool test_nttrans_create_ext(struct torture_context *tctx,
q.query_secdesc.level = RAW_FILEINFO_SEC_DESC;
q.query_secdesc.in.file.fnum = fnum;
q.query_secdesc.in.secinfo_flags =
q.query_secdesc.in.secinfo_flags =
SECINFO_OWNER |
SECINFO_GROUP |
SECINFO_DACL;
@ -296,14 +296,14 @@ static bool test_nttrans_create_ext(struct torture_context *tctx,
status = security_descriptor_dacl_add(sd, &ace);
CHECK_STATUS(status, NT_STATUS_OK);
torture_comment(tctx, "creating with an initial ACL\n");
io.ntcreatex.in.sec_desc = sd;
status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.ntcreatex.out.file.fnum;
FAIL_UNLESS(verify_sd(tctx, cli, fnum, sd));
status = smbcli_close(cli->tree, fnum);
@ -729,7 +729,7 @@ done:
mapping bits
Test copied to smb2/acls.c for SMB2.
*/
static bool test_creator_sid(struct torture_context *tctx,
static bool test_creator_sid(struct torture_context *tctx,
struct smbcli_state *cli)
{
NTSTATUS status;
@ -753,8 +753,8 @@ static bool test_creator_sid(struct torture_context *tctx,
io.ntcreatex.in.access_mask = SEC_STD_READ_CONTROL | SEC_STD_WRITE_DAC | SEC_STD_WRITE_OWNER;
io.ntcreatex.in.create_options = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
io.ntcreatex.in.share_access =
NTCREATEX_SHARE_ACCESS_READ |
io.ntcreatex.in.share_access =
NTCREATEX_SHARE_ACCESS_READ |
NTCREATEX_SHARE_ACCESS_WRITE;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF;
@ -842,7 +842,7 @@ static bool test_creator_sid(struct torture_context *tctx,
io.ntcreatex.in.access_mask = SEC_FILE_READ_DATA;
status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_ACCESS_FLAGS(io.ntcreatex.out.file.fnum,
CHECK_ACCESS_FLAGS(io.ntcreatex.out.file.fnum,
SEC_FILE_READ_DATA|
SEC_FILE_READ_ATTRIBUTE);
smbcli_close(cli->tree, io.ntcreatex.out.file.fnum);
@ -856,7 +856,7 @@ static bool test_creator_sid(struct torture_context *tctx,
io.ntcreatex.in.access_mask = SEC_GENERIC_READ;
status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_ACCESS_FLAGS(io.ntcreatex.out.file.fnum,
CHECK_ACCESS_FLAGS(io.ntcreatex.out.file.fnum,
SEC_RIGHTS_FILE_READ);
smbcli_close(cli->tree, io.ntcreatex.out.file.fnum);
@ -895,8 +895,8 @@ static bool test_creator_sid(struct torture_context *tctx,
io.ntcreatex.in.access_mask = SEC_FILE_READ_DATA;
status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_ACCESS_FLAGS(io.ntcreatex.out.file.fnum,
SEC_FILE_READ_DATA |
CHECK_ACCESS_FLAGS(io.ntcreatex.out.file.fnum,
SEC_FILE_READ_DATA |
SEC_FILE_READ_ATTRIBUTE);
smbcli_close(cli->tree, io.ntcreatex.out.file.fnum);
@ -932,7 +932,7 @@ done:
SEC_FILE_xx bits
Test copied to smb2/acls.c for SMB2.
*/
static bool test_generic_bits(struct torture_context *tctx,
static bool test_generic_bits(struct torture_context *tctx,
struct smbcli_state *cli)
{
NTSTATUS status;
@ -977,14 +977,14 @@ static bool test_generic_bits(struct torture_context *tctx,
io.generic.level = RAW_OPEN_NTCREATEX;
io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask =
SEC_STD_READ_CONTROL |
SEC_STD_WRITE_DAC |
io.ntcreatex.in.access_mask =
SEC_STD_READ_CONTROL |
SEC_STD_WRITE_DAC |
SEC_STD_WRITE_OWNER;
io.ntcreatex.in.create_options = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
io.ntcreatex.in.share_access =
NTCREATEX_SHARE_ACCESS_READ |
io.ntcreatex.in.share_access =
NTCREATEX_SHARE_ACCESS_READ |
NTCREATEX_SHARE_ACCESS_WRITE;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF;
@ -1005,8 +1005,8 @@ static bool test_generic_bits(struct torture_context *tctx,
owner_sid = dom_sid_string(tctx, sd_orig->owner_sid);
status = torture_check_privilege(cli,
owner_sid,
status = torture_check_privilege(cli,
owner_sid,
sec_privilege_name(SEC_PRIV_RESTORE));
has_restore_privilege = NT_STATUS_IS_OK(status);
if (!NT_STATUS_IS_OK(status)) {
@ -1015,8 +1015,8 @@ static bool test_generic_bits(struct torture_context *tctx,
}
torture_comment(tctx, "SEC_PRIV_RESTORE - %s\n", has_restore_privilege?"Yes":"No");
status = torture_check_privilege(cli,
owner_sid,
status = torture_check_privilege(cli,
owner_sid,
sec_privilege_name(SEC_PRIV_TAKE_OWNERSHIP));
has_take_ownership_privilege = NT_STATUS_IS_OK(status);
if (!NT_STATUS_IS_OK(status)) {
@ -1026,9 +1026,9 @@ static bool test_generic_bits(struct torture_context *tctx,
torture_comment(tctx, "SEC_PRIV_TAKE_OWNERSHIP - %s\n", has_take_ownership_privilege?"Yes":"No");
for (i=0;i<ARRAY_SIZE(file_mappings);i++) {
uint32_t expected_mask =
SEC_STD_WRITE_DAC |
SEC_STD_READ_CONTROL |
uint32_t expected_mask =
SEC_STD_WRITE_DAC |
SEC_STD_READ_CONTROL |
SEC_FILE_READ_ATTRIBUTE |
SEC_STD_DELETE;
uint32_t expected_mask_anon = SEC_FILE_READ_ATTRIBUTE;
@ -1070,7 +1070,7 @@ static bool test_generic_bits(struct torture_context *tctx,
io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_ACCESS_FLAGS(io.ntcreatex.out.file.fnum,
CHECK_ACCESS_FLAGS(io.ntcreatex.out.file.fnum,
expected_mask | file_mappings[i].specific_bits);
smbcli_close(cli->tree, io.ntcreatex.out.file.fnum);
@ -1111,7 +1111,7 @@ static bool test_generic_bits(struct torture_context *tctx,
io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_ACCESS_FLAGS(io.ntcreatex.out.file.fnum,
CHECK_ACCESS_FLAGS(io.ntcreatex.out.file.fnum,
expected_mask_anon | file_mappings[i].specific_bits);
smbcli_close(cli->tree, io.ntcreatex.out.file.fnum);
}
@ -1130,14 +1130,14 @@ static bool test_generic_bits(struct torture_context *tctx,
io.generic.level = RAW_OPEN_NTCREATEX;
io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask =
SEC_STD_READ_CONTROL |
SEC_STD_WRITE_DAC |
io.ntcreatex.in.access_mask =
SEC_STD_READ_CONTROL |
SEC_STD_WRITE_DAC |
SEC_STD_WRITE_OWNER;
io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_DIRECTORY;
io.ntcreatex.in.share_access =
NTCREATEX_SHARE_ACCESS_READ |
io.ntcreatex.in.share_access =
NTCREATEX_SHARE_ACCESS_READ |
NTCREATEX_SHARE_ACCESS_WRITE;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF;
@ -1158,8 +1158,8 @@ static bool test_generic_bits(struct torture_context *tctx,
owner_sid = dom_sid_string(tctx, sd_orig->owner_sid);
status = torture_check_privilege(cli,
owner_sid,
status = torture_check_privilege(cli,
owner_sid,
sec_privilege_name(SEC_PRIV_RESTORE));
has_restore_privilege = NT_STATUS_IS_OK(status);
if (!NT_STATUS_IS_OK(status)) {
@ -1168,8 +1168,8 @@ static bool test_generic_bits(struct torture_context *tctx,
}
torture_comment(tctx, "SEC_PRIV_RESTORE - %s\n", has_restore_privilege?"Yes":"No");
status = torture_check_privilege(cli,
owner_sid,
status = torture_check_privilege(cli,
owner_sid,
sec_privilege_name(SEC_PRIV_TAKE_OWNERSHIP));
has_take_ownership_privilege = NT_STATUS_IS_OK(status);
if (!NT_STATUS_IS_OK(status)) {
@ -1179,9 +1179,9 @@ static bool test_generic_bits(struct torture_context *tctx,
torture_comment(tctx, "SEC_PRIV_TAKE_OWNERSHIP - %s\n", has_take_ownership_privilege?"Yes":"No");
for (i=0;i<ARRAY_SIZE(dir_mappings);i++) {
uint32_t expected_mask =
SEC_STD_WRITE_DAC |
SEC_STD_READ_CONTROL |
uint32_t expected_mask =
SEC_STD_WRITE_DAC |
SEC_STD_READ_CONTROL |
SEC_FILE_READ_ATTRIBUTE |
SEC_STD_DELETE;
uint32_t expected_mask_anon = SEC_FILE_READ_ATTRIBUTE;
@ -1223,7 +1223,7 @@ static bool test_generic_bits(struct torture_context *tctx,
io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_ACCESS_FLAGS(io.ntcreatex.out.file.fnum,
CHECK_ACCESS_FLAGS(io.ntcreatex.out.file.fnum,
expected_mask | dir_mappings[i].specific_bits);
smbcli_close(cli->tree, io.ntcreatex.out.file.fnum);
@ -1264,7 +1264,7 @@ static bool test_generic_bits(struct torture_context *tctx,
io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_ACCESS_FLAGS(io.ntcreatex.out.file.fnum,
CHECK_ACCESS_FLAGS(io.ntcreatex.out.file.fnum,
expected_mask_anon | dir_mappings[i].specific_bits);
smbcli_close(cli->tree, io.ntcreatex.out.file.fnum);
}
@ -1289,7 +1289,7 @@ done:
see what access bits the owner of a file always gets
Test copied to smb2/acls.c for SMB2.
*/
static bool test_owner_bits(struct torture_context *tctx,
static bool test_owner_bits(struct torture_context *tctx,
struct smbcli_state *cli)
{
NTSTATUS status;
@ -1313,14 +1313,14 @@ static bool test_owner_bits(struct torture_context *tctx,
io.generic.level = RAW_OPEN_NTCREATEX;
io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask =
SEC_STD_READ_CONTROL |
SEC_STD_WRITE_DAC |
io.ntcreatex.in.access_mask =
SEC_STD_READ_CONTROL |
SEC_STD_WRITE_DAC |
SEC_STD_WRITE_OWNER;
io.ntcreatex.in.create_options = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
io.ntcreatex.in.share_access =
NTCREATEX_SHARE_ACCESS_READ |
io.ntcreatex.in.share_access =
NTCREATEX_SHARE_ACCESS_READ |
NTCREATEX_SHARE_ACCESS_WRITE;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF;
@ -1341,8 +1341,8 @@ static bool test_owner_bits(struct torture_context *tctx,
owner_sid = dom_sid_string(tctx, sd_orig->owner_sid);
status = torture_check_privilege(cli,
owner_sid,
status = torture_check_privilege(cli,
owner_sid,
sec_privilege_name(SEC_PRIV_RESTORE));
has_restore_privilege = NT_STATUS_IS_OK(status);
if (!NT_STATUS_IS_OK(status)) {
@ -1350,8 +1350,8 @@ static bool test_owner_bits(struct torture_context *tctx,
}
torture_comment(tctx, "SEC_PRIV_RESTORE - %s\n", has_restore_privilege?"Yes":"No");
status = torture_check_privilege(cli,
owner_sid,
status = torture_check_privilege(cli,
owner_sid,
sec_privilege_name(SEC_PRIV_TAKE_OWNERSHIP));
has_take_ownership_privilege = NT_STATUS_IS_OK(status);
if (!NT_STATUS_IS_OK(status)) {
@ -1418,7 +1418,7 @@ done:
test the inheritance of ACL flags onto new files and directories
Test copied to smb2/acls.c for SMB2.
*/
static bool test_inheritance(struct torture_context *tctx,
static bool test_inheritance(struct torture_context *tctx,
struct smbcli_state *cli)
{
NTSTATUS status;
@ -1439,14 +1439,14 @@ static bool test_inheritance(struct torture_context *tctx,
uint32_t dir_flags;
} test_flags[] = {
{
0,
0,
0,
0
},
{
SEC_ACE_FLAG_OBJECT_INHERIT,
0,
SEC_ACE_FLAG_OBJECT_INHERIT |
SEC_ACE_FLAG_OBJECT_INHERIT |
SEC_ACE_FLAG_INHERIT_ONLY,
},
{
@ -1455,10 +1455,10 @@ static bool test_inheritance(struct torture_context *tctx,
SEC_ACE_FLAG_CONTAINER_INHERIT,
},
{
SEC_ACE_FLAG_OBJECT_INHERIT |
SEC_ACE_FLAG_OBJECT_INHERIT |
SEC_ACE_FLAG_CONTAINER_INHERIT,
0,
SEC_ACE_FLAG_OBJECT_INHERIT |
SEC_ACE_FLAG_OBJECT_INHERIT |
SEC_ACE_FLAG_CONTAINER_INHERIT,
},
{
@ -1467,20 +1467,20 @@ static bool test_inheritance(struct torture_context *tctx,
0,
},
{
SEC_ACE_FLAG_NO_PROPAGATE_INHERIT |
SEC_ACE_FLAG_NO_PROPAGATE_INHERIT |
SEC_ACE_FLAG_OBJECT_INHERIT,
0,
0,
},
{
SEC_ACE_FLAG_NO_PROPAGATE_INHERIT |
SEC_ACE_FLAG_NO_PROPAGATE_INHERIT |
SEC_ACE_FLAG_CONTAINER_INHERIT,
0,
0,
},
{
SEC_ACE_FLAG_NO_PROPAGATE_INHERIT |
SEC_ACE_FLAG_CONTAINER_INHERIT |
SEC_ACE_FLAG_NO_PROPAGATE_INHERIT |
SEC_ACE_FLAG_CONTAINER_INHERIT |
SEC_ACE_FLAG_OBJECT_INHERIT,
0,
0,
@ -1491,50 +1491,50 @@ static bool test_inheritance(struct torture_context *tctx,
0,
},
{
SEC_ACE_FLAG_INHERIT_ONLY |
SEC_ACE_FLAG_INHERIT_ONLY |
SEC_ACE_FLAG_OBJECT_INHERIT,
0,
SEC_ACE_FLAG_OBJECT_INHERIT |
SEC_ACE_FLAG_OBJECT_INHERIT |
SEC_ACE_FLAG_INHERIT_ONLY,
},
{
SEC_ACE_FLAG_INHERIT_ONLY |
SEC_ACE_FLAG_INHERIT_ONLY |
SEC_ACE_FLAG_CONTAINER_INHERIT,
0,
SEC_ACE_FLAG_CONTAINER_INHERIT,
},
{
SEC_ACE_FLAG_INHERIT_ONLY |
SEC_ACE_FLAG_CONTAINER_INHERIT |
SEC_ACE_FLAG_INHERIT_ONLY |
SEC_ACE_FLAG_CONTAINER_INHERIT |
SEC_ACE_FLAG_OBJECT_INHERIT,
0,
SEC_ACE_FLAG_CONTAINER_INHERIT |
SEC_ACE_FLAG_CONTAINER_INHERIT |
SEC_ACE_FLAG_OBJECT_INHERIT,
},
{
SEC_ACE_FLAG_INHERIT_ONLY |
SEC_ACE_FLAG_INHERIT_ONLY |
SEC_ACE_FLAG_NO_PROPAGATE_INHERIT,
0,
0,
},
{
SEC_ACE_FLAG_INHERIT_ONLY |
SEC_ACE_FLAG_NO_PROPAGATE_INHERIT |
SEC_ACE_FLAG_INHERIT_ONLY |
SEC_ACE_FLAG_NO_PROPAGATE_INHERIT |
SEC_ACE_FLAG_OBJECT_INHERIT,
0,
0,
},
{
SEC_ACE_FLAG_INHERIT_ONLY |
SEC_ACE_FLAG_NO_PROPAGATE_INHERIT |
SEC_ACE_FLAG_INHERIT_ONLY |
SEC_ACE_FLAG_NO_PROPAGATE_INHERIT |
SEC_ACE_FLAG_CONTAINER_INHERIT,
0,
0,
},
{
SEC_ACE_FLAG_INHERIT_ONLY |
SEC_ACE_FLAG_NO_PROPAGATE_INHERIT |
SEC_ACE_FLAG_CONTAINER_INHERIT |
SEC_ACE_FLAG_INHERIT_ONLY |
SEC_ACE_FLAG_NO_PROPAGATE_INHERIT |
SEC_ACE_FLAG_CONTAINER_INHERIT |
SEC_ACE_FLAG_OBJECT_INHERIT,
0,
0,
@ -1688,7 +1688,7 @@ static bool test_inheritance(struct torture_context *tctx,
goto check_dir;
}
if (q.query_secdesc.out.sd->dacl->aces[0].flags !=
if (q.query_secdesc.out.sd->dacl->aces[0].flags !=
test_flags[i].file_flags) {
torture_warning(tctx, "incorrect file_flags 0x%x - expected 0x%x for parent 0x%x with (i=%d)\n",
q.query_secdesc.out.sd->dacl->aces[0].flags,
@ -1725,7 +1725,7 @@ static bool test_inheritance(struct torture_context *tctx,
continue;
}
if ((test_flags[i].parent_flags & SEC_ACE_FLAG_CONTAINER_INHERIT) &&
if ((test_flags[i].parent_flags & SEC_ACE_FLAG_CONTAINER_INHERIT) &&
(test_flags[i].parent_flags & SEC_ACE_FLAG_NO_PROPAGATE_INHERIT)) {
if (q.query_secdesc.out.sd->dacl == NULL ||
q.query_secdesc.out.sd->dacl->num_aces != 1 ||
@ -1752,7 +1752,7 @@ static bool test_inheritance(struct torture_context *tctx,
!dom_sid_equal(&q.query_secdesc.out.sd->dacl->aces[1].trustee,
creator_owner) ||
q.query_secdesc.out.sd->dacl->aces[0].flags != 0 ||
q.query_secdesc.out.sd->dacl->aces[1].flags !=
q.query_secdesc.out.sd->dacl->aces[1].flags !=
(test_flags[i].dir_flags | SEC_ACE_FLAG_INHERIT_ONLY)) {
torture_warning(tctx, "(CI) Bad sd in child dir - expected 0x%x for parent 0x%x (i=%d)\n",
test_flags[i].dir_flags,
@ -2167,7 +2167,7 @@ done:
test dynamic acl inheritance
Test copied to smb2/acls.c for SMB2.
*/
static bool test_inheritance_dynamic(struct torture_context *tctx,
static bool test_inheritance_dynamic(struct torture_context *tctx,
struct smbcli_state *cli)
{
NTSTATUS status;
@ -2180,7 +2180,7 @@ static bool test_inheritance_dynamic(struct torture_context *tctx,
union smb_setfileinfo set;
struct security_descriptor *sd, *sd_orig=NULL;
const char *owner_sid;
torture_comment(tctx, "TESTING DYNAMIC ACL INHERITANCE\n");
if (!torture_setup_dir(cli, BASEDIR))
@ -2338,7 +2338,7 @@ done:
/* test what access mask is needed for getting and setting security_descriptors
Test copied to smb2/acls.c for SMB2. */
static bool test_sd_get_set(struct torture_context *tctx,
static bool test_sd_get_set(struct torture_context *tctx,
struct smbcli_state *cli)
{
NTSTATUS status;
@ -2362,7 +2362,7 @@ static bool test_sd_get_set(struct torture_context *tctx,
SEC_FLAG_SYSTEM_SECURITY |
SEC_FLAG_MAXIMUM_ALLOWED |
SEC_STD_ALL |
SEC_FILE_ALL |
SEC_FILE_ALL |
NO_BITS_HACK;
uint64_t get_owner_bits = SEC_MASK_GENERIC | SEC_FLAG_MAXIMUM_ALLOWED | SEC_STD_READ_CONTROL;
uint64_t set_owner_bits = SEC_GENERIC_ALL | SEC_FLAG_MAXIMUM_ALLOWED | SEC_STD_WRITE_OWNER;
@ -2409,7 +2409,7 @@ static bool test_sd_get_set(struct torture_context *tctx,
status = smbcli_close(cli->tree, fnum);
CHECK_STATUS(status, NT_STATUS_OK);
/*
/*
* now try each access_mask bit and no bit at all in a loop
* and see what's allowed
* NOTE: if i == 32 it means access_mask = 0 (see NO_BITS_HACK above)
@ -2527,7 +2527,7 @@ done:
#endif
/*
/*
basic testing of security descriptor calls
*/
struct torture_suite *torture_raw_acls(TALLOC_CTX *mem_ctx)

View File

@ -1,18 +1,18 @@
/*
/*
Unix SMB/CIFS implementation.
chkpath individual test suite
Copyright (C) Andrew Tridgell 2003
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -138,7 +138,7 @@ static bool test_chkpath(struct smbcli_state *cli, struct torture_context *tctx)
}
ret &= test_path(cli, BASEDIR "\\test.txt..", NT_STATUS_NOT_A_DIRECTORY, NT_STATUS_DOS(ERRDOS,ERRbadpath));
if (!torture_set_file_attribute(cli->tree, BASEDIR, FILE_ATTRIBUTE_HIDDEN)) {
printf("failed to set basedir hidden\n");
ret = false;
@ -345,10 +345,10 @@ done:
return ret;
}
/*
basic testing of chkpath calls
/*
basic testing of chkpath calls
*/
bool torture_raw_chkpath(struct torture_context *torture,
bool torture_raw_chkpath(struct torture_context *torture,
struct smbcli_state *cli)
{
bool ret = true;

View File

@ -1,18 +1,18 @@
/*
/*
Unix SMB/CIFS implementation.
RAW_CLOSE_* individual test suite
Copyright (C) Andrew Tridgell 2003
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -27,7 +27,7 @@
#include "torture/raw/proto.h"
/**
* basic testing of all RAW_CLOSE_* calls
* basic testing of all RAW_CLOSE_* calls
*/
bool torture_raw_close(struct torture_context *torture,
struct smbcli_state *cli)
@ -67,7 +67,7 @@ bool torture_raw_close(struct torture_context *torture,
status = smb_raw_close(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
printf("Testing close.in.write_time\n");
/* the file should have the write time set */
@ -78,7 +78,7 @@ bool torture_raw_close(struct torture_context *torture,
if (basetime != nt_time_to_unix(finfo.all_info.out.write_time)) {
printf("Incorrect write time on file - %s - %s\n",
timestring(torture, basetime),
timestring(torture, basetime),
nt_time_string(torture, finfo.all_info.out.write_time));
dump_all_info(torture, &finfo);
ret = false;
@ -87,11 +87,11 @@ bool torture_raw_close(struct torture_context *torture,
printf("Testing other times\n");
/* none of the other times should be set to that time */
if (nt_time_equal(&finfo.all_info.out.write_time,
if (nt_time_equal(&finfo.all_info.out.write_time,
&finfo.all_info.out.access_time) ||
nt_time_equal(&finfo.all_info.out.write_time,
nt_time_equal(&finfo.all_info.out.write_time,
&finfo.all_info.out.create_time) ||
nt_time_equal(&finfo.all_info.out.write_time,
nt_time_equal(&finfo.all_info.out.write_time,
&finfo.all_info.out.change_time)) {
printf("Incorrect times after close - only write time should be set\n");
dump_all_info(torture, &finfo);
@ -105,7 +105,7 @@ bool torture_raw_close(struct torture_context *torture,
ret = false;
}
}
smbcli_unlink(cli->tree, fname);
REOPEN;
@ -127,7 +127,7 @@ bool torture_raw_close(struct torture_context *torture,
status = smb_raw_pathinfo(cli->tree, torture, &finfo);
CHECK_STATUS(status, NT_STATUS_OK);
if (!nt_time_equal(&finfo.all_info.out.write_time,
if (!nt_time_equal(&finfo.all_info.out.write_time,
&finfo2.all_info.out.write_time)) {
printf("Incorrect write time on file - 0 time should be ignored\n");
dump_all_info(torture, &finfo);
@ -169,7 +169,7 @@ bool torture_raw_close(struct torture_context *torture,
io_flush.flush.in.file.fnum = fnum;
status = smb_raw_flush(cli->tree, &io_flush);
CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
done:
smbcli_close(cli->tree, fnum);

View File

@ -1,20 +1,20 @@
/*
/*
Unix SMB/CIFS implementation.
libcli composite function testing
Copyright (C) Andrew Tridgell 2005
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -92,7 +92,7 @@ static bool test_loadfile(struct torture_context *tctx, struct smbcli_state *cli
}
}
torture_comment(tctx, "count=%d\n", *count);
for (i=0;i<num_ops;i++) {
status = smb_composite_loadfile_recv(c[i], tctx);
torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK, "loadfile failed");
@ -240,7 +240,7 @@ static bool test_appendacl(struct torture_context *tctx, struct smbcli_state *cl
io1.in.fname = talloc_asprintf(io_orig, BASEDIR "\\test%d.txt", i);
io1.in.data = NULL;
io1.in.size = 0;
status = smb_composite_savefile(cli->tree, &io1);
torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK, "savefile failed");
@ -250,7 +250,7 @@ static bool test_appendacl(struct torture_context *tctx, struct smbcli_state *cl
status = smb_composite_appendacl(cli->tree, io_orig[i], io_orig[i]);
torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK, "appendacl failed");
}
/* fill Security Descriptor with aces to be added */
@ -301,19 +301,19 @@ static bool test_appendacl(struct torture_context *tctx, struct smbcli_state *cl
torture_comment(tctx, "(%s) appendacl[%d] failed - %s\n", __location__, i, nt_errstr(status));
return false;
}
security_descriptor_dacl_add(io_orig[i]->out.sd, ace);
torture_assert(tctx,
security_acl_equal(io_orig[i]->out.sd->dacl,
io[i]->out.sd->dacl),
"appendacl failed - needed acl isn't set");
}
talloc_free (ace);
talloc_free (test_sid);
talloc_free (test_sd);
return true;
}

View File

@ -1,18 +1,18 @@
/*
/*
Unix SMB/CIFS implementation.
test suite for session setup operations
Copyright (C) Andrew Tridgell 2003
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -91,7 +91,7 @@ static bool test_session(struct torture_context *tctx,
status = smb_composite_sesssetup(session, &setup);
CHECK_STATUS(status, NT_STATUS_OK);
session->vuid = setup.out.vuid;
torture_comment(tctx, "create a third security context on the same transport, with given vuid\n");
@ -141,7 +141,7 @@ static bool test_session(struct torture_context *tctx,
setup.in.sesskey = cli->transport->negotiate.sesskey;
setup.in.capabilities &= ~CAP_EXTENDED_SECURITY; /* force a non extended security login (should fail) */
setup.in.workgroup = lpcfg_workgroup(tctx->lp_ctx);
setup.in.credentials = samba_cmdline_get_creds();
status = smb_composite_sesssetup(session3, &setup);
@ -160,19 +160,19 @@ static bool test_session(struct torture_context *tctx,
setup.in.sesskey = cli->transport->negotiate.sesskey;
setup.in.capabilities &= ~CAP_EXTENDED_SECURITY; /* force a non extended security login (should fail) */
setup.in.workgroup = lpcfg_workgroup(tctx->lp_ctx);
anon_creds = cli_credentials_init(tctx);
cli_credentials_set_conf(anon_creds, tctx->lp_ctx);
cli_credentials_set_anonymous(anon_creds);
setup.in.credentials = anon_creds;
status = smb_composite_sesssetup(session3, &setup);
CHECK_STATUS(status, NT_STATUS_OK);
talloc_free(session4);
}
torture_comment(tctx, "use the same tree as the existing connection\n");
tree = smbcli_tree_init(session, tctx, false);
tree->tid = cli->tree->tid;
@ -238,7 +238,7 @@ static bool test_session(struct torture_context *tctx,
setups[i].in.sesskey = cli->transport->negotiate.sesskey;
setups[i].in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */
setups[i].in.workgroup = lpcfg_workgroup(tctx->lp_ctx);
setups[i].in.credentials = samba_cmdline_get_creds();
setups[i].in.gensec_settings = gensec_settings;
@ -287,7 +287,7 @@ static bool test_tree(struct torture_context *tctx, struct smbcli_state *cli)
share = torture_setting_string(tctx, "share", NULL);
host = torture_setting_string(tctx, "host", NULL);
torture_comment(tctx, "create a second tree context on the same session\n");
tree = smbcli_tree_init(cli->session, tctx, false);
@ -295,16 +295,16 @@ static bool test_tree(struct torture_context *tctx, struct smbcli_state *cli)
tcon.tconx.in.flags = TCONX_FLAG_EXTENDED_RESPONSE;
tcon.tconx.in.password = data_blob(NULL, 0);
tcon.tconx.in.path = talloc_asprintf(tctx, "\\\\%s\\%s", host, share);
tcon.tconx.in.device = "A:";
tcon.tconx.in.device = "A:";
status = smb_raw_tcon(tree, tctx, &tcon);
CHECK_STATUS(status, NT_STATUS_OK);
tree->tid = tcon.tconx.out.tid;
torture_comment(tctx, "tid1=%d tid2=%d\n", cli->tree->tid, tree->tid);
torture_comment(tctx, "try a tconx with a bad device type\n");
tcon.tconx.in.device = "FOO";
tcon.tconx.in.device = "FOO";
status = smb_raw_tcon(tree, tctx, &tcon);
CHECK_STATUS(status, NT_STATUS_BAD_DEVICE_TYPE);
@ -360,7 +360,7 @@ static bool test_tree(struct torture_context *tctx, struct smbcli_state *cli)
/* close down the new tree */
talloc_free(tree);
done:
return ret;
}
@ -513,7 +513,7 @@ static bool test_tree_ulogoff(struct torture_context *tctx, struct smbcli_state
/* close down the new tree */
talloc_free(tree);
done:
return ret;
}
@ -663,7 +663,7 @@ static bool test_pid_2sess(struct torture_context *tctx,
setup.in.gensec_settings = lpcfg_gensec_settings(tctx, tctx->lp_ctx);
status = smb_composite_sesssetup(session, &setup);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_STATUS(status, NT_STATUS_OK);
session->vuid = setup.out.vuid;
vuid1 = cli->session->vuid;
@ -760,7 +760,7 @@ static bool test_pid_2tcon(struct torture_context *tctx,
share = torture_setting_string(tctx, "share", NULL);
host = torture_setting_string(tctx, "host", NULL);
torture_comment(tctx, "create a second tree context on the same session\n");
tree = smbcli_tree_init(cli->session, tctx, false);
@ -768,9 +768,9 @@ static bool test_pid_2tcon(struct torture_context *tctx,
tcon.tconx.in.flags = TCONX_FLAG_EXTENDED_RESPONSE;
tcon.tconx.in.password = data_blob(NULL, 0);
tcon.tconx.in.path = talloc_asprintf(tctx, "\\\\%s\\%s", host, share);
tcon.tconx.in.device = "A:";
tcon.tconx.in.device = "A:";
status = smb_raw_tcon(tree, tctx, &tcon);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_STATUS(status, NT_STATUS_OK);
tree->tid = tcon.tconx.out.tid;

View File

@ -1,19 +1,19 @@
/*
/*
Unix SMB/CIFS implementation.
ioctl individual test suite
Copyright (C) Andrew Tridgell 2003
Copyright (C) James J Myers 2003 <myersjj@samba.org>
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -171,10 +171,10 @@ done:
return ret;
}
/*
basic testing of some ioctl calls
/*
basic testing of some ioctl calls
*/
bool torture_raw_ioctl(struct torture_context *torture,
bool torture_raw_ioctl(struct torture_context *torture,
struct smbcli_state *cli)
{
bool ret = true;

View File

@ -1,18 +1,18 @@
/*
/*
Unix SMB/CIFS implementation.
test suite for various lock operations
Copyright (C) Andrew Tridgell 2003
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -107,7 +107,7 @@ static bool test_lock(struct torture_context *tctx, struct smbcli_state *cli)
torture_comment(tctx, "Testing RAW_LOCK_LOCK\n");
io.generic.level = RAW_LOCK_LOCK;
fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
torture_assert(tctx,(fnum != -1), talloc_asprintf(tctx,
"Failed to create %s - %s\n",
@ -239,7 +239,7 @@ static bool test_lockx(struct torture_context *tctx, struct smbcli_state *cli)
torture_comment(tctx, "Testing RAW_LOCK_LOCKX\n");
io.generic.level = RAW_LOCK_LOCKX;
fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
torture_assert(tctx,(fnum != -1), talloc_asprintf(tctx,
"Failed to create %s - %s\n",
@ -404,7 +404,7 @@ done:
/*
test high pid
*/
static bool test_pidhigh(struct torture_context *tctx,
static bool test_pidhigh(struct torture_context *tctx,
struct smbcli_state *cli)
{
union smb_lock io;
@ -421,7 +421,7 @@ static bool test_pidhigh(struct torture_context *tctx,
io.generic.level = RAW_LOCK_LOCKX;
cli->session->pid = 1;
fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
torture_assert(tctx,(fnum != -1), talloc_asprintf(tctx,
"Failed to create %s - %s\n",
@ -486,7 +486,7 @@ done:
/*
test locking&X async operation
*/
static bool test_async(struct torture_context *tctx,
static bool test_async(struct torture_context *tctx,
struct smbcli_state *cli)
{
struct smbcli_session *session;
@ -995,7 +995,7 @@ done:
/*
test NT_STATUS_LOCK_NOT_GRANTED vs. NT_STATUS_FILE_LOCK_CONFLICT
*/
static bool test_errorcode(struct torture_context *tctx,
static bool test_errorcode(struct torture_context *tctx,
struct smbcli_state *cli)
{
union smb_lock io;
@ -1107,7 +1107,7 @@ next_run:
CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
lock[0].pid--;
/*
/*
* demonstrate that a successful lock with count = 0 and the same offset,
* doesn't reset the error cache
*/
@ -1131,7 +1131,7 @@ next_run:
status = smb_raw_lock(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
/*
/*
* demonstrate that a successful lock with count = 0 and outside the locked range,
* doesn't reset the error cache
*/
@ -1196,7 +1196,7 @@ next_run:
status = smb_raw_lock(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
/*
/*
* demonstrate that a lock with count = 0 and inside the locked range,
* fails and resets the error cache
*/
@ -1285,7 +1285,7 @@ next_run:
status = smb_raw_lock(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
/*
/*
* demonstrate that a successful lock in a different range
* doesn't reset the cache, the failing lock on the 2nd handle
* resets the cache
@ -1485,7 +1485,7 @@ done:
/*
test LOCKING_ANDX_CHANGE_LOCKTYPE
*/
static bool test_changetype(struct torture_context *tctx,
static bool test_changetype(struct torture_context *tctx,
struct smbcli_state *cli)
{
union smb_lock io;
@ -1500,7 +1500,7 @@ static bool test_changetype(struct torture_context *tctx,
torture_comment(tctx, "Testing LOCKING_ANDX_CHANGE_LOCKTYPE\n");
io.generic.level = RAW_LOCK_LOCKX;
fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
torture_assert(tctx,(fnum != -1), talloc_asprintf(tctx,
"Failed to create %s - %s\n",

View File

@ -1,20 +1,20 @@
/*
/*
Unix SMB/CIFS implementation.
locking benchmark
Copyright (C) Andrew Tridgell 2006
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -118,11 +118,11 @@ static void lock_send(struct benchlock_state *state)
state->req->async.fn = lock_completion;
}
static void reopen_connection(struct tevent_context *ev, struct tevent_timer *te,
static void reopen_connection(struct tevent_context *ev, struct tevent_timer *te,
struct timeval t, void *private_data);
static void reopen_file(struct tevent_context *ev, struct tevent_timer *te,
static void reopen_file(struct tevent_context *ev, struct tevent_timer *te,
struct timeval t, void *private_data)
{
struct benchlock_state *state = (struct benchlock_state *)private_data;
@ -156,7 +156,7 @@ static void reopen_connection_complete(struct composite_context *ctx)
if (!NT_STATUS_IS_OK(status)) {
talloc_free(state->te);
state->te = tevent_add_timer(state->ev, state->mem_ctx,
timeval_current_ofs(1,0),
timeval_current_ofs(1,0),
reopen_connection, state);
return;
}
@ -168,12 +168,12 @@ static void reopen_connection_complete(struct composite_context *ctx)
tevent_add_timer(state->ev, state->mem_ctx, timeval_zero(), reopen_file, state);
}
/*
reopen a connection
*/
static void reopen_connection(struct tevent_context *ev, struct tevent_timer *te,
static void reopen_connection(struct tevent_context *ev, struct tevent_timer *te,
struct timeval t, void *private_data)
{
struct benchlock_state *state = (struct benchlock_state *)private_data;
@ -205,7 +205,7 @@ static void reopen_connection(struct tevent_context *ev, struct tevent_timer *te
talloc_free(state->tree);
state->tree = NULL;
ctx = smb_composite_connect_send(io, state->mem_ctx,
ctx = smb_composite_connect_send(io, state->mem_ctx,
lpcfg_resolve_context(state->tctx->lp_ctx),
state->ev);
if (ctx == NULL) {
@ -232,11 +232,11 @@ static void lock_completion(struct smbcli_request *req)
NT_STATUS_EQUAL(status, NT_STATUS_CONNECTION_RESET)) {
talloc_free(state->tree);
state->tree = NULL;
num_connected--;
num_connected--;
DEBUG(0,("reopening connection to %s\n", state->dest_host));
talloc_free(state->te);
state->te = tevent_add_timer(state->ev, state->mem_ctx,
timeval_current_ofs(1,0),
timeval_current_ofs(1,0),
reopen_connection, state);
} else {
DEBUG(0,("Lock failed - %s\n", nt_errstr(status)));
@ -271,19 +271,19 @@ static void echo_completion(struct smbcli_request *req)
NT_STATUS_EQUAL(status, NT_STATUS_CONNECTION_RESET)) {
talloc_free(state->tree);
state->tree = NULL;
num_connected--;
num_connected--;
DEBUG(0,("reopening connection to %s\n", state->dest_host));
talloc_free(state->te);
state->te = tevent_add_timer(state->ev, state->mem_ctx,
timeval_current_ofs(1,0),
timeval_current_ofs(1,0),
reopen_connection, state);
}
}
static void report_rate(struct tevent_context *ev, struct tevent_timer *te,
static void report_rate(struct tevent_context *ev, struct tevent_timer *te,
struct timeval t, void *private_data)
{
struct benchlock_state *state = talloc_get_type(private_data,
struct benchlock_state *state = talloc_get_type(private_data,
struct benchlock_state);
int i;
for (i=0;i<nprocs;i++) {
@ -313,7 +313,7 @@ static void report_rate(struct tevent_context *ev, struct tevent_timer *te,
}
}
/*
/*
benchmark locking calls
*/
bool torture_bench_lock(struct torture_context *torture)
@ -359,9 +359,9 @@ bool torture_bench_lock(struct torture_context *torture)
dest_port = get_sockaddr_port(dest_ss);
state[i].dest_host = talloc_strdup(state[i].mem_ctx, dest_str);
state[i].dest_ports = talloc_array(state[i].mem_ctx,
state[i].dest_ports = talloc_array(state[i].mem_ctx,
const char *, 2);
state[i].dest_ports[0] = talloc_asprintf(state[i].dest_ports,
state[i].dest_ports[0] = talloc_asprintf(state[i].dest_ports,
"%u", dest_port);
state[i].dest_ports[1] = NULL;
state[i].called_name = talloc_strdup(state[i].mem_ctx,
@ -376,8 +376,8 @@ bool torture_bench_lock(struct torture_context *torture)
}
for (i=0;i<nprocs;i++) {
state[i].fnum = smbcli_open(state[i].tree,
FNAME,
state[i].fnum = smbcli_open(state[i].tree,
FNAME,
O_RDWR|O_CREAT, DENY_NONE);
if (state[i].fnum == -1) {
printf("Failed to open %s on connection %d\n", FNAME, i);
@ -403,7 +403,7 @@ bool torture_bench_lock(struct torture_context *torture)
lock_send(&state[i]);
}
tv = timeval_current();
tv = timeval_current();
if (progress) {
tevent_add_timer(torture->ev, state, timeval_current_ofs(1, 0), report_rate, state);

View File

@ -1,18 +1,18 @@
/*
/*
Unix SMB/CIFS implementation.
RAW_MKDIR_* and RAW_RMDIR_* individual test suite
Copyright (C) Andrew Tridgell 2003
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -46,7 +46,7 @@ static bool test_mkdir(struct smbcli_state *cli, struct torture_context *tctx)
torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR);
/*
/*
basic mkdir
*/
md.mkdir.level = RAW_MKDIR_MKDIR;
@ -90,13 +90,13 @@ static bool test_mkdir(struct smbcli_state *cli, struct torture_context *tctx)
md.mkdir.in.path = "..\\..\\..";
status = smb_raw_mkdir(cli->tree, &md);
CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_SYNTAX_BAD);
printf("Testing t2mkdir\n");
/* try a t2mkdir - need to work out why this fails! */
md.t2mkdir.level = RAW_MKDIR_T2MKDIR;
md.t2mkdir.in.path = path;
md.t2mkdir.in.num_eas = 0;
md.t2mkdir.in.num_eas = 0;
status = smb_raw_mkdir(cli->tree, &md);
CHECK_STATUS(status, NT_STATUS_OK);
@ -155,10 +155,10 @@ done:
}
/*
basic testing of all RAW_MKDIR_* calls
/*
basic testing of all RAW_MKDIR_* calls
*/
bool torture_raw_mkdir(struct torture_context *torture,
bool torture_raw_mkdir(struct torture_context *torture,
struct smbcli_state *cli)
{
bool ret = true;

View File

@ -1,18 +1,18 @@
/*
/*
Unix SMB/CIFS implementation.
basic raw test suite for multiplexing
Copyright (C) Andrew Tridgell 2003
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -86,7 +86,7 @@ static bool test_mux_open(struct torture_context *tctx, struct smbcli_state *cli
torture_comment(tctx, "send 2nd async open, conflicting\n");
tv = timeval_current();
req2 = smb_raw_open_send(cli->tree, &io);
torture_comment(tctx, "close first sync open\n");
smbcli_close(cli->tree, fnum1);
@ -166,7 +166,7 @@ static bool test_mux_write(struct torture_context *tctx, struct smbcli_state *cl
io.writex.in.wmode = 0;
io.writex.in.remaining = 0;
io.writex.in.count = 4;
io.writex.in.data = (const uint8_t *)&fnum;
io.writex.in.data = (const uint8_t *)&fnum;
req = smb_raw_write_send(cli->tree, &io);
/* unlock the range */
@ -275,7 +275,7 @@ static bool test_mux_lock(struct torture_context *tctx, struct smbcli_state *cli
smb_raw_ntcancel(req);
torture_comment(tctx, "sending 2nd cancel\n");
/* the 2nd cancel is totally harmless, but tests the server trying to
/* the 2nd cancel is totally harmless, but tests the server trying to
cancel an already cancelled request */
smb_raw_ntcancel(req);
@ -320,7 +320,7 @@ static bool test_mux_lock(struct torture_context *tctx, struct smbcli_state *cli
/*
/*
basic testing of multiplexing notify
*/
bool torture_raw_mux(struct torture_context *torture, struct smbcli_state *cli)

View File

@ -1,18 +1,18 @@
/*
/*
Unix SMB/CIFS implementation.
basic raw test suite for change notify
Copyright (C) Andrew Tridgell 2003
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -38,7 +38,7 @@ do { \
#define BASEDIR_CN1_DIR BASEDIR "_CN1_DIR"
/*
/*
basic testing of change notify on directories
*/
static bool test_notify_dir(struct torture_context *tctx,
@ -206,7 +206,7 @@ static bool test_notify_dir(struct torture_context *tctx,
"smbcli_unlink");
/* (1st unlink) as the 2nd notify directly returns,
this unlink is only seen by the 1st notify and
this unlink is only seen by the 1st notify and
the 3rd notify (later) */
torture_comment(tctx, "Testing notify on unlink for the first file\n");
status = smbcli_unlink(cli2->tree, BASEDIR_CN1_DIR "\\test0.txt");
@ -354,7 +354,7 @@ static bool check_rename_reply(struct torture_context *tctx,
return false;
}
/*
/*
testing of recursive change notify
*/
@ -431,7 +431,7 @@ static bool test_notify_recursive(struct torture_context *tctx,
*/
smbcli_mkdir(cli->tree, BASEDIR_CN1_RECUR "\\subdir-name");
smbcli_mkdir(cli2->tree, BASEDIR_CN1_RECUR "\\subdir-name\\subname1");
smbcli_close(cli->tree,
smbcli_close(cli->tree,
smbcli_open(cli->tree,
BASEDIR_CN1_RECUR "\\subdir-name\\subname2",
O_CREAT, 0));
@ -502,7 +502,7 @@ static bool test_notify_recursive(struct torture_context *tctx,
ret &= check_rename_reply(tctx,
cli, __LINE__, &notify.nttrans.out.changes[5],
NOTIFY_ACTION_MODIFIED, "subname2-r");
ret &= check_rename_reply(tctx,
cli, __LINE__, &notify.nttrans.out.changes[8],
NOTIFY_ACTION_OLD_NAME, "subname2-r");
@ -548,7 +548,7 @@ done:
return ret;
}
/*
/*
testing of change notify mask change
*/
@ -654,7 +654,7 @@ static bool test_notify_mask_change(struct torture_context *tctx,
smbcli_mkdir(cli->tree, BASEDIR_CN1_CNMC "\\subdir-name");
smbcli_mkdir(cli->tree, BASEDIR_CN1_CNMC "\\subdir-name\\subname1");
smbcli_close(cli->tree,
smbcli_close(cli->tree,
smbcli_open(cli->tree,
BASEDIR_CN1_CNMC "\\subdir-name\\subname2",
O_CREAT, 0));
@ -705,7 +705,7 @@ done:
}
/*
/*
testing of mask bits for change notify
*/
@ -1362,7 +1362,7 @@ done:
return ret;
}
/*
/*
test setting up two change notify requests on one handle
*/
@ -1442,7 +1442,7 @@ done:
}
/*
/*
test multiple change notifies at different depths and with/without recursion
*/
@ -1658,7 +1658,7 @@ static bool test_notify_tree(struct torture_context *tctx,
status = smb_raw_changenotify_recv(req, tctx, &notify);
dirs[i].counted += notify.nttrans.out.num_changes;
}
all_done = true;
for (i=0;i<ARRAY_SIZE(dirs);i++) {
@ -1871,7 +1871,7 @@ done:
with change notify
*/
static struct smbcli_tree *secondary_tcon(struct smbcli_state *cli,
static struct smbcli_tree *secondary_tcon(struct smbcli_state *cli,
struct torture_context *tctx)
{
NTSTATUS status;
@ -1881,7 +1881,7 @@ static struct smbcli_tree *secondary_tcon(struct smbcli_state *cli,
share = torture_setting_string(tctx, "share", NULL);
host = torture_setting_string(tctx, "host", NULL);
torture_comment(tctx, "create a second tree context on the same session\n");
tree = smbcli_tree_init(cli->session, tctx, false);
@ -1889,7 +1889,7 @@ static struct smbcli_tree *secondary_tcon(struct smbcli_state *cli,
tcon.tconx.in.flags = TCONX_FLAG_EXTENDED_RESPONSE;
tcon.tconx.in.password = data_blob(NULL, 0);
tcon.tconx.in.path = talloc_asprintf(tctx, "\\\\%s\\%s", host, share);
tcon.tconx.in.device = "A:";
tcon.tconx.in.device = "A:";
status = smb_raw_tcon(tree, tctx, &tcon);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(tree);
@ -1904,7 +1904,7 @@ static struct smbcli_tree *secondary_tcon(struct smbcli_state *cli,
}
/*
/*
very simple change notify test
*/
@ -1921,7 +1921,7 @@ static bool test_notify_tcon(struct torture_context *tctx,
struct smbcli_request *req;
extern int torture_numops;
struct smbcli_tree *tree = NULL;
torture_comment(tctx, "TESTING SIMPLE CHANGE NOTIFY\n");
torture_assert(tctx, torture_setup_dir(cli, BASEDIR_CN1_NTCON),

View File

@ -1,18 +1,18 @@
/*
/*
Unix SMB/CIFS implementation.
RAW_OPEN_* individual test suite
Copyright (C) Andrew Tridgell 2003
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -225,7 +225,7 @@ static bool test_open(struct torture_context *tctx, struct smbcli_state *cli)
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.openold.out.file.fnum;
CHECK_RDWR(fnum, RDWR_RDWR);
if (io.openold.in.open_mode != io.openold.out.rmode) {
torture_warning(tctx, "(%s) rmode should equal open_mode - 0x%x 0x%x\n",
__location__, io.openold.out.rmode, io.openold.in.open_mode);
@ -408,12 +408,12 @@ static bool test_openx(struct torture_context *tctx, struct smbcli_state *cli)
status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
if (torture_setting_bool(tctx, "samba3", false)) {
CHECK_ALL_INFO(FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE,
CHECK_ALL_INFO(FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE,
attrib & ~(FILE_ATTRIBUTE_NONINDEXED|
FILE_ATTRIBUTE_SPARSE));
}
else {
CHECK_ALL_INFO(FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE,
CHECK_ALL_INFO(FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE,
attrib & ~(FILE_ATTRIBUTE_NONINDEXED));
}
smbcli_close(cli->tree, io.openx.out.file.fnum);
@ -672,7 +672,7 @@ done:
return ret;
}
/*
test RAW_OPEN_NTCREATEX
@ -833,7 +833,7 @@ static bool test_ntcreatex(struct torture_context *tctx, struct smbcli_state *cl
CHECK_NTTIME(io.ntcreatex.out.write_time, write_time);
CHECK_NTTIME(io.ntcreatex.out.change_time, change_time);
CHECK_ALL_INFO(io.ntcreatex.out.attrib, attrib);
CHECK_VAL(io.ntcreatex.out.attrib & ~FILE_ATTRIBUTE_NONINDEXED,
CHECK_VAL(io.ntcreatex.out.attrib & ~FILE_ATTRIBUTE_NONINDEXED,
FILE_ATTRIBUTE_DIRECTORY);
CHECK_ALL_INFO(io.ntcreatex.out.alloc_size, alloc_size);
CHECK_ALL_INFO(io.ntcreatex.out.size, size);
@ -842,7 +842,7 @@ static bool test_ntcreatex(struct torture_context *tctx, struct smbcli_state *cl
CHECK_VAL(io.ntcreatex.out.size, 0);
CHECK_VAL(io.ntcreatex.out.file_type, FILE_TYPE_DISK);
smbcli_unlink(cli->tree, fname);
done:
smbcli_close(cli->tree, fnum);
@ -1105,7 +1105,7 @@ static bool test_nttrans_create(struct torture_context *tctx, struct smbcli_stat
CHECK_NTTIME(io.ntcreatex.out.write_time, write_time);
CHECK_NTTIME(io.ntcreatex.out.change_time, change_time);
CHECK_ALL_INFO(io.ntcreatex.out.attrib, attrib);
CHECK_VAL(io.ntcreatex.out.attrib & ~FILE_ATTRIBUTE_NONINDEXED,
CHECK_VAL(io.ntcreatex.out.attrib & ~FILE_ATTRIBUTE_NONINDEXED,
FILE_ATTRIBUTE_DIRECTORY);
CHECK_ALL_INFO(io.ntcreatex.out.alloc_size, alloc_size);
CHECK_ALL_INFO(io.ntcreatex.out.size, size);
@ -1114,7 +1114,7 @@ static bool test_nttrans_create(struct torture_context *tctx, struct smbcli_stat
CHECK_VAL(io.ntcreatex.out.size, 0);
CHECK_VAL(io.ntcreatex.out.file_type, FILE_TYPE_DISK);
smbcli_unlink(cli->tree, fname);
done:
smbcli_close(cli->tree, fnum);
@ -1244,9 +1244,9 @@ static bool test_mknew(struct torture_context *tctx, struct smbcli_state *cli)
status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.mknew.out.file.fnum;
CHECK_ALL_INFO(FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_ARCHIVE,
CHECK_ALL_INFO(FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_ARCHIVE,
attrib & ~FILE_ATTRIBUTE_NONINDEXED);
done:
smbcli_close(cli->tree, fnum);
smbcli_deltree(cli->tree, BASEDIR);
@ -1300,9 +1300,9 @@ static bool test_create(struct torture_context *tctx, struct smbcli_state *cli)
status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.create.out.file.fnum;
CHECK_ALL_INFO(FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_ARCHIVE,
CHECK_ALL_INFO(FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_ARCHIVE,
attrib & ~FILE_ATTRIBUTE_NONINDEXED);
done:
smbcli_close(cli->tree, fnum);
smbcli_deltree(cli->tree, BASEDIR);
@ -1371,7 +1371,7 @@ static bool test_chained(struct torture_context *tctx, struct smbcli_state *cli)
smbcli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf));
smbcli_close(cli->tree, fnum);
smbcli_close(cli->tree, fnum);
io.openxreadx.level = RAW_OPEN_OPENX_READX;
io.openxreadx.in.fname = fname;
@ -1383,7 +1383,7 @@ static bool test_chained(struct torture_context *tctx, struct smbcli_state *cli)
io.openxreadx.in.write_time = 0;
io.openxreadx.in.size = 1024*1024;
io.openxreadx.in.timeout = 0;
io.openxreadx.in.offset = 0;
io.openxreadx.in.mincnt = sizeof(buf2);
io.openxreadx.in.maxcnt = sizeof(buf2);
@ -1410,7 +1410,7 @@ done:
/*
test RAW_OPEN_OPENX without a leading slash on the path.
NetApp filers are known to fail on this.
*/
static bool test_no_leading_slash(struct torture_context *tctx, struct smbcli_state *cli)
{
@ -1428,7 +1428,7 @@ static bool test_no_leading_slash(struct torture_context *tctx, struct smbcli_st
/* Create the file */
fnum = create_complex_file(cli, tctx, fname);
smbcli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf));
smbcli_close(cli->tree, fnum);
smbcli_close(cli->tree, fnum);
/* Prepare to open the file using path without leading slash */
io.openx.level = RAW_OPEN_OPENX;
@ -1457,7 +1457,7 @@ done:
test RAW_OPEN_OPENX against an existing directory to
ensure it returns NT_STATUS_FILE_IS_A_DIRECTORY.
Samba 3.2.0 - 3.2.6 are known to fail this.
*/
static bool test_openx_over_dir(struct torture_context *tctx, struct smbcli_state *cli)
{
@ -1474,7 +1474,7 @@ static bool test_openx_over_dir(struct torture_context *tctx, struct smbcli_stat
/* Create the Directory */
status = create_directory_handle(cli->tree, fname, &d_fnum);
smbcli_close(cli->tree, d_fnum);
smbcli_close(cli->tree, d_fnum);
/* Prepare to open the file over the directory. */
io.openx.level = RAW_OPEN_OPENX;
@ -1518,7 +1518,7 @@ static bool test_raw_open_multi(struct torture_context *tctx, struct smbcli_stat
int i, num_files = 3;
int num_ok = 0;
int num_collision = 0;
clients = talloc_array(mem_ctx, struct smbcli_state *, num_files);
requests = talloc_array(mem_ctx, struct smbcli_request *, num_files);
ios = talloc_array(mem_ctx, union smb_open, num_files);
@ -1597,7 +1597,7 @@ static bool test_raw_open_multi(struct torture_context *tctx, struct smbcli_stat
if (NT_STATUS_IS_OK(status)) {
num_ok += 1;
}
}
if (NT_STATUS_EQUAL(status,
NT_STATUS_OBJECT_NAME_COLLISION)) {

View File

@ -1,20 +1,20 @@
/*
/*
Unix SMB/CIFS implementation.
open benchmark
Copyright (C) Andrew Tridgell 2007
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -77,7 +77,7 @@ struct benchopen_state {
};
static void next_open(struct benchopen_state *state);
static void reopen_connection(struct tevent_context *ev, struct tevent_timer *te,
static void reopen_connection(struct tevent_context *ev, struct tevent_timer *te,
struct timeval t, void *private_data);
@ -94,7 +94,7 @@ static void reopen_connection_complete(struct composite_context *ctx)
if (!NT_STATUS_IS_OK(status)) {
talloc_free(state->te);
state->te = tevent_add_timer(state->ev, state->mem_ctx,
timeval_current_ofs(1,0),
timeval_current_ofs(1,0),
reopen_connection, state);
return;
}
@ -111,12 +111,12 @@ static void reopen_connection_complete(struct composite_context *ctx)
next_open(state);
}
/*
reopen a connection
*/
static void reopen_connection(struct tevent_context *ev, struct tevent_timer *te,
static void reopen_connection(struct tevent_context *ev, struct tevent_timer *te,
struct timeval t, void *private_data)
{
struct benchopen_state *state = (struct benchopen_state *)private_data;
@ -150,7 +150,7 @@ static void reopen_connection(struct tevent_context *ev, struct tevent_timer *te
state->open_fnum = -1;
state->close_fnum = -1;
ctx = smb_composite_connect_send(io, state->mem_ctx,
ctx = smb_composite_connect_send(io, state->mem_ctx,
lpcfg_resolve_context(state->tctx->lp_ctx),
state->ev);
if (ctx == NULL) {
@ -231,12 +231,12 @@ static void open_completed(struct smbcli_request *req)
talloc_free(state->cli);
state->tree = NULL;
state->cli = NULL;
num_connected--;
num_connected--;
DEBUG(0,("[%u] reopening connection to %s\n",
state->client_num, state->dest_host));
talloc_free(state->te);
state->te = tevent_add_timer(state->ev, state->mem_ctx,
timeval_current_ofs(1,0),
timeval_current_ofs(1,0),
reopen_connection, state);
return;
}
@ -272,7 +272,7 @@ static void open_completed(struct smbcli_request *req)
}
next_open(state);
}
}
/*
called when a close completes
@ -291,12 +291,12 @@ static void close_completed(struct smbcli_request *req)
talloc_free(state->cli);
state->tree = NULL;
state->cli = NULL;
num_connected--;
num_connected--;
DEBUG(0,("[%u] reopening connection to %s\n",
state->client_num, state->dest_host));
talloc_free(state->te);
state->te = tevent_add_timer(state->ev, state->mem_ctx,
timeval_current_ofs(1,0),
timeval_current_ofs(1,0),
reopen_connection, state);
return;
}
@ -313,7 +313,7 @@ static void close_completed(struct smbcli_request *req)
DEBUG(2,("[%d] close completed %d (fnum[%d])\n",
state->client_num, state->close_file_num,
state->close_fnum));
}
}
static void echo_completion(struct smbcli_request *req)
{
@ -324,20 +324,20 @@ static void echo_completion(struct smbcli_request *req)
NT_STATUS_EQUAL(status, NT_STATUS_CONNECTION_RESET)) {
talloc_free(state->tree);
state->tree = NULL;
num_connected--;
num_connected--;
DEBUG(0,("[%u] reopening connection to %s\n",
state->client_num, state->dest_host));
talloc_free(state->te);
state->te = tevent_add_timer(state->ev, state->mem_ctx,
timeval_current_ofs(1,0),
timeval_current_ofs(1,0),
reopen_connection, state);
}
}
static void report_rate(struct tevent_context *ev, struct tevent_timer *te,
static void report_rate(struct tevent_context *ev, struct tevent_timer *te,
struct timeval t, void *private_data)
{
struct benchopen_state *state = talloc_get_type(private_data,
struct benchopen_state *state = talloc_get_type(private_data,
struct benchopen_state);
int i;
for (i=0;i<nprocs;i++) {
@ -368,7 +368,7 @@ static void report_rate(struct tevent_context *ev, struct tevent_timer *te,
}
}
/*
/*
benchmark open calls
*/
bool torture_bench_open(struct torture_context *torture)
@ -385,7 +385,7 @@ bool torture_bench_open(struct torture_context *torture)
bool progress=false;
progress = torture_setting_bool(torture, "progress", true);
nprocs = torture_setting_int(torture, "nprocs", 4);
state = talloc_zero_array(mem_ctx, struct benchopen_state, nprocs);
@ -413,9 +413,9 @@ bool torture_bench_open(struct torture_context *torture)
dest_port = get_sockaddr_port(dest_ss);
state[i].dest_host = talloc_strdup(state[i].mem_ctx, dest_str);
state[i].dest_ports = talloc_array(state[i].mem_ctx,
state[i].dest_ports = talloc_array(state[i].mem_ctx,
const char *, 2);
state[i].dest_ports[0] = talloc_asprintf(state[i].dest_ports,
state[i].dest_ports[0] = talloc_asprintf(state[i].dest_ports,
"%u", dest_port);
state[i].dest_ports[1] = NULL;
state[i].called_name = talloc_strdup(state[i].mem_ctx,
@ -442,7 +442,7 @@ bool torture_bench_open(struct torture_context *torture)
next_open(&state[i]);
}
tv = timeval_current();
tv = timeval_current();
if (progress) {
report_te = tevent_add_timer(torture->ev, state, timeval_current_ofs(1, 0),

View File

@ -1,18 +1,18 @@
/*
/*
Unix SMB/CIFS implementation.
basic raw test suite for oplocks
Copyright (C) Andrew Tridgell 2003
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -102,8 +102,8 @@ static bool oplock_handler_ack_to_given(struct smbcli_transport *transport,
/*
a handler function for oplock break requests. Ack it as a break to none
*/
static bool oplock_handler_ack_to_none(struct smbcli_transport *transport,
uint16_t tid, uint16_t fnum,
static bool oplock_handler_ack_to_none(struct smbcli_transport *transport,
uint16_t tid, uint16_t fnum,
uint8_t level, void *private_data)
{
struct smbcli_tree *tree = (struct smbcli_tree *)private_data;
@ -144,7 +144,7 @@ static void oplock_handler_close_recv(struct smbcli_request *req)
/*
a handler function for oplock break requests - close the file
*/
static bool oplock_handler_close(struct smbcli_transport *transport, uint16_t tid,
static bool oplock_handler_close(struct smbcli_transport *transport, uint16_t tid,
uint16_t fnum, uint8_t level, void *private_data)
{
union smb_close io;
@ -1222,8 +1222,8 @@ static bool test_raw_oplock_batch1(struct torture_context *tctx, struct smbcli_s
*/
torture_comment(tctx, "BATCH1: open with batch oplock\n");
ZERO_STRUCT(break_info);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
status = smb_raw_open(cli1->tree, tctx, &io);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
@ -1305,8 +1305,8 @@ static bool test_raw_oplock_batch2(struct torture_context *tctx, struct smbcli_s
torture_comment(tctx, "BATCH2: open with batch oplock\n");
ZERO_STRUCT(break_info);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
status = smb_raw_open(cli1->tree, tctx, &io);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
@ -1385,8 +1385,8 @@ static bool test_raw_oplock_batch3(struct torture_context *tctx, struct smbcli_s
torture_comment(tctx, "BATCH3: if we close on break then the unlink can succeed\n");
ZERO_STRUCT(break_info);
smbcli_oplock_handler(cli1->transport, oplock_handler_close, cli1->tree);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
status = smb_raw_open(cli1->tree, tctx, &io);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
@ -1451,8 +1451,8 @@ static bool test_raw_oplock_batch4(struct torture_context *tctx, struct smbcli_s
ZERO_STRUCT(break_info);
smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
status = smb_raw_open(cli1->tree, tctx, &io);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
@ -1517,8 +1517,8 @@ static bool test_raw_oplock_batch5(struct torture_context *tctx, struct smbcli_s
ZERO_STRUCT(break_info);
smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
status = smb_raw_open(cli1->tree, tctx, &io);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
@ -1585,8 +1585,8 @@ static bool test_raw_oplock_batch6(struct torture_context *tctx, struct smbcli_s
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_READ | SEC_RIGHTS_FILE_WRITE;
io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ | NTCREATEX_SHARE_ACCESS_WRITE;
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
status = smb_raw_open(cli1->tree, tctx, &io);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
@ -1666,8 +1666,8 @@ static bool test_raw_oplock_batch7(struct torture_context *tctx, struct smbcli_s
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_NONE;
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
status = smb_raw_open(cli1->tree, tctx, &io);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
@ -1676,8 +1676,8 @@ static bool test_raw_oplock_batch7(struct torture_context *tctx, struct smbcli_s
ZERO_STRUCT(break_info);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
status = smb_raw_open(cli2->tree, tctx, &io);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
@ -1735,8 +1735,8 @@ static bool test_raw_oplock_batch8(struct torture_context *tctx, struct smbcli_s
ZERO_STRUCT(break_info);
smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
status = smb_raw_open(cli1->tree, tctx, &io);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
@ -1746,8 +1746,8 @@ static bool test_raw_oplock_batch8(struct torture_context *tctx, struct smbcli_s
ZERO_STRUCT(break_info);
torture_comment(tctx, "second open with attributes only shouldn't cause oplock break\n");
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
io.ntcreatex.in.access_mask = SEC_FILE_READ_ATTRIBUTE|SEC_FILE_WRITE_ATTRIBUTE|SEC_STD_SYNCHRONIZE;
status = smb_raw_open(cli2->tree, tctx, &io);
@ -1803,8 +1803,8 @@ static bool test_raw_oplock_batch9(struct torture_context *tctx, struct smbcli_s
torture_comment(tctx, "BATCH9: open with attributes only can create file\n");
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
io.ntcreatex.in.access_mask = SEC_FILE_READ_ATTRIBUTE|SEC_FILE_WRITE_ATTRIBUTE|SEC_STD_SYNCHRONIZE;
io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE;
@ -1818,8 +1818,8 @@ static bool test_raw_oplock_batch9(struct torture_context *tctx, struct smbcli_s
ZERO_STRUCT(break_info);
smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
@ -1838,8 +1838,8 @@ static bool test_raw_oplock_batch9(struct torture_context *tctx, struct smbcli_s
ZERO_STRUCT(break_info);
smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
smbcli_oplock_handler(cli2->transport, oplock_handler_ack_to_given, cli2->tree);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
@ -2056,7 +2056,7 @@ static bool test_raw_oplock_batch10(struct torture_context *tctx, struct smbcli_
smbcli_oplock_handler(cli2->transport, oplock_handler_ack_to_given, cli2->tree);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ|
@ -2290,8 +2290,8 @@ static bool test_raw_oplock_batch13(struct torture_context *tctx, struct smbcli_
torture_comment(tctx, "BATCH13: open with batch oplock\n");
ZERO_STRUCT(break_info);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ|
NTCREATEX_SHARE_ACCESS_WRITE|
@ -2305,8 +2305,8 @@ static bool test_raw_oplock_batch13(struct torture_context *tctx, struct smbcli_
torture_comment(tctx, "second open with attributes only and NTCREATEX_DISP_OVERWRITE disposition causes oplock break\n");
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
io.ntcreatex.in.access_mask = SEC_FILE_READ_ATTRIBUTE|SEC_FILE_WRITE_ATTRIBUTE|SEC_STD_SYNCHRONIZE;
io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ|
@ -2366,8 +2366,8 @@ static bool test_raw_oplock_batch14(struct torture_context *tctx, struct smbcli_
torture_comment(tctx, "BATCH14: open with batch oplock\n");
ZERO_STRUCT(break_info);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ|
NTCREATEX_SHARE_ACCESS_WRITE|
@ -2381,8 +2381,8 @@ static bool test_raw_oplock_batch14(struct torture_context *tctx, struct smbcli_
torture_comment(tctx, "second open with attributes only and NTCREATEX_DISP_SUPERSEDE disposition causes oplock break\n");
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
io.ntcreatex.in.access_mask = SEC_FILE_READ_ATTRIBUTE|SEC_FILE_WRITE_ATTRIBUTE|SEC_STD_SYNCHRONIZE;
io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ|
@ -4483,7 +4483,7 @@ bool torture_bench_oplock(struct torture_context *torture)
return false;
}
talloc_steal(mem_ctx, cli[i]);
smbcli_oplock_handler(cli[i]->transport, oplock_handler_close,
smbcli_oplock_handler(cli[i]->transport, oplock_handler_close,
cli[i]->tree);
}
@ -4503,11 +4503,11 @@ bool torture_bench_oplock(struct torture_context *torture)
io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
io.ntcreatex.in.security_flags = 0;
io.ntcreatex.in.fname = BASEDIR "\\test.dat";
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
tv = timeval_current();
tv = timeval_current();
/*
we open the same file with SHARE_ACCESS_NONE from all the
@ -4536,7 +4536,7 @@ bool torture_bench_oplock(struct torture_context *torture)
torture_comment(torture, "%.2f ops/second\n", count/timeval_elapsed(&tv));
smb_raw_exit(cli[torture_nprocs-1]->session);
done:
smb_raw_exit(cli[0]->session);
smbcli_deltree(cli[0]->tree, BASEDIR);
@ -4573,8 +4573,8 @@ static struct hold_oplock_info {
},
};
static bool oplock_handler_hold(struct smbcli_transport *transport,
uint16_t tid, uint16_t fnum, uint8_t level,
static bool oplock_handler_hold(struct smbcli_transport *transport,
uint16_t tid, uint16_t fnum, uint8_t level,
void *private_data)
{
struct smbcli_tree *tree = (struct smbcli_tree *)private_data;
@ -4605,11 +4605,11 @@ static bool oplock_handler_hold(struct smbcli_transport *transport,
}
/*
/*
used for manual testing of oplocks - especially interaction with
other filesystems (such as NFS and local access)
*/
bool torture_hold_oplock(struct torture_context *torture,
bool torture_hold_oplock(struct torture_context *torture,
struct smbcli_state *cli)
{
struct tevent_context *ev = torture->ev;
@ -4638,21 +4638,21 @@ bool torture_hold_oplock(struct torture_context *torture,
io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
io.ntcreatex.in.security_flags = 0;
io.ntcreatex.in.fname = hold_info[i].fname;
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
printf("opening %s\n", hold_info[i].fname);
status = smb_raw_open(cli->tree, cli, &io);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to open %s - %s\n",
printf("Failed to open %s - %s\n",
hold_info[i].fname, nt_errstr(status));
return false;
}
if (io.ntcreatex.out.oplock_level != BATCH_OPLOCK_RETURN) {
printf("Oplock not granted for %s - expected %d but got %d\n",
hold_info[i].fname, BATCH_OPLOCK_RETURN,
printf("Oplock not granted for %s - expected %d but got %d\n",
hold_info[i].fname, BATCH_OPLOCK_RETURN,
io.ntcreatex.out.oplock_level);
return false;
}

View File

@ -1,4 +1,4 @@
/*
/*
Unix SMB/CIFS implementation.
ping pong test
@ -7,17 +7,17 @@
Significantly based on and borrowed from lockbench.c by
Copyright (C) Andrew Tridgell 2006
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -133,7 +133,7 @@ static void write_byte(struct smbcli_state *cli, int fd, uint8_t c, int offset)
printf("write failed\n");
exit(1);
}
}
}
static void read_byte(struct smbcli_state *cli, int fd, uint8_t *c, int offset)
{
@ -154,9 +154,9 @@ static void read_byte(struct smbcli_state *cli, int fd, uint8_t *c, int offset)
printf("read failed\n");
exit(1);
}
}
}
/*
/*
ping pong
*/
bool torture_ping_pong(struct torture_context *torture)
@ -218,7 +218,7 @@ bool torture_ping_pong(struct torture_context *torture)
uint8_t c;
read_byte(cli, fd, &c, i);
incr = c-val[i];
val[i] = c;
val[i] = c;
}
if (do_writes) {
@ -236,7 +236,7 @@ bool torture_ping_pong(struct torture_context *torture)
fflush(stdout);
}
if (timeval_elapsed(&start) > 1.0) {
printf("%8u locks/sec\r",
printf("%8u locks/sec\r",
(unsigned)(2*count/timeval_elapsed(&start)));
fflush(stdout);
start = timeval_current();
@ -245,4 +245,3 @@ bool torture_ping_pong(struct torture_context *torture)
loops++;
}
}

View File

@ -1,19 +1,19 @@
/*
/*
Unix SMB/CIFS implementation.
RAW_FILEINFO_* individual test suite
Copyright (C) Andrew Tridgell 2003
Copyright (C) Andrew Bartlett <abartlet@samba.org> 2007
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -314,7 +314,7 @@ static union smb_fileinfo *fnum_find(const char *name)
int i;
for (i=0; levels[i].name; i++) {
if (NT_STATUS_IS_OK(levels[i].fnum_status) &&
strcmp(name, levels[i].name) == 0 &&
strcmp(name, levels[i].name) == 0 &&
!levels[i].only_paths) {
return &levels[i].fnum_finfo;
}
@ -333,7 +333,7 @@ static union smb_fileinfo *fname_find(bool is_ipc, const char *name)
}
for (i=0; levels[i].name; i++) {
if (NT_STATUS_IS_OK(levels[i].fname_status) &&
strcmp(name, levels[i].name) == 0 &&
strcmp(name, levels[i].name) == 0 &&
!levels[i].only_handles) {
return &levels[i].fname_finfo;
}
@ -367,7 +367,7 @@ static union smb_fileinfo *fname_find(bool is_ipc, const char *name)
ret = false; \
}} while(0)
/* used to find hints on unknown values - and to make sure
/* used to find hints on unknown values - and to make sure
we zero-fill */
#if 0 /* unused */
#define VAL_UNKNOWN(n1, v1) do {if (s1->n1.out.v1 != 0) { \
@ -380,20 +380,20 @@ static union smb_fileinfo *fname_find(bool is_ipc, const char *name)
}} while(0)
#endif
/* basic testing of all RAW_FILEINFO_* calls
for each call we test that it succeeds, and where possible test
for consistency between the calls.
/* basic testing of all RAW_FILEINFO_* calls
for each call we test that it succeeds, and where possible test
for consistency between the calls.
*/
static bool torture_raw_qfileinfo_internals(struct torture_context *torture,
TALLOC_CTX *mem_ctx,
struct smbcli_tree *tree,
static bool torture_raw_qfileinfo_internals(struct torture_context *torture,
TALLOC_CTX *mem_ctx,
struct smbcli_tree *tree,
int fnum, const char *fname,
bool is_ipc)
{
size_t i;
bool ret = true;
size_t count;
union smb_fileinfo *s1, *s2;
union smb_fileinfo *s1, *s2;
NTTIME correct_time;
uint64_t correct_size;
uint32_t correct_attrib;
@ -405,14 +405,14 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture,
if (!levels[i].only_paths) {
levels[i].fnum_finfo.generic.level = levels[i].level;
levels[i].fnum_finfo.generic.in.file.fnum = fnum;
levels[i].fnum_status = smb_raw_fileinfo(tree, mem_ctx,
levels[i].fnum_status = smb_raw_fileinfo(tree, mem_ctx,
&levels[i].fnum_finfo);
}
if (!levels[i].only_handles) {
levels[i].fname_finfo.generic.level = levels[i].level;
levels[i].fname_finfo.generic.in.file.path = talloc_strdup(mem_ctx, fname);
levels[i].fname_status = smb_raw_pathinfo(tree, mem_ctx,
levels[i].fname_status = smb_raw_pathinfo(tree, mem_ctx,
&levels[i].fname_finfo);
}
}
@ -435,7 +435,7 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture,
nt_errstr(levels[i].fname_status));
continue;
} else if (!levels[i].only_handles && !NT_STATUS_EQUAL(NT_STATUS_INVALID_DEVICE_REQUEST, levels[i].fname_status)) {
printf("ERROR: fname level %s failed, expected NT_STATUS_INVALID_DEVICE_REQUEST - %s\n",
printf("ERROR: fname level %s failed, expected NT_STATUS_INVALID_DEVICE_REQUEST - %s\n",
levels[i].name, nt_errstr(levels[i].fname_status));
count++;
}
@ -450,8 +450,8 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture,
continue;
}
if (!levels[i].only_paths && !NT_STATUS_EQUAL(levels[i].expected_ipc_fnum_status, levels[i].fnum_status)) {
printf("ERROR: fnum level %s failed, expected %s - %s\n",
levels[i].name, nt_errstr(levels[i].expected_ipc_fnum_status),
printf("ERROR: fnum level %s failed, expected %s - %s\n",
levels[i].name, nt_errstr(levels[i].expected_ipc_fnum_status),
nt_errstr(levels[i].fnum_status));
count++;
}
@ -479,17 +479,17 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture,
}
if (!levels[i].only_paths && !NT_STATUS_IS_OK(levels[i].fnum_status)) {
printf("ERROR: fnum level %s failed - %s\n",
printf("ERROR: fnum level %s failed - %s\n",
levels[i].name, nt_errstr(levels[i].fnum_status));
count++;
}
if (!levels[i].only_handles && !NT_STATUS_IS_OK(levels[i].fname_status)) {
printf("ERROR: fname level %s failed - %s\n",
printf("ERROR: fname level %s failed - %s\n",
levels[i].name, nt_errstr(levels[i].fname_status));
count++;
}
}
}
if (count != 0) {
@ -508,13 +508,13 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture,
s1 ? s1->stream_info.out.num_streams : -1);
}
skip_streams = true;
}
}
/* this code is incredibly repititive but doesn't lend itself to loops, so
we use lots of macros to make it less painful */
/* first off we check the levels that are supposed to be aliases. It will be quite rare for
/* first off we check the levels that are supposed to be aliases. It will be quite rare for
this code to fail, but we need to check it for completeness */
@ -712,7 +712,7 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture,
s1 = fnum_find("STANDARD_INFO");
correct_size = s1->standard_info.out.size;
torture_comment(torture, "size: %u\n", (unsigned int)correct_size);
SIZE_CHECK("GETATTR", getattr, size);
SIZE_CHECK("GETATTRE", getattre, size);
SIZE_CHECK("STANDARD", standard, size);
@ -733,7 +733,7 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture,
s1 = fnum_find("STANDARD_INFO");
correct_size = s1->standard_info.out.alloc_size;
torture_comment(torture, "alloc_size: %u\n", (unsigned int)correct_size);
SIZE_CHECK("GETATTRE", getattre, alloc_size);
SIZE_CHECK("STANDARD", standard, alloc_size);
SIZE_CHECK("EA_SIZE", ea_size, alloc_size);
@ -766,7 +766,7 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture,
s1 = fnum_find("BASIC_INFO");
correct_attrib = s1->basic_info.out.attrib;
torture_comment(torture, "attrib: 0x%x\n", (unsigned int)correct_attrib);
ATTRIB_CHECK("GETATTR", getattr, attrib);
if (!is_ipc) {
ATTRIB_CHECK("GETATTRE", getattre, attrib);
@ -810,7 +810,7 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture,
if (s1 && s1->all_info.out.fname.s) {
char *p = strrchr(s1->all_info.out.fname.s, '\\');
if (!p) {
printf("Not a full path in all_info/fname? - '%s'\n",
printf("Not a full path in all_info/fname? - '%s'\n",
s1->all_info.out.fname.s);
ret = false;
} else {
@ -835,40 +835,40 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture,
torture_comment(torture, "no alternate name information\n");
} else {
torture_comment(torture, "alt_name: %s\n", correct_name);
NAME_CHECK("ALT_NAME_INFO", alt_name_info, fname, STR_UNICODE);
NAME_CHECK("ALT_NAME_INFORMATION", alt_name_info, fname, STR_UNICODE);
/* and make sure we can open by alternate name */
smbcli_close(tree, fnum);
fnum = smbcli_nt_create_full(tree, correct_name, 0,
fnum = smbcli_nt_create_full(tree, correct_name, 0,
SEC_RIGHTS_FILE_ALL,
FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_DELETE|
NTCREATEX_SHARE_ACCESS_READ|
NTCREATEX_SHARE_ACCESS_WRITE,
NTCREATEX_DISP_OVERWRITE_IF,
NTCREATEX_SHARE_ACCESS_WRITE,
NTCREATEX_DISP_OVERWRITE_IF,
0, 0);
if (fnum == -1) {
printf("Unable to open by alt_name - %s\n", smbcli_errstr(tree));
ret = false;
}
if (!skip_streams) {
correct_name = "::$DATA";
torture_comment(torture, "stream_name: %s\n", correct_name);
NAME_CHECK("STREAM_INFO", stream_info, streams[0].stream_name, STR_UNICODE);
NAME_CHECK("STREAM_INFORMATION", stream_info, streams[0].stream_name, STR_UNICODE);
}
}
/* make sure the EAs look right */
s1 = fnum_find("ALL_EAS");
s2 = fnum_find("ALL_INFO");
if (s1) {
for (i=0;i<s1->all_eas.out.num_eas;i++) {
printf(" flags=%d %s=%*.*s\n",
printf(" flags=%d %s=%*.*s\n",
s1->all_eas.out.eas[i].flags,
s1->all_eas.out.eas[i].name.s,
(int)s1->all_eas.out.eas[i].value.length,
@ -883,7 +883,7 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture,
s2->all_info.out.ea_size);
}
} else {
if (s2->all_info.out.ea_size !=
if (s2->all_info.out.ea_size !=
ea_list_size(s1->all_eas.out.num_eas, s1->all_eas.out.eas)) {
printf("ERROR: ea_list_size=%d != fnum all_info.out.ea_size=%d\n",
(int)ea_list_size(s1->all_eas.out.num_eas, s1->all_eas.out.eas),
@ -931,11 +931,11 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture,
ret = false; \
}} while (0)
VAL_CHECK("STANDARD_INFO", standard_info, delete_pending,
VAL_CHECK("STANDARD_INFO", standard_info, delete_pending,
"ALL_INFO", all_info, delete_pending);
VAL_CHECK("STANDARD_INFO", standard_info, directory,
VAL_CHECK("STANDARD_INFO", standard_info, directory,
"ALL_INFO", all_info, directory);
VAL_CHECK("STANDARD_INFO", standard_info, nlink,
VAL_CHECK("STANDARD_INFO", standard_info, nlink,
"ALL_INFO", all_info, nlink);
s1 = fnum_find("BASIC_INFO");
if (s1 && is_ipc) {
@ -955,10 +955,10 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture,
ret = false;
}
}
VAL_CHECK("EA_INFO", ea_info, ea_size,
VAL_CHECK("EA_INFO", ea_info, ea_size,
"ALL_INFO", all_info, ea_size);
if (!is_ipc) {
VAL_CHECK("EA_SIZE", ea_size, ea_size,
VAL_CHECK("EA_SIZE", ea_size, ea_size,
"ALL_INFO", all_info, ea_size);
}
@ -1008,18 +1008,18 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture,
}} while (0)
#endif
/* now get a bit fancier .... */
/* when we set the delete disposition then the link count should drop
to 0 and delete_pending should be 1 */
return ret;
}
/* basic testing of all RAW_FILEINFO_* calls
for each call we test that it succeeds, and where possible test
for consistency between the calls.
/* basic testing of all RAW_FILEINFO_* calls
for each call we test that it succeeds, and where possible test
for consistency between the calls.
*/
bool torture_raw_qfileinfo(struct torture_context *torture,
bool torture_raw_qfileinfo(struct torture_context *torture,
struct smbcli_state *cli)
{
int fnum;
@ -1033,14 +1033,14 @@ bool torture_raw_qfileinfo(struct torture_context *torture,
}
ret = torture_raw_qfileinfo_internals(torture, torture, cli->tree, fnum, fname, false /* is_ipc */);
smbcli_close(cli->tree, fnum);
smbcli_unlink(cli->tree, fname);
return ret;
}
bool torture_raw_qfileinfo_pipe(struct torture_context *torture,
bool torture_raw_qfileinfo_pipe(struct torture_context *torture,
struct smbcli_state *cli)
{
bool ret = true;

View File

@ -1,18 +1,18 @@
/*
/*
Unix SMB/CIFS implementation.
RAW_QFS_* individual test suite
Copyright (C) Andrew Tridgell 2003
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -146,7 +146,7 @@ static union smb_fsinfo *find(const char *name)
ret = false; \
}} while(0)
/* used to find hints on unknown values - and to make sure
/* used to find hints on unknown values - and to make sure
we zero-fill */
#define VAL_UNKNOWN(n1, v1) do {if (s1->n1.out.v1 != 0) { \
printf("%s/%s non-zero unknown - %u (0x%x) at %s(%d)\n", \
@ -157,20 +157,20 @@ static union smb_fsinfo *find(const char *name)
ret = false; \
}} while(0)
/* basic testing of all RAW_QFS_* calls
for each call we test that it succeeds, and where possible test
for consistency between the calls.
/* basic testing of all RAW_QFS_* calls
for each call we test that it succeeds, and where possible test
for consistency between the calls.
Some of the consistency tests assume that the target filesystem is
quiescent, which is sometimes hard to achieve
*/
bool torture_raw_qfsinfo(struct torture_context *torture,
bool torture_raw_qfsinfo(struct torture_context *torture,
struct smbcli_state *cli)
{
size_t i;
bool ret = true;
size_t count;
union smb_fsinfo *s1, *s2;
union smb_fsinfo *s1, *s2;
/* scan all the levels, pulling the results */
for (i=0; levels[i].name; i++) {
@ -186,9 +186,9 @@ bool torture_raw_qfsinfo(struct torture_context *torture,
if ((cap & levels[i].capability_mask) != levels[i].capability_mask) {
continue;
}
if (!NT_STATUS_IS_OK(levels[i].status)) {
printf("ERROR: level %s failed - %s\n",
printf("ERROR: level %s failed - %s\n",
levels[i].name, nt_errstr(levels[i].status));
count++;
}
@ -207,14 +207,14 @@ bool torture_raw_qfsinfo(struct torture_context *torture,
VAL_APPROX_EQUAL(size_info, avail_alloc_units, size_info, avail_alloc_units);
VAL_EQUAL(size_info, sectors_per_unit, size_info, sectors_per_unit);
VAL_EQUAL(size_info, bytes_per_sector, size_info, bytes_per_sector);
}
}
s1 = find("DEVICE_INFO");
s2 = find("DEVICE_INFORMATION");
if (s1 && s2) {
VAL_EQUAL(device_info, device_type, device_info, device_type);
VAL_EQUAL(device_info, characteristics, device_info, characteristics);
}
}
s1 = find("VOLUME_INFO");
s2 = find("VOLUME_INFORMATION");
@ -223,18 +223,18 @@ bool torture_raw_qfsinfo(struct torture_context *torture,
VAL_EQUAL (volume_info, serial_number, volume_info, serial_number);
STR_EQUAL (volume_info, volume_name.s, volume_info, volume_name.s);
torture_comment(torture, "volume_info.volume_name = '%s'\n", s1->volume_info.out.volume_name.s);
}
}
s1 = find("ATTRIBUTE_INFO");
s2 = find("ATTRIBUTE_INFORMATION");
if (s1 && s2) {
VAL_EQUAL(attribute_info, fs_attr,
VAL_EQUAL(attribute_info, fs_attr,
attribute_info, fs_attr);
VAL_EQUAL(attribute_info, max_file_component_length,
VAL_EQUAL(attribute_info, max_file_component_length,
attribute_info, max_file_component_length);
STR_EQUAL(attribute_info, fs_type.s, attribute_info, fs_type.s);
torture_comment(torture, "attribute_info.fs_type = '%s'\n", s1->attribute_info.out.fs_type.s);
}
}
torture_comment(torture, "check for consistent disk sizes\n");
s1 = find("DSKATTR");
@ -242,16 +242,16 @@ bool torture_raw_qfsinfo(struct torture_context *torture,
if (s1 && s2) {
double size1, size2;
double scale = s1->dskattr.out.blocks_per_unit * s1->dskattr.out.block_size;
size1 = 1.0 *
s1->dskattr.out.units_total *
s1->dskattr.out.blocks_per_unit *
size1 = 1.0 *
s1->dskattr.out.units_total *
s1->dskattr.out.blocks_per_unit *
s1->dskattr.out.block_size / scale;
size2 = 1.0 *
s2->allocation.out.sectors_per_unit *
s2->allocation.out.total_alloc_units *
s2->allocation.out.bytes_per_sector / scale;
if (fabs(size1 - size2) > 1) {
printf("Inconsistent total size in DSKATTR and ALLOCATION - size1=%.0f size2=%.0f\n",
printf("Inconsistent total size in DSKATTR and ALLOCATION - size1=%.0f size2=%.0f\n",
size1, size2);
ret = false;
}
@ -264,29 +264,29 @@ bool torture_raw_qfsinfo(struct torture_context *torture,
if (s1 && s2) {
double size1, size2;
double scale = s1->dskattr.out.blocks_per_unit * s1->dskattr.out.block_size;
size1 = 1.0 *
s1->dskattr.out.units_free *
s1->dskattr.out.blocks_per_unit *
size1 = 1.0 *
s1->dskattr.out.units_free *
s1->dskattr.out.blocks_per_unit *
s1->dskattr.out.block_size / scale;
size2 = 1.0 *
s2->allocation.out.sectors_per_unit *
s2->allocation.out.avail_alloc_units *
s2->allocation.out.bytes_per_sector / scale;
if (fabs(size1 - size2) > 1) {
printf("Inconsistent avail size in DSKATTR and ALLOCATION - size1=%.0f size2=%.0f\n",
printf("Inconsistent avail size in DSKATTR and ALLOCATION - size1=%.0f size2=%.0f\n",
size1, size2);
ret = false;
}
torture_comment(torture, "free disk = %.0f MB\n", size1*scale/1.0e6);
}
torture_comment(torture, "volume info consistency\n");
s1 = find("VOLUME");
s2 = find("VOLUME_INFO");
if (s1 && s2) {
VAL_EQUAL(volume, serial_number, volume_info, serial_number);
STR_EQUAL(volume, volume_name.s, volume_info, volume_name.s);
}
}
/* disk size consistency - notice that 'avail_alloc_units' maps to the caller
available allocation units, not the total */
@ -297,7 +297,7 @@ bool torture_raw_qfsinfo(struct torture_context *torture,
VAL_APPROX_EQUAL(size_info, avail_alloc_units, full_size_information, call_avail_alloc_units);
VAL_EQUAL(size_info, sectors_per_unit, full_size_information, sectors_per_unit);
VAL_EQUAL(size_info, bytes_per_sector, full_size_information, bytes_per_sector);
}
}
printf("check for non-zero unknown fields\n");
s1 = find("QUOTA_INFORMATION");
@ -329,7 +329,7 @@ bool torture_raw_qfsinfo(struct torture_context *torture,
}} while (0)
torture_comment(torture, "check for correct termination\n");
STR_CHECK("VOLUME", volume, volume_name, 0);
STR_CHECK("VOLUME_INFO", volume_info, volume_name, STR_UNICODE);
STR_CHECK("VOLUME_INFORMATION", volume_info, volume_name, STR_UNICODE);

View File

@ -1,18 +1,18 @@
/*
/*
Unix SMB/CIFS implementation.
SMB torture tester
Copyright (C) Jelmer Vernooij 2006
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

View File

@ -1,18 +1,18 @@
/*
/*
Unix SMB/CIFS implementation.
test suite for various read operations
Copyright (C) Andrew Tridgell 2003
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -201,7 +201,7 @@ static bool test_read(struct torture_context *tctx, struct smbcli_state *cli)
io.read.in.count = ~0;
status = smb_raw_read(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
done:
smbcli_close(cli->tree, fnum);
@ -214,7 +214,7 @@ done:
/*
test lockread ops
*/
static bool test_lockread(struct torture_context *tctx,
static bool test_lockread(struct torture_context *tctx,
struct smbcli_state *cli)
{
union smb_read io;
@ -238,7 +238,7 @@ static bool test_lockread(struct torture_context *tctx,
printf("Testing RAW_READ_LOCKREAD\n");
io.generic.level = RAW_READ_LOCKREAD;
fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
@ -351,7 +351,7 @@ static bool test_lockread(struct torture_context *tctx,
io.lockread.in.count = ~0;
status = smb_raw_read(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
done:
smbcli_close(cli->tree, fnum);
@ -382,7 +382,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli)
torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR);
printf("Testing RAW_READ_READX\n");
fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
@ -657,7 +657,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli)
io.readx.in.mincnt = 100;
io.readx.in.maxcnt = 200;
status = smb_raw_read(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
if (!(cli->transport->negotiate.capabilities & CAP_LARGE_FILES)) {
printf("skipping large file tests - CAP_LARGE_FILES not set\n");
@ -694,7 +694,7 @@ done:
/*
test readbraw ops
*/
static bool test_readbraw(struct torture_context *tctx,
static bool test_readbraw(struct torture_context *tctx,
struct smbcli_state *cli)
{
union smb_read io;
@ -717,7 +717,7 @@ static bool test_readbraw(struct torture_context *tctx,
torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR);
printf("Testing RAW_READ_READBRAW\n");
fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
@ -870,7 +870,7 @@ done:
/*
test read for execute
*/
static bool test_read_for_execute(struct torture_context *tctx,
static bool test_read_for_execute(struct torture_context *tctx,
struct smbcli_state *cli)
{
union smb_open op;
@ -1021,7 +1021,7 @@ done:
}
/*
/*
basic testing of read calls
*/
struct torture_suite *torture_raw_read(TALLOC_CTX *mem_ctx)
@ -1032,7 +1032,7 @@ struct torture_suite *torture_raw_read(TALLOC_CTX *mem_ctx)
torture_suite_add_1smb_test(suite, "readx", test_readx);
torture_suite_add_1smb_test(suite, "lockread", test_lockread);
torture_suite_add_1smb_test(suite, "readbraw", test_readbraw);
torture_suite_add_1smb_test(suite, "read for execute",
torture_suite_add_1smb_test(suite, "read for execute",
test_read_for_execute);
return suite;

View File

@ -1,18 +1,18 @@
/*
/*
Unix SMB/CIFS implementation.
rename test suite
Copyright (C) Andrew Tridgell 2003
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -44,7 +44,7 @@
/*
test SMBmv ops
*/
static bool test_mv(struct torture_context *tctx,
static bool test_mv(struct torture_context *tctx,
struct smbcli_state *cli)
{
union smb_rename io;
@ -69,8 +69,8 @@ static bool test_mv(struct torture_context *tctx,
op.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
op.ntcreatex.in.create_options = 0;
op.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
op.ntcreatex.in.share_access =
NTCREATEX_SHARE_ACCESS_READ |
op.ntcreatex.in.share_access =
NTCREATEX_SHARE_ACCESS_READ |
NTCREATEX_SHARE_ACCESS_WRITE;
op.ntcreatex.in.alloc_size = 0;
op.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF;
@ -86,7 +86,7 @@ static bool test_mv(struct torture_context *tctx,
io.rename.in.pattern1 = fname1;
io.rename.in.pattern2 = fname2;
io.rename.in.attrib = 0;
torture_comment(tctx, "trying rename while first file open\n");
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
@ -94,8 +94,8 @@ static bool test_mv(struct torture_context *tctx,
smbcli_close(cli->tree, fnum);
op.ntcreatex.in.access_mask = SEC_FILE_READ_DATA;
op.ntcreatex.in.share_access =
NTCREATEX_SHARE_ACCESS_DELETE |
op.ntcreatex.in.share_access =
NTCREATEX_SHARE_ACCESS_DELETE |
NTCREATEX_SHARE_ACCESS_READ |
NTCREATEX_SHARE_ACCESS_WRITE;
status = smb_raw_open(cli->tree, tctx, &op);
@ -134,7 +134,7 @@ static bool test_mv(struct torture_context *tctx,
smb_raw_exit(cli->session);
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
torture_comment(tctx, "Trying self rename\n");
io.rename.in.pattern1 = fname2;
io.rename.in.pattern2 = fname2;
@ -238,7 +238,7 @@ done:
/*
test SMBntrename ops
*/
static bool test_ntrename(struct torture_context *tctx,
static bool test_ntrename(struct torture_context *tctx,
struct smbcli_state *cli)
{
union smb_rename io;
@ -256,17 +256,17 @@ static bool test_ntrename(struct torture_context *tctx,
torture_comment(tctx, "Trying simple rename\n");
fnum = create_complex_file(cli, tctx, fname1);
io.generic.level = RAW_RENAME_NTRENAME;
io.ntrename.in.old_name = fname1;
io.ntrename.in.new_name = fname2;
io.ntrename.in.attrib = 0;
io.ntrename.in.cluster_size = 0;
io.ntrename.in.flags = RENAME_FLAG_RENAME;
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
smbcli_close(cli->tree, fnum);
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
@ -285,7 +285,7 @@ static bool test_ntrename(struct torture_context *tctx,
torture_comment(tctx, "trying wildcard rename\n");
io.ntrename.in.old_name = BASEDIR "\\*.txt";
io.ntrename.in.new_name = fname1;
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_SYNTAX_BAD);
@ -449,7 +449,7 @@ static bool test_ntrename(struct torture_context *tctx,
torture_all_info(cli->tree, fname1);
torture_all_info(cli->tree, fname2);
}
io.ntrename.in.flags = RENAME_FLAG_MOVE_CLUSTER_INFORMATION;
status = smb_raw_rename(cli->tree, &io);
@ -493,7 +493,7 @@ static bool test_ntrename(struct torture_context *tctx,
}
}
}
done:
smb_raw_exit(cli->session);
smbcli_deltree(cli->tree, BASEDIR);
@ -581,7 +581,7 @@ static bool test_dir_rename(struct torture_context *tctx, struct smbcli_state *c
ren_io.rename.in.pattern1 = dname1;
ren_io.rename.in.pattern2 = dname2;
ren_io.rename.in.attrib = 0;
status = smb_raw_rename(cli->tree, &ren_io);
CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
@ -672,7 +672,7 @@ done:
extern bool test_trans2rename(struct torture_context *tctx, struct smbcli_state *cli1, struct smbcli_state *cli2);
extern bool test_nttransrename(struct torture_context *tctx, struct smbcli_state *cli1);
/*
/*
basic testing of rename calls
*/
struct torture_suite *torture_raw_rename(TALLOC_CTX *mem_ctx)

View File

@ -1,18 +1,18 @@
/*
/*
Unix SMB/CIFS implementation.
Test samba3 hide unreadable/unwriteable
Copyright (C) Volker Lendecke 2006
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -33,11 +33,11 @@ static void init_unixinfo_nochange(union smb_setfileinfo *info)
info->unix_basic.in.end_of_file = SMB_SIZE_NO_CHANGE_HI;
info->unix_basic.in.end_of_file <<= 32;
info->unix_basic.in.end_of_file |= SMB_SIZE_NO_CHANGE_LO;
info->unix_basic.in.num_bytes = SMB_SIZE_NO_CHANGE_HI;
info->unix_basic.in.num_bytes <<= 32;
info->unix_basic.in.num_bytes |= SMB_SIZE_NO_CHANGE_LO;
info->unix_basic.in.status_change_time = SMB_TIME_NO_CHANGE_HI;
info->unix_basic.in.status_change_time <<= 32;
info->unix_basic.in.status_change_time |= SMB_TIME_NO_CHANGE_LO;
@ -260,7 +260,7 @@ bool torture_samba3_hide(struct torture_context *torture, struct smbcli_state *c
smbcli_chmod(cli->tree, fname, UNIX_R_USR|UNIX_W_USR);
smbcli_unlink(cli->tree, fname);
return true;
}
@ -287,29 +287,29 @@ bool torture_samba3_closeerr(struct torture_context *tctx, struct smbcli_state *
fnum = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR,
DENY_NONE);
torture_assert(tctx, fnum != -1,
torture_assert(tctx, fnum != -1,
talloc_asprintf(tctx, "smbcli_open failed: %s\n",
smbcli_errstr(cli->tree)));
smbcli_close(cli->tree, fnum);
fnum = smbcli_nt_create_full(cli->tree, fname, 0,
fnum = smbcli_nt_create_full(cli->tree, fname, 0,
SEC_RIGHTS_FILE_ALL,
FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_DELETE,
NTCREATEX_DISP_OPEN, 0, 0);
torture_assert(tctx, fnum != -1,
torture_assert(tctx, fnum != -1,
talloc_asprintf(tctx, "smbcli_open failed: %s\n",
smbcli_errstr(cli->tree)));
status = smbcli_nt_delete_on_close(cli->tree, fnum, true);
torture_assert_ntstatus_ok(tctx, status,
torture_assert_ntstatus_ok(tctx, status,
"setting delete_on_close on file failed !");
status = smbcli_chmod(cli->tree, dname, 0);
torture_assert_ntstatus_ok(tctx, status,
torture_assert_ntstatus_ok(tctx, status,
"smbcli_chmod on file failed !");
status = smbcli_close(cli->tree, fnum);
@ -321,6 +321,6 @@ bool torture_samba3_closeerr(struct torture_context *tctx, struct smbcli_state *
"smbcli_close");
result = true;
return result;
}

View File

@ -1,18 +1,18 @@
/*
/*
Unix SMB/CIFS implementation.
Test some misc Samba3 code paths
Copyright (C) Volker Lendecke 2006
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -173,7 +173,7 @@ bool torture_samba3_checkfsp(struct torture_context *torture, struct smbcli_stat
torture_assert_ntstatus_equal(torture, torture_second_tcon(torture, cli->session,
torture_setting_string(torture, "share", NULL),
&tree2),
&tree2),
NT_STATUS_OK,
"creating second tcon");
@ -458,7 +458,7 @@ bool torture_samba3_badpath(struct torture_context *torture)
torture_assert_goto(torture, torture_open_connection(&cli_dos, torture, 1), ret, fail, "Could not open DOS connection\n");
torture_assert_goto(torture, lpcfg_set_cmdline(torture->lp_ctx, "nt status support",
nt_status_support ? "yes":"no"),
nt_status_support ? "yes":"no"),
ret, fail, "Could not set 'nt status support' back to where it was\n");
torture_assert_goto(torture, lpcfg_set_cmdline(torture->lp_ctx, "client ntlmv2 auth",
client_ntlmv2_auth ? "yes":"no"),
@ -486,7 +486,7 @@ bool torture_samba3_badpath(struct torture_context *torture)
dirname));
CHECK_STATUS(torture, status, NT_STATUS_DOS(ERRDOS, ERRbadpath));
torture_assert_goto(torture, fpath = talloc_asprintf(mem_ctx, "%s\\%s", dirname, fname),
torture_assert_goto(torture, fpath = talloc_asprintf(mem_ctx, "%s\\%s", dirname, fname),
ret, fail, "Could not allocate fpath\n");
fnum = smbcli_open(cli_nt->tree, fpath, O_RDWR | O_CREAT, DENY_NONE);
@ -953,7 +953,7 @@ bool torture_samba3_rootdirfid(struct torture_context *tctx, struct smbcli_state
io.ntcreatex.in.create_options = 0;
io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
io.ntcreatex.in.fname = "\\";
torture_assert_ntstatus_equal_goto(tctx, smb_raw_open(cli->tree, tctx, &io),
torture_assert_ntstatus_equal_goto(tctx, smb_raw_open(cli->tree, tctx, &io),
NT_STATUS_OK,
ret, done, "smb_open on the directory failed: %s\n");

View File

@ -1,18 +1,18 @@
/*
/*
Unix SMB/CIFS implementation.
RAW_SEARCH_* individual test suite
Copyright (C) Andrew Tridgell 2003
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -63,9 +63,9 @@ static bool single_search_callback(void *private_data, const union smb_search_da
}
/*
do a single file (non-wildcard) search
do a single file (non-wildcard) search
*/
NTSTATUS torture_single_search(struct smbcli_state *cli,
NTSTATUS torture_single_search(struct smbcli_state *cli,
TALLOC_CTX *tctx,
const char *pattern,
enum smb_search_level level,
@ -112,7 +112,7 @@ NTSTATUS torture_single_search(struct smbcli_state *cli,
c.fclose.in.id = data->search.id;
status = smb_raw_search_close(cli->tree, &c);
}
return status;
}
@ -289,7 +289,7 @@ static union smb_search_data *find(const char *name)
{
int i;
for (i=0;i<ARRAY_SIZE(levels);i++) {
if (NT_STATUS_IS_OK(levels[i].status) &&
if (NT_STATUS_IS_OK(levels[i].status) &&
strcmp(levels[i].name, name) == 0) {
return &levels[i].data;
}
@ -346,7 +346,7 @@ static NTSTATUS setup_smb1_posix(struct torture_context *tctx,
return smb_raw_trans2(cli_unix->tree, tctx, &tp);
}
/*
/*
basic testing of all RAW_SEARCH_* calls using a single file
*/
static bool test_one_file(struct torture_context *tctx,
@ -430,7 +430,7 @@ static bool test_one_file(struct torture_context *tctx,
levels[i].data_level,
0,
&levels[i].data);
expected_status = NT_STATUS_NO_SUCH_FILE;
if (levels[i].level == RAW_SEARCH_SEARCH ||
levels[i].level == RAW_SEARCH_FFIRST ||
@ -441,7 +441,7 @@ static bool test_one_file(struct torture_context *tctx,
torture_result(tctx,
TORTURE_FAIL,
__location__"search level %s(%d) should fail with %s - %s\n",
levels[i].name, (int)levels[i].level,
levels[i].name, (int)levels[i].level,
nt_errstr(expected_status),
nt_errstr(status));
ret = false;
@ -575,7 +575,7 @@ static bool test_one_file(struct torture_context *tctx,
ret = false; \
} \
}} while (0)
/* check that all the results are as expected */
CHECK_VAL("SEARCH", search, attrib, all_info, all_info, attrib&0xFFF);
CHECK_VAL("STANDARD", standard, attrib, all_info, all_info, attrib&0xFFF);
@ -696,7 +696,7 @@ static bool multiple_search_callback(void *private_data, const union smb_search_
data->count++;
data->list = talloc_realloc(data->tctx,
data->list,
data->list,
union smb_search_data,
data->count);
@ -708,9 +708,9 @@ static bool multiple_search_callback(void *private_data, const union smb_search_
enum continue_type {CONT_FLAGS, CONT_NAME, CONT_RESUME_KEY};
/*
do a single file (non-wildcard) search
do a single file (non-wildcard) search
*/
static NTSTATUS multiple_search(struct smbcli_state *cli,
static NTSTATUS multiple_search(struct smbcli_state *cli,
TALLOC_CTX *tctx,
const char *pattern,
enum smb_search_data_level data_level,
@ -738,14 +738,14 @@ static NTSTATUS multiple_search(struct smbcli_state *cli,
io.t2ffirst.in.storage_type = 0;
io.t2ffirst.in.pattern = pattern;
if (cont_type == CONT_RESUME_KEY) {
io.t2ffirst.in.flags |= FLAG_TRANS2_FIND_REQUIRE_RESUME |
io.t2ffirst.in.flags |= FLAG_TRANS2_FIND_REQUIRE_RESUME |
FLAG_TRANS2_FIND_BACKUP_INTENT;
}
}
status = smb_raw_search_first(cli->tree, tctx,
&io, data, multiple_search_callback);
while (NT_STATUS_IS_OK(status)) {
if (data_level == RAW_SEARCH_DATA_SEARCH) {
@ -829,10 +829,10 @@ static int search_compare(union smb_search_data *d1, union smb_search_data *d2)
/*
/*
basic testing of search calls using many files
*/
static bool test_many_files(struct torture_context *tctx,
static bool test_many_files(struct torture_context *tctx,
struct smbcli_state *cli)
{
const int num_files = 700;
@ -897,11 +897,11 @@ static bool test_many_files(struct torture_context *tctx,
}
result.tctx = talloc_new(tctx);
torture_comment(tctx,
"Continue %s via %s\n", search_types[t].name, search_types[t].cont_name);
status = multiple_search(cli, tctx, BASEDIR "\\*.*",
status = multiple_search(cli, tctx, BASEDIR "\\*.*",
search_types[t].data_level,
search_types[t].cont_type,
&result);
@ -951,7 +951,7 @@ static bool check_result(struct multiple_result *result, const char *name, bool
}
if (i == result->count) {
if (exist) {
printf("failed: '%s' should exist with attribute %s\n",
printf("failed: '%s' should exist with attribute %s\n",
name, attrib_string(result->list, attrib));
return false;
}
@ -959,24 +959,24 @@ static bool check_result(struct multiple_result *result, const char *name, bool
}
if (!exist) {
printf("failed: '%s' should NOT exist (has attribute %s)\n",
printf("failed: '%s' should NOT exist (has attribute %s)\n",
name, attrib_string(result->list, result->list[i].both_directory_info.attrib));
return false;
}
if ((result->list[i].both_directory_info.attrib&0xFFF) != attrib) {
printf("failed: '%s' should have attribute 0x%x (has 0x%x)\n",
name,
name,
attrib, result->list[i].both_directory_info.attrib);
return false;
}
return true;
}
/*
/*
test what happens when the directory is modified during a search
*/
static bool test_modify_search(struct torture_context *tctx,
static bool test_modify_search(struct torture_context *tctx,
struct smbcli_state *cli)
{
const int num_files = 20;
@ -1021,7 +1021,7 @@ static bool test_modify_search(struct torture_context *tctx,
&io, &result, multiple_search_callback);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(result.count, 1);
printf("pulling the second file\n");
io2.t2fnext.level = RAW_SEARCH_TRANS2;
io2.t2fnext.data_level = RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO;
@ -1045,8 +1045,8 @@ static bool test_modify_search(struct torture_context *tctx,
smbcli_unlink(cli->tree, BASEDIR "\\T014-14.txt");
torture_set_file_attribute(cli->tree, BASEDIR "\\T015-15.txt", FILE_ATTRIBUTE_HIDDEN);
torture_set_file_attribute(cli->tree, BASEDIR "\\T016-16.txt", FILE_ATTRIBUTE_NORMAL);
torture_set_file_attribute(cli->tree, BASEDIR "\\T017-17.txt", FILE_ATTRIBUTE_SYSTEM);
torture_set_file_attribute(cli->tree, BASEDIR "\\T018-18.txt", 0);
torture_set_file_attribute(cli->tree, BASEDIR "\\T017-17.txt", FILE_ATTRIBUTE_SYSTEM);
torture_set_file_attribute(cli->tree, BASEDIR "\\T018-18.txt", 0);
sfinfo.generic.level = RAW_SFILEINFO_DISPOSITION_INFORMATION;
sfinfo.generic.in.file.fnum = fnum;
sfinfo.disposition_info.in.delete_on_close = 1;
@ -1079,8 +1079,8 @@ static bool test_modify_search(struct torture_context *tctx,
if (!ret) {
for (i=0;i<result.count;i++) {
printf("%s %s (0x%x)\n",
result.list[i].both_directory_info.name.s,
printf("%s %s (0x%x)\n",
result.list[i].both_directory_info.name.s,
attrib_string(tctx, result.list[i].both_directory_info.attrib),
result.list[i].both_directory_info.attrib);
}
@ -1094,7 +1094,7 @@ done:
}
/*
/*
testing if directories always come back sorted
*/
static bool test_sorted(struct torture_context *tctx, struct smbcli_state *cli)
@ -1125,10 +1125,10 @@ static bool test_sorted(struct torture_context *tctx, struct smbcli_state *cli)
ZERO_STRUCT(result);
result.tctx = tctx;
status = multiple_search(cli, tctx, BASEDIR "\\*.*",
status = multiple_search(cli, tctx, BASEDIR "\\*.*",
RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO,
CONT_NAME, &result);
CONT_NAME, &result);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(result.count, num_files);
@ -1137,7 +1137,7 @@ static bool test_sorted(struct torture_context *tctx, struct smbcli_state *cli)
name1 = result.list[i].both_directory_info.name.s;
name2 = result.list[i+1].both_directory_info.name.s;
if (strcasecmp_m(name1, name2) > 0) {
printf("non-alphabetical order at entry %d '%s' '%s'\n",
printf("non-alphabetical order at entry %d '%s' '%s'\n",
i, name1, name2);
printf("Server does not produce sorted directory listings (not an error)\n");
goto done;
@ -1155,10 +1155,10 @@ done:
/*
/*
basic testing of many old style search calls using separate dirs
*/
static bool test_many_dirs(struct torture_context *tctx,
static bool test_many_dirs(struct torture_context *tctx,
struct smbcli_state *cli)
{
const int num_dirs = 20;
@ -1181,7 +1181,7 @@ static bool test_many_dirs(struct torture_context *tctx,
dname = talloc_asprintf(cli, BASEDIR "\\d%d", i);
status = smbcli_mkdir(cli->tree, dname);
if (!NT_STATUS_IS_OK(status)) {
printf("(%s) Failed to create %s - %s\n",
printf("(%s) Failed to create %s - %s\n",
__location__, dname, nt_errstr(status));
ret = false;
goto done;
@ -1191,7 +1191,7 @@ static bool test_many_dirs(struct torture_context *tctx,
fname = talloc_asprintf(cli, BASEDIR "\\d%d\\f%d-%d.txt", i, i, n);
fnum = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR, DENY_NONE);
if (fnum == -1) {
printf("(%s) Failed to create %s - %s\n",
printf("(%s) Failed to create %s - %s\n",
__location__, fname, smbcli_errstr(cli->tree));
ret = false;
goto done;
@ -1230,7 +1230,7 @@ static bool test_many_dirs(struct torture_context *tctx,
}
CHECK_STATUS(status, NT_STATUS_OK);
if (strncasecmp(file[i].search.name, fname, strlen(fname)) != 0) {
printf("(%s) incorrect name '%s' expected '%s'[12].txt\n",
printf("(%s) incorrect name '%s' expected '%s'[12].txt\n",
__location__, file[i].search.name, fname);
ret = false;
goto done;
@ -1263,7 +1263,7 @@ static bool test_many_dirs(struct torture_context *tctx,
}
CHECK_STATUS(status, NT_STATUS_OK);
if (strncasecmp(file2[i].search.name, fname, strlen(fname)) != 0) {
printf("(%s) incorrect name '%s' expected '%s'[12].txt\n",
printf("(%s) incorrect name '%s' expected '%s'[12].txt\n",
__location__, file2[i].search.name, fname);
ret = false;
goto done;
@ -1297,7 +1297,7 @@ static bool test_many_dirs(struct torture_context *tctx,
CHECK_STATUS(status, NT_STATUS_OK);
if (strncasecmp(file3[i].search.name, file2[i].search.name, 3) != 0) {
printf("(%s) incorrect name '%s' on rewind at dir %d\n",
printf("(%s) incorrect name '%s' on rewind at dir %d\n",
__location__, file2[i].search.name, i);
ret = false;
goto done;
@ -1305,7 +1305,7 @@ static bool test_many_dirs(struct torture_context *tctx,
if (torture_setting_bool(tctx, "rewind_support", true) &&
strcmp(file3[i].search.name, file2[i].search.name) != 0) {
printf("(%s) server did not rewind - got '%s' expected '%s'\n",
printf("(%s) server did not rewind - got '%s' expected '%s'\n",
__location__, file3[i].search.name, file2[i].search.name);
ret = false;
goto done;
@ -1323,10 +1323,10 @@ done:
}
/*
/*
testing of OS/2 style delete
*/
static bool test_os2_delete(struct torture_context *tctx,
static bool test_os2_delete(struct torture_context *tctx,
struct smbcli_state *cli)
{
const int num_files = 700;
@ -1422,7 +1422,7 @@ static bool test_os2_delete(struct torture_context *tctx,
CHECK_STATUS(status, NT_STATUS_OK);
if (total_deleted != num_files) {
printf("error: deleted %d - expected to delete %d\n",
printf("error: deleted %d - expected to delete %d\n",
total_deleted, num_files);
ret = false;
}
@ -1440,10 +1440,10 @@ static int ealist_cmp(union smb_search_data *r1, union smb_search_data *r2)
return strcmp(r1->ea_list.name.s, r2->ea_list.name.s);
}
/*
/*
testing of the rather strange ea_list level
*/
static bool test_ea_list(struct torture_context *tctx,
static bool test_ea_list(struct torture_context *tctx,
struct smbcli_state *cli)
{
int fnum;
@ -1490,7 +1490,7 @@ static bool test_ea_list(struct torture_context *tctx,
setfile.generic.in.file.path = BASEDIR "\\file3.txt";
status = smb_raw_setpathinfo(cli->tree, &setfile);
CHECK_STATUS(status, NT_STATUS_OK);
ZERO_STRUCT(result);
result.tctx = tctx;
@ -1633,7 +1633,7 @@ done:
return ret;
}
/*
/*
basic testing of all RAW_SEARCH_* calls using a single file
*/
struct torture_suite *torture_raw_search(TALLOC_CTX *mem_ctx)

View File

@ -1,18 +1,18 @@
/*
/*
Unix SMB/CIFS implementation.
seek test suite
Copyright (C) Andrew Tridgell 2003
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -68,7 +68,7 @@ static bool test_seek(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
finfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION;
finfo.position_information.in.file.fnum = fnum;
printf("Trying bad handle\n");
io.lseek.in.file.fnum = fnum+1;
io.lseek.in.mode = SEEK_MODE_START;
@ -86,7 +86,7 @@ static bool test_seek(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_fileinfo(cli->tree, mem_ctx, &finfo);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(finfo.position_information.out.position, 0);
printf("Trying relative seek\n");
io.lseek.in.file.fnum = fnum;
io.lseek.in.mode = SEEK_MODE_CURRENT;
@ -142,7 +142,7 @@ static bool test_seek(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
if (smbcli_write(cli->tree, fnum, 0, c, 0, 2) != 2) {
printf("Write failed - %s\n", smbcli_errstr(cli->tree));
ret = false;
goto done;
goto done;
}
printf("Testing position information change\n");
@ -158,11 +158,11 @@ static bool test_seek(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_seek(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(io.lseek.out.offset, 2);
if (smbcli_read(cli->tree, fnum, c, 0, 1) != 1) {
printf("Read failed - %s\n", smbcli_errstr(cli->tree));
ret = false;
goto done;
goto done;
}
printf("Testing position information change\n");
@ -220,7 +220,7 @@ static bool test_seek(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(finfo.position_information.out.position, 0);
done:
smb_raw_exit(cli->session);
@ -229,7 +229,7 @@ done:
}
/*
/*
basic testing of seek calls
*/
bool torture_raw_seek(struct torture_context *torture, struct smbcli_state *cli)

View File

@ -1,18 +1,18 @@
/*
/*
Unix SMB/CIFS implementation.
RAW_SFILEINFO_* individual test suite
Copyright (C) Andrew Tridgell 2003
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -26,9 +26,9 @@
#define BASEDIR "\\testsfileinfo"
/* basic testing of all RAW_SFILEINFO_* calls
for each call we test that it succeeds, and where possible test
for consistency between the calls.
/* basic testing of all RAW_SFILEINFO_* calls
for each call we test that it succeeds, and where possible test
for consistency between the calls.
*/
static bool
torture_raw_sfileinfo_base(struct torture_context *torture, struct smbcli_state *cli)
@ -45,7 +45,7 @@ torture_raw_sfileinfo_base(struct torture_context *torture, struct smbcli_state
time_t basetime = (time(NULL) - 86400) & ~1;
bool check_fnum;
int n = time(NULL) % 100;
path_fname = talloc_asprintf(torture, BASEDIR "\\fname_test_%d.txt", n);
path_fname_new = talloc_asprintf(torture, BASEDIR "\\fname_test_new_%d.txt", n);
fnum_fname = talloc_asprintf(torture, BASEDIR "\\fnum_test_%d.txt", n);
@ -69,7 +69,7 @@ torture_raw_sfileinfo_base(struct torture_context *torture, struct smbcli_state
} while (0)
RECREATE_BOTH;
#define CHECK_CALL_FNUM(call, rightstatus) do { \
check_fnum = true; \
call_name = #call; \
@ -194,7 +194,7 @@ torture_raw_sfileinfo_base(struct torture_context *torture, struct smbcli_state
goto done; \
}} while (0)
printf("Test setattr\n");
sfinfo.setattr.in.attrib = FILE_ATTRIBUTE_READONLY;
sfinfo.setattr.in.write_time = basetime;
@ -682,7 +682,7 @@ done:
return ret;
}
/*
/*
look for the w2k3 setpathinfo STANDARD bug
*/
static bool torture_raw_sfileinfo_bug(struct torture_context *torture,
@ -694,7 +694,7 @@ static bool torture_raw_sfileinfo_bug(struct torture_context *torture,
int fnum;
if (!torture_setting_bool(torture, "dangerous", false))
torture_skip(torture,
torture_skip(torture,
"torture_raw_sfileinfo_bug disabled - enable dangerous tests to use\n");
fnum = create_complex_file(cli, torture, fname);

View File

@ -1,20 +1,20 @@
/*
/*
Unix SMB/CIFS implementation.
test alternate data streams
Copyright (C) Andrew Tridgell 2004
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -65,7 +65,7 @@
*/
static bool check_stream(struct smbcli_state *cli, const char *location,
TALLOC_CTX *mem_ctx,
const char *fname, const char *sname,
const char *fname, const char *sname,
const char *value)
{
int fnum;
@ -85,7 +85,7 @@ static bool check_stream(struct smbcli_state *cli, const char *location,
}
return true;
}
if (fnum == -1) {
printf("(%s) Failed to open stream '%s' - %s\n",
location, full_name, smbcli_errstr(cli->tree));
@ -93,7 +93,7 @@ static bool check_stream(struct smbcli_state *cli, const char *location,
}
buf = talloc_array(mem_ctx, uint8_t, strlen(value)+11);
ret = smbcli_read(cli->tree, fnum, buf, 0, strlen(value)+11);
if (ret != strlen(value)) {
printf("(%s) Failed to read %lu bytes from stream '%s' - got %d\n",
@ -373,7 +373,7 @@ static bool test_stream_io(struct torture_context *tctx,
status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.ntcreatex.out.file.fnum;
smbcli_close(cli->tree, fnum);
status = smbcli_unlink(cli->tree, sname2);
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
@ -468,7 +468,7 @@ done:
return ret;
}
/*
/*
* Test FILE_SHARE_DELETE on streams
*
* A stream opened with !FILE_SHARE_DELETE prevents the main file to be opened
@ -2060,7 +2060,7 @@ static bool test_stream_permissions(struct torture_context *tctx,
return ret;
}
/*
/*
basic testing of streams calls
*/
struct torture_suite *torture_raw_streams(TALLOC_CTX *tctx)

View File

@ -1,18 +1,18 @@
/*
/*
Unix SMB/CIFS implementation.
unlink test suite
Copyright (C) Andrew Tridgell 2003
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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -120,9 +120,9 @@ done:
/*
test delete on close
test delete on close
*/
static bool test_delete_on_close(struct torture_context *tctx,
static bool test_delete_on_close(struct torture_context *tctx,
struct smbcli_state *cli)
{
union smb_open op;
@ -190,7 +190,7 @@ static bool test_delete_on_close(struct torture_context *tctx,
printf("Testing with directory delete_on_close 1\n");
status = create_directory_handle(cli->tree, dname, &fnum);
CHECK_STATUS(status, NT_STATUS_OK);
sfinfo.disposition_info.in.file.fnum = fnum;
sfinfo.disposition_info.in.delete_on_close = 1;
status = smb_raw_setfileinfo(cli->tree, &sfinfo);
@ -241,7 +241,7 @@ static bool test_delete_on_close(struct torture_context *tctx,
printf("Testing open dir with delete_on_close\n");
status = create_directory_handle(cli->tree, dname, &fnum);
CHECK_STATUS(status, NT_STATUS_OK);
smbcli_close(cli->tree, fnum);
fnum2 = create_complex_file(cli, tctx, inside);
smbcli_close(cli->tree, fnum2);
@ -274,7 +274,7 @@ static bool test_delete_on_close(struct torture_context *tctx,
status = create_directory_handle(cli->tree, dname, &fnum);
CHECK_STATUS(status, NT_STATUS_OK);
smbcli_close(cli->tree, fnum);
fnum2 = create_complex_file(cli, tctx, inside);
smbcli_close(cli->tree, fnum2);
@ -305,7 +305,7 @@ static bool test_delete_on_close(struct torture_context *tctx,
printf("Testing pre-existing open dir with second delete_on_close\n");
status = create_directory_handle(cli->tree, dname, &fnum);
CHECK_STATUS(status, NT_STATUS_OK);
smbcli_close(cli->tree, fnum);
fnum = create_complex_file(cli, tctx, inside);
@ -341,13 +341,13 @@ static bool test_delete_on_close(struct torture_context *tctx,
status = smb_raw_rmdir(cli->tree, &dio);
CHECK_STATUS(status, NT_STATUS_DIRECTORY_NOT_EMPTY);
smbcli_close(cli->tree, fnum);
status = smb_raw_rmdir(cli->tree, &dio);
CHECK_STATUS(status, NT_STATUS_DIRECTORY_NOT_EMPTY);
done:
smb_raw_exit(cli->session);
smbcli_deltree(cli->tree, BASEDIR);
@ -455,7 +455,7 @@ done:
return ret;
}
/*
/*
basic testing of unlink calls
*/
struct torture_suite *torture_raw_unlink(TALLOC_CTX *mem_ctx)