The branch, master has been updated
       via  a0aaf5c3345 lib: Remove unused file_id_string()
       via  fea35840b05 smbd: Use file_id_str_buf() in 
share_mode_cleanup_disconnected()
       via  6fe211c85d9 smbd: Use file_id_str_buf() in 
share_mode_memcache_fetch()
       via  0d246a156da smbd: Use file_id_str_buf() in 
share_mode_memcache_store()
       via  c229c0508bc lib: Remove unused file_id_string_tos()
       via  64349ce7176 torture3: Use file_id_str_buf() in print_brl()
       via  79291056c5b smbd: Use file_id_str_buf() in 
linux_release_kernel_oplock()
       via  f7dc0334810 smbd: Use file_id_str_buf() in 
linux_oplock_signal_handler()
       via  b0a486fabef smbd: Use file_id_str_buf() in scavenger_add_timer()
       via  0dd11a83dc2 smbd: Use file_id_str_buf() in file_find_dif()
       via  420cb1778d8 smbd: Use file_id_str_buf() in scavenger_timer()
       via  215e7f1fe41 smbd: Use file_id_str_buf() in 
scavenger_schedule_disconnected()
       via  1f5ea9d1d52 s3: smbd: smb2 cleanup - restructure 
smbd_smb2_request_pending_timer() encrypt code to look the same as 
smbd_smb2_request_reply().
       via  c133a1fd676 s3: smbd: smb2 cleanup - remove variable tf_len - this 
is a constant SMB2_TF_HDR_SIZE.
       via  eae1a45d09e s3: smbd: SMB2 - Ensure we use the correct session_id 
if encrypting an interim response.
      from  30e8f513a8b Detect when command line max protocol < min protocol

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


- Log -----------------------------------------------------------------
commit a0aaf5c3345239959221d6c2e9cd949b8ccdf233
Author: Volker Lendecke <[email protected]>
Date:   Sat Nov 9 21:13:52 2019 +0100

    lib: Remove unused file_id_string()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>
    
    Autobuild-User(master): Jeremy Allison <[email protected]>
    Autobuild-Date(master): Tue Nov 12 22:18:40 UTC 2019 on sn-devel-184

commit fea35840b0504ac2fc8a3d85cb044f3d9fb345dd
Author: Volker Lendecke <[email protected]>
Date:   Sat Nov 9 21:11:38 2019 +0100

    smbd: Use file_id_str_buf() in share_mode_cleanup_disconnected()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 6fe211c85d93910960438c48b86614baac7db7de
Author: Volker Lendecke <[email protected]>
Date:   Sat Nov 9 21:08:15 2019 +0100

    smbd: Use file_id_str_buf() in share_mode_memcache_fetch()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 0d246a156da8047b86a8cfab00f5760a840eec60
Author: Volker Lendecke <[email protected]>
Date:   Sat Nov 9 21:05:41 2019 +0100

    smbd: Use file_id_str_buf() in share_mode_memcache_store()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit c229c0508bc64bb6e2d8d29be7a7bde58d86c86e
Author: Volker Lendecke <[email protected]>
Date:   Sat Nov 9 21:01:12 2019 +0100

    lib: Remove unused file_id_string_tos()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 64349ce7176c7079ffaace037c1a58a0f24abf29
Author: Volker Lendecke <[email protected]>
Date:   Sat Nov 9 20:58:26 2019 +0100

    torture3: Use file_id_str_buf() in print_brl()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 79291056c5b550c0afa8e4089758ad5e44e15cf0
Author: Volker Lendecke <[email protected]>
Date:   Sat Nov 9 20:57:14 2019 +0100

    smbd: Use file_id_str_buf() in linux_release_kernel_oplock()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit f7dc0334810723de5321f021e2d2be9d85a73939
Author: Volker Lendecke <[email protected]>
Date:   Sat Nov 9 20:55:29 2019 +0100

    smbd: Use file_id_str_buf() in linux_oplock_signal_handler()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit b0a486fabefaabd63cd2838e503360c0865e21dc
Author: Volker Lendecke <[email protected]>
Date:   Sat Nov 9 18:53:19 2019 +0100

    smbd: Use file_id_str_buf() in scavenger_add_timer()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 0dd11a83dc2d4487315f6654f57e7a43ba6ef98e
Author: Volker Lendecke <[email protected]>
Date:   Sat Nov 9 18:32:07 2019 +0100

    smbd: Use file_id_str_buf() in file_find_dif()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 420cb1778d8bb7233465459f269002b254049def
