[SCM] Samba Shared Repository - branch master updated

David Mulder dmulder at samba.org
Tue Mar 8 23:06:01 UTC 2022


The branch, master has been updated
       via  239178aee36 s3: smbd: Rename srv_set_signing() -> smb1_srv_set_signing()
       via  b8ce6949ff4 s3: smbd: Rename srv_is_signing_negotiated() -> smb1_srv_is_signing_negotiated().
       via  e0ad956c097 s3: smbd: Rename srv_is_signing_active() -> smb1_srv_is_signing_active().
       via  93eaaccf8e6 s3: smbd: Rename srv_set_signing_negotiated() -> smb1_srv_set_signing_negotiated().
       via  ed648848958 s3: smbd: Rename srv_cancel_sign_response() -> smb1_srv_cancel_sign_response().
       via  fa9c48ae4dd s3: smbd: Rename srv_calculate_sign_mac() -> smb1_srv_calculate_sign_mac().
       via  777fbb3753b s3: smbd: Rename srv_check_sign_mac() -> smb1_srv_check_sign_mac().
       via  3e021c3762f s3: libcli: Rename smb_key_derivation() -> smb1_key_derivation()
       via  0b391fc19f7 s3: libcli: Rename smb_signing_is_negotiated() -> smb1_signing_is_negotiated()
       via  7a385775eec s3: libcli: Rename smb_signing_set_negotiated() -> smb1_signing_set_negotiated()
       via  79633b42d61 s3: libcli: Rename smb_signing_is_mandatory() -> smb1_signing_is_mandatory()
       via  e42fc9bc24d s3: libcli: Rename smb_signing_is_desired() -> smb1_signing_is_desired()
       via  2fd29169714 s3: libcli: Remove unused smb_signing_is_allowed()
       via  0c8bc1bf568 s3: libcli: Rename smb_signing_is_active() -> smb1_signing_is_active()
       via  8dd252ad91b s3: libcli: Rename smb_signing_activate() -> smb1_signing_activate()
       via  84a498feeca s3: libcli: Rename smb_signing_check_pdu() -> smb1_signing_check_pdu()
       via  6a68caff962 s3: libcli: Rename smb_signing_sign_pdu() -> smb1_signing_sign_pdu()
       via  fd9325587c9 s3: libcli: Rename smb_signing_cancel_reply() -> smb1_signing_cancel_reply()
       via  e563725a196 s3: libcli: Rename smb_signing_next_seqnum() -> smb1_signing_next_seqnum()
       via  00d8b05ddbf s3: libcli: Rename smb_signing_md5() -> smb1_signing_md5()
       via  7e82ac3a40d s3: libcli: Rename smb_signing_good() -> smb1_signing_good()
       via  6ae33a62bc4 s3: libcli: Rename smb_signing_init() -> smb1_signing_init()
       via  cba8ba327f1 s3: libcli: Rename smb_signing_init_ex() -> smb1_signing_init_ex()
       via  aee7bfa079a s3: libcli: Rename static smb_signing_reset_info() -> smb1_signing_reset_info()
       via  b879d475bfd s3: smbd: Look at the correct signing state for the debug messages in make_connection_snum().
       via  1f3f6e20dc0 s3: smbd: Split srv_init_signing() into 2 static functions smb1_srv_init_signing() and smb2_srv_init_signing().
       via  3f9d528f389 s3: smbd: Add smb2_srv_init_signing(). Initializes conn->smb2.signing_mandatory.
       via  b51b055fc4b s3: smbd: Add 'bool signing_mandatory' to struct smbXsrv_connection.smb2 component.
       via  41393579de6 s3: Simple rename 'struct smb_signing_state' -> 'struct smb1_signing_state'
       via  d972f64b30d s3: smbd: notify_mid_maps is used by both SMB1 and SMB2.
      from  7debfe7a231 ctdb-tools: Remove deprecated networking commands and replace with new commands

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


- Log -----------------------------------------------------------------
commit 239178aee363be2c3add4063fe9c50f482a58ed1
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:57:15 2022 -0800

    s3: smbd: Rename srv_set_signing() -> smb1_srv_set_signing()
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>
    
    Autobuild-User(master): David Mulder <dmulder at samba.org>
    Autobuild-Date(master): Tue Mar  8 23:05:19 UTC 2022 on sn-devel-184

