The branch, master has been updated
       via  57a54af s3: smbclient: In order to get shadow copy data over SMB1 
we must call cli_shadow_copy_data() twice.
       via  336da63 s3: libsmb: Do some hardening in the receive processing of 
cli_shadow_copy_data_recv().
       via  a9fe27e s3: libsmb: Correctly set max_setup_size in 
FSCTL_GET_SHADOW_COPY_DATA nttrans ioctl.
       via  0b252d7 s3: libsmb: Plumb in additional_flags2 = 
FLAGS2_REPARSE_PATH to cli_list_trans_send().
       via  e4a261c s3: libsmb: Make a comment note that cli_set_ea() needs 
some internal changes before cli_set_ea_path() can use previous path versions.
       via  97cde5d s3: libsmb: Plumb in additional_flags2 = 
FLAGS2_REPARSE_PATH to cli_ctemp_send().
       via  e2d7055 s3: libsmb: Plumb in additional_flags2 = 
FLAGS2_REPARSE_PATH to cli_chkpath_send().
       via  00551d7 s3: libsmb: Plumb in additional_flags2 = 
FLAGS2_REPARSE_PATH to cli_setatr_send().
       via  461000c s3: libsmb: Plumb in additional_flags2 = 
FLAGS2_REPARSE_PATH to cli_getatr_send().
       via  47c1314 s3: libsmb: Plumb in additional_flags2 = 
FLAGS2_REPARSE_PATH to cli_openx_create().
       via  d7ee917 s3: libsmb: Plumb in additional_flags2 = 
FLAGS2_REPARSE_PATH to cli_nttrans_create_send().
       via  cd4a60b s3: libsmb: Plumb in additional_flags2 = 
FLAGS2_REPARSE_PATH to cli_ntcreate1_send().
       via  17d1f19 s3: libsmb: Plumb in additional_flags2 = 
FLAGS2_REPARSE_PATH to cli_rmdir_send()
       via  3081604 s3: libsmb: s3: libsmb: Plumb in additional_flags2 = 
FLAGS2_REPARSE_PATH to cli_mkdir_send().
       via  3242a0b s3: libsmb: s3: libsmb: Plumb in additional_flags2 = 
FLAGS2_REPARSE_PATH to cli_unlink_send().
       via  c2a1905 s3: libsmb: s3: libsmb: Plumb in additional_flags2 = 
FLAGS2_REPARSE_PATH to cli_ntrename_internal_send().
       via  ae70479 s3: libsmb: s3: libsmb: Plumb in additional_flags2 = 
FLAGS2_REPARSE_PATH to cli_rename_send().
       via  21a7bf4 s3: libsmb: Plumb in additional_flags2 = 
FLAGS2_REPARSE_PATH to cli_qpathinfo_send()
       via  75e4290 s3: libsmb: Plumb in additional_flags2 = 
FLAGS2_REPARSE_PATH to cli_setpathinfo_send().
       via  19696f3 s3: libsmb: Add clistr_is_previous_version_path()
       via  79c8b75 s3: libsmb: Add uint16_t addtional_flags2 to 
cli_smb_req_create().
       via  76bbc4c s3: libsmb: Add uint16_t addtional_flags2 to 
cli_trans_send().
       via  a876f91 s3: libsmb: Add uint16_t additional_flags2 arg to 
cli_smb_send().
       via  66650e6 s3: SMB1: Add missing FLAGS2 definitions from MS-SMB.
      from  3c103f9 netcmd/domain: improve error message grammar

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 57a54af66f414708d5c02f346f08bc4bfd55349d
Author: Jeremy Allison <[email protected]>
Date:   Thu Aug 18 14:36:50 2016 -0700

    s3: smbclient: In order to get shadow copy data over SMB1 we must call 
cli_shadow_copy_data() 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.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12165
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>
    
    Autobuild-User(master): Uri Simchoni <[email protected]>
    Autobuild-Date(master): Fri Aug 19 23:59:35 CEST 2016 on sn-devel-144

commit 336da637541fba13586af6fc2cb9d143d656e87e
Author: Jeremy Allison <[email protected]>
Date:   Thu Aug 18 12:06:23 2016 -0700

    s3: libsmb: Do some hardening in the receive processing of 
