s3: smbclient: In order to get shadow copy data over SMB1 we must call cli_shadow_cop...
authorJeremy Allison <jra@samba.org>
Thu, 18 Aug 2016 21:36:50 +0000 (14:36 -0700)
committerUri Simchoni <uri@samba.org>
Fri, 19 Aug 2016 21:59:35 +0000 (23:59 +0200)
Once with 'get_names = false' to get the size, then again with 'get_names = true'
to get the data or a Windows server fails to return valid info. Samba doesn't have this bug.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
Autobuild-User(master): Uri Simchoni <uri@samba.org>
Autobuild-Date(master): Fri Aug 19 23:59:35 CEST 2016 on sn-devel-144

source3/client/client.c

index 45dc11c2ba8ab277821733375285209d26bb1019..7fbfdf0d8d95cc71bbfdf9e4f46a0c1aa7101410 100644 (file)
@@ -1782,6 +1782,20 @@ static int do_allinfo(const char *name)
                 */
                return 0;
        }
+       /*
+        * In order to get shadow copy data over SMB1 we
+        * must call twice, once with 'get_names = false'
+        * to get the size, then again with 'get_names = true'
+        * to get the data or a Windows server fails to return
+        * valid info. Samba doesn't have this bug. JRA.
+        */
+
+       status = cli_shadow_copy_data(talloc_tos(), cli, fnum,
+                                     false, &snapshots, &num_snapshots);
+       if (!NT_STATUS_IS_OK(status)) {
+               cli_close(cli, fnum);
+               return 0;
+       }
        status = cli_shadow_copy_data(talloc_tos(), cli, fnum,
                                      true, &snapshots, &num_snapshots);
        if (!NT_STATUS_IS_OK(status)) {