The branch, master has been updated
       via  5c3a0cb libcli/smb: setup tcon->smb2.should_encrypt in 
smb2cli_tcon_set_values()
       via  0aac3c0 libcli/smb: pass smbXcli_session to 
smb2cli_tcon_set_values()
       via  4d6d783 s4:libcli/smb2: remove unused smb2_session->pid
       via  bb6761c s3:libsmb: remove unused cli_state->smb2.pid
       via  e20e84d s4:libcli/smb2: remove unused variable
       via  56aa419 libcli/smb: there's no PID field in the SMB2/3 header 
anymore
       via  7de4ae7 libcli/smb: pass smbXcli_tcon to smb2cli_req_create/send()
       via  57fda88 s4:libcli/smb2: remove unused elements from smb2_tree
       via  56af56d s4:torture/smb2: create temporary smbXcli_tcon/session 
structures instead of changing them
       via  72e047f s4:torture/smb2: use smb2cli_tcon_capabilities()
       via  a10fe7b libcli/smb: add smb2cli_tcon_capabilities()
       via  167d94c s3:libsmb: remove unused tcon specific elements from 
cli_state->smb2
       via  d2ba9c3 s3:libsmb: remove cli_state->smb2.tid
       via  18bd029 s4:torture: remove unused shm_setup()
       via  97b1776 s4:torture: replace shm_setup() with 
anonymous_shared_allocate()
       via  b0f1921 s3:torture: remove unused shm_setup()
       via  e0bc165 s3:torture: replace shm_setup() with 
anonymous_shared_allocate()
       via  c66a45d s3:smb2_server: simplify the talloc_pool handling for 
smbd_smb2_request
      from  d58aa46 Fix bug 9065: source3/registry/regfio.c: bad call to memcpy 
Signed-off-by: Jeremy Allison <j...@samba.org>

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


- Log -----------------------------------------------------------------
commit 5c3a0cbae0eee6c2c35e2de037380546fc22dd9c
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Jul 25 12:34:20 2012 +0200

    libcli/smb: setup tcon->smb2.should_encrypt in smb2cli_tcon_set_values()
    
    metze
    
    Autobuild-User(master): Stefan Metzmacher <me...@samba.org>
    Autobuild-Date(master): Wed Jul 25 16:44:22 CEST 2012 on sn-devel-104

commit 0aac3c09f19875f670ac5f6438bb03f5a296cfab
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Jul 25 12:33:39 2012 +0200

    libcli/smb: pass smbXcli_session to smb2cli_tcon_set_values()
    
    metze

commit 4d6d783afeb64da85f89117324e43e4171df0d02
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Jul 25 11:40:54 2012 +0200

    s4:libcli/smb2: remove unused smb2_session->pid
    
    metze

commit bb6761c127456d56d7d39fffe26ada2e56b0b3ed
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Jul 25 11:26:22 2012 +0200

    s3:libsmb: remove unused cli_state->smb2.pid
    
    metze

commit e20e84d5271577b5e610283d8b07b2ef6230d290
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Jul 25 10:59:12 2012 +0200

    s4:libcli/smb2: remove unused variable
    
    metze

commit 56aa419d87e8f0a82ebe2110b128fa512cd1e2c6
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Jul 25 10:58:34 2012 +0200

    libcli/smb: there's no PID field in the SMB2/3 header anymore
    
    It's a reserved field...
    
    metze

commit 7de4ae7f9fbf642899afd8c89d0b3af72155e022
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Jul 25 10:36:27 2012 +0200

    libcli/smb: pass smbXcli_tcon to smb2cli_req_create/send()
    
    metze

commit 57fda88dfb685ca9ba84cda6799efcc2224e242f
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Jul 25 09:31:15 2012 +0200

    s4:libcli/smb2: remove unused elements from smb2_tree
    
    metze

commit 56af56d041c89bee6dc2a71a9b0faa85a22150d9
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Jul 25 09:29:00 2012 +0200

    s4:torture/smb2: create temporary smbXcli_tcon/session structures instead 
of changing them
    
    metze

commit 72e047f7c53f4e0481e658a1a683f398f5515bfb
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Jul 25 09:27:34 2012 +0200

    s4:torture/smb2: use smb2cli_tcon_capabilities()
    
    metze

