s3: libsmbclient - smb2. MacOSX 10 SMB2 server doesn't set STATUS_NO_MORE_FILES when...
authorJeremy Allison <jra@samba.org>
Tue, 21 Oct 2014 21:41:32 +0000 (14:41 -0700)
committerKarolin Seeger <kseeger@samba.org>
Sun, 9 Nov 2014 19:47:10 +0000 (20:47 +0100)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Steve French <smfrench@gmail.com>
Tested-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Steve French <sfrench@samba.org>
Autobuild-Date(master): Thu Oct 23 20:44:31 CEST 2014 on sn-devel-104

(cherry picked from commit 95bf43bc6a0b6a4a47b8a556eee3b78446ea4123)

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10904
smbclient loops doing a directory listing against Mac OS X 10 server with a
non-wildcard path.

source3/libsmb/cli_smb2_fnum.c

index 8eb776a13240d4f9139f18b56ce60ba429975628..aeade88e24daa24ed981ad1d7a719de09fd9a9b8 100644 (file)
@@ -501,6 +501,7 @@ NTSTATUS cli_smb2_list(struct cli_state *cli,
        bool processed_file = false;
        TALLOC_CTX *frame = talloc_stackframe();
        TALLOC_CTX *subframe = NULL;
+       bool mask_has_wild;
 
        if (smbXcli_conn_has_async_calls(cli->conn)) {
                /*
@@ -524,6 +525,8 @@ NTSTATUS cli_smb2_list(struct cli_state *cli,
                goto fail;
         }
 
+       mask_has_wild = ms_has_wild(mask);
+
        status = cli_smb2_create_fnum(cli,
                        parent_dir,
                        0,                      /* create_flags */
@@ -625,6 +628,17 @@ NTSTATUS cli_smb2_list(struct cli_state *cli,
 
                TALLOC_FREE(subframe);
 
+               if (!mask_has_wild) {
+                       /*
+                        * MacOSX 10 doesn't set STATUS_NO_MORE_FILES
+                        * when handed a non-wildcard path. Do it
+                        * for the server (with a non-wildcard path
+                        * there should only ever be one file returned.
+                        */
+                       status = STATUS_NO_MORE_FILES;
+                       break;
+               }
+
        } while (NT_STATUS_IS_OK(status));
 
        if (NT_STATUS_EQUAL(status, STATUS_NO_MORE_FILES)) {