Author: Volker Lendecke <[email protected]>
Date:   Sat Nov 9 18:30:37 2019 +0100

    smbd: Use file_id_str_buf() in scavenger_timer()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 215e7f1fe414c38bbde1c896c16ab21f98943ef1
Author: Volker Lendecke <[email protected]>
Date:   Sat Nov 9 18:27:30 2019 +0100

    smbd: Use file_id_str_buf() in scavenger_schedule_disconnected()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit 1f5ea9d1d523cdf40c6b2c370abc7f9fa335f5cf
Author: Jeremy Allison <[email protected]>
Date:   Thu Nov 7 09:16:44 2019 -0800

    s3: smbd: smb2 cleanup - restructure smbd_smb2_request_pending_timer() 
encrypt code to look the same as smbd_smb2_request_reply().
    
    This makes code changes in both (if needed) much easier
    to spot.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit c133a1fd6765908e49e2b1808818b515c987ab72
Author: Jeremy Allison <[email protected]>
Date:   Thu Nov 7 09:13:12 2019 -0800

    s3: smbd: smb2 cleanup - remove variable tf_len - this is a constant 
SMB2_TF_HDR_SIZE.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit eae1a45d09ef54dd6b59803eedca672ae9433902
Author: Jeremy Allison <[email protected]>
Date:   Thu Nov 7 12:02:13 2019 -0800

    s3: smbd: SMB2 - Ensure we use the correct session_id if encrypting an 
interim response.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14189
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

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

Summary of changes:
 source3/lib/file_id.c             | 19 -------------------
 source3/lib/file_id.h             |  5 -----
 source3/locking/share_mode_lock.c | 30 ++++++++++++++++--------------
 source3/smbd/files.c              |  3 ++-
 source3/smbd/oplock_linux.c       | 21 +++++++++++++--------
 source3/smbd/scavenger.c          | 34 +++++++++++++++++++---------------
 source3/smbd/smb2_server.c        | 23 +++++++++++------------
 source3/torture/locktest2.c       |  5 ++++-
 8 files changed, 65 insertions(+), 75 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/file_id.c b/source3/lib/file_id.c
index 49e5c50385f..0cc5a56bc27 100644
--- a/source3/lib/file_id.c
+++ b/source3/lib/file_id.c
@@ -31,14 +31,6 @@ bool file_id_equal(const struct file_id *id1, const struct 
file_id *id2)
            id1->extid == id2->extid;
 }
 