commit b8ce6949ff4709325080ec579adb49a83786a59a
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:54:00 2022 -0800

    s3: smbd: Rename srv_is_signing_negotiated() -> smb1_srv_is_signing_negotiated().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit e0ad956c097b45568cfb3370d191b0ed52adea23
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:51:06 2022 -0800

    s3: smbd: Rename srv_is_signing_active() -> smb1_srv_is_signing_active().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit 93eaaccf8e6e8652e10f5e3990db78dc113546ed
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:46:58 2022 -0800

    s3: smbd: Rename srv_set_signing_negotiated() -> smb1_srv_set_signing_negotiated().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit ed6488489580c9400b419a86ead470f9bdcd2969
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:45:19 2022 -0800

    s3: smbd: Rename srv_cancel_sign_response() -> smb1_srv_cancel_sign_response().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit fa9c48ae4dd69c80c47cd4684deff04339bd22ea
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:44:18 2022 -0800

    s3: smbd: Rename srv_calculate_sign_mac() -> smb1_srv_calculate_sign_mac().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit 777fbb3753b97eb2570df974c74689300260cf36
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:43:10 2022 -0800

    s3: smbd: Rename srv_check_sign_mac() -> smb1_srv_check_sign_mac().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit 3e021c3762fce4f5c238da5ab36797c3d6fba1a5
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:41:31 2022 -0800

    s3: libcli: Rename smb_key_derivation() -> smb1_key_derivation()
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit 0b391fc19f7098ce2f7b8faf22adab1fbb34bee7
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:39:58 2022 -0800

    s3: libcli: Rename smb_signing_is_negotiated() -> smb1_signing_is_negotiated()
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit 7a385775eeccd5a36a2767052133c7e4bcfbf904
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:38:35 2022 -0800

    s3: libcli: Rename smb_signing_set_negotiated() -> smb1_signing_set_negotiated()
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit 79633b42d6199da3b9764c28772308de08c3c94e
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:36:25 2022 -0800

    s3: libcli: Rename smb_signing_is_mandatory() -> smb1_signing_is_mandatory()
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit e42fc9bc24deb288fad14c99bcf5a63435c5cd83
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:34:42 2022 -0800

    s3: libcli: Rename smb_signing_is_desired() -> smb1_signing_is_desired()
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit 2fd29169714bd5e768789e24de34c7a7efd80a07
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:33:23 2022 -0800

    s3: libcli: Remove unused smb_signing_is_allowed()
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit 0c8bc1bf5689753cfbc1bc35d6cfba506446ac68
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:31:34 2022 -0800

    s3: libcli: Rename smb_signing_is_active() -> smb1_signing_is_active()
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit 8dd252ad91bf9ec4b6d993a49eb873f79ca33d28
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:29:57 2022 -0800

    s3: libcli: Rename smb_signing_activate() -> smb1_signing_activate()
    
    Fix the debugs that also used this name.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit 84a498feeca62f0263e2c536cfd24bf37965ff87
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:26:54 2022 -0800

    s3: libcli: Rename smb_signing_check_pdu() -> smb1_signing_check_pdu()
    
    Fix the debugs that also used this name.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit 6a68caff962e6e601b04744a0aea42dc76c21456
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:22:51 2022 -0800

    s3: libcli: Rename smb_signing_sign_pdu() -> smb1_signing_sign_pdu()
    
    Fix the debugs that also used this name.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit fd9325587c9b42c3416b81dc4dc5b9bbfa3d9bd1
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:20:27 2022 -0800

    s3: libcli: Rename smb_signing_cancel_reply() -> smb1_signing_cancel_reply()
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit e563725a196d06a2d9de1bf5f1b8d592da0a6913
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:18:39 2022 -0800

    s3: libcli: Rename smb_signing_next_seqnum() -> smb1_signing_next_seqnum()
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit 00d8b05ddbfd42cce56ad7d33da72f67fd07530e
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:16:07 2022 -0800

    s3: libcli: Rename smb_signing_md5() -> smb1_signing_md5()
    
    Fix the debug that also used this name.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit 7e82ac3a40dbe43b8e954d8d1eb6a4423b27cef9
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:14:35 2022 -0800

    s3: libcli: Rename smb_signing_good() -> smb1_signing_good()
    
    Fix the debugs that also used this name.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit 6ae33a62bc48a6b3e24563f766b6b0d51729e09c
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:12:45 2022 -0800

    s3: libcli: Rename smb_signing_init() -> smb1_signing_init()
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit cba8ba327f1caf0914ae1608a3a16135506bc15f
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:11:33 2022 -0800

    s3: libcli: Rename smb_signing_init_ex() -> smb1_signing_init_ex()
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit aee7bfa079a9e0befaae67994f55d02f7fe6d8bc
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:08:47 2022 -0800

    s3: libcli: Rename static smb_signing_reset_info() -> smb1_signing_reset_info()
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit b879d475bfde86d4f7c73ef17cedd91d03ecfeed
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:06:34 2022 -0800

    s3: smbd: Look at the correct signing state for the debug messages in make_connection_snum().
    
    The rest of the changes should now be just renaming
    the SMB1 signing functions to make it clear they are
    SMB1 specific.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit 1f3f6e20dc086a36de52bffd0bc36e15fb19e1c6
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 19:04:23 2022 -0800

    s3: smbd: Split srv_init_signing() into 2 static functions smb1_srv_init_signing() and smb2_srv_init_signing().
    
    Correctly initialize and look at xconn->smb2.signing_mandatory
    for the SMB2 signing state (this gets set correctly for the AD-DC
    case etc. inside smb2_srv_init_signing()).
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit 3f9d528f3895e2c95d22110e8e7718da30df3c08
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 18:13:11 2022 -0800

    s3: smbd: Add smb2_srv_init_signing(). Initializes conn->smb2.signing_mandatory.
    
    Not yet used.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit b51b055fc4ba56d5d9a5a990fc6031f80488e6ab
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 18:09:40 2022 -0800

    s3: smbd: Add 'bool signing_mandatory' to struct smbXsrv_connection.smb2 component.
    
    Not yet used.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit 41393579de6e1605de7b216e670575976ba53fb8
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 7 18:05:41 2022 -0800

    s3: Simple rename 'struct smb_signing_state' -> 'struct smb1_signing_state'
    
    This is only used by the SMB1 signing code, except for one
    bool for SMB2 which we will replace next.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: David Mulder <dmulder at samba.org>