cli_shadow_copy_data_recv().
    
    Protect against malicious servers.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit a9fe27e17ce55461946037bb25a432da340095ab
Author: Jeremy Allison <[email protected]>
Date:   Thu Aug 18 14:33:01 2016 -0700

    s3: libsmb: Correctly set max_setup_size in FSCTL_GET_SHADOW_COPY_DATA 
nttrans ioctl.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12165
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit 0b252d7c6fdd963308fff8938a8be185892afbbe
Author: Jeremy Allison <[email protected]>
Date:   Thu Aug 18 14:26:20 2016 -0700

    s3: libsmb: Plumb in additional_flags2 = FLAGS2_REPARSE_PATH to 
cli_list_trans_send().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12165
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit e4a261c6c826a2be75bcd9d6af8232f043acc5f1
Author: Jeremy Allison <[email protected]>
Date:   Thu Aug 18 14:20:11 2016 -0700

    s3: libsmb: Make a comment note that cli_set_ea() needs some internal 
changes before cli_set_ea_path() can use previous path versions.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12165
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit 97cde5dc92185f188868ddd71287d43ddae30516
Author: Jeremy Allison <[email protected]>
Date:   Thu Aug 18 14:07:17 2016 -0700

    s3: libsmb: Plumb in additional_flags2 = FLAGS2_REPARSE_PATH to 
cli_ctemp_send().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12165
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit e2d70551e1ba13119d53afaa00f05e70897484f0
Author: Jeremy Allison <[email protected]>
Date:   Thu Aug 18 14:05:33 2016 -0700

    s3: libsmb: Plumb in additional_flags2 = FLAGS2_REPARSE_PATH to 
cli_chkpath_send().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12165
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit 00551d73063b46d3dd2740951a2a8f1b2e351f79
Author: Jeremy Allison <[email protected]>
Date:   Thu Aug 18 14:04:05 2016 -0700

    s3: libsmb: Plumb in additional_flags2 = FLAGS2_REPARSE_PATH to 
cli_setatr_send().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12165
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit 461000c8812a99a81a9f3fc87f93c1b7c67f42bd
Author: Jeremy Allison <[email protected]>
Date:   Thu Aug 18 14:02:24 2016 -0700

    s3: libsmb: Plumb in additional_flags2 = FLAGS2_REPARSE_PATH to 
cli_getatr_send().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12165
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit 47c1314429cdf516358d5e00ca24c313ddab67b0
Author: Jeremy Allison <[email protected]>
Date:   Thu Aug 18 13:59:52 2016 -0700

    s3: libsmb: Plumb in additional_flags2 = FLAGS2_REPARSE_PATH to 
cli_openx_create().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12165
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit d7ee917b165da2695433b7b115363223f2bd214f
Author: Jeremy Allison <[email protected]>
Date:   Thu Aug 18 13:40:23 2016 -0700

    s3: libsmb: Plumb in additional_flags2 = FLAGS2_REPARSE_PATH to 
cli_nttrans_create_send().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12165
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit cd4a60bb1f84891763617f96de148068e0492773
Author: Jeremy Allison <[email protected]>
Date:   Thu Aug 18 13:37:22 2016 -0700

    s3: libsmb: Plumb in additional_flags2 = FLAGS2_REPARSE_PATH to 
cli_ntcreate1_send().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12165
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit 17d1f19eda2c735fcb10a389c3681ccd385bb9c7
Author: Jeremy Allison <[email protected]>
Date:   Thu Aug 18 13:34:44 2016 -0700

    s3: libsmb: Plumb in additional_flags2 = FLAGS2_REPARSE_PATH to 
cli_rmdir_send()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12165
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit 3081604734a9531cefa71d0417a6fbfee9a6a8b6
Author: Jeremy Allison <[email protected]>
Date:   Thu Aug 18 13:33:30 2016 -0700

    s3: libsmb: s3: libsmb: Plumb in additional_flags2 = FLAGS2_REPARSE_PATH to 
cli_mkdir_send().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12165
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit 3242a0b9f0ae0d51110dc6542195af1be91aeece
Author: Jeremy Allison <[email protected]>
Date:   Thu Aug 18 13:32:03 2016 -0700

    s3: libsmb: s3: libsmb: Plumb in additional_flags2 = FLAGS2_REPARSE_PATH to 
