From 916297e0454317cbfe400b2d7fa60073bcccb8d6 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 18 Apr 2012 12:38:06 -0700 Subject: Fix samba3.raw.samba3hide test - ensure we set up POSIX capabilities before doing POSIX calls like chmod. Autobuild-User: Jeremy Allison Autobuild-Date: Wed Apr 18 23:14:40 CEST 2012 on sn-devel-104 --- source4/torture/raw/samba3hide.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'source4/torture') diff --git a/source4/torture/raw/samba3hide.c b/source4/torture/raw/samba3hide.c index 5ecf4f682d..c3a572c21c 100644 --- a/source4/torture/raw/samba3hide.c +++ b/source4/torture/raw/samba3hide.c @@ -114,6 +114,36 @@ static bool smbcli_file_exists(struct smbcli_tree *tree, const char *fname) return NT_STATUS_IS_OK(smbcli_getatr(tree, fname, NULL, NULL, NULL)); } +static NTSTATUS smbcli_setup_unix(struct smbcli_tree *tree) +{ + union smb_fsinfo fsinfo; + union smb_setfsinfo set_fsinfo; + NTSTATUS status; + + ZERO_STRUCT(fsinfo); + ZERO_STRUCT(set_fsinfo); + + fsinfo.generic.level = RAW_QFS_UNIX_INFO; + status = smb_raw_fsinfo(tree, NULL, &fsinfo); + if (!NT_STATUS_IS_OK(status)) { + printf("smb_raw_fsinfo failed %s\n", + nt_errstr(status)); + return status; + } + + set_fsinfo.generic.level = RAW_SETFS_UNIX_INFO; + set_fsinfo.unix_info.in.major_version = fsinfo.unix_info.out.major_version; + set_fsinfo.unix_info.in.minor_version = fsinfo.unix_info.out.minor_version; + set_fsinfo.unix_info.in.capability = fsinfo.unix_info.out.capability; + + status = smb_raw_setfsinfo(tree, NULL, &set_fsinfo); + if (!NT_STATUS_IS_OK(status)) { + printf("smb_raw_setfsinfo failed %s\n", + nt_errstr(status)); + } + return status; +} + static NTSTATUS smbcli_chmod(struct smbcli_tree *tree, const char *fname, uint64_t permissions) { @@ -139,6 +169,13 @@ bool torture_samba3_hide(struct torture_context *torture) torture_fail(torture, "torture_open_connection_share failed\n"); } + status = smbcli_setup_unix(cli->tree); + if (!NT_STATUS_IS_OK(status)) { + torture_fail(torture, + talloc_asprintf(torture, "smbcli_setup_unix failed %s\n", + nt_errstr(status))); + } + status = torture_second_tcon(torture, cli->session, "hideunread", &hideunread); torture_assert_ntstatus_ok(torture, status, "second_tcon(hideunread) failed\n"); -- cgit