Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 30879
b: refs/heads/master
c: f64b23a
h: refs/heads/master
i:
  30877: f36ffb7
  30875: fcd2f8a
  30871: 7505e57
  30863: 299500b
  30847: 5f9a535
v: v3
  • Loading branch information
Steve French committed Jun 5, 2006
1 parent 7340d17 commit 32bf02b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9312f6754d4b2d3ce27c21b16fb92923ce92a411
refs/heads/master: f64b23ae4aef9f69d71ea41529a188acd5ab4930
2 changes: 2 additions & 0 deletions trunk/fs/cifs/cifsencrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ void calc_lanman_hash(struct cifsSesInfo * ses, char * lnm_session_key)

void CalcNTLMv2_response(const struct cifsSesInfo * ses,char * v2_session_response)
{
/* BB FIXME - update struct ntlmv2_response and change calling convention
of this function */
struct HMACMD5Context context;
memcpy(v2_session_response + 8, ses->server->cryptKey,8);
/* gen_blob(v2_session_response + 16); */
Expand Down
27 changes: 24 additions & 3 deletions trunk/fs/cifs/cifspdu.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@
* Size of the session key (crypto key encrypted with the password
*/
#define CIFS_SESS_KEY_SIZE (24)
#define V2_SESS_KEY_SIZE (86)

/*
* Maximum user name length
Expand Down Expand Up @@ -539,7 +538,7 @@ typedef union smb_com_session_setup_andx {
/* unsigned char * NativeOS; */
/* unsigned char * NativeLanMan; */
/* unsigned char * PrimaryDomain; */
} __attribute__((packed)) resp; /* NTLM response format (with or without extended security */
} __attribute__((packed)) resp; /* NTLM response with or without extended sec*/

struct { /* request format */
struct smb_hdr hdr; /* wct = 10 */
Expand Down Expand Up @@ -573,6 +572,26 @@ typedef union smb_com_session_setup_andx {
} __attribute__((packed)) old_resp; /* pre-NTLM (LANMAN2.1) response */
} __attribute__((packed)) SESSION_SETUP_ANDX;

/* format of NLTMv2 Response ie "case sensitive password" hash when NTLMv2 */

struct ntlmssp2_name {
__le16 type;
__le16 length;
/* char name[length]; */
} __attribute__((packed));

struct ntlmv2_resp {
char ntlmv2_hash[CIFS_ENCPWD_SIZE];
__le32 blob_sign;
__u32 reserved;
__le64 time;
__u64 client_chal; /* random */
__u32 reserved2;
struct ntlmssp2_name names[1];
/* array of name entries could follow ending in minimum 4 byte struct */
} __attribute__((packed));


#define CIFS_NETWORK_OPSYS "CIFS VFS Client for Linux"

/* Capabilities bits (for NTLM SessSetup request) */
Expand Down Expand Up @@ -603,7 +622,9 @@ typedef struct smb_com_tconx_req {
} __attribute__((packed)) TCONX_REQ;

typedef struct smb_com_tconx_rsp {
struct smb_hdr hdr; /* wct = 3 *//* note that Win2000 has sent wct=7 in some cases on responses. Four unspecified words followed OptionalSupport */
struct smb_hdr hdr; /* wct = 3 note that Win2000 has sent wct = 7
in some cases on responses. Four unspecified
words followed OptionalSupport */
__u8 AndXCommand;
__u8 AndXReserved;
__le16 AndXOffset;
Expand Down
13 changes: 9 additions & 4 deletions trunk/fs/cifs/sess.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,11 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
else
ascii_ssetup_strings(&bcc_ptr, ses, nls_cp);
} else if (type == NTLMv2) {
char * v2_sess_key = kmalloc(V2_SESS_KEY_SIZE, GFP_KERNEL);
char * v2_sess_key = kmalloc(sizeof(struct ntlmv2_resp),
GFP_KERNEL);

/* BB FIXME change all users of v2_sess_key to
struct ntlmv2_resp */

if(v2_sess_key == NULL) {
cifs_small_buf_release(smb_buf);
Expand All @@ -425,7 +429,7 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
/* cpu_to_le16(LM2_SESS_KEY_SIZE); */

pSMB->req_no_secext.CaseSensitivePasswordLength =
cpu_to_le16(V2_SESS_KEY_SIZE);
cpu_to_le16(sizeof(struct ntlmv2_resp));

/* calculate session key */
CalcNTLMv2_response(ses, v2_sess_key);
Expand All @@ -438,8 +442,9 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,

/* memcpy(bcc_ptr, (char *)ntlm_session_key,LM2_SESS_KEY_SIZE);
bcc_ptr += LM2_SESS_KEY_SIZE; */
memcpy(bcc_ptr, (char *)v2_sess_key, V2_SESS_KEY_SIZE);
bcc_ptr += V2_SESS_KEY_SIZE;
memcpy(bcc_ptr, (char *)v2_sess_key, sizeof(struct ntlmv2_resp));
bcc_ptr += sizeof(struct ntlmv2_resp);
kfree(v2_sess_key);
if(ses->capabilities & CAP_UNICODE)
unicode_ssetup_strings(&bcc_ptr, ses, nls_cp);
else
Expand Down

0 comments on commit 32bf02b

Please sign in to comment.