commit a10fe7b25203248e3b7b41248e5bbc86ba9c2ed3
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Jul 25 09:27:00 2012 +0200

    libcli/smb: add smb2cli_tcon_capabilities()
    
    metze

commit 167d94c73dc1b2c79dbc980a2094c90711500fbf
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Jul 25 09:05:32 2012 +0200

    s3:libsmb: remove unused tcon specific elements from cli_state->smb2
    
    metze

commit d2ba9c36f30e175f0715de10e72a34b6e0797718
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Jul 25 09:01:02 2012 +0200

    s3:libsmb: remove cli_state->smb2.tid
    
    metze

commit 18bd029ffb7fae85f245d91081efda5603649d2f
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Jul 25 08:36:10 2012 +0200

    s4:torture: remove unused shm_setup()
    
    metze

commit 97b1776cb6f56a112fe16e747caaad7473c6bb73
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Jul 25 08:35:44 2012 +0200

    s4:torture: replace shm_setup() with anonymous_shared_allocate()
    
    metze

commit b0f1921bd733e9ad4f8fef720fab2fd0ed675f12
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Jul 25 08:35:17 2012 +0200

    s3:torture: remove unused shm_setup()
    
    metze

commit e0bc1650805159645ae2217a81fbf92d656f0e34
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Jul 25 08:33:31 2012 +0200

    s3:torture: replace shm_setup() with anonymous_shared_allocate()
    
    metze

commit c66a45d3f29570a907ef1f9a3e499eb19e804e7e
Author: Stefan Metzmacher <me...@samba.org>
Date:   Mon Jul 23 18:22:59 2012 +0200

    s3:smb2_server: simplify the talloc_pool handling for smbd_smb2_request
    
    metze

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

Summary of changes:
 libcli/smb/smb2cli_close.c             |    8 +---
 libcli/smb/smb2cli_create.c            |    8 +---
 libcli/smb/smb2cli_flush.c             |    8 +---
 libcli/smb/smb2cli_ioctl.c             |    8 +---
 libcli/smb/smb2cli_query_directory.c   |    8 +---
 libcli/smb/smb2cli_query_info.c        |    8 +---
 libcli/smb/smb2cli_read.c              |    8 +---
 libcli/smb/smb2cli_session.c           |    6 +--
 libcli/smb/smb2cli_set_info.c          |    8 +---
 libcli/smb/smb2cli_write.c             |    8 +---
 libcli/smb/smbXcli_base.c              |   54 ++++++++++++++++++-------
 libcli/smb/smbXcli_base.h              |    8 ++--
 source3/include/client.h               |    8 ----
 source3/libsmb/smb2cli_tcon.c          |   37 +++++++++--------
 source3/smbd/globals.h                 |    3 -
 source3/smbd/smb2_server.c             |   40 ++-----------------
 source3/torture/nbio.c                 |    2 +-
 source3/torture/proto.h                |    1 -
 source3/torture/test_smb2.c            |   58 ++++++++++-----------------
 source3/torture/torture.c              |   61 +---------------------------
 source4/libcli/smb2/connect.c          |    4 +-
 source4/libcli/smb2/request.c          |    2 -
 source4/libcli/smb2/session.c          |    2 -
 source4/libcli/smb2/smb2.h             |    3 -
 source4/libcli/smb2/transport.c        |   18 ++++-----
 source4/torture/nbench/nbio.c          |    2 +-
 source4/torture/smb2/compound.c        |   68 +++++++++++++++++++++++++-------
 source4/torture/smb2/durable_v2_open.c |    8 +++-
 source4/torture/smb2/lock.c            |    4 --
 source4/torture/smb2/notify.c          |    8 ++--
 source4/torture/smb2/util.c            |    4 +-
 source4/torture/util.h                 |    1 -
 source4/torture/util_smb.c             |   61 +---------------------------
 33 files changed, 178 insertions(+), 357 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/smb/smb2cli_close.c b/libcli/smb/smb2cli_close.c
