Commit e14b2fe1e64d3e4bd2f328ff9d1969f318f55954
1 parent
cf398e3a11
Exists in
master
and in
39 other branches
[CIFS] Add remaining ntlmssp flags and standardize field names
Signed-off-by: Steve French <sfrench@us.ibm.com>
Showing 2 changed files with 57 additions and 41 deletions Side-by-side Diff
fs/cifs/connect.c
... | ... | @@ -2686,13 +2686,13 @@ |
2686 | 2686 | /* setup pointers to domain name and workstation name */ |
2687 | 2687 | bcc_ptr += SecurityBlobLength; |
2688 | 2688 | |
2689 | - SecurityBlob->WorkstationName.Buffer = 0; | |
2689 | + SecurityBlob->WorkstationName.BufferOffset = 0; | |
2690 | 2690 | SecurityBlob->WorkstationName.Length = 0; |
2691 | 2691 | SecurityBlob->WorkstationName.MaximumLength = 0; |
2692 | 2692 | |
2693 | 2693 | /* Domain not sent on first Sesssetup in NTLMSSP, instead it is sent |
2694 | 2694 | along with username on auth request (ie the response to challenge) */ |
2695 | - SecurityBlob->DomainName.Buffer = 0; | |
2695 | + SecurityBlob->DomainName.BufferOffset = 0; | |
2696 | 2696 | SecurityBlob->DomainName.Length = 0; |
2697 | 2697 | SecurityBlob->DomainName.MaximumLength = 0; |
2698 | 2698 | if (ses->capabilities & CAP_UNICODE) { |
2699 | 2699 | |
2700 | 2700 | |
2701 | 2701 | |
2702 | 2702 | |
... | ... | @@ -3020,30 +3020,30 @@ |
3020 | 3020 | |
3021 | 3021 | /* setup pointers to domain name and workstation name */ |
3022 | 3022 | |
3023 | - SecurityBlob->WorkstationName.Buffer = 0; | |
3023 | + SecurityBlob->WorkstationName.BufferOffset = 0; | |
3024 | 3024 | SecurityBlob->WorkstationName.Length = 0; |
3025 | 3025 | SecurityBlob->WorkstationName.MaximumLength = 0; |
3026 | 3026 | SecurityBlob->SessionKey.Length = 0; |
3027 | 3027 | SecurityBlob->SessionKey.MaximumLength = 0; |
3028 | - SecurityBlob->SessionKey.Buffer = 0; | |
3028 | + SecurityBlob->SessionKey.BufferOffset = 0; | |
3029 | 3029 | |
3030 | 3030 | SecurityBlob->LmChallengeResponse.Length = 0; |
3031 | 3031 | SecurityBlob->LmChallengeResponse.MaximumLength = 0; |
3032 | - SecurityBlob->LmChallengeResponse.Buffer = 0; | |
3032 | + SecurityBlob->LmChallengeResponse.BufferOffset = 0; | |
3033 | 3033 | |
3034 | 3034 | SecurityBlob->NtChallengeResponse.Length = |
3035 | 3035 | cpu_to_le16(CIFS_SESS_KEY_SIZE); |
3036 | 3036 | SecurityBlob->NtChallengeResponse.MaximumLength = |
3037 | 3037 | cpu_to_le16(CIFS_SESS_KEY_SIZE); |
3038 | 3038 | memcpy(bcc_ptr, ntlm_session_key, CIFS_SESS_KEY_SIZE); |
3039 | - SecurityBlob->NtChallengeResponse.Buffer = | |
3039 | + SecurityBlob->NtChallengeResponse.BufferOffset = | |
3040 | 3040 | cpu_to_le32(SecurityBlobLength); |
3041 | 3041 | SecurityBlobLength += CIFS_SESS_KEY_SIZE; |
3042 | 3042 | bcc_ptr += CIFS_SESS_KEY_SIZE; |
3043 | 3043 | |
3044 | 3044 | if (ses->capabilities & CAP_UNICODE) { |
3045 | 3045 | if (domain == NULL) { |
3046 | - SecurityBlob->DomainName.Buffer = 0; | |
3046 | + SecurityBlob->DomainName.BufferOffset = 0; | |
3047 | 3047 | SecurityBlob->DomainName.Length = 0; |
3048 | 3048 | SecurityBlob->DomainName.MaximumLength = 0; |
3049 | 3049 | } else { |
3050 | 3050 | |
... | ... | @@ -3052,14 +3052,14 @@ |
3052 | 3052 | ln *= 2; |
3053 | 3053 | SecurityBlob->DomainName.MaximumLength = |
3054 | 3054 | cpu_to_le16(ln); |
3055 | - SecurityBlob->DomainName.Buffer = | |
3055 | + SecurityBlob->DomainName.BufferOffset = | |
3056 | 3056 | cpu_to_le32(SecurityBlobLength); |
3057 | 3057 | bcc_ptr += ln; |
3058 | 3058 | SecurityBlobLength += ln; |
3059 | 3059 | SecurityBlob->DomainName.Length = cpu_to_le16(ln); |
3060 | 3060 | } |
3061 | 3061 | if (user == NULL) { |
3062 | - SecurityBlob->UserName.Buffer = 0; | |
3062 | + SecurityBlob->UserName.BufferOffset = 0; | |
3063 | 3063 | SecurityBlob->UserName.Length = 0; |
3064 | 3064 | SecurityBlob->UserName.MaximumLength = 0; |
3065 | 3065 | } else { |
... | ... | @@ -3068,7 +3068,7 @@ |
3068 | 3068 | ln *= 2; |
3069 | 3069 | SecurityBlob->UserName.MaximumLength = |
3070 | 3070 | cpu_to_le16(ln); |
3071 | - SecurityBlob->UserName.Buffer = | |
3071 | + SecurityBlob->UserName.BufferOffset = | |
3072 | 3072 | cpu_to_le32(SecurityBlobLength); |
3073 | 3073 | bcc_ptr += ln; |
3074 | 3074 | SecurityBlobLength += ln; |
... | ... | @@ -3080,7 +3080,7 @@ |
3080 | 3080 | SecurityBlob->WorkstationName.Length *= 2; |
3081 | 3081 | SecurityBlob->WorkstationName.MaximumLength = |
3082 | 3082 | cpu_to_le16(SecurityBlob->WorkstationName.Length); |
3083 | - SecurityBlob->WorkstationName.Buffer = | |
3083 | + SecurityBlob->WorkstationName.BufferOffset = | |
3084 | 3084 | cpu_to_le32(SecurityBlobLength); |
3085 | 3085 | bcc_ptr += SecurityBlob->WorkstationName.Length; |
3086 | 3086 | SecurityBlobLength += SecurityBlob->WorkstationName.Length; |
... | ... | @@ -3112,7 +3112,7 @@ |
3112 | 3112 | bcc_ptr += 2; /* null domain */ |
3113 | 3113 | } else { /* ASCII */ |
3114 | 3114 | if (domain == NULL) { |
3115 | - SecurityBlob->DomainName.Buffer = 0; | |
3115 | + SecurityBlob->DomainName.BufferOffset = 0; | |
3116 | 3116 | SecurityBlob->DomainName.Length = 0; |
3117 | 3117 | SecurityBlob->DomainName.MaximumLength = 0; |
3118 | 3118 | } else { |
3119 | 3119 | |
... | ... | @@ -3122,14 +3122,14 @@ |
3122 | 3122 | ln = strnlen(domain, 64); |
3123 | 3123 | SecurityBlob->DomainName.MaximumLength = |
3124 | 3124 | cpu_to_le16(ln); |
3125 | - SecurityBlob->DomainName.Buffer = | |
3125 | + SecurityBlob->DomainName.BufferOffset = | |
3126 | 3126 | cpu_to_le32(SecurityBlobLength); |
3127 | 3127 | bcc_ptr += ln; |
3128 | 3128 | SecurityBlobLength += ln; |
3129 | 3129 | SecurityBlob->DomainName.Length = cpu_to_le16(ln); |
3130 | 3130 | } |
3131 | 3131 | if (user == NULL) { |
3132 | - SecurityBlob->UserName.Buffer = 0; | |
3132 | + SecurityBlob->UserName.BufferOffset = 0; | |
3133 | 3133 | SecurityBlob->UserName.Length = 0; |
3134 | 3134 | SecurityBlob->UserName.MaximumLength = 0; |
3135 | 3135 | } else { |
... | ... | @@ -3137,7 +3137,7 @@ |
3137 | 3137 | strncpy(bcc_ptr, user, 63); |
3138 | 3138 | ln = strnlen(user, 64); |
3139 | 3139 | SecurityBlob->UserName.MaximumLength = cpu_to_le16(ln); |
3140 | - SecurityBlob->UserName.Buffer = | |
3140 | + SecurityBlob->UserName.BufferOffset = | |
3141 | 3141 | cpu_to_le32(SecurityBlobLength); |
3142 | 3142 | bcc_ptr += ln; |
3143 | 3143 | SecurityBlobLength += ln; |
fs/cifs/ntlmssp.h
... | ... | @@ -27,29 +27,39 @@ |
27 | 27 | #define UnknownMessage cpu_to_le32(8) |
28 | 28 | |
29 | 29 | /* Negotiate Flags */ |
30 | -#define NTLMSSP_NEGOTIATE_UNICODE 0x01 /* Text strings are in unicode */ | |
31 | -#define NTLMSSP_NEGOTIATE_OEM 0x02 /* Text strings are in OEM */ | |
32 | -#define NTLMSSP_REQUEST_TARGET 0x04 /* Server return its auth realm */ | |
33 | -#define NTLMSSP_NEGOTIATE_SIGN 0x0010 /* Request signature capability */ | |
34 | -#define NTLMSSP_NEGOTIATE_SEAL 0x0020 /* Request confidentiality */ | |
35 | -#define NTLMSSP_NEGOTIATE_DGRAM 0x0040 | |
36 | -#define NTLMSSP_NEGOTIATE_LM_KEY 0x0080 /* Sign/seal use LM session key */ | |
37 | -#define NTLMSSP_NEGOTIATE_NTLM 0x0200 /* NTLM authentication */ | |
38 | -#define NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED 0x1000 | |
30 | +#define NTLMSSP_NEGOTIATE_UNICODE 0x01 /* Text strings are unicode */ | |
31 | +#define NTLMSSP_NEGOTIATE_OEM 0x02 /* Text strings are in OEM */ | |
32 | +#define NTLMSSP_REQUEST_TARGET 0x04 /* Srv returns its auth realm */ | |
33 | +/* define reserved9 0x08 */ | |
34 | +#define NTLMSSP_NEGOTIATE_SIGN 0x0010 /* Request signing capability */ | |
35 | +#define NTLMSSP_NEGOTIATE_SEAL 0x0020 /* Request confidentiality */ | |
36 | +#define NTLMSSP_NEGOTIATE_DGRAM 0x0040 | |
37 | +#define NTLMSSP_NEGOTIATE_LM_KEY 0x0080 /* Use LM session key */ | |
38 | +/* defined reserved 8 0x0100 */ | |
39 | +#define NTLMSSP_NEGOTIATE_NTLM 0x0200 /* NTLM authentication */ | |
40 | +#define NTLMSSP_NEGOTIATE_NT_ONLY 0x0400 /* Lanman not allowed */ | |
41 | +#define NTLMSSP_ANONYMOUS 0x0800 | |
42 | +#define NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED 0x1000 /* reserved6 */ | |
39 | 43 | #define NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED 0x2000 |
40 | -#define NTLMSSP_NEGOTIATE_LOCAL_CALL 0x4000 /* client/server on same machine */ | |
41 | -#define NTLMSSP_NEGOTIATE_ALWAYS_SIGN 0x8000 /* Sign for all security levels */ | |
42 | -#define NTLMSSP_TARGET_TYPE_DOMAIN 0x10000 | |
43 | -#define NTLMSSP_TARGET_TYPE_SERVER 0x20000 | |
44 | -#define NTLMSSP_TARGET_TYPE_SHARE 0x40000 | |
45 | -#define NTLMSSP_NEGOTIATE_NTLMV2 0x80000 | |
46 | -#define NTLMSSP_REQUEST_INIT_RESP 0x100000 | |
47 | -#define NTLMSSP_REQUEST_ACCEPT_RESP 0x200000 | |
48 | -#define NTLMSSP_REQUEST_NOT_NT_KEY 0x400000 | |
44 | +#define NTLMSSP_NEGOTIATE_LOCAL_CALL 0x4000 /* client/server same machine */ | |
45 | +#define NTLMSSP_NEGOTIATE_ALWAYS_SIGN 0x8000 /* Sign. All security levels */ | |
46 | +#define NTLMSSP_TARGET_TYPE_DOMAIN 0x10000 | |
47 | +#define NTLMSSP_TARGET_TYPE_SERVER 0x20000 | |
48 | +#define NTLMSSP_TARGET_TYPE_SHARE 0x40000 | |
49 | +#define NTLMSSP_NEGOTIATE_EXTENDED_SEC 0x80000 /* NB:not related to NTLMv2 pwd*/ | |
50 | +/* #define NTLMSSP_REQUEST_INIT_RESP 0x100000 */ | |
51 | +#define NTLMSSP_NEGOTIATE_IDENTIFY 0x100000 | |
52 | +#define NTLMSSP_REQUEST_ACCEPT_RESP 0x200000 /* reserved5 */ | |
53 | +#define NTLMSSP_REQUEST_NON_NT_KEY 0x400000 | |
49 | 54 | #define NTLMSSP_NEGOTIATE_TARGET_INFO 0x800000 |
50 | -#define NTLMSSP_NEGOTIATE_128 0x20000000 | |
51 | -#define NTLMSSP_NEGOTIATE_KEY_XCH 0x40000000 | |
52 | -#define NTLMSSP_NEGOTIATE_56 0x80000000 | |
55 | +/* #define reserved4 0x1000000 */ | |
56 | +#define NTLMSSP_NEGOTIATE_VERSION 0x2000000 /* we do not set */ | |
57 | +/* #define reserved3 0x4000000 */ | |
58 | +/* #define reserved2 0x8000000 */ | |
59 | +/* #define reserved1 0x10000000 */ | |
60 | +#define NTLMSSP_NEGOTIATE_128 0x20000000 | |
61 | +#define NTLMSSP_NEGOTIATE_KEY_XCH 0x40000000 | |
62 | +#define NTLMSSP_NEGOTIATE_56 0x80000000 | |
53 | 63 | |
54 | 64 | /* Although typedefs are not commonly used for structure definitions */ |
55 | 65 | /* in the Linux kernel, in this particular case they are useful */ |
56 | 66 | |
57 | 67 | |
58 | 68 | |
59 | 69 | |
60 | 70 | |
... | ... | @@ -60,32 +70,36 @@ |
60 | 70 | typedef struct _SECURITY_BUFFER { |
61 | 71 | __le16 Length; |
62 | 72 | __le16 MaximumLength; |
63 | - __le32 Buffer; /* offset to buffer */ | |
73 | + __le32 BufferOffset; /* offset to buffer */ | |
64 | 74 | } __attribute__((packed)) SECURITY_BUFFER; |
65 | 75 | |
66 | 76 | typedef struct _NEGOTIATE_MESSAGE { |
67 | 77 | __u8 Signature[sizeof(NTLMSSP_SIGNATURE)]; |
68 | - __le32 MessageType; /* 1 */ | |
78 | + __le32 MessageType; /* NtLmNegotiate = 1 */ | |
69 | 79 | __le32 NegotiateFlags; |
70 | 80 | SECURITY_BUFFER DomainName; /* RFC 1001 style and ASCII */ |
71 | 81 | SECURITY_BUFFER WorkstationName; /* RFC 1001 and ASCII */ |
82 | + /* SECURITY_BUFFER for version info not present since we | |
83 | + do not set the version is present flag */ | |
72 | 84 | char DomainString[0]; |
73 | 85 | /* followed by WorkstationString */ |
74 | 86 | } __attribute__((packed)) NEGOTIATE_MESSAGE, *PNEGOTIATE_MESSAGE; |
75 | 87 | |
76 | 88 | typedef struct _CHALLENGE_MESSAGE { |
77 | 89 | __u8 Signature[sizeof(NTLMSSP_SIGNATURE)]; |
78 | - __le32 MessageType; /* 2 */ | |
90 | + __le32 MessageType; /* NtLmChallenge = 2 */ | |
79 | 91 | SECURITY_BUFFER TargetName; |
80 | 92 | __le32 NegotiateFlags; |
81 | 93 | __u8 Challenge[CIFS_CRYPTO_KEY_SIZE]; |
82 | 94 | __u8 Reserved[8]; |
83 | 95 | SECURITY_BUFFER TargetInfoArray; |
96 | + /* SECURITY_BUFFER for version info not present since we | |
97 | + do not set the version is present flag */ | |
84 | 98 | } __attribute__((packed)) CHALLENGE_MESSAGE, *PCHALLENGE_MESSAGE; |
85 | 99 | |
86 | 100 | typedef struct _AUTHENTICATE_MESSAGE { |
87 | - __u8 Signature[sizeof (NTLMSSP_SIGNATURE)]; | |
88 | - __le32 MessageType; /* 3 */ | |
101 | + __u8 Signature[sizeof(NTLMSSP_SIGNATURE)]; | |
102 | + __le32 MessageType; /* NtLmsAuthenticate = 3 */ | |
89 | 103 | SECURITY_BUFFER LmChallengeResponse; |
90 | 104 | SECURITY_BUFFER NtChallengeResponse; |
91 | 105 | SECURITY_BUFFER DomainName; |
... | ... | @@ -93,6 +107,8 @@ |
93 | 107 | SECURITY_BUFFER WorkstationName; |
94 | 108 | SECURITY_BUFFER SessionKey; |
95 | 109 | __le32 NegotiateFlags; |
110 | + /* SECURITY_BUFFER for version info not present since we | |
111 | + do not set the version is present flag */ | |
96 | 112 | char UserString[0]; |
97 | 113 | } __attribute__((packed)) AUTHENTICATE_MESSAGE, *PAUTHENTICATE_MESSAGE; |