commit d972f64b30d9681bbc3fbee5b7572eb24d757eb0
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Sep 8 15:06:11 2021 -0700

    s3: smbd: notify_mid_maps is used by both SMB1 and SMB2.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: David Mulder <dmulder at samba.org>

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

Summary of changes:
 libcli/smb/smbXcli_base.c   |  22 +++++-----
 libcli/smb/smb_signing.c    | 105 +++++++++++++++++++++-----------------------
 libcli/smb/smb_signing.h    |  29 ++++++------
 source3/param/loadparm.h    |   2 +-
 source3/smbd/globals.h      |   8 ++--
 source3/smbd/negprot.c      |   6 +--
 source3/smbd/notify.c       |   8 ++--
 source3/smbd/nttrans.c      |   2 +-
 source3/smbd/process.c      |   8 ++--
 source3/smbd/proto.h        |  14 +++---
 source3/smbd/reply.c        |  14 +++---
 source3/smbd/service.c      |  10 ++++-
 source3/smbd/sesssetup.c    |  14 +++---
 source3/smbd/signing.c      |  82 ++++++++++++++++++++++------------
 source3/smbd/smb2_negprot.c |   9 ++--
 source3/smbd/trans2.c       |   4 +-
 16 files changed, 181 insertions(+), 156 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index 7579fa1c378..0f3e4fa3f90 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -104,7 +104,7 @@ struct smbXcli_conn {
 
 		uint16_t mid;
 
-		struct smb_signing_state *signing;
+		struct smb1_signing_state *signing;
 		struct smb_trans_enc_state *trans_enc;
 
 		struct tevent_req *read_braw_req;
@@ -425,7 +425,7 @@ struct smbXcli_conn *smbXcli_conn_create(TALLOC_CTX *mem_ctx,
 	conn->smb1.mid = 1;
 
 	/* initialise signing */
-	conn->smb1.signing = smb_signing_init(conn,
+	conn->smb1.signing = smb1_signing_init(conn,
 					      conn->allow_signing,
 					      conn->desire_signing,
 					      conn->mandatory_signing);
@@ -790,7 +790,7 @@ bool smb1cli_conn_activate_signing(struct smbXcli_conn *conn,
 				   const DATA_BLOB user_session_key,
 				   const DATA_BLOB response)
 {
-	return smb_signing_activate(conn->smb1.signing,
+	return smb1_signing_activate(conn->smb1.signing,
 				    user_session_key,
 				    response);
 }
@@ -801,12 +801,12 @@ bool smb1cli_conn_check_signing(struct smbXcli_conn *conn,
 	const uint8_t *hdr = buf + NBT_HDR_SIZE;
 	size_t len = smb_len_nbt(buf);
 
-	return smb_signing_check_pdu(conn->smb1.signing, hdr, len, seqnum);
+	return smb1_signing_check_pdu(conn->smb1.signing, hdr, len, seqnum);
 }
 
 bool smb1cli_conn_signing_is_active(struct smbXcli_conn *conn)
 {
-	return smb_signing_is_active(conn->smb1.signing);
+	return smb1_signing_is_active(conn->smb1.signing);
 }
 
 void smb1cli_conn_set_encryption(struct smbXcli_conn *conn,
@@ -949,7 +949,7 @@ static NTSTATUS smbXcli_req_cancel_write_req(struct tevent_req *req)
 		 * pending, we're able to recover the signing
 		 * state.
 		 */
-		smb_signing_cancel_reply(conn->smb1.signing,
+		smb1_signing_cancel_reply(conn->smb1.signing,
 					 state->smb1.one_way_seqnum);
 		return NT_STATUS_OK;
 	}
@@ -1673,9 +1673,9 @@ static NTSTATUS smb1cli_conn_signv(struct smbXcli_conn *conn,
 		return NT_STATUS_NO_MEMORY;
 	}
 
-	*seqnum = smb_signing_next_seqnum(conn->smb1.signing,
+	*seqnum = smb1_signing_next_seqnum(conn->smb1.signing,
 					  one_way_seqnum);
-	status = smb_signing_sign_pdu(conn->smb1.signing,
+	status = smb1_signing_sign_pdu(conn->smb1.signing,
 				      buf,
 				      talloc_get_size(buf),
 				      *seqnum);
@@ -2295,7 +2295,7 @@ static NTSTATUS smb1cli_conn_dispatch_incoming(struct smbXcli_conn *conn,
 	state = tevent_req_data(req, struct smbXcli_req_state);
 
 	if (!oplock_break /* oplock breaks are not signed */
-	    && !smb_signing_check_pdu(conn->smb1.signing,
+	    && !smb1_signing_check_pdu(conn->smb1.signing,
 				      inhdr, len, state->smb1.seqnum+1)) {
 		DEBUG(10, ("cli_check_sign_mac failed\n"));
 		return NT_STATUS_ACCESS_DENIED;
@@ -4659,7 +4659,7 @@ static void smbXcli_negprot_smb1_done(struct tevent_req *subreq)
 			server_mandatory = true;
 		}
 
-		ok = smb_signing_set_negotiated(conn->smb1.signing,
+		ok = smb1_signing_set_negotiated(conn->smb1.signing,
 						server_allowed,
 						server_mandatory);
 		if (!ok) {
@@ -6138,7 +6138,7 @@ NTSTATUS smb1cli_session_protect_session_key(struct smbXcli_session *session)
 		return NT_STATUS_INVALID_PARAMETER_MIX;
 	}
 
-	status = smb_key_derivation(session->smb1.application_key.data,
+	status = smb1_key_derivation(session->smb1.application_key.data,
 				    session->smb1.application_key.length,
 				    session->smb1.application_key.data);
 	if (!NT_STATUS_IS_OK(status)) {
diff --git a/libcli/smb/smb_signing.c b/libcli/smb/smb_signing.c
index c75a0756821..f01865c9bc5 100644
--- a/libcli/smb/smb_signing.c
+++ b/libcli/smb/smb_signing.c
@@ -27,9 +27,9 @@
 #include <gnutls/gnutls.h>
 #include <gnutls/crypto.h>
 
-/* Used by the SMB signing functions. */
+/* Used by the SMB1 signing functions. */
 
-struct smb_signing_state {
+struct smb1_signing_state {
 	/* is signing localy allowed */
 	bool allowed;
 
@@ -55,7 +55,7 @@ struct smb_signing_state {
 	void (*free_fn)(TALLOC_CTX *mem_ctx, void *ptr);
 };
 
-static void smb_signing_reset_info(struct smb_signing_state *si)
+static void smb1_signing_reset_info(struct smb1_signing_state *si)
 {
 	si->active = false;
 	si->seqnum = 0;
@@ -69,27 +69,27 @@ static void smb_signing_reset_info(struct smb_signing_state *si)
 	si->mac_key.length = 0;
 }
 
-struct smb_signing_state *smb_signing_init_ex(TALLOC_CTX *mem_ctx,
+struct smb1_signing_state *smb1_signing_init_ex(TALLOC_CTX *mem_ctx,
 					      bool allowed,
 					      bool desired,
 					      bool mandatory,
 					      void *(*alloc_fn)(TALLOC_CTX *, size_t),
 					      void (*free_fn)(TALLOC_CTX *, void *))
 {
-	struct smb_signing_state *si;
+	struct smb1_signing_state *si;
 
 	if (alloc_fn) {
-		void *p = alloc_fn(mem_ctx, sizeof(struct smb_signing_state));
+		void *p = alloc_fn(mem_ctx, sizeof(struct smb1_signing_state));
 		if (p == NULL) {
 			return NULL;
 		}
-		memset(p, 0, sizeof(struct smb_signing_state));
-		si = (struct smb_signing_state *)p;
+		memset(p, 0, sizeof(struct smb1_signing_state));
+		si = (struct smb1_signing_state *)p;
 		si->mem_ctx = mem_ctx;
 		si->alloc_fn = alloc_fn;
 		si->free_fn = free_fn;
 	} else {
-		si = talloc_zero(mem_ctx, struct smb_signing_state);
+		si = talloc_zero(mem_ctx, struct smb1_signing_state);
 		if (si == NULL) {
 			return NULL;
 		}
@@ -110,16 +110,16 @@ struct smb_signing_state *smb_signing_init_ex(TALLOC_CTX *mem_ctx,
 	return si;
 }
 
-struct smb_signing_state *smb_signing_init(TALLOC_CTX *mem_ctx,
+struct smb1_signing_state *smb1_signing_init(TALLOC_CTX *mem_ctx,
 					   bool allowed,
 					   bool desired,
 					   bool mandatory)
 {
-	return smb_signing_init_ex(mem_ctx, allowed, desired, mandatory,
+	return smb1_signing_init_ex(mem_ctx, allowed, desired, mandatory,
 				   NULL, NULL);
 }
 
-static bool smb_signing_good(struct smb_signing_state *si,
+static bool smb1_signing_good(struct smb1_signing_state *si,
 			     bool good, uint32_t seq)
 {
 	if (good) {
@@ -131,18 +131,18 @@ static bool smb_signing_good(struct smb_signing_state *si,
 
 	if (!si->mandatory && !si->active) {
 		/* Non-mandatory signing - just turn off if this is the first bad packet.. */
-		DEBUG(5, ("smb_signing_good: signing negotiated but not required and peer\n"
-			  "isn't sending correct signatures. Turning off.\n"));
-		smb_signing_reset_info(si);
+		DBG_INFO("signing negotiated but not required and peer\n"
+			  "isn't sending correct signatures. Turning off.\n");
+		smb1_signing_reset_info(si);
 		return true;
 	}
 
 	/* Mandatory signing or bad packet after signing started - fail and disconnect. */
-	DEBUG(0, ("smb_signing_good: BAD SIG: seq %u\n", (unsigned int)seq));
+	DBG_ERR("BAD SIG: seq %u\n", (unsigned int)seq);
 	return false;
 }
 
-static NTSTATUS smb_signing_md5(const DATA_BLOB *mac_key,
+static NTSTATUS smb1_signing_md5(const DATA_BLOB *mac_key,
 				const uint8_t *hdr, size_t len,
 				uint32_t seq_number,
 				uint8_t calc_md5_mac[16])
@@ -159,7 +159,7 @@ static NTSTATUS smb_signing_md5(const DATA_BLOB *mac_key,
 	 * We do this here, to avoid modifying the packet.
 	 */
 
-	DEBUG(10,("smb_signing_md5: sequence number %u\n", seq_number ));
+	DBG_DEBUG("sequence number %u\n", seq_number );
 
 	SIVAL(sequence_buf, 0, seq_number);
 	SIVAL(sequence_buf, 4, 0);
@@ -204,7 +204,7 @@ static NTSTATUS smb_signing_md5(const DATA_BLOB *mac_key,
 	return NT_STATUS_OK;
 }
 
-uint32_t smb_signing_next_seqnum(struct smb_signing_state *si, bool oneway)
+uint32_t smb1_signing_next_seqnum(struct smb1_signing_state *si, bool oneway)
 {
 	uint32_t seqnum;
 
@@ -222,7 +222,7 @@ uint32_t smb_signing_next_seqnum(struct smb_signing_state *si, bool oneway)
 	return seqnum;
 }
 
-void smb_signing_cancel_reply(struct smb_signing_state *si, bool oneway)
+void smb1_signing_cancel_reply(struct smb1_signing_state *si, bool oneway)
 {
 	if (si->mac_key.length == 0) {
 		return;
@@ -235,7 +235,7 @@ void smb_signing_cancel_reply(struct smb_signing_state *si, bool oneway)
 	}
 }
 
-NTSTATUS smb_signing_sign_pdu(struct smb_signing_state *si,
+NTSTATUS smb1_signing_sign_pdu(struct smb1_signing_state *si,
 			      uint8_t *outhdr, size_t len,
 			      uint32_t seqnum)
 {
@@ -251,9 +251,9 @@ NTSTATUS smb_signing_sign_pdu(struct smb_signing_state *si,
 
 	/* JRA Paranioa test - we should be able to get rid of this... */
 	if (len < (HDR_SS_FIELD + 8)) {
-		DEBUG(1,("smb_signing_sign_pdu: Logic error. "
+		DBG_WARNING("Logic error. "
 			 "Can't check signature on short packet! smb_len = %u\n",
-			 (unsigned)len));
+			 (unsigned)len);
 		abort();
 	}
 
@@ -286,7 +286,7 @@ NTSTATUS smb_signing_sign_pdu(struct smb_signing_state *si,
 	} else {
 		NTSTATUS status;
 
-		status = smb_signing_md5(&si->mac_key,
+		status = smb1_signing_md5(&si->mac_key,
 				         outhdr,
 					 len,
 					 seqnum,
@@ -296,7 +296,7 @@ NTSTATUS smb_signing_sign_pdu(struct smb_signing_state *si,
 		}
 	}
 
-	DEBUG(10, ("smb_signing_sign_pdu: sent SMB signature of\n"));
+	DBG_DEBUG("sent SMB signature of\n");
 	dump_data(10, calc_md5_mac, 8);
 
 	memcpy(&outhdr[HDR_SS_FIELD], calc_md5_mac, 8);
@@ -307,7 +307,7 @@ NTSTATUS smb_signing_sign_pdu(struct smb_signing_state *si,
 	return NT_STATUS_OK;
 }
 
-bool smb_signing_check_pdu(struct smb_signing_state *si,
+bool smb1_signing_check_pdu(struct smb1_signing_state *si,
 			   const uint8_t *inhdr, size_t len,
 			   uint32_t seqnum)
 {
@@ -321,13 +321,13 @@ bool smb_signing_check_pdu(struct smb_signing_state *si,
 	}
 
 	if (len < (HDR_SS_FIELD + 8)) {
-		DEBUG(1,("smb_signing_check_pdu: Can't check signature "
+		DBG_WARNING("Can't check signature "
 			 "on short packet! smb_len = %u\n",
-			 (unsigned)len));
+			 (unsigned)len);
 		return false;
 	}
 
-	status = smb_signing_md5(&si->mac_key,
+	status = smb1_signing_md5(&si->mac_key,
 				 inhdr,
 				 len,
 				 seqnum,
@@ -345,35 +345,33 @@ bool smb_signing_check_pdu(struct smb_signing_state *si,
 		int i;
 		const int sign_range = 5;
 
-		DEBUG(5, ("smb_signing_check_pdu: BAD SIG: wanted SMB signature of\n"));
+		DBG_INFO("BAD SIG: wanted SMB signature of\n");
 		dump_data(5, calc_md5_mac, 8);
 
-		DEBUG(5, ("smb_signing_check_pdu: BAD SIG: got SMB signature of\n"));
+		DBG_INFO("BAD SIG: got SMB signature of\n");
 		dump_data(5, reply_sent_mac, 8);
 
 		for (i = -sign_range; i < sign_range; i++) {
-			smb_signing_md5(&si->mac_key, inhdr, len,
+			smb1_signing_md5(&si->mac_key, inhdr, len,
 					seqnum+i, calc_md5_mac);
 			if (memcmp(reply_sent_mac, calc_md5_mac, 8) == 0) {
-				DEBUG(0,("smb_signing_check_pdu: "
-					 "out of seq. seq num %u matches. "
+				DBG_ERR("out of seq. seq num %u matches. "
 					 "We were expecting seq %u\n",
 					 (unsigned int)seqnum+i,
-					 (unsigned int)seqnum));
+					 (unsigned int)seqnum);
 				break;
 			}
 		}
 	} else {
-		DEBUG(10, ("smb_signing_check_pdu: seq %u: "
-			   "got good SMB signature of\n",
-			   (unsigned int)seqnum));
+		DBG_DEBUG("seq %u: got good SMB signature of\n",
+			   (unsigned int)seqnum);
 		dump_data(10, reply_sent_mac, 8);
 	}
 
-	return smb_signing_good(si, good, seqnum);
+	return smb1_signing_good(si, good, seqnum);
 }
 
-bool smb_signing_activate(struct smb_signing_state *si,
+bool smb1_signing_activate(struct smb1_signing_state *si,
 			  const DATA_BLOB user_session_key,
 			  const DATA_BLOB response)
 {
@@ -396,7 +394,7 @@ bool smb_signing_activate(struct smb_signing_state *si,
 		return false;
 	}
 
-	smb_signing_reset_info(si);
+	smb1_signing_reset_info(si);
 
 	len = response.length + user_session_key.length;
 	if (si->alloc_fn) {
@@ -415,19 +413,19 @@ bool smb_signing_activate(struct smb_signing_state *si,
 	ofs = 0;
 	memcpy(&si->mac_key.data[ofs], user_session_key.data, user_session_key.length);
 
-	DEBUG(10, ("smb_signing_activate: user_session_key\n"));
+	DBG_DEBUG("user_session_key\n");
 	dump_data(10, user_session_key.data, user_session_key.length);
 
 	if (response.length) {
 		ofs = user_session_key.length;
 		memcpy(&si->mac_key.data[ofs], response.data, response.length);
-		DEBUG(10, ("smb_signing_activate: response_data\n"));
+		DBG_DEBUG("response_data\n");
 		dump_data(10, response.data, response.length);
 	} else {
-		DEBUG(10, ("smb_signing_activate: NULL response_data\n"));
+		DBG_DEBUG("NULL response_data\n");
 	}
 
-	dump_data_pw("smb_signing_activate: mac key is:\n",
+	dump_data_pw("smb1_signing_activate: mac key is:\n",
 		     si->mac_key.data, si->mac_key.length);
 
 	/* Initialise the sequence number */
@@ -436,27 +434,22 @@ bool smb_signing_activate(struct smb_signing_state *si,
 	return true;
 }
 
-bool smb_signing_is_active(struct smb_signing_state *si)
+bool smb1_signing_is_active(struct smb1_signing_state *si)
 {
 	return si->active;
 }
 
-bool smb_signing_is_allowed(struct smb_signing_state *si)
-{
-	return si->allowed;
-}
-
-bool smb_signing_is_desired(struct smb_signing_state *si)
+bool smb1_signing_is_desired(struct smb1_signing_state *si)
 {
 	return si->desired;
 }
 
-bool smb_signing_is_mandatory(struct smb_signing_state *si)
+bool smb1_signing_is_mandatory(struct smb1_signing_state *si)
 {
 	return si->mandatory;
 }
 
-bool smb_signing_set_negotiated(struct smb_signing_state *si,
+bool smb1_signing_set_negotiated(struct smb1_signing_state *si,
 				bool allowed, bool mandatory)
 {
 	if (si->active) {
@@ -499,12 +492,12 @@ bool smb_signing_set_negotiated(struct smb_signing_state *si,
 	return true;
 }
 
-bool smb_signing_is_negotiated(struct smb_signing_state *si)
+bool smb1_signing_is_negotiated(struct smb1_signing_state *si)
 {
 	return si->negotiated;
 }
 
-NTSTATUS smb_key_derivation(const uint8_t *KI,
+NTSTATUS smb1_key_derivation(const uint8_t *KI,
 			    size_t KI_len,
 			    uint8_t KO[16])
 {
diff --git a/libcli/smb/smb_signing.h b/libcli/smb/smb_signing.h
index 66cf40e4065..9f2f3c15a1a 100644
--- a/libcli/smb/smb_signing.h
+++ b/libcli/smb/smb_signing.h
@@ -22,37 +22,36 @@
 #ifndef _SMB_SIGNING_H_
 #define _SMB_SIGNING_H_
 
-struct smb_signing_state;
+struct smb1_signing_state;
 
-struct smb_signing_state *smb_signing_init(TALLOC_CTX *mem_ctx,
+struct smb1_signing_state *smb1_signing_init(TALLOC_CTX *mem_ctx,
 					   bool allowed,
 					   bool desired,
 					   bool mandatory);
-struct smb_signing_state *smb_signing_init_ex(TALLOC_CTX *mem_ctx,
+struct smb1_signing_state *smb1_signing_init_ex(TALLOC_CTX *mem_ctx,
 					      bool allowed,
 					      bool desired,
 					      bool mandatory,
 					      void *(*alloc_fn)(TALLOC_CTX *, size_t),
 					      void (*free_fn)(TALLOC_CTX *, void *));
-uint32_t smb_signing_next_seqnum(struct smb_signing_state *si, bool oneway);
-void smb_signing_cancel_reply(struct smb_signing_state *si, bool oneway);
-NTSTATUS smb_signing_sign_pdu(struct smb_signing_state *si,
+uint32_t smb1_signing_next_seqnum(struct smb1_signing_state *si, bool oneway);
+void smb1_signing_cancel_reply(struct smb1_signing_state *si, bool oneway);
+NTSTATUS smb1_signing_sign_pdu(struct smb1_signing_state *si,
 			      uint8_t *outhdr, size_t len,
 			      uint32_t seqnum);
-bool smb_signing_check_pdu(struct smb_signing_state *si,
+bool smb1_signing_check_pdu(struct smb1_signing_state *si,
 			   const uint8_t *inhdr, size_t len,
 			   uint32_t seqnum);
-bool smb_signing_activate(struct smb_signing_state *si,
+bool smb1_signing_activate(struct smb1_signing_state *si,
 			  const DATA_BLOB user_session_key,
 			  const DATA_BLOB response);
-bool smb_signing_is_active(struct smb_signing_state *si);
-bool smb_signing_is_allowed(struct smb_signing_state *si);
-bool smb_signing_is_desired(struct smb_signing_state *si);
-bool smb_signing_is_mandatory(struct smb_signing_state *si);
-bool smb_signing_set_negotiated(struct smb_signing_state *si,
+bool smb1_signing_is_active(struct smb1_signing_state *si);
+bool smb1_signing_is_desired(struct smb1_signing_state *si);
+bool smb1_signing_is_mandatory(struct smb1_signing_state *si);
+bool smb1_signing_set_negotiated(struct smb1_signing_state *si,
 				bool allowed, bool mandatory);
-bool smb_signing_is_negotiated(struct smb_signing_state *si);
-NTSTATUS smb_key_derivation(const uint8_t *KI,
+bool smb1_signing_is_negotiated(struct smb1_signing_state *si);
+NTSTATUS smb1_key_derivation(const uint8_t *KI,
 			    size_t KI_len,
 			    uint8_t KO[16]);
 
diff --git a/source3/param/loadparm.h b/source3/param/loadparm.h
index 52197ae4979..55a8926b920 100644
--- a/source3/param/loadparm.h
+++ b/source3/param/loadparm.h
@@ -171,7 +171,7 @@ const char *lp_printcapname(void);
 bool lp_disable_spoolss( void );
 void lp_set_spoolss_state( uint32_t state );
 uint32_t lp_get_spoolss_state( void );
-struct smb_signing_state;
+struct smb1_signing_state;
 void set_use_sendfile(int snum, bool val);
 void lp_set_mangling_method(const char *new_method);
 bool lp_posix_pathnames(void);
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index b5bb26d1e36..a024305486c 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -439,7 +439,7 @@ struct smbXsrv_connection {
 			 */
 			int max_send;
 		} sessions;
-		struct smb_signing_state *signing_state;
+		struct smb1_signing_state *signing_state;
 
 		struct {
 			uint16_t client_major;
@@ -542,6 +542,8 @@ struct smbXsrv_connection {
 		struct {
 			uint8_t read_body_padding;
 		} smbtorture;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list