diff options
Diffstat (limited to 'fs/cifs/cifspdu.h')
-rw-r--r-- | fs/cifs/cifspdu.h | 98 |
1 files changed, 84 insertions, 14 deletions
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h index b2233ac05bd2..86239023545b 100644 --- a/fs/cifs/cifspdu.h +++ b/fs/cifs/cifspdu.h | |||
@@ -16,7 +16,7 @@ | |||
16 | * | 16 | * |
17 | * You should have received a copy of the GNU Lesser General Public License | 17 | * You should have received a copy of the GNU Lesser General Public License |
18 | * along with this library; if not, write to the Free Software | 18 | * along with this library; if not, write to the Free Software |
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #ifndef _CIFSPDU_H | 22 | #ifndef _CIFSPDU_H |
@@ -24,8 +24,14 @@ | |||
24 | 24 | ||
25 | #include <net/sock.h> | 25 | #include <net/sock.h> |
26 | 26 | ||
27 | #ifdef CONFIG_CIFS_WEAK_PW_HASH | ||
28 | #define LANMAN_PROT 0 | ||
29 | #define CIFS_PROT 1 | ||
30 | #else | ||
27 | #define CIFS_PROT 0 | 31 | #define CIFS_PROT 0 |
28 | #define BAD_PROT CIFS_PROT+1 | 32 | #endif |
33 | #define POSIX_PROT CIFS_PROT+1 | ||
34 | #define BAD_PROT 0xFFFF | ||
29 | 35 | ||
30 | /* SMB command codes */ | 36 | /* SMB command codes */ |
31 | /* Some commands have minimal (wct=0,bcc=0), or uninteresting, responses | 37 | /* Some commands have minimal (wct=0,bcc=0), or uninteresting, responses |
@@ -110,7 +116,7 @@ | |||
110 | /* | 116 | /* |
111 | * Size of the session key (crypto key encrypted with the password | 117 | * Size of the session key (crypto key encrypted with the password |
112 | */ | 118 | */ |
113 | #define CIFS_SESSION_KEY_SIZE (24) | 119 | #define CIFS_SESS_KEY_SIZE (24) |
114 | 120 | ||
115 | /* | 121 | /* |
116 | * Maximum user name length | 122 | * Maximum user name length |
@@ -400,6 +406,29 @@ typedef struct negotiate_req { | |||
400 | unsigned char DialectsArray[1]; | 406 | unsigned char DialectsArray[1]; |
401 | } __attribute__((packed)) NEGOTIATE_REQ; | 407 | } __attribute__((packed)) NEGOTIATE_REQ; |
402 | 408 | ||
409 | /* Dialect index is 13 for LANMAN */ | ||
410 | |||
411 | typedef struct lanman_neg_rsp { | ||
412 | struct smb_hdr hdr; /* wct = 13 */ | ||
413 | __le16 DialectIndex; | ||
414 | __le16 SecurityMode; | ||
415 | __le16 MaxBufSize; | ||
416 | __le16 MaxMpxCount; | ||
417 | __le16 MaxNumberVcs; | ||
418 | __le16 RawMode; | ||
419 | __le32 SessionKey; | ||
420 | __le32 ServerTime; | ||
421 | __le16 ServerTimeZone; | ||
422 | __le16 EncryptionKeyLength; | ||
423 | __le16 Reserved; | ||
424 | __u16 ByteCount; | ||
425 | unsigned char EncryptionKey[1]; | ||
426 | } __attribute__((packed)) LANMAN_NEG_RSP; | ||
427 | |||
428 | #define READ_RAW_ENABLE 1 | ||
429 | #define WRITE_RAW_ENABLE 2 | ||
430 | #define RAW_ENABLE (READ_RAW_ENABLE | WRITE_RAW_ENABLE) | ||
431 | |||
403 | typedef struct negotiate_rsp { | 432 | typedef struct negotiate_rsp { |
404 | struct smb_hdr hdr; /* wct = 17 */ | 433 | struct smb_hdr hdr; /* wct = 17 */ |
405 | __le16 DialectIndex; | 434 | __le16 DialectIndex; |
@@ -509,7 +538,7 @@ typedef union smb_com_session_setup_andx { | |||
509 | /* unsigned char * NativeOS; */ | 538 | /* unsigned char * NativeOS; */ |
510 | /* unsigned char * NativeLanMan; */ | 539 | /* unsigned char * NativeLanMan; */ |
511 | /* unsigned char * PrimaryDomain; */ | 540 | /* unsigned char * PrimaryDomain; */ |
512 | } __attribute__((packed)) resp; /* NTLM response format (with or without extended security */ | 541 | } __attribute__((packed)) resp; /* NTLM response with or without extended sec*/ |
513 | 542 | ||
514 | struct { /* request format */ | 543 | struct { /* request format */ |
515 | struct smb_hdr hdr; /* wct = 10 */ | 544 | struct smb_hdr hdr; /* wct = 10 */ |
@@ -520,8 +549,8 @@ typedef union smb_com_session_setup_andx { | |||
520 | __le16 MaxMpxCount; | 549 | __le16 MaxMpxCount; |
521 | __le16 VcNumber; | 550 | __le16 VcNumber; |
522 | __u32 SessionKey; | 551 | __u32 SessionKey; |
523 | __le16 PassswordLength; | 552 | __le16 PasswordLength; |
524 | __u32 Reserved; | 553 | __u32 Reserved; /* encrypt key len and offset */ |
525 | __le16 ByteCount; | 554 | __le16 ByteCount; |
526 | unsigned char AccountPassword[1]; /* followed by */ | 555 | unsigned char AccountPassword[1]; /* followed by */ |
527 | /* STRING AccountName */ | 556 | /* STRING AccountName */ |
@@ -543,6 +572,26 @@ typedef union smb_com_session_setup_andx { | |||
543 | } __attribute__((packed)) old_resp; /* pre-NTLM (LANMAN2.1) response */ | 572 | } __attribute__((packed)) old_resp; /* pre-NTLM (LANMAN2.1) response */ |
544 | } __attribute__((packed)) SESSION_SETUP_ANDX; | 573 | } __attribute__((packed)) SESSION_SETUP_ANDX; |
545 | 574 | ||
575 | /* format of NLTMv2 Response ie "case sensitive password" hash when NTLMv2 */ | ||
576 | |||
577 | struct ntlmssp2_name { | ||
578 | __le16 type; | ||
579 | __le16 length; | ||
580 | /* char name[length]; */ | ||
581 | } __attribute__((packed)); | ||
582 | |||
583 | struct ntlmv2_resp { | ||
584 | char ntlmv2_hash[CIFS_ENCPWD_SIZE]; | ||
585 | __le32 blob_signature; | ||
586 | __u32 reserved; | ||
587 | __le64 time; | ||
588 | __u64 client_chal; /* random */ | ||
589 | __u32 reserved2; | ||
590 | struct ntlmssp2_name names[1]; | ||
591 | /* array of name entries could follow ending in minimum 4 byte struct */ | ||
592 | } __attribute__((packed)); | ||
593 | |||
594 | |||
546 | #define CIFS_NETWORK_OPSYS "CIFS VFS Client for Linux" | 595 | #define CIFS_NETWORK_OPSYS "CIFS VFS Client for Linux" |
547 | 596 | ||
548 | /* Capabilities bits (for NTLM SessSetup request) */ | 597 | /* Capabilities bits (for NTLM SessSetup request) */ |
@@ -573,7 +622,9 @@ typedef struct smb_com_tconx_req { | |||
573 | } __attribute__((packed)) TCONX_REQ; | 622 | } __attribute__((packed)) TCONX_REQ; |
574 | 623 | ||
575 | typedef struct smb_com_tconx_rsp { | 624 | typedef struct smb_com_tconx_rsp { |
576 | struct smb_hdr hdr; /* wct = 3 *//* note that Win2000 has sent wct=7 in some cases on responses. Four unspecified words followed OptionalSupport */ | 625 | struct smb_hdr hdr; /* wct = 3 note that Win2000 has sent wct = 7 |
626 | in some cases on responses. Four unspecified | ||
627 | words followed OptionalSupport */ | ||
577 | __u8 AndXCommand; | 628 | __u8 AndXCommand; |
578 | __u8 AndXReserved; | 629 | __u8 AndXReserved; |
579 | __le16 AndXOffset; | 630 | __le16 AndXOffset; |
@@ -1323,6 +1374,9 @@ struct smb_t2_rsp { | |||
1323 | #define SMB_FILE_MAXIMUM_INFO 0x40d | 1374 | #define SMB_FILE_MAXIMUM_INFO 0x40d |
1324 | 1375 | ||
1325 | /* Find File infolevels */ | 1376 | /* Find File infolevels */ |
1377 | #define SMB_FIND_FILE_INFO_STANDARD 0x001 | ||
1378 | #define SMB_FIND_FILE_QUERY_EA_SIZE 0x002 | ||
1379 | #define SMB_FIND_FILE_QUERY_EAS_FROM_LIST 0x003 | ||
1326 | #define SMB_FIND_FILE_DIRECTORY_INFO 0x101 | 1380 | #define SMB_FIND_FILE_DIRECTORY_INFO 0x101 |
1327 | #define SMB_FIND_FILE_FULL_DIRECTORY_INFO 0x102 | 1381 | #define SMB_FIND_FILE_FULL_DIRECTORY_INFO 0x102 |
1328 | #define SMB_FIND_FILE_NAMES_INFO 0x103 | 1382 | #define SMB_FIND_FILE_NAMES_INFO 0x103 |
@@ -1844,13 +1898,13 @@ typedef struct { | |||
1844 | typedef struct { | 1898 | typedef struct { |
1845 | __le32 DeviceType; | 1899 | __le32 DeviceType; |
1846 | __le32 DeviceCharacteristics; | 1900 | __le32 DeviceCharacteristics; |
1847 | } __attribute__((packed)) FILE_SYSTEM_DEVICE_INFO; /* device info, level 0x104 */ | 1901 | } __attribute__((packed)) FILE_SYSTEM_DEVICE_INFO; /* device info level 0x104 */ |
1848 | 1902 | ||
1849 | typedef struct { | 1903 | typedef struct { |
1850 | __le32 Attributes; | 1904 | __le32 Attributes; |
1851 | __le32 MaxPathNameComponentLength; | 1905 | __le32 MaxPathNameComponentLength; |
1852 | __le32 FileSystemNameLen; | 1906 | __le32 FileSystemNameLen; |
1853 | char FileSystemName[52]; /* do not really need to save this - so potentially get only subset of name */ | 1907 | char FileSystemName[52]; /* do not have to save this - get subset? */ |
1854 | } __attribute__((packed)) FILE_SYSTEM_ATTRIBUTE_INFO; | 1908 | } __attribute__((packed)) FILE_SYSTEM_ATTRIBUTE_INFO; |
1855 | 1909 | ||
1856 | /******************************************************************************/ | 1910 | /******************************************************************************/ |
@@ -1947,7 +2001,8 @@ typedef struct { | |||
1947 | 2001 | ||
1948 | struct file_allocation_info { | 2002 | struct file_allocation_info { |
1949 | __le64 AllocationSize; /* Note old Samba srvr rounds this up too much */ | 2003 | __le64 AllocationSize; /* Note old Samba srvr rounds this up too much */ |
1950 | } __attribute__((packed)); /* size used on disk, level 0x103 for set, 0x105 for query */ | 2004 | } __attribute__((packed)); /* size used on disk, for level 0x103 for set, |
2005 | 0x105 for query */ | ||
1951 | 2006 | ||
1952 | struct file_end_of_file_info { | 2007 | struct file_end_of_file_info { |
1953 | __le64 FileSize; /* offset to end of file */ | 2008 | __le64 FileSize; /* offset to end of file */ |
@@ -2054,7 +2109,7 @@ typedef struct { | |||
2054 | __le32 ExtFileAttributes; | 2109 | __le32 ExtFileAttributes; |
2055 | __le32 FileNameLength; | 2110 | __le32 FileNameLength; |
2056 | char FileName[1]; | 2111 | char FileName[1]; |
2057 | } __attribute__((packed)) FILE_DIRECTORY_INFO; /* level 0x101 FF response data area */ | 2112 | } __attribute__((packed)) FILE_DIRECTORY_INFO; /* level 0x101 FF resp data */ |
2058 | 2113 | ||
2059 | typedef struct { | 2114 | typedef struct { |
2060 | __le32 NextEntryOffset; | 2115 | __le32 NextEntryOffset; |
@@ -2069,7 +2124,7 @@ typedef struct { | |||
2069 | __le32 FileNameLength; | 2124 | __le32 FileNameLength; |
2070 | __le32 EaSize; /* length of the xattrs */ | 2125 | __le32 EaSize; /* length of the xattrs */ |
2071 | char FileName[1]; | 2126 | char FileName[1]; |
2072 | } __attribute__((packed)) FILE_FULL_DIRECTORY_INFO; /* level 0x102 FF response data area */ | 2127 | } __attribute__((packed)) FILE_FULL_DIRECTORY_INFO; /* level 0x102 rsp data */ |
2073 | 2128 | ||
2074 | typedef struct { | 2129 | typedef struct { |
2075 | __le32 NextEntryOffset; | 2130 | __le32 NextEntryOffset; |
@@ -2086,7 +2141,7 @@ typedef struct { | |||
2086 | __le32 Reserved; | 2141 | __le32 Reserved; |
2087 | __u64 UniqueId; /* inode num - le since Samba puts ino in low 32 bit*/ | 2142 | __u64 UniqueId; /* inode num - le since Samba puts ino in low 32 bit*/ |
2088 | char FileName[1]; | 2143 | char FileName[1]; |
2089 | } __attribute__((packed)) SEARCH_ID_FULL_DIR_INFO; /* level 0x105 FF response data area */ | 2144 | } __attribute__((packed)) SEARCH_ID_FULL_DIR_INFO; /* level 0x105 FF rsp data */ |
2090 | 2145 | ||
2091 | typedef struct { | 2146 | typedef struct { |
2092 | __le32 NextEntryOffset; | 2147 | __le32 NextEntryOffset; |
@@ -2104,7 +2159,22 @@ typedef struct { | |||
2104 | __u8 Reserved; | 2159 | __u8 Reserved; |
2105 | __u8 ShortName[12]; | 2160 | __u8 ShortName[12]; |
2106 | char FileName[1]; | 2161 | char FileName[1]; |
2107 | } __attribute__((packed)) FILE_BOTH_DIRECTORY_INFO; /* level 0x104 FF response data area */ | 2162 | } __attribute__((packed)) FILE_BOTH_DIRECTORY_INFO; /* level 0x104 FFrsp data */ |
2163 | |||
2164 | typedef struct { | ||
2165 | __u32 ResumeKey; | ||
2166 | __le16 CreationDate; /* SMB Date */ | ||
2167 | __le16 CreationTime; /* SMB Time */ | ||
2168 | __le16 LastAccessDate; | ||
2169 | __le16 LastAccessTime; | ||
2170 | __le16 LastWriteDate; | ||
2171 | __le16 LastWriteTime; | ||
2172 | __le32 DataSize; /* File Size (EOF) */ | ||
2173 | __le32 AllocationSize; | ||
2174 | __le16 Attributes; /* verify not u32 */ | ||
2175 | __u8 FileNameLength; | ||
2176 | char FileName[1]; | ||
2177 | } __attribute__((packed)) FIND_FILE_STANDARD_INFO; /* level 0x1 FF resp data */ | ||
2108 | 2178 | ||
2109 | 2179 | ||
2110 | struct win_dev { | 2180 | struct win_dev { |