diff options
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/cifsglob.h | 8 | ||||
-rw-r--r-- | fs/cifs/sess.c | 73 |
2 files changed, 55 insertions, 26 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 61d617370e56..9b7762c754cb 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -495,9 +495,15 @@ require use of the stronger protocol */ | |||
495 | #ifdef CONFIG_CIFS_WEAK_PW_HASH | 495 | #ifdef CONFIG_CIFS_WEAK_PW_HASH |
496 | #define CIFSSEC_MUST_LANMAN 0x10010 | 496 | #define CIFSSEC_MUST_LANMAN 0x10010 |
497 | #define CIFSSEC_MUST_PLNTXT 0x20020 | 497 | #define CIFSSEC_MUST_PLNTXT 0x20020 |
498 | #ifdef CONFIG_CIFS_UPCALL | ||
499 | #define CIFSSEC_MASK 0x3F03F /* allows weak security but also krb5 */ | ||
500 | #else | ||
498 | #define CIFSSEC_MASK 0x37037 /* current flags supported if weak */ | 501 | #define CIFSSEC_MASK 0x37037 /* current flags supported if weak */ |
502 | #else /* do not allow weak pw hash */ | ||
503 | #ifdef CONFIG_CIFS_UPCALL | ||
504 | #define CIFSSEC_MASK 0x0F00F /* flags supported if no weak allowed */ | ||
499 | #else | 505 | #else |
500 | #define CIFSSEC_MASK 0x07007 /* flags supported if no weak config */ | 506 | #define CIFSSEC_MASK 0x07007 /* flags supported if no weak allowed */ |
501 | #endif /* WEAK_PW_HASH */ | 507 | #endif /* WEAK_PW_HASH */ |
502 | #define CIFSSEC_MUST_SEAL 0x40040 /* not supported yet */ | 508 | #define CIFSSEC_MUST_SEAL 0x40040 /* not supported yet */ |
503 | 509 | ||
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index 78797c0e076c..c74a064e7825 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c | |||
@@ -74,6 +74,52 @@ static __u32 cifs_ssetup_hdr(struct cifsSesInfo *ses, SESSION_SETUP_ANDX *pSMB) | |||
74 | return capabilities; | 74 | return capabilities; |
75 | } | 75 | } |
76 | 76 | ||
77 | static void | ||
78 | unicode_oslm_strings(char **pbcc_area, const struct nls_table *nls_cp) | ||
79 | { | ||
80 | char *bcc_ptr = *pbcc_area; | ||
81 | int bytes_ret = 0; | ||
82 | |||
83 | /* Copy OS version */ | ||
84 | bytes_ret = cifs_strtoUCS((__le16 *)bcc_ptr, "Linux version ", 32, | ||
85 | nls_cp); | ||
86 | bcc_ptr += 2 * bytes_ret; | ||
87 | bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, init_utsname()->release, | ||
88 | 32, nls_cp); | ||
89 | bcc_ptr += 2 * bytes_ret; | ||
90 | bcc_ptr += 2; /* trailing null */ | ||
91 | |||
92 | bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, CIFS_NETWORK_OPSYS, | ||
93 | 32, nls_cp); | ||
94 | bcc_ptr += 2 * bytes_ret; | ||
95 | bcc_ptr += 2; /* trailing null */ | ||
96 | |||
97 | *pbcc_area = bcc_ptr; | ||
98 | } | ||
99 | |||
100 | static void unicode_domain_string(char **pbcc_area, struct cifsSesInfo *ses, | ||
101 | const struct nls_table *nls_cp) | ||
102 | { | ||
103 | char *bcc_ptr = *pbcc_area; | ||
104 | int bytes_ret = 0; | ||
105 | |||
106 | /* copy domain */ | ||
107 | if (ses->domainName == NULL) { | ||
108 | /* Sending null domain better than using a bogus domain name (as | ||
109 | we did briefly in 2.6.18) since server will use its default */ | ||
110 | *bcc_ptr = 0; | ||
111 | *(bcc_ptr+1) = 0; | ||
112 | bytes_ret = 0; | ||
113 | } else | ||
114 | bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, ses->domainName, | ||
115 | 256, nls_cp); | ||
116 | bcc_ptr += 2 * bytes_ret; | ||
117 | bcc_ptr += 2; /* account for null terminator */ | ||
118 | |||
119 | *pbcc_area = bcc_ptr; | ||
120 | } | ||
121 | |||
122 | |||
77 | static void unicode_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses, | 123 | static void unicode_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses, |
78 | const struct nls_table *nls_cp) | 124 | const struct nls_table *nls_cp) |
79 | { | 125 | { |
@@ -99,32 +145,9 @@ static void unicode_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses, | |||
99 | } | 145 | } |
100 | bcc_ptr += 2 * bytes_ret; | 146 | bcc_ptr += 2 * bytes_ret; |
101 | bcc_ptr += 2; /* account for null termination */ | 147 | bcc_ptr += 2; /* account for null termination */ |
102 | /* copy domain */ | ||
103 | if (ses->domainName == NULL) { | ||
104 | /* Sending null domain better than using a bogus domain name (as | ||
105 | we did briefly in 2.6.18) since server will use its default */ | ||
106 | *bcc_ptr = 0; | ||
107 | *(bcc_ptr+1) = 0; | ||
108 | bytes_ret = 0; | ||
109 | } else | ||
110 | bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, ses->domainName, | ||
111 | 256, nls_cp); | ||
112 | bcc_ptr += 2 * bytes_ret; | ||
113 | bcc_ptr += 2; /* account for null terminator */ | ||
114 | 148 | ||
115 | /* Copy OS version */ | 149 | unicode_domain_string(&bcc_ptr, ses, nls_cp); |
116 | bytes_ret = cifs_strtoUCS((__le16 *)bcc_ptr, "Linux version ", 32, | 150 | unicode_oslm_strings(&bcc_ptr, nls_cp); |
117 | nls_cp); | ||
118 | bcc_ptr += 2 * bytes_ret; | ||
119 | bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, init_utsname()->release, | ||
120 | 32, nls_cp); | ||
121 | bcc_ptr += 2 * bytes_ret; | ||
122 | bcc_ptr += 2; /* trailing null */ | ||
123 | |||
124 | bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, CIFS_NETWORK_OPSYS, | ||
125 | 32, nls_cp); | ||
126 | bcc_ptr += 2 * bytes_ret; | ||
127 | bcc_ptr += 2; /* trailing null */ | ||
128 | 151 | ||
129 | *pbcc_area = bcc_ptr; | 152 | *pbcc_area = bcc_ptr; |
130 | } | 153 | } |