Fix bug 9633: recursive mget should continue on EPERM
authorDavid Disseldorp <ddiss@samba.org>
Mon, 4 Feb 2013 18:04:39 +0000 (19:04 +0100)
committerKarolin Seeger <kseeger@samba.org>
Thu, 14 Mar 2013 09:51:41 +0000 (10:51 +0100)
Regression introduced by 14ff2e8de9bd8d0064762234555260f5eea643fe.
When downloading files recursively, smbclient halts if it encounters
a folder to which it does not have permission to traverse.
(cherry picked from commit e5b4ac7978213acf7517b6852f7750e41cad787a)

source3/client/client.c

index 58115ad19c849a949681210d2d6771f19734ff06..f6e42f6ffe436ee81c5a9a86f89dc9f080dc82cf 100644 (file)
@@ -1307,8 +1307,17 @@ static NTSTATUS do_mget(struct cli_state *cli_state, struct file_info *finfo,
                return NT_STATUS_NO_MEMORY;
        }
 
-       status = do_list(mget_mask, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY,do_mget,false, true);
-       if (!NT_STATUS_IS_OK(status)) {
+       status = do_list(mget_mask,
+                        (FILE_ATTRIBUTE_SYSTEM
+                         | FILE_ATTRIBUTE_HIDDEN
+                         | FILE_ATTRIBUTE_DIRECTORY),
+                        do_mget, false, true);
+       if (!NT_STATUS_IS_OK(status)
+        && !NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
+               /*
+                * Ignore access denied errors to ensure all permitted files are
+                * pulled down.
+                */
                return status;
        }