📄 cifspdu.h
字号:
unsigned char DialectsArray[1];} __attribute__((packed)) NEGOTIATE_REQ;/* Dialect index is 13 for LANMAN */#define MIN_TZ_ADJ (15 * 60) /* minimum grid for timezones in seconds */typedef struct lanman_neg_rsp { struct smb_hdr hdr; /* wct = 13 */ __le16 DialectIndex; __le16 SecurityMode; __le16 MaxBufSize; __le16 MaxMpxCount; __le16 MaxNumberVcs; __le16 RawMode; __le32 SessionKey; struct { __le16 Time; __le16 Date; } __attribute__((packed)) SrvTime; __le16 ServerTimeZone; __le16 EncryptionKeyLength; __le16 Reserved; __u16 ByteCount; unsigned char EncryptionKey[1];} __attribute__((packed)) LANMAN_NEG_RSP;#define READ_RAW_ENABLE 1#define WRITE_RAW_ENABLE 2#define RAW_ENABLE (READ_RAW_ENABLE | WRITE_RAW_ENABLE)typedef struct negotiate_rsp { struct smb_hdr hdr; /* wct = 17 */ __le16 DialectIndex; __u8 SecurityMode; __le16 MaxMpxCount; __le16 MaxNumberVcs; __le32 MaxBufferSize; __le32 MaxRawSize; __le32 SessionKey; __le32 Capabilities; /* see below */ __le32 SystemTimeLow; __le32 SystemTimeHigh; __le16 ServerTimeZone; __u8 EncryptionKeyLength; __u16 ByteCount; union { unsigned char EncryptionKey[1]; /* cap extended security off */ /* followed by Domain name - if extended security is off */ /* followed by 16 bytes of server GUID */ /* then security blob if cap_extended_security negotiated */ struct { unsigned char GUID[16]; unsigned char SecurityBlob[1]; } __attribute__((packed)) extended_response; } __attribute__((packed)) u;} __attribute__((packed)) NEGOTIATE_RSP;/* SecurityMode bits */#define SECMODE_USER 0x01 /* off indicates share level security */#define SECMODE_PW_ENCRYPT 0x02#define SECMODE_SIGN_ENABLED 0x04 /* SMB security signatures enabled */#define SECMODE_SIGN_REQUIRED 0x08 /* SMB security signatures required *//* Negotiate response Capabilities */#define CAP_RAW_MODE 0x00000001#define CAP_MPX_MODE 0x00000002#define CAP_UNICODE 0x00000004#define CAP_LARGE_FILES 0x00000008#define CAP_NT_SMBS 0x00000010 /* implies CAP_NT_FIND */#define CAP_RPC_REMOTE_APIS 0x00000020#define CAP_STATUS32 0x00000040#define CAP_LEVEL_II_OPLOCKS 0x00000080#define CAP_LOCK_AND_READ 0x00000100#define CAP_NT_FIND 0x00000200#define CAP_DFS 0x00001000#define CAP_INFOLEVEL_PASSTHRU 0x00002000#define CAP_LARGE_READ_X 0x00004000#define CAP_LARGE_WRITE_X 0x00008000#define CAP_UNIX 0x00800000#define CAP_RESERVED 0x02000000#define CAP_BULK_TRANSFER 0x20000000#define CAP_COMPRESSED_DATA 0x40000000#define CAP_EXTENDED_SECURITY 0x80000000typedef union smb_com_session_setup_andx { struct { /* request format */ struct smb_hdr hdr; /* wct = 12 */ __u8 AndXCommand; __u8 AndXReserved; __le16 AndXOffset; __le16 MaxBufferSize; __le16 MaxMpxCount; __le16 VcNumber; __u32 SessionKey; __le16 SecurityBlobLength; __u32 Reserved; __le32 Capabilities; /* see below */ __le16 ByteCount; unsigned char SecurityBlob[1]; /* followed by */ /* STRING NativeOS */ /* STRING NativeLanMan */ } __attribute__((packed)) req; /* NTLM request format (with extended security */ struct { /* request format */ struct smb_hdr hdr; /* wct = 13 */ __u8 AndXCommand; __u8 AndXReserved; __le16 AndXOffset; __le16 MaxBufferSize; __le16 MaxMpxCount; __le16 VcNumber; __u32 SessionKey; __le16 CaseInsensitivePasswordLength; /* ASCII password len */ __le16 CaseSensitivePasswordLength; /* Unicode password length*/ __u32 Reserved; /* see below */ __le32 Capabilities; __le16 ByteCount; unsigned char CaseInsensitivePassword[1]; /* followed by: */ /* unsigned char * CaseSensitivePassword; */ /* STRING AccountName */ /* STRING PrimaryDomain */ /* STRING NativeOS */ /* STRING NativeLanMan */ } __attribute__((packed)) req_no_secext; /* NTLM request format (without extended security */ struct { /* default (NTLM) response format */ struct smb_hdr hdr; /* wct = 4 */ __u8 AndXCommand; __u8 AndXReserved; __le16 AndXOffset; __le16 Action; /* see below */ __le16 SecurityBlobLength; __u16 ByteCount; unsigned char SecurityBlob[1]; /* followed by *//* unsigned char * NativeOS; *//* unsigned char * NativeLanMan; *//* unsigned char * PrimaryDomain; */ } __attribute__((packed)) resp; /* NTLM response (with or without extended sec) */ struct { /* request format */ struct smb_hdr hdr; /* wct = 10 */ __u8 AndXCommand; __u8 AndXReserved; __le16 AndXOffset; __le16 MaxBufferSize; __le16 MaxMpxCount; __le16 VcNumber; __u32 SessionKey; __le16 PasswordLength; __u32 Reserved; /* encrypt key len and offset */ __le16 ByteCount; unsigned char AccountPassword[1]; /* followed by */ /* STRING AccountName */ /* STRING PrimaryDomain */ /* STRING NativeOS */ /* STRING NativeLanMan */ } __attribute__((packed)) old_req; /* pre-NTLM (LANMAN2.1) req format */ struct { /* default (NTLM) response format */ struct smb_hdr hdr; /* wct = 3 */ __u8 AndXCommand; __u8 AndXReserved; __le16 AndXOffset; __le16 Action; /* see below */ __u16 ByteCount; unsigned char NativeOS[1]; /* followed by *//* unsigned char * NativeLanMan; *//* unsigned char * PrimaryDomain; */ } __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 */#define NTLMSSP_SERVER_TYPE 1#define NTLMSSP_DOMAIN_TYPE 2#define NTLMSSP_FQ_DOMAIN_TYPE 3#define NTLMSSP_DNS_DOMAIN_TYPE 4#define NTLMSSP_DNS_PARENT_TYPE 5struct ntlmssp2_name { __le16 type; __le16 length;/* char name[length]; */} __attribute__((packed));struct ntlmv2_resp { char ntlmv2_hash[CIFS_ENCPWD_SIZE]; __le32 blob_signature; __u32 reserved; __le64 time; __u64 client_chal; /* random */ __u32 reserved2; struct ntlmssp2_name names[2]; /* 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) */#define CAP_UNICODE 0x00000004#define CAP_LARGE_FILES 0x00000008#define CAP_NT_SMBS 0x00000010#define CAP_STATUS32 0x00000040#define CAP_LEVEL_II_OPLOCKS 0x00000080#define CAP_NT_FIND 0x00000200 /* reserved should be zero (because NT_SMBs implies the same thing?) */#define CAP_BULK_TRANSFER 0x20000000#define CAP_EXTENDED_SECURITY 0x80000000/* Action bits */#define GUEST_LOGIN 1typedef struct smb_com_tconx_req { struct smb_hdr hdr; /* wct = 4 */ __u8 AndXCommand; __u8 AndXReserved; __le16 AndXOffset; __le16 Flags; /* see below */ __le16 PasswordLength; __le16 ByteCount; unsigned char Password[1]; /* followed by *//* STRING Path *//* \\server\share name */ /* STRING Service */} __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 */ __u8 AndXCommand; __u8 AndXReserved; __le16 AndXOffset; __le16 OptionalSupport; /* see below */ __u16 ByteCount; unsigned char Service[1]; /* always ASCII, not Unicode */ /* STRING NativeFileSystem */} __attribute__((packed)) TCONX_RSP;/* tree connect Flags */#define DISCONNECT_TID 0x0001#define TCON_EXTENDED_SECINFO 0x0008/* OptionalSupport bits */#define SMB_SUPPORT_SEARCH_BITS 0x0001 /* "must have" directory search bits (exclusive searches supported) */#define SMB_SHARE_IS_IN_DFS 0x0002typedef struct smb_com_logoff_andx_req { struct smb_hdr hdr; /* wct = 2 */ __u8 AndXCommand; __u8 AndXReserved; __u16 AndXOffset; __u16 ByteCount;} __attribute__((packed)) LOGOFF_ANDX_REQ;typedef struct smb_com_logoff_andx_rsp { struct smb_hdr hdr; /* wct = 2 */ __u8 AndXCommand; __u8 AndXReserved; __u16 AndXOffset; __u16 ByteCount;} __attribute__((packed)) LOGOFF_ANDX_RSP;typedef union smb_com_tree_disconnect { /* as an altetnative can use flag on tree_connect PDU to effect disconnect */ /* tdis is probably simplest SMB PDU */ struct { struct smb_hdr hdr; /* wct = 0 */ __u16 ByteCount; /* bcc = 0 */ } __attribute__((packed)) req; struct { struct smb_hdr hdr; /* wct = 0 */ __u16 ByteCount; /* bcc = 0 */ } __attribute__((packed)) resp;} __attribute__((packed)) TREE_DISCONNECT;typedef struct smb_com_close_req { struct smb_hdr hdr; /* wct = 3 */ __u16 FileID; __u32 LastWriteTime; /* should be zero or -1 */ __u16 ByteCount; /* 0 */} __attribute__((packed)) CLOSE_REQ;typedef struct smb_com_close_rsp { struct smb_hdr hdr; /* wct = 0 */ __u16 ByteCount; /* bct = 0 */} __attribute__((packed)) CLOSE_RSP;typedef struct smb_com_findclose_req { struct smb_hdr hdr; /* wct = 1 */ __u16 FileID; __u16 ByteCount; /* 0 */} __attribute__((packed)) FINDCLOSE_REQ;/* OpenFlags */#define REQ_MORE_INFO 0x00000001 /* legacy (OPEN_AND_X) only */#define REQ_OPLOCK 0x00000002#define REQ_BATCHOPLOCK 0x00000004#define REQ_OPENDIRONLY 0x00000008#define REQ_EXTENDED_INFO 0x00000010typedef struct smb_com_open_req { /* also handles create */ struct smb_hdr hdr; /* wct = 24 */ __u8 AndXCommand; __u8 AndXReserved; __le16 AndXOffset; __u8 Reserved; /* Must Be Zero */ __le16 NameLength; __le32 OpenFlags; __le32 RootDirectoryFid; __le32 DesiredAccess; __le64 AllocationSize; __le32 FileAttributes; __le32 ShareAccess; __le32 CreateDisposition; __le32 CreateOptions; __le32 ImpersonationLevel; __u8 SecurityFlags; __le16 ByteCount; char fileName[1];} __attribute__((packed)) OPEN_REQ;/* open response: oplock levels */#define OPLOCK_NONE 0#define OPLOCK_EXCLUSIVE 1#define OPLOCK_BATCH 2#define OPLOCK_READ 3 /* level 2 oplock *//* open response for CreateAction shifted left */#define CIFS_CREATE_ACTION 0x20000 /* file created */typedef struct smb_com_open_rsp { struct smb_hdr hdr; /* wct = 34 BB */ __u8 AndXCommand; __u8 AndXReserved; __le16 AndXOffset; __u8 OplockLevel; __u16 Fid; __le32 CreateAction; __le64 CreationTime; __le64 LastAccessTime; __le64 LastWriteTime; __le64 ChangeTime; __le32 FileAttributes; __le64 AllocationSize; __le64 EndOfFile; __le16 FileType; __le16 DeviceState; __u8 DirectoryFlag; __u16 ByteCount; /* bct = 0 */} __attribute__((packed)) OPEN_RSP;/* format of legacy open request */typedef struct smb_com_openx_req { struct smb_hdr hdr; /* wct = 15 */ __u8 AndXCommand; __u8 AndXReserved; __le16 AndXOffset; __le16 OpenFlags; __le16 Mode; __le16 Sattr; /* search attributes */ __le16 FileAttributes; /* dos attrs */ __le32 CreateTime; /* os2 format */ __le16 OpenFunction; __le32 EndOfFile; __le32 Timeout; __le32 Reserved; __le16 ByteCount; /* file name follows */ char fileName[1];} __attribute__((packed)) OPENX_REQ;typedef struct smb_com_openx_rsp { struct smb_hdr hdr; /* wct = 15 */ __u8 AndXCommand; __u8 AndXReserved; __le16 AndXOffset; __u16 Fid; __le16 FileAttributes; __le32 LastWriteTime; /* os2 format */ __le32 EndOfFile; __le16 Access; __le16 FileType; __le16 IPCState; __le16 Action; __u32 FileId; __u16 Reserved; __u16 ByteCount;} __attribute__((packed)) OPENX_RSP;/* For encoding of POSIX Open Request - see trans2 function 0x209 data struct *//* Legacy write request for older servers */typedef struct smb_com_writex_req { struct smb_hdr hdr; /* wct = 12 */ __u8 AndXCommand; __u8 AndXReserved; __le16 AndXOffset; __u16 Fid; __le32 OffsetLow; __u32 Reserved; /* Timeout */ __le16 WriteMode; /* 1 = write through */ __le16 Remaining; __le16 Reserved2; __le16 DataLengthLow; __le16 DataOffset; __le16 ByteCount; __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ char Data[0];} __attribute__((packed)) WRITEX_REQ;typedef struct smb_com_write_req { struct smb_hdr hdr; /* wct = 14 */ __u8 AndXCommand; __u8 AndXReserved; __le16 AndXOffset; __u16 Fid; __le32 OffsetLow;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -