aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsglob.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/cifsglob.h')
-rw-r--r--fs/cifs/cifsglob.h69
1 files changed, 44 insertions, 25 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 4f07f6fbe494..52ca861ed35e 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -44,6 +44,7 @@
44#define MAX_TREE_SIZE (2 + MAX_SERVER_SIZE + 1 + MAX_SHARE_SIZE + 1) 44#define MAX_TREE_SIZE (2 + MAX_SERVER_SIZE + 1 + MAX_SHARE_SIZE + 1)
45#define MAX_SERVER_SIZE 15 45#define MAX_SERVER_SIZE 15
46#define MAX_SHARE_SIZE 80 46#define MAX_SHARE_SIZE 80
47#define CIFS_MAX_DOMAINNAME_LEN 256 /* max domain name length */
47#define MAX_USERNAME_SIZE 256 /* reasonable maximum for current servers */ 48#define MAX_USERNAME_SIZE 256 /* reasonable maximum for current servers */
48#define MAX_PASSWORD_SIZE 512 /* max for windows seems to be 256 wide chars */ 49#define MAX_PASSWORD_SIZE 512 /* max for windows seems to be 256 wide chars */
49 50
@@ -101,20 +102,14 @@ enum statusEnum {
101}; 102};
102 103
103enum securityEnum { 104enum securityEnum {
104 LANMAN = 0, /* Legacy LANMAN auth */ 105 Unspecified = 0, /* not specified */
106 LANMAN, /* Legacy LANMAN auth */
105 NTLM, /* Legacy NTLM012 auth with NTLM hash */ 107 NTLM, /* Legacy NTLM012 auth with NTLM hash */
106 NTLMv2, /* Legacy NTLM auth with NTLMv2 hash */ 108 NTLMv2, /* Legacy NTLM auth with NTLMv2 hash */
107 RawNTLMSSP, /* NTLMSSP without SPNEGO, NTLMv2 hash */ 109 RawNTLMSSP, /* NTLMSSP without SPNEGO, NTLMv2 hash */
108/* NTLMSSP, */ /* can use rawNTLMSSP instead of NTLMSSP via SPNEGO */
109 Kerberos, /* Kerberos via SPNEGO */ 110 Kerberos, /* Kerberos via SPNEGO */
110}; 111};
111 112
112enum protocolEnum {
113 TCP = 0,
114 SCTP
115 /* Netbios frames protocol not supported at this time */
116};
117
118struct session_key { 113struct session_key {
119 unsigned int len; 114 unsigned int len;
120 char *response; 115 char *response;
@@ -131,9 +126,11 @@ struct cifs_secmech {
131 struct crypto_shash *hmacmd5; /* hmac-md5 hash function */ 126 struct crypto_shash *hmacmd5; /* hmac-md5 hash function */
132 struct crypto_shash *md5; /* md5 hash function */ 127 struct crypto_shash *md5; /* md5 hash function */
133 struct crypto_shash *hmacsha256; /* hmac-sha256 hash function */ 128 struct crypto_shash *hmacsha256; /* hmac-sha256 hash function */
129 struct crypto_shash *cmacaes; /* block-cipher based MAC function */
134 struct sdesc *sdeschmacmd5; /* ctxt to generate ntlmv2 hash, CR1 */ 130 struct sdesc *sdeschmacmd5; /* ctxt to generate ntlmv2 hash, CR1 */
135 struct sdesc *sdescmd5; /* ctxt to generate cifs/smb signature */ 131 struct sdesc *sdescmd5; /* ctxt to generate cifs/smb signature */
136 struct sdesc *sdeschmacsha256; /* ctxt to generate smb2 signature */ 132 struct sdesc *sdeschmacsha256; /* ctxt to generate smb2 signature */
133 struct sdesc *sdesccmacaes; /* ctxt to generate smb3 signature */
137}; 134};
138 135
139/* per smb session structure/fields */ 136/* per smb session structure/fields */
@@ -181,6 +178,7 @@ enum smb_version {
181 Smb_20, 178 Smb_20,
182 Smb_21, 179 Smb_21,
183 Smb_30, 180 Smb_30,
181 Smb_302,
184}; 182};
185 183
186struct mid_q_entry; 184struct mid_q_entry;
@@ -197,6 +195,7 @@ struct cifs_writedata;
197struct cifs_io_parms; 195struct cifs_io_parms;
198struct cifs_search_info; 196struct cifs_search_info;
199struct cifsInodeInfo; 197struct cifsInodeInfo;
198struct cifs_open_parms;
200 199
201struct smb_version_operations { 200struct smb_version_operations {
202 int (*send_cancel)(struct TCP_Server_Info *, void *, 201 int (*send_cancel)(struct TCP_Server_Info *, void *,
@@ -228,6 +227,7 @@ struct smb_version_operations {
228 void (*dump_detail)(void *); 227 void (*dump_detail)(void *);
229 void (*clear_stats)(struct cifs_tcon *); 228 void (*clear_stats)(struct cifs_tcon *);
230 void (*print_stats)(struct seq_file *m, struct cifs_tcon *); 229 void (*print_stats)(struct seq_file *m, struct cifs_tcon *);
230 void (*dump_share_caps)(struct seq_file *, struct cifs_tcon *);
231 /* verify the message */ 231 /* verify the message */
232 int (*check_message)(char *, unsigned int); 232 int (*check_message)(char *, unsigned int);
233 bool (*is_oplock_break)(char *, struct TCP_Server_Info *); 233 bool (*is_oplock_break)(char *, struct TCP_Server_Info *);
@@ -309,9 +309,8 @@ struct smb_version_operations {
309 const char *, const char *, 309 const char *, const char *,
310 struct cifs_sb_info *); 310 struct cifs_sb_info *);
311 /* open a file for non-posix mounts */ 311 /* open a file for non-posix mounts */
312 int (*open)(const unsigned int, struct cifs_tcon *, const char *, int, 312 int (*open)(const unsigned int, struct cifs_open_parms *,
313 int, int, struct cifs_fid *, __u32 *, FILE_ALL_INFO *, 313 __u32 *, FILE_ALL_INFO *);
314 struct cifs_sb_info *);
315 /* set fid protocol-specific info */ 314 /* set fid protocol-specific info */
316 void (*set_fid)(struct cifsFileInfo *, struct cifs_fid *, __u32); 315 void (*set_fid)(struct cifsFileInfo *, struct cifs_fid *, __u32);
317 /* close a file */ 316 /* close a file */
@@ -367,8 +366,13 @@ struct smb_version_operations {
367 void (*set_lease_key)(struct inode *, struct cifs_fid *fid); 366 void (*set_lease_key)(struct inode *, struct cifs_fid *fid);
368 /* generate new lease key */ 367 /* generate new lease key */
369 void (*new_lease_key)(struct cifs_fid *fid); 368 void (*new_lease_key)(struct cifs_fid *fid);
369 /* The next two functions will need to be changed to per smb session */
370 void (*generate_signingkey)(struct TCP_Server_Info *server);
370 int (*calc_signature)(struct smb_rqst *rqst, 371 int (*calc_signature)(struct smb_rqst *rqst,
371 struct TCP_Server_Info *server); 372 struct TCP_Server_Info *server);
373 int (*query_mf_symlink)(const unsigned char *path, char *pbuf,
374 unsigned int *pbytes_read, struct cifs_sb_info *cifs_sb,
375 unsigned int xid);
372}; 376};
373 377
374struct smb_version_values { 378struct smb_version_values {
@@ -387,6 +391,8 @@ struct smb_version_values {
387 unsigned int cap_nt_find; 391 unsigned int cap_nt_find;
388 unsigned int cap_large_files; 392 unsigned int cap_large_files;
389 unsigned int oplock_read; 393 unsigned int oplock_read;
394 __u16 signing_enabled;
395 __u16 signing_required;
390}; 396};
391 397
392#define HEADER_SIZE(server) (server->vals->header_size) 398#define HEADER_SIZE(server) (server->vals->header_size)
@@ -407,7 +413,8 @@ struct smb_vol {
407 kgid_t backupgid; 413 kgid_t backupgid;
408 umode_t file_mode; 414 umode_t file_mode;
409 umode_t dir_mode; 415 umode_t dir_mode;
410 unsigned secFlg; 416 enum securityEnum sectype; /* sectype requested via mnt opts */
417 bool sign; /* was signing requested via mnt opts? */
411 bool retry:1; 418 bool retry:1;
412 bool intr:1; 419 bool intr:1;
413 bool setuids:1; 420 bool setuids:1;
@@ -441,6 +448,7 @@ struct smb_vol {
441 bool mfsymlinks:1; /* use Minshall+French Symlinks */ 448 bool mfsymlinks:1; /* use Minshall+French Symlinks */
442 bool multiuser:1; 449 bool multiuser:1;
443 bool rwpidforward:1; /* pid forward for read/write operations */ 450 bool rwpidforward:1; /* pid forward for read/write operations */
451 bool nosharesock;
444 unsigned int rsize; 452 unsigned int rsize;
445 unsigned int wsize; 453 unsigned int wsize;
446 bool sockopt_tcp_nodelay:1; 454 bool sockopt_tcp_nodelay:1;
@@ -514,6 +522,7 @@ struct TCP_Server_Info {
514 struct task_struct *tsk; 522 struct task_struct *tsk;
515 char server_GUID[16]; 523 char server_GUID[16];
516 __u16 sec_mode; 524 __u16 sec_mode;
525 bool sign; /* is signing enabled on this connection? */
517 bool session_estab; /* mark when very first sess is established */ 526 bool session_estab; /* mark when very first sess is established */
518#ifdef CONFIG_CIFS_SMB2 527#ifdef CONFIG_CIFS_SMB2
519 int echo_credits; /* echo reserved slots */ 528 int echo_credits; /* echo reserved slots */
@@ -521,7 +530,6 @@ struct TCP_Server_Info {
521 bool echoes:1; /* enable echoes */ 530 bool echoes:1; /* enable echoes */
522#endif 531#endif
523 u16 dialect; /* dialect index that server chose */ 532 u16 dialect; /* dialect index that server chose */
524 enum securityEnum secType;
525 bool oplocks:1; /* enable oplocks */ 533 bool oplocks:1; /* enable oplocks */
526 unsigned int maxReq; /* Clients should submit no more */ 534 unsigned int maxReq; /* Clients should submit no more */
527 /* than maxReq distinct unanswered SMBs to the server when using */ 535 /* than maxReq distinct unanswered SMBs to the server when using */
@@ -540,12 +548,17 @@ struct TCP_Server_Info {
540 int timeAdj; /* Adjust for difference in server time zone in sec */ 548 int timeAdj; /* Adjust for difference in server time zone in sec */
541 __u64 CurrentMid; /* multiplex id - rotating counter */ 549 __u64 CurrentMid; /* multiplex id - rotating counter */
542 char cryptkey[CIFS_CRYPTO_KEY_SIZE]; /* used by ntlm, ntlmv2 etc */ 550 char cryptkey[CIFS_CRYPTO_KEY_SIZE]; /* used by ntlm, ntlmv2 etc */
551 char smb3signingkey[SMB3_SIGN_KEY_SIZE]; /* for signing smb3 packets */
543 /* 16th byte of RFC1001 workstation name is always null */ 552 /* 16th byte of RFC1001 workstation name is always null */
544 char workstation_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL]; 553 char workstation_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL];
545 __u32 sequence_number; /* for signing, protected by srv_mutex */ 554 __u32 sequence_number; /* for signing, protected by srv_mutex */
546 struct session_key session_key; 555 struct session_key session_key;
547 unsigned long lstrp; /* when we got last response from this server */ 556 unsigned long lstrp; /* when we got last response from this server */
548 struct cifs_secmech secmech; /* crypto sec mech functs, descriptors */ 557 struct cifs_secmech secmech; /* crypto sec mech functs, descriptors */
558#define CIFS_NEGFLAVOR_LANMAN 0 /* wct == 13, LANMAN */
559#define CIFS_NEGFLAVOR_UNENCAP 1 /* wct == 17, but no ext_sec */
560#define CIFS_NEGFLAVOR_EXTENDED 2 /* wct == 17, ext_sec bit set */
561 char negflavor; /* NEGOTIATE response flavor */
549 /* extended security flavors that server supports */ 562 /* extended security flavors that server supports */
550 bool sec_ntlmssp; /* supports NTLMSSP */ 563 bool sec_ntlmssp; /* supports NTLMSSP */
551 bool sec_kerberosu2u; /* supports U2U Kerberos */ 564 bool sec_kerberosu2u; /* supports U2U Kerberos */
@@ -697,7 +710,6 @@ struct cifs_ses {
697 enum statusEnum status; 710 enum statusEnum status;
698 unsigned overrideSecFlg; /* if non-zero override global sec flags */ 711 unsigned overrideSecFlg; /* if non-zero override global sec flags */
699 __u16 ipc_tid; /* special tid for connection to IPC share */ 712 __u16 ipc_tid; /* special tid for connection to IPC share */
700 __u16 flags;
701 __u16 vcnum; 713 __u16 vcnum;
702 char *serverOS; /* name of operating system underlying server */ 714 char *serverOS; /* name of operating system underlying server */
703 char *serverNOS; /* name of network operating system of server */ 715 char *serverNOS; /* name of network operating system of server */
@@ -714,21 +726,14 @@ struct cifs_ses {
714 char *password; 726 char *password;
715 struct session_key auth_key; 727 struct session_key auth_key;
716 struct ntlmssp_auth *ntlmssp; /* ciphertext, flags, server challenge */ 728 struct ntlmssp_auth *ntlmssp; /* ciphertext, flags, server challenge */
729 enum securityEnum sectype; /* what security flavor was specified? */
730 bool sign; /* is signing required? */
717 bool need_reconnect:1; /* connection reset, uid now invalid */ 731 bool need_reconnect:1; /* connection reset, uid now invalid */
718#ifdef CONFIG_CIFS_SMB2 732#ifdef CONFIG_CIFS_SMB2
719 __u16 session_flags; 733 __u16 session_flags;
720#endif /* CONFIG_CIFS_SMB2 */ 734#endif /* CONFIG_CIFS_SMB2 */
721}; 735};
722 736
723/* no more than one of the following three session flags may be set */
724#define CIFS_SES_NT4 1
725#define CIFS_SES_OS2 2
726#define CIFS_SES_W9X 4
727/* following flag is set for old servers such as OS2 (and Win95?)
728 which do not negotiate NTLM or POSIX dialects, but instead
729 negotiate one of the older LANMAN dialects */
730#define CIFS_SES_LANMAN 8
731
732static inline bool 737static inline bool
733cap_unix(struct cifs_ses *ses) 738cap_unix(struct cifs_ses *ses)
734{ 739{
@@ -816,7 +821,7 @@ struct cifs_tcon {
816#ifdef CONFIG_CIFS_SMB2 821#ifdef CONFIG_CIFS_SMB2
817 bool print:1; /* set if connection to printer share */ 822 bool print:1; /* set if connection to printer share */
818 bool bad_network_name:1; /* set if ret status STATUS_BAD_NETWORK_NAME */ 823 bool bad_network_name:1; /* set if ret status STATUS_BAD_NETWORK_NAME */
819 __u32 capabilities; 824 __le32 capabilities;
820 __u32 share_flags; 825 __u32 share_flags;
821 __u32 maximal_access; 826 __u32 maximal_access;
822 __u32 vol_serial_number; 827 __u32 vol_serial_number;
@@ -911,6 +916,17 @@ struct cifs_search_info {
911 bool smallBuf:1; /* so we know which buf_release function to call */ 916 bool smallBuf:1; /* so we know which buf_release function to call */
912}; 917};
913 918
919struct cifs_open_parms {
920 struct cifs_tcon *tcon;
921 struct cifs_sb_info *cifs_sb;
922 int disposition;
923 int desired_access;
924 int create_options;
925 const char *path;
926 struct cifs_fid *fid;
927 bool reconnect:1;
928};
929
914struct cifs_fid { 930struct cifs_fid {
915 __u16 netfid; 931 __u16 netfid;
916#ifdef CONFIG_CIFS_SMB2 932#ifdef CONFIG_CIFS_SMB2
@@ -1348,7 +1364,7 @@ require use of the stronger protocol */
1348#define CIFSSEC_MUST_SEAL 0x40040 /* not supported yet */ 1364#define CIFSSEC_MUST_SEAL 0x40040 /* not supported yet */
1349#define CIFSSEC_MUST_NTLMSSP 0x80080 /* raw ntlmssp with ntlmv2 */ 1365#define CIFSSEC_MUST_NTLMSSP 0x80080 /* raw ntlmssp with ntlmv2 */
1350 1366
1351#define CIFSSEC_DEF (CIFSSEC_MAY_SIGN | CIFSSEC_MAY_NTLMSSP) 1367#define CIFSSEC_DEF (CIFSSEC_MAY_SIGN | CIFSSEC_MAY_NTLMV2 | CIFSSEC_MAY_NTLMSSP)
1352#define CIFSSEC_MAX (CIFSSEC_MUST_SIGN | CIFSSEC_MUST_NTLMV2) 1368#define CIFSSEC_MAX (CIFSSEC_MUST_SIGN | CIFSSEC_MUST_NTLMV2)
1353#define CIFSSEC_AUTH_MASK (CIFSSEC_MAY_NTLM | CIFSSEC_MAY_NTLMV2 | CIFSSEC_MAY_LANMAN | CIFSSEC_MAY_PLNTXT | CIFSSEC_MAY_KRB5 | CIFSSEC_MAY_NTLMSSP) 1369#define CIFSSEC_AUTH_MASK (CIFSSEC_MAY_NTLM | CIFSSEC_MAY_NTLMV2 | CIFSSEC_MAY_LANMAN | CIFSSEC_MAY_PLNTXT | CIFSSEC_MAY_KRB5 | CIFSSEC_MAY_NTLMSSP)
1354/* 1370/*
@@ -1494,4 +1510,7 @@ extern struct smb_version_values smb21_values;
1494#define SMB30_VERSION_STRING "3.0" 1510#define SMB30_VERSION_STRING "3.0"
1495extern struct smb_version_operations smb30_operations; 1511extern struct smb_version_operations smb30_operations;
1496extern struct smb_version_values smb30_values; 1512extern struct smb_version_values smb30_values;
1513#define SMB302_VERSION_STRING "3.02"
1514/*extern struct smb_version_operations smb302_operations;*/ /* not needed yet */
1515extern struct smb_version_values smb302_values;
1497#endif /* _CIFS_GLOB_H */ 1516#endif /* _CIFS_GLOB_H */