1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

s3/client: fix dfs deltree, resolve dfs path

since 4cc4938a28 do_list seems
to deal with non dfs root path, hence we need to resolve the
path before calling cli_unlink.

Also remove the knownfail

We additionally have to also remove the fallback to remove 'file3'
int the smbcacls_dfs_propagate_inherit.teardown as the deltree
that happens in the baseclass now succeeds.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15100

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jun 17 17:12:07 UTC 2022 on sn-devel-184
This commit is contained in:
Noel Power 2022-06-16 17:17:45 +01:00 committed by Jeremy Allison
parent 23a5a05db0
commit 81fdcf95ae
3 changed files with 40 additions and 19 deletions

View File

@ -85,11 +85,3 @@ class DfsInheritanceSmbCaclsTests(InheritanceSmbCaclsTests):
def tearDown(self):
super(DfsInheritanceSmbCaclsTests, self).tearDown()
# for dfs tests inevitably we fallback to remove the local files in
# the base class, the base class however doesn't know about the
# target dfs share (or its contents) so we have to assume we need to
# remove the file on the dfs share
smbclient_args = self.build_test_cmd("smbclient", ["//%s/%s" % (self.server, self.dfs_target_share), "-c", "rm file-3"])
self.check_output(smbclient_args)

View File

@ -1,5 +1,4 @@
^samba3.blackbox.smbclient_s3.SMB3.*.creating.a.bad.symlink.and.deleting.it
^samba3.blackbox.smbclient_s3.SMB3.*.deltree on MS-DFS share
^samba3.blackbox.acl_xattr.SMB3.nt_affects_posix
^samba3.blackbox.acl_xattr.SMB3.nt_affects_chown
^samba3.blackbox.acl_xattr.SMB3.nt_affects_chgrp

View File

@ -2439,20 +2439,37 @@ static NTSTATUS delete_remote_files_list(struct cli_state *cli_state,
{
NTSTATUS status = NT_STATUS_OK;
struct file_list *deltree_list_iter = NULL;
char *targetname = NULL;
struct cli_state *targetcli = NULL;
struct cli_credentials *creds = samba_cmdline_get_creds();
TALLOC_CTX *ctx = talloc_tos();
for (deltree_list_iter = flist;
deltree_list_iter != NULL;
deltree_list_iter = deltree_list_iter->next) {
status = cli_resolve_path(ctx,
"",
creds,
cli_state,
deltree_list_iter->file_path,
&targetcli,
&targetname);
if (!NT_STATUS_IS_OK(status)) {
d_printf("delete_remote_files %s: %s\n",
deltree_list_iter->file_path,
nt_errstr(status));
return status;
}
if (CLI_DIRSEP_CHAR == '/') {
/* POSIX. */
status = cli_posix_unlink(cli_state,
deltree_list_iter->file_path);
status = cli_posix_unlink(targetcli,
targetname);
} else if (deltree_list_iter->isdir) {
status = cli_rmdir(cli_state,
deltree_list_iter->file_path);
status = cli_rmdir(targetcli,
targetname);
} else {
status = cli_unlink(cli_state,
deltree_list_iter->file_path,
status = cli_unlink(targetcli,
targetname,
FILE_ATTRIBUTE_SYSTEM |
FILE_ATTRIBUTE_HIDDEN);
}
@ -2561,14 +2578,27 @@ static int cmd_deltree(void)
deltree_list_iter = deltree_list_iter->next) {
if (deltree_list_iter->isdir == false) {
char *targetname = NULL;
struct cli_state *targetcli = NULL;
struct cli_credentials *creds = samba_cmdline_get_creds();
status = cli_resolve_path(ctx,
"",
creds,
cli,
deltree_list_iter->file_path,
&targetcli,
&targetname);
if (!NT_STATUS_IS_OK(status)) {
goto err;
}
/* Just a regular file. */
if (CLI_DIRSEP_CHAR == '/') {
/* POSIX. */
status = cli_posix_unlink(cli,
deltree_list_iter->file_path);
status = cli_posix_unlink(targetcli,
targetname);
} else {
status = cli_unlink(cli,
deltree_list_iter->file_path,
status = cli_unlink(targetcli,
targetname,
FILE_ATTRIBUTE_SYSTEM |
FILE_ATTRIBUTE_HIDDEN);
}