summaryrefslogtreecommitdiff
path: root/source4/smb_server/signing.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-06-29 07:40:14 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:56:49 -0500
commit118f3edd27f5adacc1da636ed05b33f04999584f (patch)
treeb4b314537144d48820589e925c4e3fb08f293ee5 /source4/smb_server/signing.c
parentb87fa55bdc69fe50743ddb58977e408853abb4cb (diff)
downloadsamba-118f3edd27f5adacc1da636ed05b33f04999584f.tar.gz
samba-118f3edd27f5adacc1da636ed05b33f04999584f.tar.bz2
samba-118f3edd27f5adacc1da636ed05b33f04999584f.zip
r1291: rename struct smbsrv_context to smbsrv_connection
because this is the connection state per transport layer (tcp) connection I also moved the substructs directly into smbsrv_connection, because they don't need a struct name and we should allway pass the complete smbsrv_connection struct into functions metze (This used to be commit 60f823f201fcedf5473008e8453a6351e73a92c7)
Diffstat (limited to 'source4/smb_server/signing.c')
-rw-r--r--source4/smb_server/signing.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/source4/smb_server/signing.c b/source4/smb_server/signing.c
index 4765d9d6c3..edc177174e 100644
--- a/source4/smb_server/signing.c
+++ b/source4/smb_server/signing.c
@@ -54,7 +54,7 @@ static void calc_signature(uint8_t *buffer, size_t length,
void req_sign_packet(struct smbsrv_request *req)
{
/* check if we are doing signing on this connection */
- if (req->smb_ctx->signing.signing_state != SMB_SIGNING_REQUIRED) {
+ if (req->smb_conn->signing.signing_state != SMB_SIGNING_REQUIRED) {
return;
}
@@ -63,7 +63,7 @@ void req_sign_packet(struct smbsrv_request *req)
mark_packet_signed(req);
calc_signature(req->out.hdr, req->out.size - NBT_HDR_SIZE,
- &req->smb_ctx->signing.mac_key,
+ &req->smb_conn->signing.mac_key,
&req->out.hdr[HDR_SS_FIELD]);
}
@@ -72,15 +72,15 @@ void req_sign_packet(struct smbsrv_request *req)
setup the signing key for a connection. Called after authentication succeeds
in a session setup
*/
-void srv_setup_signing(struct smbsrv_context *smb_ctx,
+void srv_setup_signing(struct smbsrv_connection *smb_conn,
DATA_BLOB *session_key,
DATA_BLOB *session_response)
{
- smb_ctx->signing.mac_key = data_blob(NULL,
+ smb_conn->signing.mac_key = data_blob(NULL,
session_key->length + session_response->length);
- memcpy(smb_ctx->signing.mac_key.data, session_key->data, session_key->length);
+ memcpy(smb_conn->signing.mac_key.data, session_key->data, session_key->length);
if (session_response->length != 0) {
- memcpy(&smb_ctx->signing.mac_key.data[session_key->length],
+ memcpy(&smb_conn->signing.mac_key.data[session_key->length],
session_response->data,
session_response->length);
}
@@ -92,12 +92,12 @@ void srv_setup_signing(struct smbsrv_context *smb_ctx,
*/
static void req_signing_alloc_seq_num(struct smbsrv_request *req)
{
- req->seq_num = req->smb_ctx->signing.next_seq_num;
+ req->seq_num = req->smb_conn->signing.next_seq_num;
/* TODO: we need to handle one-way requests like NTcancel, which
only increment the sequence number by 1 */
- if (req->smb_ctx->signing.signing_state != SMB_SIGNING_OFF) {
- req->smb_ctx->signing.next_seq_num += 2;
+ if (req->smb_conn->signing.signing_state != SMB_SIGNING_OFF) {
+ req->smb_conn->signing.next_seq_num += 2;
}
}
@@ -108,12 +108,12 @@ BOOL req_signing_check_incoming(struct smbsrv_request *req)
{
uint8_t client_md5_mac[8], signature[8];
- switch (req->smb_ctx->signing.signing_state) {
+ switch (req->smb_conn->signing.signing_state) {
case SMB_SIGNING_OFF:
return True;
case SMB_SIGNING_SUPPORTED:
if (req->flags2 & FLAGS2_SMB_SECURITY_SIGNATURES) {
- req->smb_ctx->signing.signing_state = SMB_SIGNING_REQUIRED;
+ req->smb_conn->signing.signing_state = SMB_SIGNING_REQUIRED;
}
return True;
case SMB_SIGNING_REQUIRED:
@@ -137,7 +137,7 @@ BOOL req_signing_check_incoming(struct smbsrv_request *req)
SBVAL(req->in.hdr, HDR_SS_FIELD, req->seq_num);
calc_signature(req->in.hdr, req->in.size - NBT_HDR_SIZE,
- &req->smb_ctx->signing.mac_key,
+ &req->smb_conn->signing.mac_key,
signature);
if (memcmp(client_md5_mac, signature, 8) != 0) {