index 42ed65a..fbeee55 100644
--- a/libcli/smb/smb2cli_close.c
+++ b/libcli/smb/smb2cli_close.c
@@ -42,7 +42,6 @@ struct tevent_req *smb2cli_close_send(TALLOC_CTX *mem_ctx,
        struct tevent_req *req, *subreq;
        struct smb2cli_close_state *state;
        uint8_t *fixed;
-       uint32_t tcon_id = 0;
 
        req = tevent_req_create(mem_ctx, &state,
                                struct smb2cli_close_state);
@@ -55,15 +54,10 @@ struct tevent_req *smb2cli_close_send(TALLOC_CTX *mem_ctx,
        SBVAL(fixed, 8, fid_persistent);
        SBVAL(fixed, 16, fid_volatile);
 
-       if (tcon) {
-               tcon_id = smb2cli_tcon_current_id(tcon);
-       }
-
        subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_CLOSE,
                                  0, 0, /* flags */
                                  timeout_msec,
-                                 0xFEFF, /* pid */
-                                 tcon_id,
+                                 tcon,
                                  session,
                                  state->fixed, sizeof(state->fixed),
                                  NULL, 0);
diff --git a/libcli/smb/smb2cli_create.c b/libcli/smb/smb2cli_create.c
index 33af378..4d264ef 100644
--- a/libcli/smb/smb2cli_create.c
+++ b/libcli/smb/smb2cli_create.c
@@ -70,7 +70,6 @@ struct tevent_req *smb2cli_create_send(
        size_t blobs_offset;
        uint8_t *dyn;
        size_t dyn_len;
-       uint32_t tcon_id = 0;
 
        req = tevent_req_create(mem_ctx, &state,
                                struct smb2cli_create_state);
@@ -138,15 +137,10 @@ struct tevent_req *smb2cli_create_send(
                data_blob_free(&blob);
        }
 
-       if (tcon) {
-               tcon_id = smb2cli_tcon_current_id(tcon);
-       }
-
        subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_CREATE,
                                  0, 0, /* flags */
                                  timeout_msec,
-                                 0xFEFF, /* pid */
-                                 tcon_id,
+                                 tcon,
                                  session,
                                  state->fixed, sizeof(state->fixed),
                                  dyn, dyn_len);
diff --git a/libcli/smb/smb2cli_flush.c b/libcli/smb/smb2cli_flush.c
index ca7a0fe..a280e15 100644
--- a/libcli/smb/smb2cli_flush.c
+++ b/libcli/smb/smb2cli_flush.c
@@ -41,7 +41,6 @@ struct tevent_req *smb2cli_flush_send(TALLOC_CTX *mem_ctx,
        struct tevent_req *req, *subreq;
        struct smb2cli_flush_state *state;
        uint8_t *fixed;
-       uint32_t tcon_id = 0;
 
        req = tevent_req_create(mem_ctx, &state,
                                struct smb2cli_flush_state);
@@ -53,15 +52,10 @@ struct tevent_req *smb2cli_flush_send(TALLOC_CTX *mem_ctx,
        SBVAL(fixed, 8, fid_persistent);
        SBVAL(fixed, 16, fid_volatile);
 
-       if (tcon) {
-               tcon_id = smb2cli_tcon_current_id(tcon);
-       }
-
        subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_FLUSH,
                                  0, 0, /* flags */
                                  timeout_msec,
-                                 0xFEFF, /* pid */
-                                 tcon_id,
+                                 tcon,
                                  session,
                                  state->fixed, sizeof(state->fixed),
                                  NULL, 0);
diff --git a/libcli/smb/smb2cli_ioctl.c b/libcli/smb/smb2cli_ioctl.c
index 03296c6..687c9d5 100644
--- a/libcli/smb/smb2cli_ioctl.c
+++ b/libcli/smb/smb2cli_ioctl.c
@@ -61,7 +61,6 @@ struct tevent_req *smb2cli_ioctl_send(TALLOC_CTX *mem_ctx,
        uint32_t output_buffer_offset = 0;
        uint32_t output_buffer_length = 0;
        uint32_t pad_length = 0;
-       uint32_t tcon_id = 0;
 
        req = tevent_req_create(mem_ctx, &state,
                                struct smb2cli_ioctl_state);
@@ -134,15 +133,10 @@ struct tevent_req *smb2cli_ioctl_send(TALLOC_CTX *mem_ctx,
                dyn_len = sizeof(state->dyn_pad);
        }
 
-       if (tcon) {
-               tcon_id = smb2cli_tcon_current_id(tcon);
-       }
-
        subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_IOCTL,
                                  0, 0, /* flags */
                                  timeout_msec,
-                                 0xFEFF, /* pid */
-                                 tcon_id,
+                                 tcon,
                                  session,
                                  state->fixed, sizeof(state->fixed),
                                  dyn, dyn_len);
diff --git a/libcli/smb/smb2cli_query_directory.c 
b/libcli/smb/smb2cli_query_directory.c
index 4ff93de..3278378 100644
--- a/libcli/smb/smb2cli_query_directory.c
+++ b/libcli/smb/smb2cli_query_directory.c
@@ -52,7 +52,6 @@ struct tevent_req *smb2cli_query_directory_send(TALLOC_CTX 
*mem_ctx,
        uint8_t *fixed;
        uint8_t *dyn;
        size_t dyn_len;
-       uint32_t tcon_id = 0;
 
        req = tevent_req_create(mem_ctx, &state,
                                struct smb2cli_query_directory_state);
@@ -88,15 +87,10 @@ struct tevent_req *smb2cli_query_directory_send(TALLOC_CTX 
*mem_ctx,
                dyn_len = sizeof(state->dyn_pad);
        }
 
-       if (tcon) {
-               tcon_id = smb2cli_tcon_current_id(tcon);
-       }
-
        subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_FIND,
                                  0, 0, /* flags */
                                  timeout_msec,
-                                 0xFEFF, /* pid */
-                                 tcon_id,
+                                 tcon,
                                  session,
                                  state->fixed, sizeof(state->fixed),
                                  dyn, dyn_len);
diff --git a/libcli/smb/smb2cli_query_info.c b/libcli/smb/smb2cli_query_info.c
index b5d9e79..80cec9c 100644
--- a/libcli/smb/smb2cli_query_info.c
+++ b/libcli/smb/smb2cli_query_info.c
@@ -55,7 +55,6 @@ struct tevent_req *smb2cli_query_info_send(TALLOC_CTX 
*mem_ctx,
        size_t dyn_len;
        uint16_t input_buffer_offset = 0;
        uint32_t input_buffer_length = 0;
-       uint32_t tcon_id = 0;
 
        req = tevent_req_create(mem_ctx, &state,
                                struct smb2cli_query_info_state);
@@ -91,15 +90,10 @@ struct tevent_req *smb2cli_query_info_send(TALLOC_CTX 
*mem_ctx,
                dyn_len = sizeof(state->dyn_pad);
        }
 
-       if (tcon) {
-               tcon_id = smb2cli_tcon_current_id(tcon);
-       }
-
        subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_GETINFO,
                                  0, 0, /* flags */
                                  timeout_msec,
-                                 0xFEFF, /* pid */
-                                 tcon_id,
+                                 tcon,
                                  session,
                                  state->fixed, sizeof(state->fixed),
                                  dyn, dyn_len);
diff --git a/libcli/smb/smb2cli_read.c b/libcli/smb/smb2cli_read.c
index 5ff4b64..e808b0c 100644
--- a/libcli/smb/smb2cli_read.c
+++ b/libcli/smb/smb2cli_read.c
@@ -49,7 +49,6 @@ struct tevent_req *smb2cli_read_send(TALLOC_CTX *mem_ctx,
        struct tevent_req *req, *subreq;
        struct smb2cli_read_state *state;
        uint8_t *fixed;
-       uint32_t tcon_id = 0;
 
        req = tevent_req_create(mem_ctx, &state,
                                struct smb2cli_read_state);
@@ -67,15 +66,10 @@ struct tevent_req *smb2cli_read_send(TALLOC_CTX *mem_ctx,
        SBVAL(fixed, 32, minimum_count);
        SBVAL(fixed, 40, remaining_bytes);
 
-       if (tcon) {
-               tcon_id = smb2cli_tcon_current_id(tcon);
-       }
-
        subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_READ,
                                  0, 0, /* flags */
                                  timeout_msec,
-                                 0xFEFF, /* pid */
-                                 tcon_id,
+                                 tcon,
                                  session,
                                  state->fixed, sizeof(state->fixed),
                                  state->dyn_pad, sizeof(state->dyn_pad));
diff --git a/libcli/smb/smb2cli_session.c b/libcli/smb/smb2cli_session.c
index 640eb95..d34fbd4 100644
--- a/libcli/smb/smb2cli_session.c
+++ b/libcli/smb/smb2cli_session.c
@@ -99,8 +99,7 @@ struct tevent_req *smb2cli_session_setup_send(TALLOC_CTX 
*mem_ctx,
                                  conn, SMB2_OP_SESSSETUP,
                                  0, 0, /* flags */
                                  timeout_msec,
-                                 0xFEFF,
-                                 0, /* tid */
+                                 NULL, /* tcon */
                                  session,
                                  state->fixed, sizeof(state->fixed),
                                  dyn, dyn_len);
@@ -256,8 +255,7 @@ struct tevent_req *smb2cli_logoff_send(TALLOC_CTX *mem_ctx,
                                  conn, SMB2_OP_LOGOFF,
                                  0, 0, /* flags */
                                  timeout_msec,
-                                 0xFEFF, /* pid */
-                                 0, /* tid */
+                                 NULL, /* tcon */
                                  session,
                                  state->fixed, sizeof(state->fixed),
                                  NULL, 0);
diff --git a/libcli/smb/smb2cli_set_info.c b/libcli/smb/smb2cli_set_info.c
index e33ba83..41fe83e 100644
--- a/libcli/smb/smb2cli_set_info.c
+++ b/libcli/smb/smb2cli_set_info.c
@@ -50,7 +50,6 @@ struct tevent_req *smb2cli_set_info_send(TALLOC_CTX *mem_ctx,
        size_t dyn_len;
        uint16_t input_buffer_offset = 0;
        uint32_t input_buffer_length = 0;
-       uint32_t tcon_id = 0;
 
        req = tevent_req_create(mem_ctx, &state,
                                struct smb2cli_set_info_state);
@@ -83,15 +82,10 @@ struct tevent_req *smb2cli_set_info_send(TALLOC_CTX 
*mem_ctx,
                dyn_len = sizeof(state->dyn_pad);
        }
 
-       if (tcon) {
-               tcon_id = smb2cli_tcon_current_id(tcon);
-       }
-
        subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_SETINFO,
                                  0, 0, /* flags */
                                  timeout_msec,
-                                 0xFEFF, /* pid */
-                                 tcon_id,
+                                 tcon,
                                  session,
                                  state->fixed, sizeof(state->fixed),
                                  dyn, dyn_len);
diff --git a/libcli/smb/smb2cli_write.c b/libcli/smb/smb2cli_write.c
index cd98e5e..a149924 100644
--- a/libcli/smb/smb2cli_write.c
+++ b/libcli/smb/smb2cli_write.c
@@ -49,7 +49,6 @@ struct tevent_req *smb2cli_write_send(TALLOC_CTX *mem_ctx,
        uint8_t *fixed;
        const uint8_t *dyn;
        size_t dyn_len;
-       uint32_t tcon_id = 0;
 
        req = tevent_req_create(mem_ctx, &state,
                                struct smb2cli_write_state);
@@ -76,15 +75,10 @@ struct tevent_req *smb2cli_write_send(TALLOC_CTX *mem_ctx,
                dyn_len = sizeof(state->dyn_pad);
        }
 
-       if (tcon) {
-               tcon_id = smb2cli_tcon_current_id(tcon);
-       }
-
        subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_WRITE,
                                  0, 0, /* flags */
                                  timeout_msec,
-                                 0xFEFF, /* pid */
-                                 tcon_id,
+                                 tcon,
                                  session,
                                  state->fixed, sizeof(state->fixed),
                                  dyn, dyn_len);
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index 037c0dd..7a5a0b0 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -167,6 +167,7 @@ struct smbXcli_tcon {
                uint32_t flags;
                uint32_t capabilities;
                uint32_t maximal_access;
+               bool should_encrypt;
        } smb2;
 };
 
@@ -2365,10 +2366,9 @@ static bool smb2cli_req_cancel(struct tevent_req *req)
                tevent_req_data(req,
                struct smbXcli_req_state);
        uint32_t flags = IVAL(state->smb2.hdr, SMB2_HDR_FLAGS);
-       uint32_t pid = IVAL(state->smb2.hdr, SMB2_HDR_PID);
-       uint32_t tid = IVAL(state->smb2.hdr, SMB2_HDR_TID);
        uint64_t mid = BVAL(state->smb2.hdr, SMB2_HDR_MESSAGE_ID);
        uint64_t aid = BVAL(state->smb2.hdr, SMB2_HDR_ASYNC_ID);
+       struct smbXcli_tcon *tcon = state->tcon;
        struct smbXcli_session *session = state->session;
        uint8_t *fixed = state->smb2.pad;
        uint16_t fixed_len = 4;
@@ -2384,7 +2384,7 @@ static bool smb2cli_req_cancel(struct tevent_req *req)
                                    SMB2_OP_CANCEL,
                                    flags, 0,
                                    0, /* timeout */
-                                   pid, tid, session,
+                                   tcon, session,
                                    fixed, fixed_len,
                                    NULL, 0);
        if (subreq == NULL) {
@@ -2397,8 +2397,6 @@ static bool smb2cli_req_cancel(struct tevent_req *req)
        }
 
        SIVAL(substate->smb2.hdr, SMB2_HDR_FLAGS, flags);
-       SIVAL(substate->smb2.hdr, SMB2_HDR_PID, pid);
-       SIVAL(substate->smb2.hdr, SMB2_HDR_TID, tid);
        SBVAL(substate->smb2.hdr, SMB2_HDR_MESSAGE_ID, mid);
        SBVAL(substate->smb2.hdr, SMB2_HDR_ASYNC_ID, aid);
 
@@ -2426,8 +2424,7 @@ struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
                                      uint32_t additional_flags,
                                      uint32_t clear_flags,
                                      uint32_t timeout_msec,
-                                     uint32_t pid,
-                                     uint32_t tid,
+                                     struct smbXcli_tcon *tcon,
                                      struct smbXcli_session *session,
                                      const uint8_t *fixed,
                                      uint16_t fixed_len,
@@ -2437,6 +2434,7 @@ struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
        struct tevent_req *req;
        struct smbXcli_req_state *state;
        uint32_t flags = 0;
+       uint32_t tid = 0;
        uint64_t uid = 0;
 
        req = tevent_req_create(mem_ctx, &state,
@@ -2448,6 +2446,7 @@ struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
        state->ev = ev;
        state->conn = conn;
        state->session = session;
+       state->tcon = tcon;
 
        if (session) {
                uid = session->smb2.session_id;
@@ -2455,8 +2454,6 @@ struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
                state->smb2.should_sign = session->smb2.should_sign;
                state->smb2.should_encrypt = session->smb2.should_encrypt;
 
-               /* TODO: turn on encryption based on the tree connect. */
-
                if (cmd == SMB2_OP_SESSSETUP &&
                    session->smb2.signing_key.length != 0) {
                        state->smb2.should_sign = true;
@@ -2466,12 +2463,20 @@ struct tevent_req *smb2cli_req_create(TALLOC_CTX 
*mem_ctx,
                    session->smb2.channel_signing_key.length == 0) {
                        state->smb2.should_encrypt = false;
                }
+       }
 
-               if (state->smb2.should_encrypt) {
-                       state->smb2.should_sign = false;
+       if (tcon) {
+               tid = tcon->smb2.tcon_id;
+
+               if (tcon->smb2.should_encrypt) {
+                       state->smb2.should_encrypt = true;
                }
        }
 
+       if (state->smb2.should_encrypt) {
+               state->smb2.should_sign = false;
+       }
+
        state->smb2.recv_iov = talloc_zero_array(state, struct iovec, 3);
        if (state->smb2.recv_iov == NULL) {
                TALLOC_FREE(req);
@@ -2495,7 +2500,7 @@ struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
        SSVAL(state->smb2.hdr, SMB2_HDR_LENGTH,         SMB2_HDR_BODY);
        SSVAL(state->smb2.hdr, SMB2_HDR_OPCODE,         cmd);
        SIVAL(state->smb2.hdr, SMB2_HDR_FLAGS,          flags);
-       SIVAL(state->smb2.hdr, SMB2_HDR_PID,            pid);
+       SIVAL(state->smb2.hdr, SMB2_HDR_PID,            0); /* reserved */
        SIVAL(state->smb2.hdr, SMB2_HDR_TID,            tid);
        SBVAL(state->smb2.hdr, SMB2_HDR_SESSION_ID,     uid);
 
@@ -2794,8 +2799,7 @@ struct tevent_req *smb2cli_req_send(TALLOC_CTX *mem_ctx,
                                    uint32_t additional_flags,
                                    uint32_t clear_flags,
                                    uint32_t timeout_msec,
-                                   uint32_t pid,
-                                   uint32_t tid,
+                                   struct smbXcli_tcon *tcon,
                                    struct smbXcli_session *session,
                                    const uint8_t *fixed,
                                    uint16_t fixed_len,
@@ -2808,7 +2812,7 @@ struct tevent_req *smb2cli_req_send(TALLOC_CTX *mem_ctx,
        req = smb2cli_req_create(mem_ctx, ev, conn, cmd,
                                 additional_flags, clear_flags,
                                 timeout_msec,
-                                pid, tid, session,
+                                tcon, session,
                                 fixed, fixed_len, dyn, dyn_len);
        if (req == NULL) {
                return NULL;
@@ -3999,7 +4003,7 @@ static struct tevent_req 
*smbXcli_negprot_smb2_subreq(struct smbXcli_negprot_sta
                                state->conn, SMB2_OP_NEGPROT,
                                0, 0, /* flags */
                                state->timeout_msec,
-                               0xFEFF, 0, NULL, /* pid, tid, session */
+                               NULL, NULL, /* tcon, session */
                                state->smb2.fixed, sizeof(state->smb2.fixed),
                                state->smb2.dyn, dialect_count*2);
 }
@@ -4617,7 +4621,13 @@ uint32_t smb2cli_tcon_current_id(struct smbXcli_tcon 
*tcon)
        return tcon->smb2.tcon_id;
 }
 
+uint32_t smb2cli_tcon_capabilities(struct smbXcli_tcon *tcon)
+{
+       return tcon->smb2.capabilities;
+}
+
 void smb2cli_tcon_set_values(struct smbXcli_tcon *tcon,
+                            struct smbXcli_session *session,
                             uint32_t tcon_id,
                             uint8_t type,
                             uint32_t flags,
@@ -4629,4 +4639,16 @@ void smb2cli_tcon_set_values(struct smbXcli_tcon *tcon,
        tcon->smb2.flags = flags;
        tcon->smb2.capabilities = capabilities;
        tcon->smb2.maximal_access = maximal_access;
+
+       tcon->smb2.should_encrypt = false;
+
+       if (session == NULL) {
+               return;
+       }
+
+       tcon->smb2.should_encrypt = session->smb2.should_encrypt;
+
+       if (flags & SMB2_SHAREFLAG_ENCRYPT_DATA) {
+               tcon->smb2.should_encrypt = true;
+       }
 }
diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h
index 60ef272..804fe44 100644
--- a/libcli/smb/smbXcli_base.h
+++ b/libcli/smb/smbXcli_base.h
@@ -200,8 +200,7 @@ struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
                                      uint32_t additional_flags,
                                      uint32_t clear_flags,
                                      uint32_t timeout_msec,
-                                     uint32_t pid,
-                                     uint32_t tid,
+                                     struct smbXcli_tcon *tcon,
                                      struct smbXcli_session *session,
                                      const uint8_t *fixed,
                                      uint16_t fixed_len,
@@ -224,8 +223,7 @@ struct tevent_req *smb2cli_req_send(TALLOC_CTX *mem_ctx,
                                    uint32_t additional_flags,
                                    uint32_t clear_flags,
                                    uint32_t timeout_msec,
-                                   uint32_t pid,
-                                   uint32_t tid,
+                                   struct smbXcli_tcon *tcon,
                                    struct smbXcli_session *session,
                                    const uint8_t *fixed,
                                    uint16_t fixed_len,
@@ -284,7 +282,9 @@ bool smb1cli_tcon_set_values(struct smbXcli_tcon *tcon,
                             const char *service,
                             const char *fs_type);
 uint32_t smb2cli_tcon_current_id(struct smbXcli_tcon *tcon);
+uint32_t smb2cli_tcon_capabilities(struct smbXcli_tcon *tcon);
 void smb2cli_tcon_set_values(struct smbXcli_tcon *tcon,
+                            struct smbXcli_session *session,
                             uint32_t tcon_id,
                             uint8_t type,
                             uint32_t flags,
diff --git a/source3/include/client.h b/source3/include/client.h
index 00a7e1b..748f78e 100644
--- a/source3/include/client.h
+++ b/source3/include/client.h
@@ -108,16 +108,8 @@ struct cli_state {
        } smb1;
 
        struct {
-               uint32_t pid;
-               uint32_t tid;
                struct smbXcli_session *session;
                struct smbXcli_tcon *tcon;
-


-- 
Samba Shared Repository

Reply via email to