/[smeserver]/rpms/samba/sme10/samba-4.2.10-badlock-bugfixes.patch
ViewVC logotype

Contents of /rpms/samba/sme10/samba-4.2.10-badlock-bugfixes.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Thu Mar 2 16:04:48 2017 UTC (7 years, 2 months ago) by unnilennium
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
update to samba-4.4.4-12 upstream version

1 From 256f09848913caea3236ee7a5d0086a5906717e7 Mon Sep 17 00:00:00 2001
2 From: Stefan Metzmacher <metze@samba.org>
3 Date: Fri, 22 Apr 2016 16:18:24 +0200
4 Subject: [PATCH 01/30] s4:gensec_tstream: allow wrapped messages up to a size
5 of 0xfffffff
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11872
11
12 Signed-off-by: Stefan Metzmacher <metze@samba.org>
13 Reviewed-by: Andreas Schneider <asn@samba.org>
14 Reviewed-by: Günther Deschner <gd@samba.org>
15 (cherry picked from commit 8704958fb3b212b401a8e7d94fdd9c627adbde0d)
16 ---
17 source4/auth/gensec/gensec_tstream.c | 6 +++++-
18 1 file changed, 5 insertions(+), 1 deletion(-)
19
20 diff --git a/source4/auth/gensec/gensec_tstream.c b/source4/auth/gensec/gensec_tstream.c
21 index 92f4fa6..c828170 100644
22 --- a/source4/auth/gensec/gensec_tstream.c
23 +++ b/source4/auth/gensec/gensec_tstream.c
24 @@ -253,7 +253,11 @@ static int tstream_gensec_readv_next_vector(struct tstream_context *unix_stream,
25
26 msg_len = RIVAL(state->wrapped.hdr, 0);
27
28 - if (msg_len > 0x00FFFFFF) {
29 + /*
30 + * I got a Windows 2012R2 server responding with
31 + * a message of 0x1b28a33.
32 + */
33 + if (msg_len > 0x0FFFFFFF) {
34 errno = EMSGSIZE;
35 return -1;
36 }
37 --
38 1.9.1
39
40
41 From 2790b1f017568218f1854f85ce301ccb740737ff Mon Sep 17 00:00:00 2001
42 From: Stefan Metzmacher <metze@samba.org>
43 Date: Fri, 22 Apr 2016 16:31:55 +0200
44 Subject: [PATCH 02/30] s3:libads/sasl: allow wrapped messages up to a size of
45 0xfffffff
46 MIME-Version: 1.0
47 Content-Type: text/plain; charset=UTF-8
48 Content-Transfer-Encoding: 8bit
49
50 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11872
51
52 Signed-off-by: Stefan Metzmacher <metze@samba.org>
53 Reviewed-by: Andreas Schneider <asn@samba.org>
54 Reviewed-by: Günther Deschner <gd@samba.org>
55 (cherry picked from commit 795e796658e6da0149c9c00ece7cca4ccc457717)
56 ---
57 source3/libads/sasl.c | 4 ++--
58 1 file changed, 2 insertions(+), 2 deletions(-)
59
60 diff --git a/source3/libads/sasl.c b/source3/libads/sasl.c
61 index b8d4527..10f63e8 100644
62 --- a/source3/libads/sasl.c
63 +++ b/source3/libads/sasl.c
64 @@ -328,7 +328,7 @@ static ADS_STATUS ads_sasl_spnego_gensec_bind(ADS_STRUCT *ads,
65 * arcfour-hmac-md5.
66 */
67 ads->ldap.in.min_wrapped = MIN(ads->ldap.out.sig_size, 0x2C);
68 - ads->ldap.in.max_wrapped = max_wrapped;
69 + ads->ldap.in.max_wrapped = ADS_SASL_WRAPPING_IN_MAX_WRAPPED;
70 status = ads_setup_sasl_wrapping(ads, &ads_sasl_gensec_ops, auth_generic_state->gensec_security);
71 if (!ADS_ERR_OK(status)) {
72 DEBUG(0, ("ads_setup_sasl_wrapping() failed: %s\n",
73 @@ -986,7 +986,7 @@ static ADS_STATUS ads_sasl_gssapi_do_bind(ADS_STRUCT *ads, const gss_name_t serv
74
75 ads->ldap.out.sig_size = max_msg_size - ads->ldap.out.max_unwrapped;
76 ads->ldap.in.min_wrapped = 0x2C; /* taken from a capture with LDAP unbind */
77 - ads->ldap.in.max_wrapped = max_msg_size;
78 + ads->ldap.in.max_wrapped = ADS_SASL_WRAPPING_IN_MAX_WRAPPED;
79 status = ads_setup_sasl_wrapping(ads, &ads_sasl_gssapi_ops, context_handle);
80 if (!ADS_ERR_OK(status)) {
81 DEBUG(0, ("ads_setup_sasl_wrapping() failed: %s\n",
82 --
83 1.9.1
84
85
86 From d5a662e47b710a05b274c23bc7fcbf9e6c88d92e Mon Sep 17 00:00:00 2001
87 From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org>
88 Date: Thu, 28 Apr 2016 12:58:10 +0200
89 Subject: [PATCH 03/30] lib:krb5_wrap:krb5_samba: increase debug level for
90 smb_krb5_get_default_realm_from_ccache().
91
92 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11872
93
94 Guenther
95
96 Signed-off-by: Guenther Deschner <gd@samba.org>
97 Reviewed-by: Stefan Metzmacher <metze@samba.org>
98 Reviewed-by: Andreas Schneider <asn@samba.org>
99 (cherry picked from commit 95b8b020626ba58a77a21e3da804bac2f0cf90b1)
100 ---
101 lib/krb5_wrap/krb5_samba.c | 4 ++--
102 1 file changed, 2 insertions(+), 2 deletions(-)
103
104 diff --git a/lib/krb5_wrap/krb5_samba.c b/lib/krb5_wrap/krb5_samba.c
105 index 5f0378b..c066c1d 100644
106 --- a/lib/krb5_wrap/krb5_samba.c
107 +++ b/lib/krb5_wrap/krb5_samba.c
108 @@ -2388,12 +2388,12 @@ static char *smb_krb5_get_default_realm_from_ccache(TALLOC_CTX *mem_ctx)
109 "Trying to read krb5 cache: %s\n",
110 krb5_cc_default_name(ctx)));
111 if (krb5_cc_default(ctx, &cc)) {
112 - DEBUG(0,("kerberos_get_default_realm_from_ccache: "
113 + DEBUG(5,("kerberos_get_default_realm_from_ccache: "
114 "failed to read default cache\n"));
115 goto out;
116 }
117 if (krb5_cc_get_principal(ctx, cc, &princ)) {
118 - DEBUG(0,("kerberos_get_default_realm_from_ccache: "
119 + DEBUG(5,("kerberos_get_default_realm_from_ccache: "
120 "failed to get default principal\n"));
121 goto out;
122 }
123 --
124 1.9.1
125
126
127 From 64eafe403323471515067c2115f7b90f4985f99e Mon Sep 17 00:00:00 2001
128 From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org>
129 Date: Thu, 28 Apr 2016 12:58:33 +0200
130 Subject: [PATCH 04/30] s3:librpc:crypto:gse: increase debug level for
131 gse_init_client().
132
133 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11872
134
135 Guenther
136
137 Signed-off-by: Guenther Deschner <gd@samba.org>
138 Reviewed-by: Stefan Metzmacher <metze@samba.org>
139 Reviewed-by: Andreas Schneider <asn@samba.org>
140 (cherry picked from commit b6595037f3fcaafb957d9c08edfb89c72cded987)
141 ---
142 source3/librpc/crypto/gse.c | 2 +-
143 1 file changed, 1 insertion(+), 1 deletion(-)
144
145 diff --git a/source3/librpc/crypto/gse.c b/source3/librpc/crypto/gse.c
146 index fc31064..82c8085 100644
147 --- a/source3/librpc/crypto/gse.c
148 +++ b/source3/librpc/crypto/gse.c
149 @@ -239,7 +239,7 @@ static NTSTATUS gse_init_client(TALLOC_CTX *mem_ctx,
150 GSS_C_NT_USER_NAME,
151 &gse_ctx->server_name);
152 if (gss_maj) {
153 - DEBUG(0, ("gss_import_name failed for %s, with [%s]\n",
154 + DEBUG(5, ("gss_import_name failed for %s, with [%s]\n",
155 (char *)name_buffer.value,
156 gse_errstr(gse_ctx, gss_maj, gss_min)));
157 status = NT_STATUS_INTERNAL_ERROR;
158 --
159 1.9.1
160
161
162 From 1672168e6e13130ad98b8513b877c5071a2587ba Mon Sep 17 00:00:00 2001
163 From: Stefan Metzmacher <metze@samba.org>
164 Date: Thu, 28 Apr 2016 12:26:16 +0200
165 Subject: [PATCH 05/30] auth/spnego: change log level for 'Failed to setup
166 SPNEGO negTokenInit request: NT_STATUS_INTERNAL_ERROR'
167 MIME-Version: 1.0
168 Content-Type: text/plain; charset=UTF-8
169 Content-Transfer-Encoding: 8bit
170
171 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11872
172
173 Signed-off-by: Stefan Metzmacher <metze@samba.org>
174 Reviewed-by: Andreas Schneider <asn@samba.org>
175 Reviewed-by: Günther Deschner <gd@samba.org>
176 (cherry picked from commit 9930bd17f2d39e4be1e125f83f7de489a94ea1d1)
177 ---
178 auth/gensec/spnego.c | 2 +-
179 1 file changed, 1 insertion(+), 1 deletion(-)
180
181 diff --git a/auth/gensec/spnego.c b/auth/gensec/spnego.c
182 index 1d4b172..5126952 100644
183 --- a/auth/gensec/spnego.c
184 +++ b/auth/gensec/spnego.c
185 @@ -661,7 +661,7 @@ static NTSTATUS gensec_spnego_create_negTokenInit(struct gensec_security *gensec
186 talloc_free(spnego_state->sub_sec_security);
187 spnego_state->sub_sec_security = NULL;
188
189 - DEBUG(1, ("Failed to setup SPNEGO negTokenInit request: %s\n", nt_errstr(nt_status)));
190 + DEBUG(10, ("Failed to setup SPNEGO negTokenInit request: %s\n", nt_errstr(nt_status)));
191 return nt_status;
192 }
193
194 --
195 1.9.1
196
197
198 From c06ae7f3e1e9ba5fa82d8d6b0665f2fd7cef2f4a Mon Sep 17 00:00:00 2001
199 From: Stefan Metzmacher <metze@samba.org>
200 Date: Sat, 23 Apr 2016 05:17:25 +0200
201 Subject: [PATCH 06/30] auth/spnego: handle broken mechListMIC response from
202 Windows 2000
203 MIME-Version: 1.0
204 Content-Type: text/plain; charset=UTF-8
205 Content-Transfer-Encoding: 8bit
206
207 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11870
208
209 Signed-off-by: Stefan Metzmacher <metze@samba.org>
210 Reviewed-by: Andreas Schneider <asn@samba.org>
211 Reviewed-by: Günther Deschner <gd@samba.org>
212 (cherry picked from commit 032c2733dea834e2c95178cdd0deb73e7bb13621)
213 ---
214 auth/gensec/spnego.c | 18 ++++++++++++++++++
215 1 file changed, 18 insertions(+)
216
217 diff --git a/auth/gensec/spnego.c b/auth/gensec/spnego.c
218 index 5126952..33a4b46 100644
219 --- a/auth/gensec/spnego.c
220 +++ b/auth/gensec/spnego.c
221 @@ -1078,6 +1078,24 @@ static NTSTATUS gensec_spnego_update(struct gensec_security *gensec_security, TA
222 }
223
224 if (spnego.negTokenTarg.mechListMIC.length > 0) {
225 + DATA_BLOB *m = &spnego.negTokenTarg.mechListMIC;
226 + const DATA_BLOB *r = &spnego.negTokenTarg.responseToken;
227 +
228 + /*
229 + * Windows 2000 has a bug, it repeats the
230 + * responseToken in the mechListMIC field.
231 + */
232 + if (m->length == r->length) {
233 + int cmp;
234 +
235 + cmp = memcmp(m->data, r->data, m->length);
236 + if (cmp == 0) {
237 + data_blob_free(m);
238 + }
239 + }
240 + }
241 +
242 + if (spnego.negTokenTarg.mechListMIC.length > 0) {
243 if (spnego_state->no_response_expected) {
244 spnego_state->needs_mic_check = true;
245 }
246 --
247 1.9.1
248
249
250 From 1bf9b8a08263e71ac7f354884e8c9a244518140e Mon Sep 17 00:00:00 2001
251 From: Stefan Metzmacher <metze@samba.org>
252 Date: Wed, 20 Apr 2016 18:44:21 +0200
253 Subject: [PATCH 07/30] auth/ntlmssp: don't require any flags in the
254 ccache_resume code
255 MIME-Version: 1.0
256 Content-Type: text/plain; charset=UTF-8
257 Content-Transfer-Encoding: 8bit
258
259 ntlmssp_client_challenge() already checks for required flags
260 before asking winbindd.
261
262 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11850
263
264 Signed-off-by: Stefan Metzmacher <metze@samba.org>
265 Reviewed-by: Andreas Schneider <asn@samba.org>
266 Reviewed-by: Günther Deschner <gd@samba.org>
267 (cherry picked from commit 5041adb6657596399049a33e6a739a040b4df0db)
268 ---
269 auth/ntlmssp/ntlmssp_client.c | 7 +------
270 1 file changed, 1 insertion(+), 6 deletions(-)
271
272 diff --git a/auth/ntlmssp/ntlmssp_client.c b/auth/ntlmssp/ntlmssp_client.c
273 index b419615..8b367fc 100644
274 --- a/auth/ntlmssp/ntlmssp_client.c
275 +++ b/auth/ntlmssp/ntlmssp_client.c
276 @@ -172,19 +172,14 @@ NTSTATUS gensec_ntlmssp_resume_ccache(struct gensec_security *gensec_security,
277
278 if (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_SIGN) {
279 gensec_security->want_features |= GENSEC_FEATURE_SIGN;
280 -
281 - ntlmssp_state->required_flags |= NTLMSSP_NEGOTIATE_SIGN;
282 }
283
284 if (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_SEAL) {
285 gensec_security->want_features |= GENSEC_FEATURE_SEAL;
286 -
287 - ntlmssp_state->required_flags |= NTLMSSP_NEGOTIATE_SIGN;
288 - ntlmssp_state->required_flags |= NTLMSSP_NEGOTIATE_SEAL;
289 }
290
291 - ntlmssp_state->neg_flags |= ntlmssp_state->required_flags;
292 ntlmssp_state->conf_flags = ntlmssp_state->neg_flags;
293 + ntlmssp_state->required_flags = 0;
294
295 if (DEBUGLEVEL >= 10) {
296 struct NEGOTIATE_MESSAGE *negotiate = talloc(
297 --
298 1.9.1
299
300
301 From d92fa261f8a3e1320309e5c515e4036cff31c0df Mon Sep 17 00:00:00 2001
302 From: Stefan Metzmacher <metze@samba.org>
303 Date: Wed, 20 Apr 2016 18:44:21 +0200
304 Subject: [PATCH 08/30] auth/ntlmssp: don't require NTLMSSP_SIGN for smb
305 connections
306 MIME-Version: 1.0
307 Content-Type: text/plain; charset=UTF-8
308 Content-Transfer-Encoding: 8bit
309
310 Enforcement of SMB signing is done at the SMB layer.
311
312 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11850
313
314 Signed-off-by: Stefan Metzmacher <metze@samba.org>
315 Reviewed-by: Andreas Schneider <asn@samba.org>
316 Reviewed-by: Günther Deschner <gd@samba.org>
317 (cherry picked from commit d97b347d041f9b5c0aa71f35526cbefd56f3500b)
318 ---
319 auth/ntlmssp/ntlmssp_client.c | 5 ++++-
320 1 file changed, 4 insertions(+), 1 deletion(-)
321
322 diff --git a/auth/ntlmssp/ntlmssp_client.c b/auth/ntlmssp/ntlmssp_client.c
323 index 8b367fc..b423f20 100644
324 --- a/auth/ntlmssp/ntlmssp_client.c
325 +++ b/auth/ntlmssp/ntlmssp_client.c
326 @@ -843,8 +843,11 @@ NTSTATUS gensec_ntlmssp_client_start(struct gensec_security *gensec_security)
327 * Without this, Windows will not create the master key
328 * that it thinks is only used for NTLMSSP signing and
329 * sealing. (It is actually pulled out and used directly)
330 + *
331 + * We don't require this here as some servers (e.g. NetAPP)
332 + * doesn't support this.
333 */
334 - ntlmssp_state->required_flags |= NTLMSSP_NEGOTIATE_SIGN;
335 + ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_SIGN;
336 }
337 if (gensec_security->want_features & GENSEC_FEATURE_SIGN) {
338 ntlmssp_state->required_flags |= NTLMSSP_NEGOTIATE_SIGN;
339 --
340 1.9.1
341
342
343 From be36cbcaf1f2e17301af73051ae7a1ab2dce84ea Mon Sep 17 00:00:00 2001
344 From: Stefan Metzmacher <metze@samba.org>
345 Date: Tue, 19 Apr 2016 07:31:50 +0200
346 Subject: [PATCH 09/30] s3:libsmb: use password = NULL for anonymous
347 connections
348 MIME-Version: 1.0
349 Content-Type: text/plain; charset=UTF-8
350 Content-Transfer-Encoding: 8bit
351
352 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11858
353
354 Signed-off-by: Stefan Metzmacher <metze@samba.org>
355 Reviewed-by: Andreas Schneider <asn@samba.org>
356 Reviewed-by: Günther Deschner <gd@samba.org>
357 (cherry picked from commit 53be47410236ef7c90fe895f49f300e3fe47a8bf)
358 ---
359 source3/libsmb/cliconnect.c | 11 +++++++++++
360 1 file changed, 11 insertions(+)
361
362 diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
363 index 039fba2..b518ab8 100644
364 --- a/source3/libsmb/cliconnect.c
365 +++ b/source3/libsmb/cliconnect.c
366 @@ -1343,6 +1343,17 @@ static struct tevent_req *cli_session_setup_gensec_send(
367 talloc_set_destructor(
368 state, cli_session_setup_gensec_state_destructor);
369
370 + if (user == NULL || strlen(user) == 0) {
371 + if (pass != NULL && strlen(pass) == 0) {
372 + /*
373 + * some callers pass "" as no password
374 + *
375 + * gensec only handles NULL as no password.
376 + */
377 + pass = NULL;
378 + }
379 + }
380 +
381 status = auth_generic_client_prepare(state, &state->auth_generic);
382 if (tevent_req_nterror(req, status)) {
383 return tevent_req_post(req, ev);
384 --
385 1.9.1
386
387
388 From 495a374b65a8932bb1d83b326bcb974c65118760 Mon Sep 17 00:00:00 2001
389 From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org>
390 Date: Wed, 20 Apr 2016 20:09:53 +0200
391 Subject: [PATCH 10/30] libcli/smb: fix NULL pointer derreference in
392 smbXcli_session_is_authenticated().
393
394 Guenther
395
396 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11841
397
398 Signed-off-by: Guenther Deschner <gd@samba.org>
399 Reviewed-by: Stefan Metzmacher <metze@samba.org>
400 Reviewed-by: Andreas Schneider <asn@samba.org>
401 (cherry picked from commit 8e016ffeb01167bb8dec66cf9e4bc8605461c15a)
402 ---
403 libcli/smb/smbXcli_base.c | 4 ++++
404 1 file changed, 4 insertions(+)
405
406 diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
407 index 7bf48c8..193222c 100644
408 --- a/libcli/smb/smbXcli_base.c
409 +++ b/libcli/smb/smbXcli_base.c
410 @@ -4945,6 +4945,10 @@ bool smbXcli_session_is_authenticated(struct smbXcli_session *session)
411 {
412 const DATA_BLOB *application_key;
413
414 + if (session == NULL) {
415 + return false;
416 + }
417 +
418 if (session->conn == NULL) {
419 return false;
420 }
421 --
422 1.9.1
423
424
425 From 9a4ab7a5af1433016240732b1d4e1af48bb982ee Mon Sep 17 00:00:00 2001
426 From: Stefan Metzmacher <metze@samba.org>
427 Date: Mon, 18 Apr 2016 17:33:11 +0200
428 Subject: [PATCH 11/30] libcli/smb: add smb1cli_session_set_action() helper
429 function
430 MIME-Version: 1.0
431 Content-Type: text/plain; charset=UTF-8
432 Content-Transfer-Encoding: 8bit
433
434 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11841
435
436 Signed-off-by: Stefan Metzmacher <metze@samba.org>
437 Reviewed-by: Andreas Schneider <asn@samba.org>
438 Reviewed-by: Günther Deschner <gd@samba.org>
439 (cherry picked from commit e6f9e176f2bb0e3e7451ac58e84ff55328219fcd)
440 ---
441 libcli/smb/smbXcli_base.c | 7 +++++++
442 libcli/smb/smbXcli_base.h | 2 ++
443 2 files changed, 9 insertions(+)
444
445 diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
446 index 193222c..c55875b 100644
447 --- a/libcli/smb/smbXcli_base.c
448 +++ b/libcli/smb/smbXcli_base.c
449 @@ -152,6 +152,7 @@ struct smbXcli_session {
450
451 struct {
452 uint16_t session_id;
453 + uint16_t action;
454 DATA_BLOB application_key;
455 bool protected_key;
456 } smb1;
457 @@ -5016,6 +5017,12 @@ void smb1cli_session_set_id(struct smbXcli_session *session,
458 session->smb1.session_id = session_id;
459 }
460
461 +void smb1cli_session_set_action(struct smbXcli_session *session,
462 + uint16_t action)
463 +{
464 + session->smb1.action = action;
465 +}
466 +
467 NTSTATUS smb1cli_session_set_session_key(struct smbXcli_session *session,
468 const DATA_BLOB _session_key)
469 {
470 diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h
471 index 9a957e2..29edd09 100644
472 --- a/libcli/smb/smbXcli_base.h
473 +++ b/libcli/smb/smbXcli_base.h
474 @@ -379,6 +379,8 @@ void smbXcli_session_set_disconnect_expired(struct smbXcli_session *session);
475 uint16_t smb1cli_session_current_id(struct smbXcli_session* session);
476 void smb1cli_session_set_id(struct smbXcli_session* session,
477 uint16_t session_id);
478 +void smb1cli_session_set_action(struct smbXcli_session *session,
479 + uint16_t action);
480 NTSTATUS smb1cli_session_set_session_key(struct smbXcli_session *session,
481 const DATA_BLOB _session_key);
482 NTSTATUS smb1cli_session_protect_session_key(struct smbXcli_session *session);
483 --
484 1.9.1
485
486
487 From 7d295b4b481701d0c668a8de20aed1ef4133cf4b Mon Sep 17 00:00:00 2001
488 From: Stefan Metzmacher <metze@samba.org>
489 Date: Mon, 18 Apr 2016 17:34:21 +0200
490 Subject: [PATCH 12/30] libcli/smb: add SMB1 session setup action flags
491 MIME-Version: 1.0
492 Content-Type: text/plain; charset=UTF-8
493 Content-Transfer-Encoding: 8bit
494
495 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11841
496
497 Signed-off-by: Stefan Metzmacher <metze@samba.org>
498 Reviewed-by: Andreas Schneider <asn@samba.org>
499 Reviewed-by: Günther Deschner <gd@samba.org>
500 (cherry picked from commit cceaa61cf064926baca6db4b303d34ea90d40d52)
501 ---
502 libcli/smb/smb_constants.h | 6 ++++++
503 1 file changed, 6 insertions(+)
504
505 diff --git a/libcli/smb/smb_constants.h b/libcli/smb/smb_constants.h
506 index 9b1de50..c7a49ab 100644
507 --- a/libcli/smb/smb_constants.h
508 +++ b/libcli/smb/smb_constants.h
509 @@ -276,6 +276,12 @@ enum smb_signing_setting {
510 CAP_LARGE_WRITEX | \
511 0)
512
513 +/*
514 + * The action flags in the SMB session setup response
515 + */
516 +#define SMB_SETUP_GUEST 0x0001
517 +#define SMB_SETUP_USE_LANMAN_KEY 0x0002
518 +
519 /* Client-side offline caching policy types */
520 enum csc_policy {
521 CSC_POLICY_MANUAL=0,
522 --
523 1.9.1
524
525
526 From 2785ec5201f804ee17831e458647baca3c0ded76 Mon Sep 17 00:00:00 2001
527 From: Stefan Metzmacher <metze@samba.org>
528 Date: Mon, 18 Apr 2016 17:38:46 +0200
529 Subject: [PATCH 13/30] libcli/smb: add smbXcli_session_is_guest() helper
530 function
531 MIME-Version: 1.0
532 Content-Type: text/plain; charset=UTF-8
533 Content-Transfer-Encoding: 8bit
534
535 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11841
536
537 Signed-off-by: Stefan Metzmacher <metze@samba.org>
538 Reviewed-by: Andreas Schneider <asn@samba.org>
539 Reviewed-by: Günther Deschner <gd@samba.org>
540 (cherry picked from commit 8f4a4bec089b46bbeb0e0f37bb682acb88702bf2)
541 ---
542 libcli/smb/smbXcli_base.c | 24 ++++++++++++++++++++++++
543 libcli/smb/smbXcli_base.h | 1 +
544 2 files changed, 25 insertions(+)
545
546 diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
547 index c55875b..b07fdad 100644
548 --- a/libcli/smb/smbXcli_base.c
549 +++ b/libcli/smb/smbXcli_base.c
550 @@ -4942,6 +4942,30 @@ struct smbXcli_session *smbXcli_session_copy(TALLOC_CTX *mem_ctx,
551 return session;
552 }
553
554 +bool smbXcli_session_is_guest(struct smbXcli_session *session)
555 +{
556 + if (session == NULL) {
557 + return false;
558 + }
559 +
560 + if (session->conn == NULL) {
561 + return false;
562 + }
563 +
564 + if (session->conn->protocol >= PROTOCOL_SMB2_02) {
565 + if (session->smb2->session_flags & SMB2_SESSION_FLAG_IS_GUEST) {
566 + return true;
567 + }
568 + return false;
569 + }
570 +
571 + if (session->smb1.action & SMB_SETUP_GUEST) {
572 + return true;
573 + }
574 +
575 + return false;
576 +}
577 +
578 bool smbXcli_session_is_authenticated(struct smbXcli_session *session)
579 {
580 const DATA_BLOB *application_key;
581 diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h
582 index 29edd09..50466b1 100644
583 --- a/libcli/smb/smbXcli_base.h
584 +++ b/libcli/smb/smbXcli_base.h
585 @@ -371,6 +371,7 @@ struct smbXcli_session *smbXcli_session_create(TALLOC_CTX *mem_ctx,
586 struct smbXcli_conn *conn);
587 struct smbXcli_session *smbXcli_session_copy(TALLOC_CTX *mem_ctx,
588 struct smbXcli_session *src);
589 +bool smbXcli_session_is_guest(struct smbXcli_session *session);
590 bool smbXcli_session_is_authenticated(struct smbXcli_session *session);
591 NTSTATUS smbXcli_session_application_key(struct smbXcli_session *session,
592 TALLOC_CTX *mem_ctx,
593 --
594 1.9.1
595
596
597 From 7199058a6fdf26ed0739a3681ddce9f3cf31caee Mon Sep 17 00:00:00 2001
598 From: Stefan Metzmacher <metze@samba.org>
599 Date: Tue, 19 Apr 2016 07:19:19 +0200
600 Subject: [PATCH 14/30] s3:libsmb: record the session setup action flags
601 MIME-Version: 1.0
602 Content-Type: text/plain; charset=UTF-8
603 Content-Transfer-Encoding: 8bit
604
605 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11841
606
607 Signed-off-by: Stefan Metzmacher <metze@samba.org>
608 Reviewed-by: Andreas Schneider <asn@samba.org>
609 Reviewed-by: Günther Deschner <gd@samba.org>
610 (cherry picked from commit 02c902103521e5a2b1d221db83e6c59d0ce31099)
611 ---
612 source3/libsmb/cliconnect.c | 5 +++++
613 1 file changed, 5 insertions(+)
614
615 diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
616 index b518ab8..bad6c28 100644
617 --- a/source3/libsmb/cliconnect.c
618 +++ b/source3/libsmb/cliconnect.c
619 @@ -242,6 +242,7 @@ static void cli_session_setup_lanman2_done(struct tevent_req *subreq)
620 p = bytes;
621
622 cli_state_set_uid(state->cli, SVAL(inhdr, HDR_UID));
623 + smb1cli_session_set_action(cli->smb1.session, SVAL(vwv+2, 0));
624
625 status = smb_bytes_talloc_string(cli,
626 inhdr,
627 @@ -449,6 +450,7 @@ static void cli_session_setup_guest_done(struct tevent_req *subreq)
628 p = bytes;
629
630 cli_state_set_uid(state->cli, SVAL(inhdr, HDR_UID));
631 + smb1cli_session_set_action(cli->smb1.session, SVAL(vwv+2, 0));
632
633 status = smb_bytes_talloc_string(cli,
634 inhdr,
635 @@ -613,6 +615,7 @@ static void cli_session_setup_plain_done(struct tevent_req *subreq)
636 p = bytes;
637
638 cli_state_set_uid(state->cli, SVAL(inhdr, HDR_UID));
639 + smb1cli_session_set_action(cli->smb1.session, SVAL(vwv+2, 0));
640
641 status = smb_bytes_talloc_string(cli,
642 inhdr,
643 @@ -929,6 +932,7 @@ static void cli_session_setup_nt1_done(struct tevent_req *subreq)
644 p = bytes;
645
646 cli_state_set_uid(state->cli, SVAL(inhdr, HDR_UID));
647 + smb1cli_session_set_action(cli->smb1.session, SVAL(vwv+2, 0));
648
649 status = smb_bytes_talloc_string(cli,
650 inhdr,
651 @@ -1178,6 +1182,7 @@ static void cli_sesssetup_blob_done(struct tevent_req *subreq)
652 state->inbuf = in;
653 inhdr = in + NBT_HDR_SIZE;
654 cli_state_set_uid(state->cli, SVAL(inhdr, HDR_UID));
655 + smb1cli_session_set_action(cli->smb1.session, SVAL(vwv+2, 0));
656
657 blob_length = SVAL(vwv+3, 0);
658 if (blob_length > num_bytes) {
659 --
660 1.9.1
661
662
663 From 947c7f9232a5150bfe53815081aaff90ad5d8621 Mon Sep 17 00:00:00 2001
664 From: Stefan Metzmacher <metze@samba.org>
665 Date: Tue, 19 Apr 2016 07:20:28 +0200
666 Subject: [PATCH 15/30] s3:libsmb: don't finish the gensec handshake for guest
667 logins
668 MIME-Version: 1.0
669 Content-Type: text/plain; charset=UTF-8
670 Content-Transfer-Encoding: 8bit
671
672 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11841
673
674 Signed-off-by: Stefan Metzmacher <metze@samba.org>
675 Reviewed-by: Andreas Schneider <asn@samba.org>
676 Reviewed-by: Günther Deschner <gd@samba.org>
677 (cherry picked from commit fa5799207e55ee8e329f36f784d027845eaf0e34)
678 ---
679 source3/libsmb/cliconnect.c | 21 +++++++++++++++++++++
680 1 file changed, 21 insertions(+)
681
682 diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
683 index bad6c28..c4ac605 100644
684 --- a/source3/libsmb/cliconnect.c
685 +++ b/source3/libsmb/cliconnect.c
686 @@ -1590,6 +1590,27 @@ static void cli_session_setup_gensec_remote_done(struct tevent_req *subreq)
687 }
688
689 if (NT_STATUS_IS_OK(status)) {
690 + struct smbXcli_session *session = NULL;
691 + bool is_guest = false;
692 +
693 + if (smbXcli_conn_protocol(state->cli->conn) >= PROTOCOL_SMB2_02) {
694 + session = state->cli->smb2.session;
695 + } else {
696 + session = state->cli->smb1.session;
697 + }
698 +
699 + is_guest = smbXcli_session_is_guest(session);
700 + if (is_guest) {
701 + /*
702 + * We can't finish the gensec handshake, we don't
703 + * have a negotiated session key.
704 + *
705 + * So just pretend we are completely done.
706 + */
707 + state->blob_in = data_blob_null;
708 + state->local_ready = true;
709 + }
710 +
711 state->remote_ready = true;
712 }
713
714 --
715 1.9.1
716
717
718 From 4187e7a514392647fa5db841befc728de282112a Mon Sep 17 00:00:00 2001
719 From: Stefan Metzmacher <metze@samba.org>
720 Date: Tue, 19 Apr 2016 07:33:03 +0200
721 Subject: [PATCH 16/30] s3:libsmb: use anonymous authentication via spnego if
722 possible
723 MIME-Version: 1.0
724 Content-Type: text/plain; charset=UTF-8
725 Content-Transfer-Encoding: 8bit
726
727 This makes the authentication consistent between
728 SMB1 with CAP_EXTENDED_SECURITY (introduced in Windows 2000)
729 and SNB2.
730
731 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11841
732
733 Signed-off-by: Stefan Metzmacher <metze@samba.org>
734 Reviewed-by: Andreas Schneider <asn@samba.org>
735 Reviewed-by: Günther Deschner <gd@samba.org>
736 (cherry picked from commit e72ad193a53e20b769f798d02c0610f91859bd38)
737 ---
738 source3/libsmb/cliconnect.c | 55 ++++++++++++++++++++++++---------------------
739 1 file changed, 29 insertions(+), 26 deletions(-)
740
741 diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
742 index c4ac605..420fe3c 100644
743 --- a/source3/libsmb/cliconnect.c
744 +++ b/source3/libsmb/cliconnect.c
745 @@ -1661,6 +1661,19 @@ static void cli_session_setup_gensec_ready(struct tevent_req *req)
746 }
747 }
748
749 + if (state->is_anonymous) {
750 + /*
751 + * Windows server does not set the
752 + * SMB2_SESSION_FLAG_IS_NULL flag.
753 + *
754 + * This fix makes sure we do not try
755 + * to verify a signature on the final
756 + * session setup response.
757 + */
758 + tevent_req_done(req);
759 + return;
760 + }
761 +
762 status = gensec_session_key(state->auth_generic->gensec_security,
763 state, &state->session_key);
764 if (tevent_req_nterror(req, status)) {
765 @@ -1670,20 +1683,6 @@ static void cli_session_setup_gensec_ready(struct tevent_req *req)
766 if (smbXcli_conn_protocol(state->cli->conn) >= PROTOCOL_SMB2_02) {
767 struct smbXcli_session *session = state->cli->smb2.session;
768
769 - if (state->is_anonymous) {
770 - /*
771 - * Windows server does not set the
772 - * SMB2_SESSION_FLAG_IS_GUEST nor
773 - * SMB2_SESSION_FLAG_IS_NULL flag.
774 - *
775 - * This fix makes sure we do not try
776 - * to verify a signature on the final
777 - * session setup response.
778 - */
779 - tevent_req_done(req);
780 - return;
781 - }
782 -
783 status = smb2cli_session_set_session_key(session,
784 state->session_key,
785 state->recv_iov);
786 @@ -2121,6 +2120,21 @@ struct tevent_req *cli_session_setup_send(TALLOC_CTX *mem_ctx,
787 return req;
788 }
789
790 + /*
791 + * if the server supports extended security then use SPNEGO
792 + * even for anonymous connections.
793 + */
794 + if (smb1cli_conn_capabilities(cli->conn) & CAP_EXTENDED_SECURITY) {
795 + subreq = cli_session_setup_spnego_send(
796 + state, ev, cli, user, pass, workgroup);
797 + if (tevent_req_nomem(subreq, req)) {
798 + return tevent_req_post(req, ev);
799 + }
800 + tevent_req_set_callback(subreq, cli_session_setup_done_spnego,
801 + req);
802 + return req;
803 + }
804 +
805 /* if no user is supplied then we have to do an anonymous connection.
806 passwords are ignored */
807
808 @@ -2169,18 +2183,7 @@ struct tevent_req *cli_session_setup_send(TALLOC_CTX *mem_ctx,
809 return req;
810 }
811
812 - /* if the server supports extended security then use SPNEGO */
813 -
814 - if (smb1cli_conn_capabilities(cli->conn) & CAP_EXTENDED_SECURITY) {
815 - subreq = cli_session_setup_spnego_send(
816 - state, ev, cli, user, pass, workgroup);
817 - if (tevent_req_nomem(subreq, req)) {
818 - return tevent_req_post(req, ev);
819 - }
820 - tevent_req_set_callback(subreq, cli_session_setup_done_spnego,
821 - req);
822 - return req;
823 - } else {
824 + {
825 /* otherwise do a NT1 style session setup */
826 if (lp_client_ntlmv2_auth() && lp_client_use_spnego()) {
827 /*
828 --
829 1.9.1
830
831
832 From d960e432ead98a170d34e07602c69c464e7afddc Mon Sep 17 00:00:00 2001
833 From: Stefan Metzmacher <metze@samba.org>
834 Date: Fri, 22 Apr 2016 10:04:38 +0200
835 Subject: [PATCH 17/30] auth/spnego: only try to verify the mechListMic if
836 signing was negotiated.
837 MIME-Version: 1.0
838 Content-Type: text/plain; charset=UTF-8
839 Content-Transfer-Encoding: 8bit
840
841 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11847
842
843 Signed-off-by: Stefan Metzmacher <metze@samba.org>
844 Reviewed-by: Andreas Schneider <asn@samba.org>
845 Reviewed-by: Günther Deschner <gd@samba.org>
846 (cherry picked from commit 65462958522baee6eedcedd4193cfcc8cf0f510e)
847 ---
848 auth/gensec/spnego.c | 18 ++++++++++--------
849 1 file changed, 10 insertions(+), 8 deletions(-)
850
851 diff --git a/auth/gensec/spnego.c b/auth/gensec/spnego.c
852 index 33a4b46..1b23427 100644
853 --- a/auth/gensec/spnego.c
854 +++ b/auth/gensec/spnego.c
855 @@ -885,6 +885,7 @@ static NTSTATUS gensec_spnego_update(struct gensec_security *gensec_security, TA
856 case SPNEGO_SERVER_TARG:
857 {
858 NTSTATUS nt_status;
859 + bool have_sign = true;
860 bool new_spnego = false;
861
862 if (!in.length) {
863 @@ -947,18 +948,20 @@ static NTSTATUS gensec_spnego_update(struct gensec_security *gensec_security, TA
864 goto server_response;
865 }
866
867 + have_sign = gensec_have_feature(spnego_state->sub_sec_security,
868 + GENSEC_FEATURE_SIGN);
869 new_spnego = gensec_have_feature(spnego_state->sub_sec_security,
870 GENSEC_FEATURE_NEW_SPNEGO);
871 if (spnego.negTokenTarg.mechListMIC.length > 0) {
872 new_spnego = true;
873 }
874
875 - if (new_spnego) {
876 + if (have_sign && new_spnego) {
877 spnego_state->needs_mic_check = true;
878 spnego_state->needs_mic_sign = true;
879 }
880
881 - if (spnego.negTokenTarg.mechListMIC.length > 0) {
882 + if (have_sign && spnego.negTokenTarg.mechListMIC.length > 0) {
883 nt_status = gensec_check_packet(spnego_state->sub_sec_security,
884 spnego_state->mech_types.data,
885 spnego_state->mech_types.length,
886 @@ -1142,8 +1145,11 @@ static NTSTATUS gensec_spnego_update(struct gensec_security *gensec_security, TA
887 if (spnego_state->no_response_expected &&
888 !spnego_state->done_mic_check)
889 {
890 + bool have_sign = true;
891 bool new_spnego = false;
892
893 + have_sign = gensec_have_feature(spnego_state->sub_sec_security,
894 + GENSEC_FEATURE_SIGN);
895 new_spnego = gensec_have_feature(spnego_state->sub_sec_security,
896 GENSEC_FEATURE_NEW_SPNEGO);
897
898 @@ -1170,16 +1176,12 @@ static NTSTATUS gensec_spnego_update(struct gensec_security *gensec_security, TA
899 }
900
901 if (spnego_state->mic_requested) {
902 - bool sign;
903 -
904 - sign = gensec_have_feature(spnego_state->sub_sec_security,
905 - GENSEC_FEATURE_SIGN);
906 - if (sign) {
907 + if (have_sign) {
908 new_spnego = true;
909 }
910 }
911
912 - if (new_spnego) {
913 + if (have_sign && new_spnego) {
914 spnego_state->needs_mic_check = true;
915 spnego_state->needs_mic_sign = true;
916 }
917 --
918 1.9.1
919
920
921 From f73ea5c9d0bb11732a485bb18e96fda1d72d1fdf Mon Sep 17 00:00:00 2001
922 From: Stefan Metzmacher <metze@samba.org>
923 Date: Wed, 27 Apr 2016 01:44:56 +0200
924 Subject: [PATCH 18/30] s4:auth_anonymous: anonymous authentication doesn't
925 allow a password
926 MIME-Version: 1.0
927 Content-Type: text/plain; charset=UTF-8
928 Content-Transfer-Encoding: 8bit
929
930 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11847
931
932 Signed-off-by: Stefan Metzmacher <metze@samba.org>
933 Reviewed-by: Andreas Schneider <asn@samba.org>
934 Reviewed-by: Günther Deschner <gd@samba.org>
935 (cherry picked from commit d247dceaaab24b568425f2360e40f5e91be452cc)
936 ---
937 source4/auth/ntlm/auth_anonymous.c | 30 ++++++++++++++++++++++++++++++
938 1 file changed, 30 insertions(+)
939
940 diff --git a/source4/auth/ntlm/auth_anonymous.c b/source4/auth/ntlm/auth_anonymous.c
941 index 28cbfe8..ab1aac2 100644
942 --- a/source4/auth/ntlm/auth_anonymous.c
943 +++ b/source4/auth/ntlm/auth_anonymous.c
944 @@ -41,6 +41,36 @@ static NTSTATUS anonymous_want_check(struct auth_method_context *ctx,
945 return NT_STATUS_NOT_IMPLEMENTED;
946 }
947
948 + switch (user_info->password_state) {
949 + case AUTH_PASSWORD_PLAIN:
950 + if (user_info->password.plaintext != NULL &&
951 + strlen(user_info->password.plaintext) > 0)
952 + {
953 + return NT_STATUS_NOT_IMPLEMENTED;
954 + }
955 + break;
956 + case AUTH_PASSWORD_HASH:
957 + if (user_info->password.hash.lanman != NULL) {
958 + return NT_STATUS_NOT_IMPLEMENTED;
959 + }
960 + if (user_info->password.hash.nt != NULL) {
961 + return NT_STATUS_NOT_IMPLEMENTED;
962 + }
963 + break;
964 + case AUTH_PASSWORD_RESPONSE:
965 + if (user_info->password.response.lanman.length == 1) {
966 + if (user_info->password.response.lanman.data[0] != '\0') {
967 + return NT_STATUS_NOT_IMPLEMENTED;
968 + }
969 + } else if (user_info->password.response.lanman.length > 1) {
970 + return NT_STATUS_NOT_IMPLEMENTED;
971 + }
972 + if (user_info->password.response.nt.length > 0) {
973 + return NT_STATUS_NOT_IMPLEMENTED;
974 + }
975 + break;
976 + }
977 +
978 return NT_STATUS_OK;
979 }
980
981 --
982 1.9.1
983
984
985 From df208ed074e6db304d0b8f123e6d0e69f46ad269 Mon Sep 17 00:00:00 2001
986 From: Stefan Metzmacher <metze@samba.org>
987 Date: Wed, 27 Apr 2016 01:48:32 +0200
988 Subject: [PATCH 19/30] s3:auth_builtin: anonymous authentication doesn't allow
989 a password
990 MIME-Version: 1.0
991 Content-Type: text/plain; charset=UTF-8
992 Content-Transfer-Encoding: 8bit
993
994 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11847
995
996 Signed-off-by: Stefan Metzmacher <metze@samba.org>
997 Reviewed-by: Andreas Schneider <asn@samba.org>
998 Reviewed-by: Günther Deschner <gd@samba.org>
999 (cherry picked from commit ead483b0c0ec746c0869162024c97f2e08df7f4b)
1000 ---
1001 source3/auth/auth_builtin.c | 47 ++++++++++++++++++++++++++++++++++++++-------
1002 1 file changed, 40 insertions(+), 7 deletions(-)
1003
1004 diff --git a/source3/auth/auth_builtin.c b/source3/auth/auth_builtin.c
1005 index dce58bf..7480799 100644
1006 --- a/source3/auth/auth_builtin.c
1007 +++ b/source3/auth/auth_builtin.c
1008 @@ -38,17 +38,50 @@ static NTSTATUS check_guest_security(const struct auth_context *auth_context,
1009 const struct auth_usersupplied_info *user_info,
1010 struct auth_serversupplied_info **server_info)
1011 {
1012 - /* mark this as 'not for me' */
1013 - NTSTATUS nt_status = NT_STATUS_NOT_IMPLEMENTED;
1014 -
1015 DEBUG(10, ("Check auth for: [%s]\n", user_info->mapped.account_name));
1016
1017 - if (!(user_info->mapped.account_name
1018 - && *user_info->mapped.account_name)) {
1019 - nt_status = make_server_info_guest(NULL, server_info);
1020 + if (user_info->mapped.account_name && *user_info->mapped.account_name) {
1021 + /* mark this as 'not for me' */
1022 + return NT_STATUS_NOT_IMPLEMENTED;
1023 }
1024
1025 - return nt_status;
1026 + switch (user_info->password_state) {
1027 + case AUTH_PASSWORD_PLAIN:
1028 + if (user_info->password.plaintext != NULL &&
1029 + strlen(user_info->password.plaintext) > 0)
1030 + {
1031 + /* mark this as 'not for me' */
1032 + return NT_STATUS_NOT_IMPLEMENTED;
1033 + }
1034 + break;
1035 + case AUTH_PASSWORD_HASH:
1036 + if (user_info->password.hash.lanman != NULL) {
1037 + /* mark this as 'not for me' */
1038 + return NT_STATUS_NOT_IMPLEMENTED;
1039 + }
1040 + if (user_info->password.hash.nt != NULL) {
1041 + /* mark this as 'not for me' */
1042 + return NT_STATUS_NOT_IMPLEMENTED;
1043 + }
1044 + break;
1045 + case AUTH_PASSWORD_RESPONSE:
1046 + if (user_info->password.response.lanman.length == 1) {
1047 + if (user_info->password.response.lanman.data[0] != '\0') {
1048 + /* mark this as 'not for me' */
1049 + return NT_STATUS_NOT_IMPLEMENTED;
1050 + }
1051 + } else if (user_info->password.response.lanman.length > 1) {
1052 + /* mark this as 'not for me' */
1053 + return NT_STATUS_NOT_IMPLEMENTED;
1054 + }
1055 + if (user_info->password.response.nt.length > 0) {
1056 + /* mark this as 'not for me' */
1057 + return NT_STATUS_NOT_IMPLEMENTED;
1058 + }
1059 + break;
1060 + }
1061 +
1062 + return make_server_info_guest(NULL, server_info);
1063 }
1064
1065 /* Guest modules initialisation */
1066 --
1067 1.9.1
1068
1069
1070 From aa8ccc2939df6bc477f90c901723e2c829b81b45 Mon Sep 17 00:00:00 2001
1071 From: Stefan Metzmacher <metze@samba.org>
1072 Date: Wed, 20 Apr 2016 16:29:42 +0200
1073 Subject: [PATCH 20/30] libcli/security: implement SECURITY_GUEST
1074 MIME-Version: 1.0
1075 Content-Type: text/plain; charset=UTF-8
1076 Content-Transfer-Encoding: 8bit
1077
1078 SECURITY_GUEST is not exactly the same as SECURITY_ANONYMOUS.
1079
1080 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11847
1081
1082 Signed-off-by: Stefan Metzmacher <metze@samba.org>
1083 Reviewed-by: Andreas Schneider <asn@samba.org>
1084 Reviewed-by: Günther Deschner <gd@samba.org>
1085 (cherry picked from commit 837e6176329330893d5a1e4ce4ac67dbac758e56)
1086 ---
1087 libcli/security/security_token.c | 5 +++++
1088 libcli/security/security_token.h | 2 ++
1089 libcli/security/session.c | 4 ++++
1090 libcli/security/session.h | 1 +
1091 4 files changed, 12 insertions(+)
1092
1093 diff --git a/libcli/security/security_token.c b/libcli/security/security_token.c
1094 index 6812d42..2e5a87b 100644
1095 --- a/libcli/security/security_token.c
1096 +++ b/libcli/security/security_token.c
1097 @@ -130,6 +130,11 @@ bool security_token_has_sid_string(const struct security_token *token, const cha
1098 return ret;
1099 }
1100
1101 +bool security_token_has_builtin_guests(const struct security_token *token)
1102 +{
1103 + return security_token_has_sid(token, &global_sid_Builtin_Guests);
1104 +}
1105 +
1106 bool security_token_has_builtin_administrators(const struct security_token *token)
1107 {
1108 return security_token_has_sid(token, &global_sid_Builtin_Administrators);
1109 diff --git a/libcli/security/security_token.h b/libcli/security/security_token.h
1110 index b8ca990..5c5b30b 100644
1111 --- a/libcli/security/security_token.h
1112 +++ b/libcli/security/security_token.h
1113 @@ -51,6 +51,8 @@ bool security_token_has_sid(const struct security_token *token, const struct dom
1114
1115 bool security_token_has_sid_string(const struct security_token *token, const char *sid_string);
1116
1117 +bool security_token_has_builtin_guests(const struct security_token *token);
1118 +
1119 bool security_token_has_builtin_administrators(const struct security_token *token);
1120
1121 bool security_token_has_nt_authenticated_users(const struct security_token *token);
1122 diff --git a/libcli/security/session.c b/libcli/security/session.c
1123 index 0c32556..0fbb87d 100644
1124 --- a/libcli/security/session.c
1125 +++ b/libcli/security/session.c
1126 @@ -38,6 +38,10 @@ enum security_user_level security_session_user_level(struct auth_session_info *s
1127 return SECURITY_ANONYMOUS;
1128 }
1129
1130 + if (security_token_has_builtin_guests(session_info->security_token)) {
1131 + return SECURITY_GUEST;
1132 + }
1133 +
1134 if (security_token_has_builtin_administrators(session_info->security_token)) {
1135 return SECURITY_ADMINISTRATOR;
1136 }
1137 diff --git a/libcli/security/session.h b/libcli/security/session.h
1138 index ee9187d..31e950e 100644
1139 --- a/libcli/security/session.h
1140 +++ b/libcli/security/session.h
1141 @@ -24,6 +24,7 @@
1142
1143 enum security_user_level {
1144 SECURITY_ANONYMOUS = 0,
1145 + SECURITY_GUEST = 1,
1146 SECURITY_USER = 10,
1147 SECURITY_RO_DOMAIN_CONTROLLER = 20,
1148 SECURITY_DOMAIN_CONTROLLER = 30,
1149 --
1150 1.9.1
1151
1152
1153 From af588816572e60d88c38ca345745d1370c9998a0 Mon Sep 17 00:00:00 2001
1154 From: Stefan Metzmacher <metze@samba.org>
1155 Date: Mon, 18 Apr 2016 17:36:56 +0200
1156 Subject: [PATCH 21/30] s3:smbd: make use SMB_SETUP_GUEST constant
1157 MIME-Version: 1.0
1158 Content-Type: text/plain; charset=UTF-8
1159 Content-Transfer-Encoding: 8bit
1160
1161 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11847
1162
1163 Signed-off-by: Stefan Metzmacher <metze@samba.org>
1164 Reviewed-by: Andreas Schneider <asn@samba.org>
1165 Reviewed-by: Günther Deschner <gd@samba.org>
1166 (cherry picked from commit 25ce97892ad3ce5028e4dbbbdd844ef6619ac396)
1167 ---
1168 source3/smbd/sesssetup.c | 6 +++---
1169 1 file changed, 3 insertions(+), 3 deletions(-)
1170
1171 diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c
1172 index 33574f7..1dbc180 100644
1173 --- a/source3/smbd/sesssetup.c
1174 +++ b/source3/smbd/sesssetup.c
1175 @@ -286,7 +286,7 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
1176 }
1177
1178 if (security_session_user_level(session_info, NULL) < SECURITY_USER) {
1179 - action = 1;
1180 + action |= SMB_SETUP_GUEST;
1181 }
1182
1183 if (session_info->session_key.length > 0) {
1184 @@ -412,7 +412,7 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
1185 }
1186
1187 if (security_session_user_level(session_info, NULL) < SECURITY_USER) {
1188 - action = 1;
1189 + action |= SMB_SETUP_GUEST;
1190 }
1191
1192 /*
1193 @@ -940,7 +940,7 @@ void reply_sesssetup_and_X(struct smb_request *req)
1194 }
1195
1196 if (security_session_user_level(session_info, NULL) < SECURITY_USER) {
1197 - action = 1;
1198 + action |= SMB_SETUP_GUEST;
1199 }
1200
1201 /* register the name and uid as being validated, so further connections
1202 --
1203 1.9.1
1204
1205
1206 From 4e4530282bdbe75c9d27611888548db7c5d00beb Mon Sep 17 00:00:00 2001
1207 From: Stefan Metzmacher <metze@samba.org>
1208 Date: Wed, 20 Apr 2016 16:34:28 +0200
1209 Subject: [PATCH 22/30] s3:smbd: only mark real guest sessions with the GUEST
1210 flag
1211 MIME-Version: 1.0
1212 Content-Type: text/plain; charset=UTF-8
1213 Content-Transfer-Encoding: 8bit
1214
1215 Real anonymous sessions don't get it.
1216
1217 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11847
1218
1219 Signed-off-by: Stefan Metzmacher <metze@samba.org>
1220 Reviewed-by: Andreas Schneider <asn@samba.org>
1221 Reviewed-by: Günther Deschner <gd@samba.org>
1222 (similar to commit 79a71545bfc87525c6ba6c8fe9fa7d8a9da33441)
1223 ---
1224 source3/smbd/sesssetup.c | 6 +++---
1225 source3/smbd/smb2_sesssetup.c | 7 ++++---
1226 2 files changed, 7 insertions(+), 6 deletions(-)
1227
1228 diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c
1229 index 1dbc180..77b8077 100644
1230 --- a/source3/smbd/sesssetup.c
1231 +++ b/source3/smbd/sesssetup.c
1232 @@ -285,7 +285,7 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
1233 return;
1234 }
1235
1236 - if (security_session_user_level(session_info, NULL) < SECURITY_USER) {
1237 + if (security_session_user_level(session_info, NULL) == SECURITY_GUEST) {
1238 action |= SMB_SETUP_GUEST;
1239 }
1240
1241 @@ -411,7 +411,7 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
1242 return;
1243 }
1244
1245 - if (security_session_user_level(session_info, NULL) < SECURITY_USER) {
1246 + if (security_session_user_level(session_info, NULL) == SECURITY_GUEST) {
1247 action |= SMB_SETUP_GUEST;
1248 }
1249
1250 @@ -939,7 +939,7 @@ void reply_sesssetup_and_X(struct smb_request *req)
1251 /* perhaps grab OS version here?? */
1252 }
1253
1254 - if (security_session_user_level(session_info, NULL) < SECURITY_USER) {
1255 + if (security_session_user_level(session_info, NULL) == SECURITY_GUEST) {
1256 action |= SMB_SETUP_GUEST;
1257 }
1258
1259 diff --git a/source3/smbd/smb2_sesssetup.c b/source3/smbd/smb2_sesssetup.c
1260 index 8b239c9..c738856 100644
1261 --- a/source3/smbd/smb2_sesssetup.c
1262 +++ b/source3/smbd/smb2_sesssetup.c
1263 @@ -202,11 +202,12 @@ static NTSTATUS smbd_smb2_auth_generic_return(struct smbXsrv_session *session,
1264 }
1265
1266 if (security_session_user_level(session_info, NULL) < SECURITY_USER) {
1267 - /* we map anonymous to guest internally */
1268 - *out_session_flags |= SMB2_SESSION_FLAG_IS_GUEST;
1269 - *out_session_flags |= SMB2_SESSION_FLAG_IS_NULL;
1270 + if (security_session_user_level(session_info, NULL) == SECURITY_GUEST) {
1271 + *out_session_flags |= SMB2_SESSION_FLAG_IS_GUEST;
1272 + }
1273 /* force no signing */
1274 x->global->signing_required = false;
1275 + /* we map anonymous to guest internally */
1276 guest = true;
1277 }
1278
1279 --
1280 1.9.1
1281
1282
1283 From 209ea55537c2e1141205465116c9d89b32b91dad Mon Sep 17 00:00:00 2001
1284 From: Stefan Metzmacher <metze@samba.org>
1285 Date: Wed, 20 Apr 2016 18:27:34 +0200
1286 Subject: [PATCH 23/30] auth/ntlmssp: do map to guest checking after the
1287 authentication
1288 MIME-Version: 1.0
1289 Content-Type: text/plain; charset=UTF-8
1290 Content-Transfer-Encoding: 8bit
1291
1292 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11847
1293
1294 Signed-off-by: Stefan Metzmacher <metze@samba.org>
1295 Reviewed-by: Andreas Schneider <asn@samba.org>
1296 Reviewed-by: Günther Deschner <gd@samba.org>
1297 (cherry picked from commit d667520568996471b55007a42b503edbabb1eee0)
1298 ---
1299 auth/ntlmssp/gensec_ntlmssp_server.c | 16 +--------------
1300 auth/ntlmssp/ntlmssp_server.c | 40 ++++++++++++++++++++++++++++++++++++
1301 2 files changed, 41 insertions(+), 15 deletions(-)
1302
1303 diff --git a/auth/ntlmssp/gensec_ntlmssp_server.c b/auth/ntlmssp/gensec_ntlmssp_server.c
1304 index 6147b14..f3c26c7 100644
1305 --- a/auth/ntlmssp/gensec_ntlmssp_server.c
1306 +++ b/auth/ntlmssp/gensec_ntlmssp_server.c
1307 @@ -130,21 +130,7 @@ NTSTATUS gensec_ntlmssp_server_start(struct gensec_security *gensec_security)
1308 ntlmssp_state->allow_lm_key = true;
1309 }
1310
1311 - if (lpcfg_map_to_guest(gensec_security->settings->lp_ctx) != NEVER_MAP_TO_GUEST) {
1312 - /*
1313 - * map to guest is not secure anyway, so
1314 - * try to make it work and don't try to
1315 - * negotiate new_spnego and MIC checking
1316 - */
1317 - ntlmssp_state->force_old_spnego = true;
1318 - }
1319 -
1320 - if (role == ROLE_ACTIVE_DIRECTORY_DC) {
1321 - /*
1322 - * map to guest is not supported on an AD DC.
1323 - */
1324 - ntlmssp_state->force_old_spnego = false;
1325 - }
1326 + ntlmssp_state->force_old_spnego = false;
1327
1328 ntlmssp_state->neg_flags =
1329 NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_VERSION;
1330 diff --git a/auth/ntlmssp/ntlmssp_server.c b/auth/ntlmssp/ntlmssp_server.c
1331 index 9549641..3f13ccb 100644
1332 --- a/auth/ntlmssp/ntlmssp_server.c
1333 +++ b/auth/ntlmssp/ntlmssp_server.c
1334 @@ -31,6 +31,9 @@
1335 #include "auth/gensec/gensec.h"
1336 #include "auth/gensec/gensec_internal.h"
1337 #include "auth/common_auth.h"
1338 +#include "param/param.h"
1339 +#include "param/loadparm.h"
1340 +#include "libcli/security/session.h"
1341
1342 /**
1343 * Determine correct target name flags for reply, given server role
1344 @@ -698,6 +701,7 @@ static NTSTATUS ntlmssp_server_check_password(struct gensec_security *gensec_sec
1345 struct ntlmssp_state *ntlmssp_state = gensec_ntlmssp->ntlmssp_state;
1346 struct auth4_context *auth_context = gensec_security->auth_context;
1347 NTSTATUS nt_status = NT_STATUS_NOT_IMPLEMENTED;
1348 + struct auth_session_info *session_info = NULL;
1349 struct auth_usersupplied_info *user_info;
1350
1351 user_info = talloc_zero(ntlmssp_state, struct auth_usersupplied_info);
1352 @@ -734,6 +738,42 @@ static NTSTATUS ntlmssp_server_check_password(struct gensec_security *gensec_sec
1353
1354 NT_STATUS_NOT_OK_RETURN(nt_status);
1355
1356 + if (lpcfg_map_to_guest(gensec_security->settings->lp_ctx) != NEVER_MAP_TO_GUEST
1357 + && auth_context->generate_session_info != NULL)
1358 + {
1359 + NTSTATUS tmp_status;
1360 +
1361 + /*
1362 + * We need to check if the auth is anonymous or mapped to guest
1363 + */
1364 + tmp_status = auth_context->generate_session_info(auth_context, mem_ctx,
1365 + gensec_ntlmssp->server_returned_info,
1366 + gensec_ntlmssp->ntlmssp_state->user,
1367 + AUTH_SESSION_INFO_SIMPLE_PRIVILEGES,
1368 + &session_info);
1369 + if (!NT_STATUS_IS_OK(tmp_status)) {
1370 + /*
1371 + * We don't care about failures,
1372 + * the worst result is that we try MIC checking
1373 + * for a map to guest authentication.
1374 + */
1375 + TALLOC_FREE(session_info);
1376 + }
1377 + }
1378 +
1379 + if (session_info != NULL) {
1380 + if (security_session_user_level(session_info, NULL) < SECURITY_USER) {
1381 + /*
1382 + * Anonymous and GUEST are not secure anyway.
1383 + * avoid new_spnego and MIC checking.
1384 + */
1385 + ntlmssp_state->new_spnego = false;
1386 + ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_SIGN;
1387 + ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_SEAL;
1388 + }
1389 + TALLOC_FREE(session_info);
1390 + }
1391 +
1392 talloc_steal(mem_ctx, user_session_key->data);
1393 talloc_steal(mem_ctx, lm_session_key->data);
1394
1395 --
1396 1.9.1
1397
1398
1399 From 9635bf9f38a98b353d58d9b918021dc306673b2d Mon Sep 17 00:00:00 2001
1400 From: Stefan Metzmacher <metze@samba.org>
1401 Date: Mon, 25 Apr 2016 14:45:55 +0200
1402 Subject: [PATCH 24/30] auth/spnego: add spnego:simulate_w2k option for testing
1403 MIME-Version: 1.0
1404 Content-Type: text/plain; charset=UTF-8
1405 Content-Transfer-Encoding: 8bit
1406
1407 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11849
1408
1409 Signed-off-by: Stefan Metzmacher <metze@samba.org>
1410 Reviewed-by: Andreas Schneider <asn@samba.org>
1411 Reviewed-by: Günther Deschner <gd@samba.org>
1412 (cherry picked from commit db9c01a51975a0a3ec2564357617958c2f466091)
1413 ---
1414 auth/gensec/spnego.c | 28 +++++++++++++++++++++++++++-
1415 1 file changed, 27 insertions(+), 1 deletion(-)
1416
1417 diff --git a/auth/gensec/spnego.c b/auth/gensec/spnego.c
1418 index 1b23427..6a82b5f 100644
1419 --- a/auth/gensec/spnego.c
1420 +++ b/auth/gensec/spnego.c
1421 @@ -59,6 +59,8 @@ struct spnego_state {
1422 bool needs_mic_check;
1423 bool done_mic_check;
1424
1425 + bool simulate_w2k;
1426 +
1427 /*
1428 * The following is used to implement
1429 * the update token fragmentation
1430 @@ -88,6 +90,9 @@ static NTSTATUS gensec_spnego_client_start(struct gensec_security *gensec_securi
1431 spnego_state->out_max_length = gensec_max_update_size(gensec_security);
1432 spnego_state->out_status = NT_STATUS_MORE_PROCESSING_REQUIRED;
1433
1434 + spnego_state->simulate_w2k = gensec_setting_bool(gensec_security->settings,
1435 + "spnego", "simulate_w2k", false);
1436 +
1437 gensec_security->private_data = spnego_state;
1438 return NT_STATUS_OK;
1439 }
1440 @@ -109,6 +114,9 @@ static NTSTATUS gensec_spnego_server_start(struct gensec_security *gensec_securi
1441 spnego_state->out_max_length = gensec_max_update_size(gensec_security);
1442 spnego_state->out_status = NT_STATUS_MORE_PROCESSING_REQUIRED;
1443
1444 + spnego_state->simulate_w2k = gensec_setting_bool(gensec_security->settings,
1445 + "spnego", "simulate_w2k", false);
1446 +
1447 gensec_security->private_data = spnego_state;
1448 return NT_STATUS_OK;
1449 }
1450 @@ -775,11 +783,23 @@ static NTSTATUS gensec_spnego_update(struct gensec_security *gensec_security, TA
1451 spnego.negTokenInit.mechToken,
1452 &unwrapped_out);
1453
1454 + if (spnego_state->simulate_w2k) {
1455 + /*
1456 + * Windows 2000 returns the unwrapped token
1457 + * also in the mech_list_mic field.
1458 + *
1459 + * In order to verify our client code,
1460 + * we need a way to have a server with this
1461 + * broken behaviour
1462 + */
1463 + mech_list_mic = unwrapped_out;
1464 + }
1465 +
1466 nt_status = gensec_spnego_server_negTokenTarg(spnego_state,
1467 out_mem_ctx,
1468 nt_status,
1469 unwrapped_out,
1470 - null_data_blob,
1471 + mech_list_mic,
1472 out);
1473
1474 spnego_free_data(&spnego);
1475 @@ -950,6 +970,9 @@ static NTSTATUS gensec_spnego_update(struct gensec_security *gensec_security, TA
1476
1477 have_sign = gensec_have_feature(spnego_state->sub_sec_security,
1478 GENSEC_FEATURE_SIGN);
1479 + if (spnego_state->simulate_w2k) {
1480 + have_sign = false;
1481 + }
1482 new_spnego = gensec_have_feature(spnego_state->sub_sec_security,
1483 GENSEC_FEATURE_NEW_SPNEGO);
1484 if (spnego.negTokenTarg.mechListMIC.length > 0) {
1485 @@ -1150,6 +1173,9 @@ static NTSTATUS gensec_spnego_update(struct gensec_security *gensec_security, TA
1486
1487 have_sign = gensec_have_feature(spnego_state->sub_sec_security,
1488 GENSEC_FEATURE_SIGN);
1489 + if (spnego_state->simulate_w2k) {
1490 + have_sign = false;
1491 + }
1492 new_spnego = gensec_have_feature(spnego_state->sub_sec_security,
1493 GENSEC_FEATURE_NEW_SPNEGO);
1494
1495 --
1496 1.9.1
1497
1498
1499 From 178dc27b2fb2a3d11ad026798209c71724e11284 Mon Sep 17 00:00:00 2001
1500 From: Stefan Metzmacher <metze@samba.org>
1501 Date: Mon, 25 Apr 2016 15:58:27 +0200
1502 Subject: [PATCH 25/30] auth/ntlmssp: add
1503 ntlmssp_{client,server}:force_old_spnego option for testing
1504 MIME-Version: 1.0
1505 Content-Type: text/plain; charset=UTF-8
1506 Content-Transfer-Encoding: 8bit
1507
1508 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11849
1509
1510 Signed-off-by: Stefan Metzmacher <metze@samba.org>
1511 Reviewed-by: Andreas Schneider <asn@samba.org>
1512 Reviewed-by: Günther Deschner <gd@samba.org>
1513 (cherry picked from commit 7a2cb2c97611171613fc677a534277839348c56f)
1514 ---
1515 auth/ntlmssp/gensec_ntlmssp_server.c | 7 +++++++
1516 auth/ntlmssp/ntlmssp_client.c | 3 +++
1517 2 files changed, 10 insertions(+)
1518
1519 diff --git a/auth/ntlmssp/gensec_ntlmssp_server.c b/auth/ntlmssp/gensec_ntlmssp_server.c
1520 index f3c26c7..08a8c8f 100644
1521 --- a/auth/ntlmssp/gensec_ntlmssp_server.c
1522 +++ b/auth/ntlmssp/gensec_ntlmssp_server.c
1523 @@ -132,6 +132,13 @@ NTSTATUS gensec_ntlmssp_server_start(struct gensec_security *gensec_security)
1524
1525 ntlmssp_state->force_old_spnego = false;
1526
1527 + if (gensec_setting_bool(gensec_security->settings, "ntlmssp_server", "force_old_spnego", false)) {
1528 + /*
1529 + * For testing Windows 2000 mode
1530 + */
1531 + ntlmssp_state->force_old_spnego = true;
1532 + }
1533 +
1534 ntlmssp_state->neg_flags =
1535 NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_VERSION;
1536
1537 diff --git a/auth/ntlmssp/ntlmssp_client.c b/auth/ntlmssp/ntlmssp_client.c
1538 index b423f20..5edd5f4 100644
1539 --- a/auth/ntlmssp/ntlmssp_client.c
1540 +++ b/auth/ntlmssp/ntlmssp_client.c
1541 @@ -784,6 +784,9 @@ NTSTATUS gensec_ntlmssp_client_start(struct gensec_security *gensec_security)
1542
1543 ntlmssp_state->use_ntlmv2 = lpcfg_client_ntlmv2_auth(gensec_security->settings->lp_ctx);
1544
1545 + ntlmssp_state->force_old_spnego = gensec_setting_bool(gensec_security->settings,
1546 + "ntlmssp_client", "force_old_spnego", false);
1547 +
1548 ntlmssp_state->expected_state = NTLMSSP_INITIAL;
1549
1550 ntlmssp_state->neg_flags =
1551 --
1552 1.9.1
1553
1554
1555 From 0d826b092f20dbc70ea48210d41ec300b44d7ca8 Mon Sep 17 00:00:00 2001
1556 From: Stefan Metzmacher <metze@samba.org>
1557 Date: Tue, 26 Apr 2016 08:50:00 +0200
1558 Subject: [PATCH 26/30] selftest:Samba4: provide DC_* variables for fl2000dc
1559 and fl2008r2dc
1560 MIME-Version: 1.0
1561 Content-Type: text/plain; charset=UTF-8
1562 Content-Transfer-Encoding: 8bit
1563
1564 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11849
1565
1566 Signed-off-by: Stefan Metzmacher <metze@samba.org>
1567 Reviewed-by: Andreas Schneider <asn@samba.org>
1568 Reviewed-by: Günther Deschner <gd@samba.org>
1569 (cherry picked from commit b8055cb42cadf48367867213a35635f3391c9b8d)
1570 ---
1571 selftest/target/Samba4.pm | 14 ++++++++++++++
1572 1 file changed, 14 insertions(+)
1573
1574 diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
1575 index 7ea1544..e8d5915 100755
1576 --- a/selftest/target/Samba4.pm
1577 +++ b/selftest/target/Samba4.pm
1578 @@ -1154,6 +1154,13 @@ sub provision_fl2000dc($$)
1579 warn("Unable to add wins configuration");
1580 return undef;
1581 }
1582 + $ret->{DC_SERVER} = $ret->{SERVER};
1583 + $ret->{DC_SERVER_IP} = $ret->{SERVER_IP};
1584 + $ret->{DC_SERVER_IPV6} = $ret->{SERVER_IPV6};
1585 + $ret->{DC_NETBIOSNAME} = $ret->{NETBIOSNAME};
1586 + $ret->{DC_USERNAME} = $ret->{USERNAME};
1587 + $ret->{DC_PASSWORD} = $ret->{PASSWORD};
1588 + $ret->{DC_REALM} = $ret->{REALM};
1589
1590 return $ret;
1591 }
1592 @@ -1230,6 +1237,13 @@ sub provision_fl2008r2dc($$)
1593 warn("Unable to add wins configuration");
1594 return undef;
1595 }
1596 + $ret->{DC_SERVER} = $ret->{SERVER};
1597 + $ret->{DC_SERVER_IP} = $ret->{SERVER_IP};
1598 + $ret->{DC_SERVER_IPV6} = $ret->{SERVER_IPV6};
1599 + $ret->{DC_NETBIOSNAME} = $ret->{NETBIOSNAME};
1600 + $ret->{DC_USERNAME} = $ret->{USERNAME};
1601 + $ret->{DC_PASSWORD} = $ret->{PASSWORD};
1602 + $ret->{DC_REALM} = $ret->{REALM};
1603
1604 return $ret;
1605 }
1606 --
1607 1.9.1
1608
1609
1610 From be28f570c5da6074d07f6fd3243daa580eb3fef7 Mon Sep 17 00:00:00 2001
1611 From: Stefan Metzmacher <metze@samba.org>
1612 Date: Tue, 26 Apr 2016 11:33:52 +0200
1613 Subject: [PATCH 27/30] s3:test_smbclient_auth.sh: this script reqiures 5
1614 arguments
1615 MIME-Version: 1.0
1616 Content-Type: text/plain; charset=UTF-8
1617 Content-Transfer-Encoding: 8bit
1618
1619 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11849
1620
1621 Signed-off-by: Stefan Metzmacher <metze@samba.org>
1622 Reviewed-by: Andreas Schneider <asn@samba.org>
1623 Reviewed-by: Günther Deschner <gd@samba.org>
1624 (cherry picked from commit 70910334caa176bf98fece7d638ed599979dc173)
1625 ---
1626 source3/script/tests/test_smbclient_auth.sh | 2 +-
1627 1 file changed, 1 insertion(+), 1 deletion(-)
1628
1629 diff --git a/source3/script/tests/test_smbclient_auth.sh b/source3/script/tests/test_smbclient_auth.sh
1630 index 2402f73..18fff75 100755
1631 --- a/source3/script/tests/test_smbclient_auth.sh
1632 +++ b/source3/script/tests/test_smbclient_auth.sh
1633 @@ -2,7 +2,7 @@
1634
1635 # this runs the file serving tests that are expected to pass with samba3 against shares with various options
1636
1637 -if [ $# -lt 4 ]; then
1638 +if [ $# -lt 5 ]; then
1639 cat <<EOF
1640 Usage: test_smbclient_auth.sh SERVER SERVER_IP USERNAME PASSWORD SMBCLIENT <smbclient arguments>
1641 EOF
1642 --
1643 1.9.1
1644
1645
1646 From 0ec99f370a1a4b02be063a458777fa0d3e81fff7 Mon Sep 17 00:00:00 2001
1647 From: Stefan Metzmacher <metze@samba.org>
1648 Date: Wed, 27 Apr 2016 01:00:14 +0200
1649 Subject: [PATCH 28/30] selftest:Samba4: let fl2000dc use Windows2000
1650 supported_enctypes
1651 MIME-Version: 1.0
1652 Content-Type: text/plain; charset=UTF-8
1653 Content-Transfer-Encoding: 8bit
1654
1655 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11849
1656
1657 Signed-off-by: Stefan Metzmacher <metze@samba.org>
1658 Reviewed-by: Andreas Schneider <asn@samba.org>
1659 Reviewed-by: Günther Deschner <gd@samba.org>
1660 (similar to commit 587b5db7979c1ca1055f5bfd81ab79606cd3c2dd)
1661 ---
1662 selftest/target/Samba.pm | 13 +++++++++++++
1663 selftest/target/Samba4.pm | 3 +++
1664 2 files changed, 16 insertions(+)
1665
1666 diff --git a/selftest/target/Samba.pm b/selftest/target/Samba.pm
1667 index dabe442..069b85e 100644
1668 --- a/selftest/target/Samba.pm
1669 +++ b/selftest/target/Samba.pm
1670 @@ -204,6 +204,19 @@ sub mk_krb5_conf($$)
1671 forwardable = yes
1672 allow_weak_crypto = yes
1673
1674 +";
1675 +
1676 + if (defined($ctx->{supported_enctypes})) {
1677 + print KRB5CONF "
1678 + default_etypes = $ctx->{supported_enctypes}
1679 + default_as_etypes = $ctx->{supported_enctypes}
1680 + default_tgs_enctypes = $ctx->{supported_enctypes}
1681 + default_tkt_enctypes = $ctx->{supported_enctypes}
1682 + permitted_enctypes = $ctx->{supported_enctypes}
1683 +";
1684 + }
1685 +
1686 + print KRB5CONF "
1687 [realms]
1688 $our_realms_stanza
1689 $other_realms_stanza
1690 diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
1691 index e8d5915..48ff9b8 100755
1692 --- a/selftest/target/Samba4.pm
1693 +++ b/selftest/target/Samba4.pm
1694 @@ -282,6 +282,9 @@ sub provision_raw_prepare($$$$$$$$$$)
1695 $ctx->{swiface} = $swiface;
1696 $ctx->{password} = $password;
1697 $ctx->{kdc_ipv4} = $kdc_ipv4;
1698 + if ($functional_level eq "2000") {
1699 + $ctx->{supported_enctypes} = "arcfour-hmac-md5 des-cbc-md5 des-cbc-crc"
1700 + }
1701
1702 #
1703 # Set smbd log level here.
1704 --
1705 1.9.1
1706
1707
1708 From 2db8fe86ebb7c5833fe9240a7abb7645ce5a8191 Mon Sep 17 00:00:00 2001
1709 From: Stefan Metzmacher <metze@samba.org>
1710 Date: Mon, 25 Apr 2016 16:02:22 +0200
1711 Subject: [PATCH 29/30] selftest:Samba4: let fl2000dc use Windows2000 style
1712 SPNEGO/NTLMSSP
1713 MIME-Version: 1.0
1714 Content-Type: text/plain; charset=UTF-8
1715 Content-Transfer-Encoding: 8bit
1716
1717 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11849
1718
1719 Signed-off-by: Stefan Metzmacher <metze@samba.org>
1720 Reviewed-by: Andreas Schneider <asn@samba.org>
1721 Reviewed-by: Günther Deschner <gd@samba.org>
1722 (similar to commit 4de43387235cb17a185fdd1afd658972e8c174ef)
1723 ---
1724 selftest/target/Samba4.pm | 6 +++++-
1725 1 file changed, 5 insertions(+), 1 deletion(-)
1726
1727 diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
1728 index 48ff9b8..48186b1 100755
1729 --- a/selftest/target/Samba4.pm
1730 +++ b/selftest/target/Samba4.pm
1731 @@ -1144,6 +1144,10 @@ sub provision_fl2000dc($$)
1732 my ($self, $prefix) = @_;
1733
1734 print "PROVISIONING DC...";
1735 + my $extra_conf_options = "
1736 + spnego:simulate_w2k=yes
1737 + ntlmssp_server:force_old_spnego=yes
1738 +";
1739 my $ret = $self->provision($prefix,
1740 "domain controller",
1741 "dc5",
1742 @@ -1151,7 +1155,7 @@ sub provision_fl2000dc($$)
1743 "samba2000.example.com",
1744 "2000",
1745 "locDCpass5",
1746 - undef, "", "", undef);
1747 + undef, $extra_conf_options, "", undef);
1748
1749 unless($self->add_wins_config("$prefix/private")) {
1750 warn("Unable to add wins configuration");
1751 --
1752 1.9.1
1753
1754
1755 From 314eec5def43b12eba026da90af4919f1f1c94e0 Mon Sep 17 00:00:00 2001
1756 From: Stefan Metzmacher <metze@samba.org>
1757 Date: Mon, 25 Apr 2016 16:12:47 +0200
1758 Subject: [PATCH 30/30] s3:selftest: add smbclient_ntlm tests
1759 MIME-Version: 1.0
1760 Content-Type: text/plain; charset=UTF-8
1761 Content-Transfer-Encoding: 8bit
1762
1763 We test all combinations of NT1 with and without spnego and SMB3
1764 for user, anonymous and guest authentication.
1765
1766 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11849
1767
1768 Signed-off-by: Stefan Metzmacher <metze@samba.org>
1769 Reviewed-by: Andreas Schneider <asn@samba.org>
1770 Reviewed-by: Günther Deschner <gd@samba.org>
1771
1772 Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
1773 Autobuild-Date(master): Thu Apr 28 20:16:45 CEST 2016 on sn-devel-144
1774
1775 (similar to commit eee88e07b3e68efb467b390536eea4155b5ced7e)
1776 ---
1777 source3/script/tests/test_smbclient_ntlm.sh | 40 +++++++++++++++++++++++++++++
1778 source3/selftest/tests.py | 4 ++-
1779 2 files changed, 43 insertions(+), 1 deletion(-)
1780 create mode 100755 source3/script/tests/test_smbclient_ntlm.sh
1781
1782 diff --git a/source3/script/tests/test_smbclient_ntlm.sh b/source3/script/tests/test_smbclient_ntlm.sh
1783 new file mode 100755
1784 index 0000000..b8fc564
1785 --- /dev/null
1786 +++ b/source3/script/tests/test_smbclient_ntlm.sh
1787 @@ -0,0 +1,40 @@
1788 +#!/bin/sh
1789 +
1790 +# this runs a smbclient based authentication tests
1791 +
1792 +if [ $# -lt 5 ]; then
1793 +cat <<EOF
1794 +Usage: test_smbclient_ntlm.sh SERVER USERNAME PASSWORD MAPTOGUEST SMBCLIENT <smbclient arguments>
1795 +EOF
1796 +exit 1;
1797 +fi
1798 +
1799 +SERVER="$1"
1800 +USERNAME="$2"
1801 +PASSWORD="$3"
1802 +MAPTOGUEST="$4"
1803 +SMBCLIENT="$5"
1804 +SMBCLIENT="$VALGRIND ${SMBCLIENT}"
1805 +shift 5
1806 +ADDARGS="$*"
1807 +
1808 +incdir=`dirname $0`/../../../testprogs/blackbox
1809 +. $incdir/subunit.sh
1810 +
1811 +testit "smbclient username.password.NT1OLD" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U$USERNAME%$PASSWORD -mNT1 --option=clientusespnego=no --option=clientntlmv2auth=no -c quit $ADDARGS
1812 +testit "smbclient username.password.NT1NEW" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U$USERNAME%$PASSWORD -mNT1 -c quit $ADDARGS
1813 +testit "smbclient username.password.SMB3" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U$USERNAME%$PASSWORD -mSMB3 -c quit $ADDARGS
1814 +
1815 +testit "smbclient anonymous.nopassword.NT1OLD" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U% -mNT1 --option=clientusespnego=no --option=clientntlmv2auth=no -c quit $ADDARGS
1816 +testit "smbclient anonymous.nopassword.NT1NEW" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U% -mNT1 -c quit $ADDARGS
1817 +testit "smbclient anonymous.nopassword.SMB3" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U% -mSMB3 -c quit $ADDARGS
1818 +if test x"${MAPTOGUEST}" = x"never" ; then
1819 + testit_expect_failure "smbclient anonymous.badpassword.NT1NEW.fail" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U%badpassword -mNT1 -c quit $ADDARGS
1820 + testit_expect_failure "smbclient anonymous.badpassword.SMB3.fail" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U%badpassword -mSMB3 -c quit $ADDARGS
1821 +else
1822 + testit "smbclient anonymous.badpassword.NT1NEW.guest" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U%badpassword -mNT1 -c quit $ADDARGS
1823 + testit "smbclient anonymous.badpassword.SMB3.guest" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U%badpassword -mSMB3 -c quit $ADDARGS
1824 +
1825 + testit "smbclient baduser.badpassword.NT1NEW.guest" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -Ubaduser%badpassword -mNT1 -c quit $ADDARGS
1826 + testit "smbclient baduser.badpassword.SMB3.guest" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -Ubaduser%badpassword -mSMB3 -c quit $ADDARGS
1827 +fi
1828 diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
1829 index 8b92921..d27595c 100755
1830 --- a/source3/selftest/tests.py
1831 +++ b/source3/selftest/tests.py
1832 @@ -128,8 +128,9 @@ for options in ["--option=clientusespnego=no", " --option=clientntlmv2auth=no --
1833 env = "s3dc"
1834 plantestsuite("samba3.blackbox.smbclient_auth.plain (%s) %s" % (env, options), env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', smbclient3, configuration, options])
1835
1836 -for env in ["s3dc", "member", "s3member", "dc", "s4member"]:
1837 +for env in ["s3dc", "member", "s3member", "dc", "s4member", "fl2000dc"]:
1838 plantestsuite("samba3.blackbox.smbclient_machine_auth.plain (%s:local)" % env, "%s:local" % env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_machine_auth.sh"), '$SERVER', smbclient3, configuration])
1839 + plantestsuite("samba3.blackbox.smbclient_ntlm.plain (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_ntlm.sh"), '$SERVER', '$DC_USERNAME', '$DC_PASSWORD', "never", smbclient3, configuration])
1840
1841 for env in ["s3dc", "member", "s3member"]:
1842 plantestsuite("samba3.blackbox.smbclient_auth.plain (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', smbclient3, configuration])
1843 @@ -155,6 +156,7 @@ for env in ["maptoguest", "simpleserver"]:
1844
1845 env = "maptoguest"
1846 plantestsuite("samba3.blackbox.smbclient_auth.plain (%s) bad username" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IP', 'notmy$USERNAME', '$PASSWORD', smbclient3, configuration + " --option=clientntlmv2auth=no --option=clientlanmanauth=yes"])
1847 +plantestsuite("samba3.blackbox.smbclient_ntlm.plain (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_ntlm.sh"), '$SERVER', '$USERNAME', '$PASSWORD', "baduser", smbclient3, configuration])
1848
1849 # plain
1850 for env in ["s3dc"]:
1851 --
1852 1.9.1
1853

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed