Skip to content

Commit f560cda

Browse files
Ronnie Sahlbergsmfrench
authored andcommitted
cifs: dump the session id and keys also for SMB2 sessions
We already dump these keys for SMB3, lets also dump it for SMB2 sessions so that we can use the session key in wireshark to check and validate that the signatures are correct. Signed-off-by: Ronnie Sahlberg <[email protected]> Signed-off-by: Steve French <[email protected]> Reviewed-by: Aurelien Aptel <[email protected]>
1 parent 8f3d9f3 commit f560cda

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

fs/cifs/smb2pdu.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1552,6 +1552,21 @@ SMB2_sess_auth_rawntlmssp_authenticate(struct SMB2_sess_data *sess_data)
15521552
}
15531553

15541554
rc = SMB2_sess_establish_session(sess_data);
1555+
#ifdef CONFIG_CIFS_DEBUG_DUMP_KEYS
1556+
if (ses->server->dialect < SMB30_PROT_ID) {
1557+
cifs_dbg(VFS, "%s: dumping generated SMB2 session keys\n", __func__);
1558+
/*
1559+
* The session id is opaque in terms of endianness, so we can't
1560+
* print it as a long long. we dump it as we got it on the wire
1561+
*/
1562+
cifs_dbg(VFS, "Session Id %*ph\n", (int)sizeof(ses->Suid),
1563+
&ses->Suid);
1564+
cifs_dbg(VFS, "Session Key %*ph\n",
1565+
SMB2_NTLMV2_SESSKEY_SIZE, ses->auth_key.response);
1566+
cifs_dbg(VFS, "Signing Key %*ph\n",
1567+
SMB3_SIGN_KEY_SIZE, ses->auth_key.response);
1568+
}
1569+
#endif
15551570
out:
15561571
kfree(ntlmssp_blob);
15571572
SMB2_sess_free_buffer(sess_data);

0 commit comments

Comments
 (0)