Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5478f9ba authored by Pavel Shilovsky's avatar Pavel Shilovsky Committed by Pavel Shilovsky
Browse files

CIFS: Add session setup/logoff capability for SMB2

parent ec2e4523
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -504,6 +504,9 @@ struct cifs_ses {
	struct session_key auth_key;
	struct ntlmssp_auth *ntlmssp; /* ciphertext, flags, server challenge */
	bool need_reconnect:1; /* connection reset, uid now invalid */
#ifdef CONFIG_CIFS_SMB2
	__u16 session_flags;
#endif /* CONFIG_CIFS_SMB2 */
};
/* no more than one of the following three session flags may be set */
#define CIFS_SES_NT4 1
+10 −0
Original line number Diff line number Diff line
@@ -126,3 +126,13 @@ typedef struct _AUTHENTICATE_MESSAGE {
	   do not set the version is present flag */
	char UserString[0];
} __attribute__((packed)) AUTHENTICATE_MESSAGE, *PAUTHENTICATE_MESSAGE;

/*
 * Size of the session key (crypto key encrypted with the password
 */

int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len, struct cifs_ses *ses);
void build_ntlmssp_negotiate_blob(unsigned char *pbuffer, struct cifs_ses *ses);
int build_ntlmssp_auth_blob(unsigned char *pbuffer, u16 *buflen,
			struct cifs_ses *ses,
			const struct nls_table *nls_cp);
+3 −3
Original line number Diff line number Diff line
@@ -364,7 +364,7 @@ static int decode_ascii_ssetup(char **pbcc_area, __u16 bleft,
	return rc;
}

static int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len,
int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len,
				    struct cifs_ses *ses)
{
	unsigned int tioffset; /* challenge message target info area */
@@ -415,7 +415,7 @@ static int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len,

/* We do not malloc the blob, it is passed in pbuffer, because
   it is fixed size, and small, making this approach cleaner */
static void build_ntlmssp_negotiate_blob(unsigned char *pbuffer,
void build_ntlmssp_negotiate_blob(unsigned char *pbuffer,
					 struct cifs_ses *ses)
{
	NEGOTIATE_MESSAGE *sec_blob = (NEGOTIATE_MESSAGE *)pbuffer;
@@ -451,7 +451,7 @@ static void build_ntlmssp_negotiate_blob(unsigned char *pbuffer,
/* We do not malloc the blob, it is passed in pbuffer, because its
   maximum possible size is fixed and small, making this approach cleaner.
   This function returns the length of the data in the blob */
static int build_ntlmssp_auth_blob(unsigned char *pbuffer,
int build_ntlmssp_auth_blob(unsigned char *pbuffer,
					u16 *buflen,
				   struct cifs_ses *ses,
				   const struct nls_table *nls_cp)
+5 −0
Original line number Diff line number Diff line
@@ -224,6 +224,11 @@ smb2_get_data_area_len(int *off, int *len, struct smb2_hdr *hdr)
		    ((struct smb2_negotiate_rsp *)hdr)->SecurityBufferLength);
		break;
	case SMB2_SESSION_SETUP:
		*off = le16_to_cpu(
		    ((struct smb2_sess_setup_rsp *)hdr)->SecurityBufferOffset);
		*len = le16_to_cpu(
		    ((struct smb2_sess_setup_rsp *)hdr)->SecurityBufferLength);
		break;
	case SMB2_CREATE:
	case SMB2_READ:
	case SMB2_QUERY_INFO:
+2 −0
Original line number Diff line number Diff line
@@ -170,6 +170,8 @@ struct smb_version_operations smb21_operations = {
	.dump_detail = smb2_dump_detail,
	.need_neg = smb2_need_neg,
	.negotiate = smb2_negotiate,
	.sess_setup = SMB2_sess_setup,
	.logoff = SMB2_logoff,
};

struct smb_version_values smb21_values = {
Loading