-/*
-  a static-like (on talloc_tos()) string for a file_id structure
- */
-const char *file_id_string_tos(const struct file_id *id)
-{
-       return file_id_string(talloc_tos(), id);
-}
-
 char *file_id_str_buf(struct file_id fid, struct file_id_buf *dst)
 {
        snprintf(dst->buf,
@@ -50,17 +42,6 @@ char *file_id_str_buf(struct file_id fid, struct file_id_buf 
*dst)
        return dst->buf;
 }
 
-/*
-  an allocated string for a file_id structure
- */
-const char *file_id_string(TALLOC_CTX *mem_ctx, const struct file_id *id)
-{
-       struct file_id_buf buf;
-       char *result = talloc_strdup(mem_ctx, file_id_str_buf(*id, &buf));
-       SMB_ASSERT(result != NULL);
-       return result;
-}
-
 /*
   push a 16 byte version of a file id into a buffer.  This ignores the extid
   and is needed when dev/inodes are stored in persistent storage (tdbs).
diff --git a/source3/lib/file_id.h b/source3/lib/file_id.h
index c001199a35b..a946cb4d692 100644
--- a/source3/lib/file_id.h
+++ b/source3/lib/file_id.h
@@ -34,14 +34,9 @@ bool file_id_equal(const struct file_id *id1, const struct 
file_id *id2);
 struct file_id_buf { char buf[63]; };
 char *file_id_str_buf(struct file_id fid, struct file_id_buf *dst);
 
-/*
-  a static-like (on talloc_tos()) string for a file_id structure
- */
-const char *file_id_string_tos(const struct file_id *id);
 /*
   an allocated string for a file_id structure
  */
-const char *file_id_string(TALLOC_CTX *mem_ctx, const struct file_id *id);
 void push_file_id_16(char *buf, const struct file_id *id);
 void push_file_id_24(char *buf, const struct file_id *id);
 void pull_file_id_24(const char *buf, struct file_id *id);
diff --git a/source3/locking/share_mode_lock.c 
b/source3/locking/share_mode_lock.c
index 92289404468..4fcca861e48 100644
--- a/source3/locking/share_mode_lock.c
+++ b/source3/locking/share_mode_lock.c
@@ -177,11 +177,12 @@ static DATA_BLOB memcache_key(const struct file_id *id)
 static void share_mode_memcache_store(struct share_mode_data *d)
 {
        const DATA_BLOB key = memcache_key(&d->id);
+       struct file_id_buf idbuf;
 
        DBG_DEBUG("stored entry for file %s seq %"PRIx64" key %s\n",
                  d->base_name,
                  d->sequence_number,
-                 file_id_string(talloc_tos(), &d->id));
+                 file_id_str_buf(d->id, &idbuf));
 
        /* Ensure everything stored in the cache is pristine. */
        d->modified = false;
@@ -293,6 +294,7 @@ static struct share_mode_data 
*share_mode_memcache_fetch(TALLOC_CTX *mem_ctx,
        uint16_t flags;
        void *ptr;
        struct file_id id;
+       struct file_id_buf idbuf;
        DATA_BLOB key;
 
        /* Ensure this is a locking_key record. */
@@ -307,17 +309,17 @@ static struct share_mode_data 
*share_mode_memcache_fetch(TALLOC_CTX *mem_ctx,
                        SHARE_MODE_LOCK_CACHE,
                        key);
        if (ptr == NULL) {
-               DEBUG(10,("failed to find entry for key %s\n",
-                       file_id_string(mem_ctx, &id)));
+               DBG_DEBUG("failed to find entry for key %s\n",
+                         file_id_str_buf(id, &idbuf));
                return NULL;
        }
        /* sequence number key is at start of blob. */
        ndr_err = get_share_mode_blob_header(blob, &sequence_number, &flags);
        if (ndr_err != NDR_ERR_SUCCESS) {
                /* Bad blob. Remove entry. */
-               DEBUG(10,("bad blob %u key %s\n",
-                       (unsigned int)ndr_err,
-                       file_id_string(mem_ctx, &id)));
+               DBG_DEBUG("bad blob %u key %s\n",
+                         (unsigned int)ndr_err,
+                         file_id_str_buf(id, &idbuf));
                memcache_delete(NULL,
                        SHARE_MODE_LOCK_CACHE,
                        key);
@@ -330,7 +332,7 @@ static struct share_mode_data 
*share_mode_memcache_fetch(TALLOC_CTX *mem_ctx,
                          "for key %s\n",
                          d->sequence_number,
                          sequence_number,
-                         file_id_string(mem_ctx, &id));
+                         file_id_str_buf(id, &idbuf));
                /* Cache out of date. Remove entry. */
                memcache_delete(NULL,
                        SHARE_MODE_LOCK_CACHE,
@@ -358,7 +360,7 @@ static struct share_mode_data 
*share_mode_memcache_fetch(TALLOC_CTX *mem_ctx,
        DBG_DEBUG("fetched entry for file %s seq %"PRIx64" key %s\n",
                  d->base_name,
                  d->sequence_number,
-                 file_id_string(mem_ctx, &id));
+                 file_id_str_buf(id, &idbuf));
 
        return d;
 }
@@ -1197,13 +1199,13 @@ bool share_mode_cleanup_disconnected(struct file_id fid,
        struct share_mode_data *data;
        bool ret = false;
        TALLOC_CTX *frame = talloc_stackframe();
+       struct file_id_buf idbuf;
        bool ok;
 
        state.lck = get_existing_share_mode_lock(frame, fid);
        if (state.lck == NULL) {
-               DEBUG(5, ("share_mode_cleanup_disconnected: "
-                         "Could not fetch share mode entry for %s\n",
-                         file_id_string(frame, &fid)));
+               DBG_INFO("Could not fetch share mode entry for %s\n",
+                        file_id_str_buf(fid, &idbuf));
                goto done;
        }
        data = state.lck->data;
@@ -1226,7 +1228,7 @@ bool share_mode_cleanup_disconnected(struct file_id fid,
                          "with file (file-id='%s', servicepath='%s', "
                          "base_name='%s%s%s') and open_persistent_id %"PRIu64" 
"
                          "==> do not cleanup\n",
-                         file_id_string(frame, &fid),
+                         file_id_str_buf(fid, &idbuf),
                          data->servicepath,
                          data->base_name,
                          (data->stream_name == NULL)
@@ -1242,7 +1244,7 @@ bool share_mode_cleanup_disconnected(struct file_id fid,
                          "with file (file-id='%s', servicepath='%s', "
                          "base_name='%s%s%s') and open_persistent_id %"PRIu64" 
"
                          "==> do not cleanup\n",
-                         file_id_string(frame, &fid),
+                         file_id_str_buf(fid, &idbuf),
                          data->servicepath,
                          data->base_name,
                          (data->stream_name == NULL)
@@ -1258,7 +1260,7 @@ bool share_mode_cleanup_disconnected(struct file_id fid,
                  "base_name='%s%s%s') "
                  "from open_persistent_id %"PRIu64"\n",
                  data->num_share_modes,
-                 file_id_string(frame, &fid),
+                 file_id_str_buf(fid, &idbuf),
                  data->servicepath,
                  data->base_name,
                  (data->stream_name == NULL)
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index e0ec601c56f..077610cad75 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -344,11 +344,12 @@ files_struct *file_find_dif(struct smbd_server_connection 
*sconn,
                        if ((fsp->fh->fd == -1) &&
                            (fsp->oplock_type != NO_OPLOCK &&
                             fsp->oplock_type != LEASE_OPLOCK)) {
+                               struct file_id_buf idbuf;
                                DEBUG(0,("file_find_dif: file %s file_id = "
                                         "%s, gen = %u oplock_type = %u is a "
                                         "stat open with oplock type !\n",
                                         fsp_str_dbg(fsp),
-                                        file_id_string_tos(&fsp->file_id),
+                                        file_id_str_buf(fsp->file_id, &idbuf),
                                         (unsigned int)fsp->fh->gen_id,
                                         (unsigned int)fsp->oplock_type ));
                                smb_panic("file_find_dif");
diff --git a/source3/smbd/oplock_linux.c b/source3/smbd/oplock_linux.c
index 2a494ea05c1..7549d492ce0 100644
--- a/source3/smbd/oplock_linux.c
+++ b/source3/smbd/oplock_linux.c
@@ -140,19 +140,22 @@ static void linux_oplock_signal_handler(struct 
tevent_context *ev_ctx,
 static bool linux_set_kernel_oplock(struct kernel_oplocks *ctx,
                                    files_struct *fsp, int oplock_type)
 {
+       struct file_id_buf idbuf;
+
        if ( SMB_VFS_LINUX_SETLEASE(fsp, F_WRLCK) == -1) {
-               DEBUG(3,("linux_set_kernel_oplock: Refused oplock on file %s, "
-                        "fd = %d, file_id = %s. (%s)\n",
-                        fsp_str_dbg(fsp), fsp->fh->fd,
-                        file_id_string_tos(&fsp->file_id),
-                        strerror(errno)));
+               DBG_NOTICE("Refused oplock on file %s, "
+                          "fd = %d, file_id = %s. (%s)\n",
+                          fsp_str_dbg(fsp),
+                          fsp->fh->fd,
+                          file_id_str_buf(fsp->file_id, &idbuf),
+                          strerror(errno));
                return False;
        }
        
        DBG_NOTICE("got kernel oplock on file %s, "
                   "file_id = %s gen_id = %"PRIu64"\n",
                   fsp_str_dbg(fsp),
-                  file_id_string_tos(&fsp->file_id),
+                  file_id_str_buf(fsp->file_id, &idbuf),
                   fsp->fh->gen_id);
 
        return True;
@@ -165,6 +168,8 @@ static bool linux_set_kernel_oplock(struct kernel_oplocks 
*ctx,
 static void linux_release_kernel_oplock(struct kernel_oplocks *ctx,
                                        files_struct *fsp, int oplock_type)
 {
+       struct file_id_buf idbuf;
+
        if (DEBUGLVL(10)) {
                /*
                 * Check and print out the current kernel
@@ -175,7 +180,7 @@ static void linux_release_kernel_oplock(struct 
kernel_oplocks *ctx,
                        "gen_id = %"PRIu64" has kernel oplock state "
                        "of %x.\n",
                        fsp_str_dbg(fsp),
-                       file_id_string_tos(&fsp->file_id),
+                       file_id_str_buf(fsp->file_id, &idbuf),
                        fsp->fh->gen_id,
                        state);
        }
@@ -190,7 +195,7 @@ static void linux_release_kernel_oplock(struct 
kernel_oplocks *ctx,
                        dbgtext("%s, file_id = %s, gen_id = %"PRIu64". "
                                "Error was %s\n",
                                fsp_str_dbg(fsp),
-                               file_id_string_tos(&fsp->file_id),
+                               file_id_str_buf(fsp->file_id, &idbuf),
                                fsp->fh->gen_id,
                                strerror(errno));
                }
diff --git a/source3/smbd/scavenger.c b/source3/smbd/scavenger.c
index a9fda7f0641..cd5c85d2871 100644
--- a/source3/smbd/scavenger.c
+++ b/source3/smbd/scavenger.c
@@ -410,6 +410,7 @@ void scavenger_schedule_disconnected(struct files_struct 
*fsp)
        struct scavenger_message msg;
        DATA_BLOB msg_blob;
        struct server_id_buf tmp;
+       struct file_id_buf idbuf;
 
        if (fsp->op == NULL) {
                return;
@@ -428,7 +429,7 @@ void scavenger_schedule_disconnected(struct files_struct 
*fsp)
        DEBUG(10, ("smbd: %s mark file %s as disconnected at %s with timeout "
                   "at %s in %fs\n",
                   server_id_str_buf(self, &tmp),
-                  file_id_string_tos(&fsp->file_id),
+                  file_id_str_buf(fsp->file_id, &idbuf),
                   timeval_string(talloc_tos(), &disconnect_time, true),
                   timeval_string(talloc_tos(), &until, true),
                   fsp->op->global->durable_timeout_msec/1000.0));
@@ -466,28 +467,30 @@ static void scavenger_timer(struct tevent_context *ev,
 {
        struct scavenger_timer_context *ctx =
                talloc_get_type_abort(data, struct scavenger_timer_context);
+       struct file_id_buf idbuf;
        NTSTATUS status;
        bool ok;
 
-       DEBUG(10, ("scavenger: do cleanup for file %s at %s\n",
-                 file_id_string_tos(&ctx->msg.file_id),
-                 timeval_string(talloc_tos(), &t, true)));
+       DBG_DEBUG("do cleanup for file %s at %s\n",
+                 file_id_str_buf(ctx->msg.file_id, &idbuf),
+                 timeval_string(talloc_tos(), &t, true));
 
        ok = share_mode_cleanup_disconnected(ctx->msg.file_id,
                                             ctx->msg.open_persistent_id);
        if (!ok) {
-               DEBUG(2, ("Failed to cleanup share modes and byte range locks "
-                         "for file %s open %llu\n",
-                         file_id_string_tos(&ctx->msg.file_id),
-                         (unsigned long long)ctx->msg.open_persistent_id));
+               DBG_WARNING("Failed to cleanup share modes and byte range "
+                           "locks for file %s open %"PRIu64"\n",
+                           file_id_str_buf(ctx->msg.file_id, &idbuf),
+                           ctx->msg.open_persistent_id);
        }
 
        status = smbXsrv_open_cleanup(ctx->msg.open_persistent_id);
        if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(2, ("Failed to cleanup open global for file %s open %llu:"
-                         " %s\n", file_id_string_tos(&ctx->msg.file_id),
-                         (unsigned long long)ctx->msg.open_persistent_id,
-                         nt_errstr(status)));
+               DBG_WARNING("Failed to cleanup open global for file %s open "
+                           "%"PRIu64": %s\n",
+                           file_id_str_buf(ctx->msg.file_id, &idbuf),
+                           ctx->msg.open_persistent_id,
+                           nt_errstr(status));
        }
 }
 
@@ -497,12 +500,13 @@ static void scavenger_add_timer(struct 
smbd_scavenger_state *state,
        struct tevent_timer *te;
        struct scavenger_timer_context *ctx;
        struct timeval until;
+       struct file_id_buf idbuf;
 
        nttime_to_timeval(&until, msg->until);
 
-       DEBUG(10, ("scavenger: schedule file %s for cleanup at %s\n",
-                  file_id_string_tos(&msg->file_id),
-                  timeval_string(talloc_tos(), &until, true)));
+       DBG_DEBUG("schedule file %s for cleanup at %s\n",
+                 file_id_str_buf(msg->file_id, &idbuf),
+                 timeval_string(talloc_tos(), &until, true));
 
        ctx = talloc_zero(state, struct scavenger_timer_context);
        if (ctx == NULL) {
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index 130fe5048c0..7044ecb991a 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -1600,15 +1600,11 @@ static void smbd_smb2_request_pending_timer(struct 
tevent_context *ev,
        uint8_t *outhdr = NULL;
        const uint8_t *inhdr = NULL;
        uint8_t *tf = NULL;
-       size_t tf_len = 0;
        uint8_t *hdr = NULL;
        uint8_t *body = NULL;
        uint8_t *dyn = NULL;
        uint32_t flags = 0;
-       uint64_t session_id = 0;
        uint64_t message_id = 0;
-       uint64_t nonce_high = 0;
-       uint64_t nonce_low = 0;
        uint64_t async_id = 0;
        NTSTATUS status;
        bool ok;
@@ -1620,7 +1616,6 @@ static void smbd_smb2_request_pending_timer(struct 
tevent_context *ev,
        outhdr = SMBD_SMB2_OUT_HDR_PTR(req);
        flags = IVAL(outhdr, SMB2_HDR_FLAGS);
        message_id = BVAL(outhdr, SMB2_HDR_MESSAGE_ID);
-       session_id = BVAL(outhdr, SMB2_HDR_SESSION_ID);
 
        async_id = message_id; /* keep it simple for now... */
 
@@ -1646,13 +1641,16 @@ static void smbd_smb2_request_pending_timer(struct 
tevent_context *ev,
        }
 
        tf = state->buf + NBT_HDR_SIZE;
-       tf_len = SMB2_TF_HDR_SIZE;
 
        hdr = tf + SMB2_TF_HDR_SIZE;
        body = hdr + SMB2_HDR_BODY;
        dyn = body + 8;
 
        if (req->do_encryption) {
+               uint64_t nonce_high = 0;
+               uint64_t nonce_low = 0;
+               uint64_t session_id = req->session->global->session_wire_id;
+
                status = smb2_get_new_nonce(req->session,
                                            &nonce_high,
                                            &nonce_low);
@@ -1661,12 +1659,12 @@ static void smbd_smb2_request_pending_timer(struct 
tevent_context *ev,
                                                         nt_errstr(status));
                        return;
                }
-       }
 
-       SIVAL(tf, SMB2_TF_PROTOCOL_ID, SMB2_TF_MAGIC);
-       SBVAL(tf, SMB2_TF_NONCE+0, nonce_low);
-       SBVAL(tf, SMB2_TF_NONCE+8, nonce_high);
-       SBVAL(tf, SMB2_TF_SESSION_ID, session_id);
+               SIVAL(tf, SMB2_TF_PROTOCOL_ID, SMB2_TF_MAGIC);
+               SBVAL(tf, SMB2_TF_NONCE+0, nonce_low);
+               SBVAL(tf, SMB2_TF_NONCE+8, nonce_high);
+               SBVAL(tf, SMB2_TF_SESSION_ID, session_id);
+       }
 
        SIVAL(hdr, SMB2_HDR_PROTOCOL_ID, SMB2_MAGIC);
        SSVAL(hdr, SMB2_HDR_LENGTH, SMB2_HDR_BODY);
@@ -1696,7 +1694,8 @@ static void smbd_smb2_request_pending_timer(struct 
tevent_context *ev,
 
        if (req->do_encryption) {
                state->vector[1+SMBD_SMB2_TF_IOV_OFS].iov_base   = tf;
-               state->vector[1+SMBD_SMB2_TF_IOV_OFS].iov_len    = tf_len;
+               state->vector[1+SMBD_SMB2_TF_IOV_OFS].iov_len    =
+                                                       SMB2_TF_HDR_SIZE;
        } else {
                state->vector[1+SMBD_SMB2_TF_IOV_OFS].iov_base   = NULL;
                state->vector[1+SMBD_SMB2_TF_IOV_OFS].iov_len    = 0;
diff --git a/source3/torture/locktest2.c b/source3/torture/locktest2.c
index 6ab1ed4fa19..84fdddbf93c 100644
--- a/source3/torture/locktest2.c
+++ b/source3/torture/locktest2.c
@@ -156,8 +156,11 @@ static void print_brl(struct file_id id, struct server_id 
pid,
                      br_off start, br_off size,
                      void *private_data)
 {
+       struct file_id_buf idbuf;
+
        printf("%6d   %s    %s  %.0f:%.0f(%.0f)\n", 
-              (int)procid_to_pid(&pid), file_id_string_tos(&id),
+              (int)procid_to_pid(&pid),
+              file_id_str_buf(id, &idbuf),
               lock_type==READ_LOCK?"R":"W",
               (double)start, (double)start+size-1,(double)size);
 


-- 
Samba Shared Repository

Reply via email to