[SCM] Samba Shared Repository - branch master updated

Andreas Schneider asn at samba.org
Tue Jun 11 15:26:02 UTC 2019


The branch, master has been updated
       via  08750166542 libcli/smb: add missing struct smb2_signing_key allocation in smb2cli_session_set_channel_key()
       via  1817db965dc libcli:smb: Fix signing with multichannel
       via  4646698f1b0 s3: net: Consider unprocessed in input buffer
      from  49e2d369186 lib/tdb/common: clang: Fix 'Value stored to 'last_ptr' is never read'

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


- Log -----------------------------------------------------------------
commit 08750166542f46644038d1ff9d839b270436addf
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jun 7 18:58:43 2019 +0200

    libcli/smb: add missing struct smb2_signing_key allocation in smb2cli_session_set_channel_key()
    
    This was missing in commit 17e22e020fcb84fb9ddda350915369dc9ea28ef1
    and causes all multi-channel tests to segfault.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Tue Jun 11 15:25:56 UTC 2019 on sn-devel-184

commit 1817db965dc0caf55e4308fa4d9203ab4381dc90
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Jun 11 15:39:24 2019 +0200

    libcli:smb: Fix signing with multichannel
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 4646698f1b040e743180b7d43578c31d6a28983e
Author: Samuel Cabrero <scabrero at suse.de>
Date:   Fri Jun 7 21:12:12 2019 +0200

    s3: net: Consider unprocessed in input buffer
    
    If there is unprocessed data in the input buffer (ilen > 0), place new
    data read after the unprocessed one.
    
    Signed-off-by: Samuel Cabrero <scabrero at suse.de>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

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

Summary of changes:
 libcli/smb/smbXcli_base.c    | 21 +++++++++++++++++----
 source3/registry/reg_parse.c |  2 +-
 2 files changed, 18 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index a82146a60f4..133b961528b 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -3282,7 +3282,8 @@ skip_credits:
 			 * If it is a channel binding, we already have the main
 			 * signing key and try that one.
 			 */
-			if (!smb2_signing_key_valid(signing_key)) {
+			if (signing_key != NULL &&
+			    !smb2_signing_key_valid(signing_key)) {
 				signing_key = state->session->smb2->signing_key;
 			}
 
@@ -3290,7 +3291,8 @@ skip_credits:
 			 * If we do not have any session key yet, we skip the
 			 * signing of SMB2_OP_SESSSETUP requests.
 			 */
-			if (!smb2_signing_key_valid(signing_key)) {
+			if (signing_key != NULL &&
+			    !smb2_signing_key_valid(signing_key)) {
 				signing_key = NULL;
 			}
 		}
@@ -3789,12 +3791,14 @@ static NTSTATUS smb2cli_conn_dispatch_incoming(struct smbXcli_conn *conn,
 			 * we try the main signing key, if it is not
 			 * the final response.
 			 */
-			if (!smb2_signing_key_valid(signing_key) &&
+			if (signing_key != NULL &&
+			    !smb2_signing_key_valid(signing_key) &&
 			    !NT_STATUS_IS_OK(status)) {
 				signing_key = session->smb2->signing_key;
 			}
 
-			if (!smb2_signing_key_valid(signing_key)) {
+			if (signing_key != NULL &&
+			    !smb2_signing_key_valid(signing_key)) {
 				/*
 				 * If we do not have a session key to
 				 * verify the signature, we defer the
@@ -6298,6 +6302,15 @@ NTSTATUS smb2cli_session_set_channel_key(struct smbXcli_session *session,
 	memcpy(channel_key, _channel_key.data,
 	       MIN(_channel_key.length, sizeof(channel_key)));
 
+	session->smb2_channel.signing_key = talloc_zero(session,
+						 struct smb2_signing_key);
+	if (session->smb2_channel.signing_key == NULL) {
+		ZERO_STRUCT(channel_key);
+		return NT_STATUS_NO_MEMORY;
+	}
+	talloc_set_destructor(session->smb2_channel.signing_key,
+			      smb2_signing_key_destructor);
+
 	session->smb2_channel.signing_key->blob =
 		data_blob_talloc(session->smb2_channel.signing_key,
 				 channel_key,
diff --git a/source3/registry/reg_parse.c b/source3/registry/reg_parse.c
index c64cf66a5ab..24e9b62a516 100644
--- a/source3/registry/reg_parse.c
+++ b/source3/registry/reg_parse.c
@@ -1016,7 +1016,7 @@ int reg_parse_fd(int fd, const struct reg_parse_callback* cb, const char* opts)
 		space_to_read = sizeof(buf_in) - ilen;
 
 		/* Read the next chunk from the file. */
-		nread = read(fd, buf_in, space_to_read);
+		nread = read(fd, buf_in + ilen, space_to_read);
 		if (nread < 0) {
 			DBG_ERR("read failed: %s\n", strerror(errno));
 			ret = -1;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list