cli_unlink_send().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12165
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit c2a1905abd5d8756dd4afdd3116d311b1dec1246
Author: Jeremy Allison <[email protected]>
Date:   Thu Aug 18 13:29:01 2016 -0700

    s3: libsmb: s3: libsmb: Plumb in additional_flags2 = FLAGS2_REPARSE_PATH to 
cli_ntrename_internal_send().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12165
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit ae7047923e756d7ee1d760b7495560c25c71b523
Author: Jeremy Allison <[email protected]>
Date:   Thu Aug 18 13:26:59 2016 -0700

    s3: libsmb: s3: libsmb: Plumb in additional_flags2 = FLAGS2_REPARSE_PATH to 
cli_rename_send().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12165
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit 21a7bf428bb8ed5b5634b87896bf0aa6c095d7f6
Author: Jeremy Allison <[email protected]>
Date:   Thu Aug 18 13:17:49 2016 -0700

    s3: libsmb: Plumb in additional_flags2 = FLAGS2_REPARSE_PATH to 
cli_qpathinfo_send()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12165
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit 75e4290b6055cf95fc4730c4fa431bcc91eed203
Author: Jeremy Allison <[email protected]>
Date:   Thu Aug 18 13:12:22 2016 -0700

    s3: libsmb: Plumb in additional_flags2 = FLAGS2_REPARSE_PATH to 
cli_setpathinfo_send().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12165
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit 19696f3494bd944ac9226aeebebb7a00df6f53b4
Author: Jeremy Allison <[email protected]>
Date:   Thu Aug 18 13:06:54 2016 -0700

    s3: libsmb: Add clistr_is_previous_version_path()
    
    Looks for @GMT- token in pathname.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12165
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit 79c8b756715d021f12474a12eca1efb596f92a84
Author: Jeremy Allison <[email protected]>
Date:   Thu Aug 18 13:45:35 2016 -0700

    s3: libsmb: Add uint16_t addtional_flags2 to cli_smb_req_create().
    
    Not yet used.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12165
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit 76bbc4c0c338a021e10f3d2de2f6c58b4ee81169
Author: Jeremy Allison <[email protected]>
Date:   Thu Aug 18 12:45:32 2016 -0700

    s3: libsmb: Add uint16_t addtional_flags2 to cli_trans_send().
    
    Not yet used.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12165
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit a876f915fd2cddc96e6044c0a73c87153445baf6
Author: Jeremy Allison <[email protected]>
Date:   Thu Aug 18 12:20:25 2016 -0700

    s3: libsmb: Add uint16_t additional_flags2 arg to cli_smb_send().
    
    Not yet used.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12165
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

commit 66650e67698ed2ed2c1e604343d4209e84f58032
Author: Jeremy Allison <[email protected]>
Date:   Wed Aug 17 14:33:00 2016 -0700

    s3: SMB1: Add missing FLAGS2 definitions from MS-SMB.
    
    https://bugzilla.samba.org/show_bug.cgi?id=12165
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Uri Simchoni <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 libcli/smb/smb_constants.h    |   2 +
 source3/client/client.c       |  14 ++++
 source3/include/async_smb.h   |   5 +-
 source3/libsmb/async_smb.c    |   4 +-
 source3/libsmb/cliconnect.c   |  20 ++---
 source3/libsmb/clientgen.c    |   2 +-
 source3/libsmb/clifile.c      | 181 +++++++++++++++++++++++++++++++++++-------
 source3/libsmb/clifsinfo.c    |   7 +-
 source3/libsmb/clilist.c      |  21 +++--
 source3/libsmb/climessage.c   |   6 +-
 source3/libsmb/clioplock.c    |   2 +-
 source3/libsmb/clireadwrite.c |   4 +-
 source3/libsmb/clistr.c       |  28 +++++++
 source3/libsmb/clisymlink.c   |   4 +-
 source3/libsmb/clitrans.c     |   3 +-
 source3/libsmb/proto.h        |   3 +-
 16 files changed, 246 insertions(+), 60 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/smb/smb_constants.h b/libcli/smb/smb_constants.h
