]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3/client: fix dfs deltree, resolve dfs path
authorNoel Power <noel.power@suse.com>
Thu, 16 Jun 2022 16:17:45 +0000 (17:17 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 17 Jun 2022 17:12:07 +0000 (17:12 +0000)
since 4cc4938a2866738aaff4dc91550bb7a5ad05d7fb 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

python/samba/tests/blackbox/smbcacls_dfs_propagate_inherit.py
selftest/knownfail.d/smbclient-smb3
source3/client/client.c

index 36c29c8cccac6c460a8e0c2b2d7d05b00e81264f..42680df0d06ee1bb1743c85ca82d3d47f43cfa56 100644 (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)
-
-
index f6ca529c61d1c3842dd3690fdbda2b5098d0f34d..119e93e479af8078a4639b19b84ac86fc47efc6b 100644 (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
index 2b93cd36704c050bd96432d26eec28c0f0808948..651da5fbf7a314eccc1794d807477cfa38998da8 100644 (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);
                        }