index e03e843..2fcb590 100644
--- a/libcli/smb/smb_constants.h
+++ b/libcli/smb/smb_constants.h
@@ -309,8 +309,10 @@ enum csc_policy {
 #define FLAGS2_LONG_PATH_COMPONENTS    0x0001
 #define FLAGS2_EXTENDED_ATTRIBUTES     0x0002
 #define FLAGS2_SMB_SECURITY_SIGNATURES 0x0004
+#define FLAGS2_COMPRESSED              0x0008 /* MS-SMB */
 #define FLAGS2_SMB_SECURITY_SIGNATURES_REQUIRED 0x0010
 #define FLAGS2_IS_LONG_NAME            0x0040
+#define FLAGS2_REPARSE_PATH            0x0400 /* MS-SMB @GMT- path. */
 #define FLAGS2_EXTENDED_SECURITY       0x0800
 #define FLAGS2_DFS_PATHNAMES           0x1000
 #define FLAGS2_READ_PERMIT_EXECUTE     0x2000
diff --git a/source3/client/client.c b/source3/client/client.c
index 45dc11c..7fbfdf0 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -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)) {
diff --git a/source3/include/async_smb.h b/source3/include/async_smb.h
index 00c2313..3c64d08 100644
--- a/source3/include/async_smb.h
+++ b/source3/include/async_smb.h
@@ -27,12 +27,15 @@ struct tevent_req *cli_smb_req_create(TALLOC_CTX *mem_ctx,
                                      struct cli_state *cli,
                                      uint8_t smb_command,
                                      uint8_t additional_flags,
+                                     uint16_t additional_flags2,
                                      uint8_t wct, uint16_t *vwv,
                                      int iov_count,
                                      struct iovec *bytes_iov);
 struct tevent_req *cli_smb_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
                                struct cli_state *cli,
-                               uint8_t smb_command, uint8_t additional_flags,
+                               uint8_t smb_command,
+                               uint8_t additional_flags,
+                               uint16_t additional_flags2,
                                uint8_t wct, uint16_t *vwv,
                                uint32_t num_bytes,
                                const uint8_t *bytes);
diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c
index 8d5c3d4..bcb24a4 100644
--- a/source3/libsmb/async_smb.c
+++ b/source3/libsmb/async_smb.c
@@ -54,13 +54,13 @@ struct tevent_req *cli_smb_req_create(TALLOC_CTX *mem_ctx,
                                      struct cli_state *cli,
                                      uint8_t smb_command,
                                      uint8_t additional_flags,
+                                     uint16_t additional_flags2,
                                      uint8_t wct, uint16_t *vwv,
                                      int iov_count,
                                      struct iovec *bytes_iov)
 {
        struct cli_smb_req_state *state;
        uint8_t clear_flags = 0;
-       uint16_t additional_flags2 = 0;
        uint16_t clear_flags2 = 0;
 
        state = talloc_zero(mem_ctx, struct cli_smb_req_state);
@@ -101,13 +101,13 @@ struct tevent_req *cli_smb_send(TALLOC_CTX *mem_ctx,
                                struct cli_state *cli,
                                uint8_t smb_command,
                                uint8_t additional_flags,
+                               uint16_t additional_flags2,
                                uint8_t wct, uint16_t *vwv,
                                uint32_t num_bytes,
                                const uint8_t *bytes)
 {
        struct cli_smb_req_state *state;
        uint8_t clear_flags = 0;
-       uint16_t additional_flags2 = 0;
        uint16_t clear_flags2 = 0;
 
        state = talloc_zero(mem_ctx, struct cli_smb_req_state);
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 33759d9..9c8851f 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -204,7 +204,7 @@ static struct tevent_req *cli_session_setup_lanman2_send(
                return tevent_req_post(req, ev);
        }
 
-       subreq = cli_smb_send(state, ev, cli, SMBsesssetupX, 0, 10, vwv,
+       subreq = cli_smb_send(state, ev, cli, SMBsesssetupX, 0, 0, 10, vwv,
                              talloc_get_size(bytes), bytes);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
@@ -386,8 +386,8 @@ struct tevent_req 
*cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
        state->bytes.iov_base = (void *)bytes;
        state->bytes.iov_len = talloc_get_size(bytes);
 
-       subreq = cli_smb_req_create(state, ev, cli, SMBsesssetupX, 0, 13, vwv,
-                                   1, &state->bytes);
+       subreq = cli_smb_req_create(state, ev, cli, SMBsesssetupX, 0, 0, 13,
+                       vwv, 1, &state->bytes);
        if (subreq == NULL) {
                TALLOC_FREE(req);
                return NULL;
@@ -569,7 +569,7 @@ static struct tevent_req *cli_session_setup_plain_send(
                return tevent_req_post(req, ev);
        }
 
-       subreq = cli_smb_send(state, ev, cli, SMBsesssetupX, 0, 13, vwv,
+       subreq = cli_smb_send(state, ev, cli, SMBsesssetupX, 0, 0, 13, vwv,
                              talloc_get_size(bytes), bytes);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
@@ -880,7 +880,7 @@ static struct tevent_req *cli_session_setup_nt1_send(
                return tevent_req_post(req, ev);
        }
 
-       subreq = cli_smb_send(state, ev, cli, SMBsesssetupX, 0, 13, vwv,
+       subreq = cli_smb_send(state, ev, cli, SMBsesssetupX, 0, 0, 13, vwv,
                              talloc_get_size(bytes), bytes);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
@@ -1111,7 +1111,7 @@ static bool cli_sesssetup_blob_next(struct 
cli_sesssetup_blob_state *state,
        if (state->buf == NULL) {
                return false;
        }
-       subreq = cli_smb_send(state, state->ev, state->cli, SMBsesssetupX, 0,
+       subreq = cli_smb_send(state, state->ev, state->cli, SMBsesssetupX, 0, 0,
                              12, state->vwv,
                              talloc_get_size(state->buf), state->buf);
        if (subreq == NULL) {
@@ -2331,7 +2331,7 @@ static struct tevent_req *cli_ulogoff_send(TALLOC_CTX 
*mem_ctx,
        SCVAL(state->vwv+1, 0, 0);
        SSVAL(state->vwv+2, 0, 0);
 
-       subreq = cli_smb_send(state, ev, cli, SMBulogoffX, 0, 2, state->vwv,
+       subreq = cli_smb_send(state, ev, cli, SMBulogoffX, 0, 0, 2, state->vwv,
                              0, NULL);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
@@ -2549,7 +2549,7 @@ struct tevent_req *cli_tcon_andx_create(TALLOC_CTX 
*mem_ctx,
        state->bytes.iov_base = (void *)bytes;
        state->bytes.iov_len = talloc_get_size(bytes);
 
-       subreq = cli_smb_req_create(state, ev, cli, SMBtconX, 0, 4, vwv,
+       subreq = cli_smb_req_create(state, ev, cli, SMBtconX, 0, 0, 4, vwv,
                                    1, &state->bytes);
        if (subreq == NULL) {
                TALLOC_FREE(req);
@@ -2877,7 +2877,7 @@ static struct tevent_req *cli_tdis_send(TALLOC_CTX 
*mem_ctx,
        }
        state->cli = cli;
 
-       subreq = cli_smb_send(state, ev, cli, SMBtdis, 0, 0, NULL, 0, NULL);
+       subreq = cli_smb_send(state, ev, cli, SMBtdis, 0, 0, 0, NULL, 0, NULL);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
        }
@@ -3594,7 +3594,7 @@ static struct tevent_req *cli_raw_tcon_send(
                return tevent_req_post(req, ev);
        }
 
-       subreq = cli_smb_send(state, ev, cli, SMBtcon, 0, 0, NULL,
+       subreq = cli_smb_send(state, ev, cli, SMBtcon, 0, 0, 0, NULL,
                              talloc_get_size(bytes), bytes);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index bf31bb1..bc5c1b1 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -592,7 +592,7 @@ NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
         if (ev == NULL) {
                 goto fail;
         }
-        req = cli_smb_send(mem_ctx, ev, cli, smb_command, additional_flags,
+        req = cli_smb_send(mem_ctx, ev, cli, smb_command, additional_flags, 0,
                           wct, vwv, num_bytes, bytes);
         if (req == NULL) {
                 goto fail;
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index 684f263..0964b3a 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -173,6 +173,7 @@ struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
 {
        struct tevent_req *req, *subreq;
        struct cli_setpathinfo_state *state;
+       uint16_t additional_flags2 = 0;
 
        req = tevent_req_create(mem_ctx, &state,
                                struct cli_setpathinfo_state);
@@ -196,10 +197,16 @@ struct tevent_req *cli_setpathinfo_send(TALLOC_CTX 
*mem_ctx,
                return tevent_req_post(req, ev);
        }
 
+       if (clistr_is_previous_version_path(path) &&
+                       !INFO_LEVEL_IS_UNIX(level)) {
+               additional_flags2 = FLAGS2_REPARSE_PATH;
+       }
+
        subreq = cli_trans_send(
                state,                  /* mem ctx. */
                ev,                     /* event ctx. */
                cli,                    /* cli_state. */
+               additional_flags2,      /* additional_flags2 */
                SMBtrans2,              /* cmd. */
                NULL,                   /* pipe name. */
                -1,                     /* fid. */
@@ -1127,6 +1134,7 @@ struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
        struct tevent_req *req = NULL, *subreq = NULL;
        struct cli_rename_state *state = NULL;
        uint8_t additional_flags = 0;
+       uint16_t additional_flags2 = 0;
        uint8_t *bytes = NULL;
 
        req = tevent_req_create(mem_ctx, &state, struct cli_rename_state);
@@ -1147,6 +1155,10 @@ struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
+       if (clistr_is_previous_version_path(fname_src)) {
+               additional_flags2 = FLAGS2_REPARSE_PATH;
+       }
+
        bytes = talloc_realloc(state, bytes, uint8_t,
                        talloc_get_size(bytes)+1);
        if (tevent_req_nomem(bytes, req)) {
@@ -1161,7 +1173,8 @@ struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
        }
 
        subreq = cli_smb_send(state, ev, cli, SMBmv, additional_flags,
-                             1, state->vwv, talloc_get_size(bytes), bytes);
+                       additional_flags2,
+                       1, state->vwv, talloc_get_size(bytes), bytes);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
        }
@@ -1254,6 +1267,7 @@ static struct tevent_req 
*cli_ntrename_internal_send(TALLOC_CTX *mem_ctx,
        struct tevent_req *req = NULL, *subreq = NULL;
        struct cli_ntrename_internal_state *state = NULL;
        uint8_t additional_flags = 0;
+       uint16_t additional_flags2 = 0;
        uint8_t *bytes = NULL;
 
        req = tevent_req_create(mem_ctx, &state,
@@ -1276,6 +1290,10 @@ static struct tevent_req 
*cli_ntrename_internal_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
+       if (clistr_is_previous_version_path(fname_src)) {
+               additional_flags2 = FLAGS2_REPARSE_PATH;
+       }
+
        bytes = talloc_realloc(state, bytes, uint8_t,
                        talloc_get_size(bytes)+1);
        if (tevent_req_nomem(bytes, req)) {
@@ -1290,7 +1308,8 @@ static struct tevent_req 
*cli_ntrename_internal_send(TALLOC_CTX *mem_ctx,
        }
 
        subreq = cli_smb_send(state, ev, cli, SMBntrename, additional_flags,
-                             4, state->vwv, talloc_get_size(bytes), bytes);
+                       additional_flags2,
+                       4, state->vwv, talloc_get_size(bytes), bytes);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
        }
@@ -1454,6 +1473,7 @@ struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
        struct tevent_req *req = NULL, *subreq = NULL;
        struct cli_unlink_state *state = NULL;
        uint8_t additional_flags = 0;
+       uint16_t additional_flags2 = 0;
        uint8_t *bytes = NULL;
 
        req = tevent_req_create(mem_ctx, &state, struct cli_unlink_state);
@@ -1475,7 +1495,12 @@ struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
+       if (clistr_is_previous_version_path(fname)) {
+               additional_flags2 = FLAGS2_REPARSE_PATH;
+       }
+
        subreq = cli_smb_send(state, ev, cli, SMBunlink, additional_flags,
+                               additional_flags2,
                                1, state->vwv, talloc_get_size(bytes), bytes);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
@@ -1565,6 +1590,7 @@ struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
        struct tevent_req *req = NULL, *subreq = NULL;
        struct cli_mkdir_state *state = NULL;
        uint8_t additional_flags = 0;
+       uint16_t additional_flags2 = 0;
        uint8_t *bytes = NULL;
 
        req = tevent_req_create(mem_ctx, &state, struct cli_mkdir_state);
@@ -1584,8 +1610,13 @@ struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
+       if (clistr_is_previous_version_path(dname)) {
+               additional_flags2 = FLAGS2_REPARSE_PATH;
+       }
+
        subreq = cli_smb_send(state, ev, cli, SMBmkdir, additional_flags,
-                             0, NULL, talloc_get_size(bytes), bytes);
+                       additional_flags2,
+                       0, NULL, talloc_get_size(bytes), bytes);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
        }
@@ -1674,6 +1705,7 @@ struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
        struct tevent_req *req = NULL, *subreq = NULL;
        struct cli_rmdir_state *state = NULL;
        uint8_t additional_flags = 0;
+       uint16_t additional_flags2 = 0;
        uint8_t *bytes = NULL;
 
        req = tevent_req_create(mem_ctx, &state, struct cli_rmdir_state);
@@ -1693,8 +1725,13 @@ struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
+       if (clistr_is_previous_version_path(dname)) {
+               additional_flags2 = FLAGS2_REPARSE_PATH;
+       }
+
        subreq = cli_smb_send(state, ev, cli, SMBrmdir, additional_flags,
-                             0, NULL, talloc_get_size(bytes), bytes);
+                       additional_flags2,
+                       0, NULL, talloc_get_size(bytes), bytes);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
        }
@@ -1809,6 +1846,7 @@ struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX 
*mem_ctx,
        subreq = cli_trans_send(state,                  /* mem ctx. */
                                ev,                     /* event ctx. */
                                cli,                    /* cli_state. */
+                               0,                      /* additional_flags2 */
                                SMBtrans2,              /* cmd. */
                                NULL,                   /* pipe name. */
                                -1,                     /* fid. */
@@ -1905,6 +1943,7 @@ static struct tevent_req *cli_ntcreate1_send(TALLOC_CTX 
*mem_ctx,
        uint16_t *vwv;
        uint8_t *bytes;
        size_t converted_len;
+       uint16_t additional_flags2 = 0;
 
        req = tevent_req_create(mem_ctx, &state, struct cli_ntcreate1_state);
        if (req == NULL) {
@@ -1939,6 +1978,10 @@ static struct tevent_req *cli_ntcreate1_send(TALLOC_CTX 
*mem_ctx,
                                   fname, strlen(fname)+1,
                                   &converted_len);
 
+       if (clistr_is_previous_version_path(fname)) {
+               additional_flags2 = FLAGS2_REPARSE_PATH;
+       }
+
        /* sigh. this copes with broken netapp filer behaviour */
        bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), 
"", 1, NULL);
 
@@ -1948,8 +1991,9 @@ static struct tevent_req *cli_ntcreate1_send(TALLOC_CTX 
*mem_ctx,
 
        SSVAL(vwv+2, 1, converted_len);
 
-       subreq = cli_smb_send(state, ev, cli, SMBntcreateX, 0, 24, vwv,
-                             talloc_get_size(bytes), bytes);
+       subreq = cli_smb_send(state, ev, cli, SMBntcreateX, 0,
+                       additional_flags2, 24, vwv,
+                       talloc_get_size(bytes), bytes);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
        }
@@ -2197,6 +2241,7 @@ struct tevent_req *cli_nttrans_create_send(TALLOC_CTX 
*mem_ctx,
        size_t secdesc_len;
        NTSTATUS status;
        size_t converted_len;
+       uint16_t additional_flags2 = 0;
 
        req = tevent_req_create(mem_ctx,
                                &state, struct cli_nttrans_create_state);
@@ -2237,6 +2282,10 @@ struct tevent_req *cli_nttrans_create_send(TALLOC_CTX 
*mem_ctx,
                return tevent_req_post(req, ev);
        }
 
+       if (clistr_is_previous_version_path(fname)) {
+               additional_flags2 = FLAGS2_REPARSE_PATH;
+       }
+
        SIVAL(param, 0, CreatFlags);
        SIVAL(param, 4, 0x0);   /* RootDirectoryFid */
        SIVAL(param, 8, DesiredAccess);
@@ -2253,7 +2302,9 @@ struct tevent_req *cli_nttrans_create_send(TALLOC_CTX 
*mem_ctx,
        SIVAL(param, 48, 0x02); /* ImpersonationLevel */
        SCVAL(param, 52, SecurityFlags);
 
-       subreq = cli_trans_send(state, ev, cli, SMBnttrans,
+       subreq = cli_trans_send(state, ev, cli,
+                               additional_flags2, /* additional_flags2 */
+                               SMBnttrans,
                                NULL, -1, /* name, fid */
                                NT_TRANSACT_CREATE, 0,
                                NULL, 0, 0, /* setup */
@@ -2389,6 +2440,7 @@ struct tevent_req *cli_openx_create(TALLOC_CTX *mem_ctx,
        unsigned openfn;
        unsigned accessmode;
        uint8_t additional_flags;
+       uint16_t additional_flags2 = 0;
        uint8_t *bytes;
 
        req = tevent_req_create(mem_ctx, &state, struct cli_openx_state);
@@ -2456,11 +2508,15 @@ struct tevent_req *cli_openx_create(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
+       if (clistr_is_previous_version_path(fname)) {
+               additional_flags2 = FLAGS2_REPARSE_PATH;
+       }
+
        state->bytes.iov_base = (void *)bytes;
        state->bytes.iov_len = talloc_get_size(bytes);
 
        subreq = cli_smb_req_create(state, ev, cli, SMBopenX, additional_flags,
-                                   15, state->vwv, 1, &state->bytes);
+                       additional_flags2, 15, state->vwv, 1, &state->bytes);
        if (subreq == NULL) {
                TALLOC_FREE(req);
                return NULL;
@@ -2722,8 +2778,8 @@ struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
        SSVAL(state->vwv+0, 0, fnum);
        SIVALS(state->vwv+1, 0, -1);
 
-       subreq = cli_smb_req_create(state, ev, cli, SMBclose, 0, 3, state->vwv,
-                                   0, NULL);
+       subreq = cli_smb_req_create(state, ev, cli, SMBclose, 0, 0,
+                               3, state->vwv, 0, NULL);
        if (subreq == NULL) {
                TALLOC_FREE(req);
                return NULL;
@@ -2860,6 +2916,7 @@ struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
        subreq = cli_trans_send(state,                  /* mem ctx. */
                                ev,                     /* event ctx. */
                                cli,                    /* cli_state. */
+                               0,                      /* additional_flags2 */
                                SMBtrans2,              /* cmd. */
                                NULL,                   /* pipe name. */
                                -1,                     /* fid. */
@@ -3032,7 +3089,7 @@ struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
        SIVAL(state->data, 2, offset);
        SIVAL(state->data, 6, len);
 
-       subreq = cli_smb_send(state, ev, cli, SMBlockingX, additional_flags,
+       subreq = cli_smb_send(state, ev, cli, SMBlockingX, additional_flags, 0,
                                8, state->vwv, 10, state->data);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
@@ -3196,7 +3253,7 @@ struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
        SOFF_T_R(state->data, 4, offset);
        SOFF_T_R(state->data, 12, len);
 
-       subreq = cli_smb_send(state, ev, cli, SMBlockingX, additional_flags,
+       subreq = cli_smb_send(state, ev, cli, SMBlockingX, additional_flags, 0,
                                8, state->vwv, 20, state->data);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
@@ -3344,6 +3401,7 @@ static struct tevent_req 
*cli_posix_lock_internal_send(TALLOC_CTX *mem_ctx,
        subreq = cli_trans_send(state,                  /* mem ctx. */
                                ev,                     /* event ctx. */
                                cli,                    /* cli_state. */
+                               0,                      /* additional_flags2 */
                                SMBtrans2,              /* cmd. */
                                NULL,                   /* pipe name. */
                                -1,                     /* fid. */
@@ -3536,7 +3594,7 @@ struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
        state->zone_offset = smb1cli_conn_server_time_zone(cli->conn);
        SSVAL(state->vwv+0,0,fnum);
 
-       subreq = cli_smb_send(state, ev, cli, SMBgetattrE, additional_flags,
+       subreq = cli_smb_send(state, ev, cli, SMBgetattrE, additional_flags, 0,
                              1, state->vwv, 0, NULL);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
@@ -3685,6 +3743,7 @@ struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
        struct tevent_req *req = NULL, *subreq = NULL;
        struct cli_getatr_state *state = NULL;


-- 
Samba Shared Repository

Reply via email to