[SCM] Samba Shared Repository - branch v4-2-test updated

Karolin Seeger kseeger at samba.org
Wed Oct 28 14:09:04 UTC 2015


The branch, v4-2-test has been updated
       via  1bbb6bf selftest: Avoid system krb5.conf in "none" test env
       via  fbf5c79 selftest: Avoid system krb5.conf in some test envs that don't use kerberos
       via  0d3fd03 selftest: Avoid system krb5.conf in testenv provisioning
       via  52e3615 auth: gensec: Parameters out_mem_ctx and ev are passed in the wrong order to gensec_spnego_server_try_fallback().
       via  fc280ca async_req: fix non-blocking connect()
       via  c016c1a selftest: add a test for async_connect_send()
       via  a915f8f s3-torture: Remove (incorrect) samba3-specific behavior in samba3.raw.unlink now the server is correct
       via  7c535ad s3-torture: Add WILDDELETE test to smbtorture3 to test old wildcard delete with zero attribute
       via  84f6010 s3-smbd: Fix old DOS client doing wildcard delete - gives a attribute type of zero
       via  d098372 smbd: Send SMB2 oplock breaks unencrypted
      from  929166e VERSION: Bump version up to 4.2.6...

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-2-test


- Log -----------------------------------------------------------------
commit 1bbb6bf902b73c9ec2c55d81ce3066ef5cda9b96
Author: Uri Simchoni <uri at samba.org>
Date:   Mon Oct 26 07:38:08 2015 +0200

    selftest: Avoid system krb5.conf in "none" test env
    
    Some torture tests do not perform Kerberos activity and do not
    run against a server (hence the "none" test env), but do create
    a krb5 context, and that causes the Kerberos libs to read
    krb5.conf and choke if they don't understand it.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11576
    
    Signed-off-by: Uri Simchoni <uri at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    (cherry picked from commit f9d6be3b749313a03e9097d848ce078f19197a0a)
    
    Autobuild-User(v4-2-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-2-test): Wed Oct 28 15:08:10 CET 2015 on sn-devel-104

commit fbf5c79567383deaedd81c7dd290488f718fe1b2
Author: Uri Simchoni <uri at samba.org>
Date:   Sun Oct 25 15:02:17 2015 +0200

    selftest: Avoid system krb5.conf in some test envs that don't use kerberos
    
    Some test envs don't use kerberos (e.g. nt4_dc). However, the client
    tools are built with Kerberos support and may get upset if hitting
    a krb5.conf file they don't understand.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11576
    
    Signed-off-by: Uri Simchoni <uri at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    (cherry picked from commit 8d3106b1a4d9da5bf8b127fa70a77076d3dfeca8)

commit 0d3fd03139d142c297f5dfbcbe0c5fbad0ca3c08
Author: Uri Simchoni <uri at samba.org>
Date:   Sat Oct 24 00:41:23 2015 +0300

    selftest: Avoid system krb5.conf in testenv provisioning
    
    Some provisioning commands don't necessarily need a krb5.conf,
    but they still must cause samba's Kerberos libraries to avoid
    looking at the system krb5.conf, as this file may not be understood
    by samba's Kerberos libs and fail the env provisioning.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11576
    
    Signed-off-by: Uri Simchoni <uri at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    (cherry picked from commit 63c891938a2d3e1c222898d6dea5c640822b0191)

commit 52e36158c96ab1441ca2a1e22afd44b12c654b4c
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Oct 21 11:13:46 2015 -0700

    auth: gensec: Parameters out_mem_ctx and ev are passed in the wrong order to gensec_spnego_server_try_fallback().
    
    Fix suggested by <lev at zadarastorage.com>. Fixes a memory leak.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11565
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Thu Oct 22 11:27:19 CEST 2015 on sn-devel-104
    
    (cherry picked from commit d4059e1a53ea8940b1b147d797efa1b39a5cabd1)

commit fc280cac24f567efcbeb2b65424fdf819c4bd897
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Oct 18 22:21:10 2015 +0200

    async_req: fix non-blocking connect()
    
    According to Stevens UNIX Network Programming and various other sources,
    the correct handling for non-blocking connect() is:
    
    - when the initial connect() return -1/EINPROGRESS polling the socket
      for *writeability*
    
    - in the poll handler call getsocktopt() with SO_ERROR to get the
      finished connect() return value
    
    Simply calling connect() a second time without error checking is
    probably wrong and not portable. For a successfull connect() Linux
    returns 0, but Solaris will return EISCONN:
    
    24254:   0.0336  0.0002 connect(4, 0xFEFFECAC, 16, SOV_DEFAULT) Err#150 EINPROGRESS
    24254:          AF_INET  name = 10.10.10.143  port = 1024
    24254:   0.0349  0.0001 port_associate(3, 4, 0x00000004, 0x0000001D,0x080648A8) = 0
    24254:   0.0495  0.0146 port_getn(3, 0xFEFFEB50, 1, 1, 0xFEFFEB60) = 1 [0]
    24254:   0.0497  0.0002 connect(4, 0x080646E4, 16, SOV_DEFAULT) Err#133 EISCONN
    24254:          AF_INET  name = 10.10.10.143  port = 1024
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11564
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 05d4dbda8357712cb81008e0d611fdb0e7239587)

commit c016c1a269c6b7c642a6261ebbe2863eda5b7653
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Oct 18 22:23:20 2015 +0200

    selftest: add a test for async_connect_send()
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11564
    
    Also includes:
    
    selftest: Fix memset parameters in test for async_connect_send()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit aa96c75346a9bad60471a206d65c7b7049b9ca83)
    (cherry picked from commit 7cf45539da9cba25130457941814da12d0a828c3)

commit a915f8f6c80d726499c1e1a83f7108bf23ab0bd2
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Oct 20 12:31:03 2015 -0700

    s3-torture: Remove (incorrect) samba3-specific behavior in samba3.raw.unlink now the server is correct
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11452
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    (cherry picked from commit e4054f211872168ac4cf022e2d961e8979610920)

commit 7c535ad0fb471eef8e56f7a53f8e8fca48ad840c
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Oct 19 16:06:01 2015 -0700

    s3-torture: Add WILDDELETE test to smbtorture3 to test old wildcard delete with zero attribute
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11452
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    (cherry picked from commit 618d3dd5990e7477d45220cf7183c5cdaa548f1a)

commit 84f601056958d0b89274e852cd79aacc15641a2d
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Oct 19 16:04:02 2015 -0700

    s3-smbd: Fix old DOS client doing wildcard delete - gives a attribute type of zero
    
    In the wildcard delete path we forgot to map 0 -> FILE_ATTRIBUTE_NORMAL
    as we do in the non-wildcard delete path.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11452
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    (cherry picked from commit 1d51119f8acaa586e9ec09d14f10b43ed0053df5)

commit d098372717a474cfb34a498b9787e40c8a658599
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 6 16:10:43 2015 +0200

    smbd: Send SMB2 oplock breaks unencrypted
    
    This is not what Windows server does, but it seems that Windows
    clients expect.  Windows->Windows never runs into this issue, because
    an encryption-enabled SMB3 connection will always use leases, and lease
    breaks *are* unencrypted...
    
    You can reproduce the issue Windows->Windows by disabling leases on the
    Windows server. Disable leases using the registry key:
    
    HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\DisableLeasing
    
    Dochelp confirmed that this is a valid workaround for Windows clients
    dropping encrypted oplock breaks.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11570
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Sat Oct 24 05:01:32 CEST 2015 on sn-devel-104
    
    (cherry picked from commit 0a924d13cf4bb570cce3955cf0de9d8678b37dbe)

-----------------------------------------------------------------------

Summary of changes:
 auth/gensec/spnego.c                    |   2 +-
 lib/async_req/async_connect_send_test.c | 130 ++++++++++++++++++++++++++++++++
 lib/async_req/async_sock.c              |  56 +++++++-------
 lib/async_req/wscript_build             |   4 +
 selftest/selftest.pl                    |   5 +-
 selftest/target/Samba3.pm               |  14 ++++
 selftest/target/Samba4.pm               |  18 ++++-
 source3/script/tests/test_async_req.sh  |  11 +++
 source3/selftest/tests.py               |   5 +-
 source3/smbd/reply.c                    |   3 +
 source3/smbd/smb2_server.c              |   2 +-
 source3/torture/torture.c               |  67 ++++++++++++++++
 source4/torture/raw/unlink.c            |   7 +-
 13 files changed, 281 insertions(+), 43 deletions(-)
 create mode 100644 lib/async_req/async_connect_send_test.c
 create mode 100644 source3/script/tests/test_async_req.sh


Changeset truncated at 500 lines:

diff --git a/auth/gensec/spnego.c b/auth/gensec/spnego.c
index 20cacdb..8fd11e9 100644
--- a/auth/gensec/spnego.c
+++ b/auth/gensec/spnego.c
@@ -791,7 +791,7 @@ static NTSTATUS gensec_spnego_update(struct gensec_security *gensec_security, TA
 			len = spnego_read_data(gensec_security, in, &spnego);
 			if (len == -1) {
 				return gensec_spnego_server_try_fallback(gensec_security, spnego_state,
-									 out_mem_ctx, ev, in, out);
+									 ev, out_mem_ctx, in, out);
 			}
 			/* client sent NegTargetInit, we send NegTokenTarg */
 
diff --git a/lib/async_req/async_connect_send_test.c b/lib/async_req/async_connect_send_test.c
new file mode 100644
index 0000000..34ea6b7
--- /dev/null
+++ b/lib/async_req/async_connect_send_test.c
@@ -0,0 +1,130 @@
+/*
+ * Test async connect
+ * Copyright (C) Ralph Boehme 2015
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "replace.h"
+#include "lib/tevent/tevent.h"
+#include "lib/async_req/async_sock.h"
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+int main(int argc, const char *argv[])
+{
+	int result, listen_sock, status, exit_status;
+	uint16_t port;
+	struct sockaddr_in addr = { 0 };
+	pid_t pid;
+
+	listen_sock = socket(PF_INET, SOCK_STREAM, 0);
+	if (listen_sock == -1) {
+		perror("socket() failed");
+		exit(1);
+	}
+
+	addr.sin_family = AF_INET;
+	addr.sin_addr.s_addr = inet_addr("127.0.0.1");
+
+	for (port = 1024; port < UINT16_MAX; port++) {
+		addr.sin_port = htons(port);
+		result = bind(listen_sock, (struct sockaddr *)&addr, sizeof(addr));
+		if (result == 0) {
+			break;
+		}
+	}
+
+	if (port == UINT16_MAX) {
+		printf("Huh, no free port?\n");
+		return 1;
+	}
+
+	result = listen(listen_sock, 1);
+	if (result == -1) {
+		perror("listen() failed");
+		close(listen_sock);
+		return 1;
+	}
+
+	pid = fork();
+	if (pid == -1) {
+		perror("fork");
+		return 1;
+	}
+
+	if (pid == 0) {
+		struct tevent_context *ev;
+		struct tevent_req *req;
+		int fd;
+
+		ev = tevent_context_init(NULL);
+		if (ev == NULL) {
+			fprintf(stderr, "tevent_context_init failed\n");
+			return 1;
+		}
+
+		fd = socket(PF_INET, SOCK_STREAM, 0);
+		if (fd == -1) {
+			perror("socket");
+			return 1;
+		}
+
+		memset(&addr, 0, sizeof(addr));
+		addr.sin_family = AF_INET;
+		addr.sin_port = htons(port);
+		addr.sin_addr.s_addr = inet_addr("127.0.0.1");
+
+		req = async_connect_send(ev, ev, fd,
+					 (struct sockaddr *)&addr,
+					 sizeof(struct sockaddr_in),
+					 NULL, NULL, NULL);
+
+		if (!tevent_req_poll(req, ev)) {
+			perror("tevent_req_poll() failed");
+			return 1;
+		}
+
+		status = 0;
+		result = async_connect_recv(req, &status);
+		if (result != 0) {
+			return status;
+		}
+		return 0;
+	}
+
+	result = waitpid(pid, &status, 0);
+	if (result == -1) {
+		perror("waitpid");
+		return 1;
+	}
+
+	if (!WIFEXITED(status)) {
+		printf("child status: %d\n", status);
+		return 2;
+	}
+
+	exit_status = WEXITSTATUS(status);
+	printf("test done: status=%d\n", exit_status);
+
+	if (exit_status != 0) {
+		return exit_status;
+	}
+
+	return 0;
+}
diff --git a/lib/async_req/async_sock.c b/lib/async_req/async_sock.c
index 2f3225d..9c58f98 100644
--- a/lib/async_req/async_sock.c
+++ b/lib/async_req/async_sock.c
@@ -121,24 +121,17 @@ struct tevent_req *async_connect_send(
 		return tevent_req_post(req, ev);
 	}
 
-	/**
-	 * A number of error messages show that something good is progressing
-	 * and that we have to wait for readability.
-	 *
-	 * If none of them are present, bail out.
+	/*
+	 * The only errno indicating that the connect is still in
+	 * flight is EINPROGRESS, everything else is an error
 	 */
 
-	if (!(errno == EINPROGRESS || errno == EALREADY ||
-#ifdef EISCONN
-	      errno == EISCONN ||
-#endif
-	      errno == EAGAIN || errno == EINTR)) {
+	if (errno != EINPROGRESS) {
 		tevent_req_error(req, errno);
 		return tevent_req_post(req, ev);
 	}
 
-	state->fde = tevent_add_fd(ev, state, fd,
-				   TEVENT_FD_READ | TEVENT_FD_WRITE,
+	state->fde = tevent_add_fd(ev, state, fd, TEVENT_FD_WRITE,
 				   async_connect_connected, req);
 	if (state->fde == NULL) {
 		tevent_req_error(req, ENOMEM);
@@ -177,27 +170,32 @@ static void async_connect_connected(struct tevent_context *ev,
 	struct async_connect_state *state =
 		tevent_req_data(req, struct async_connect_state);
 	int ret;
-
-	if (state->before_connect != NULL) {
-		state->before_connect(state->private_data);
-	}
-
-	ret = connect(state->fd, (struct sockaddr *)(void *)&state->address,
-		      state->address_len);
-
-	if (state->after_connect != NULL) {
-		state->after_connect(state->private_data);
-	}
-
-	if (ret == 0) {
-		tevent_req_done(req);
+	int socket_error = 0;
+	socklen_t slen = sizeof(socket_error);
+
+	ret = getsockopt(state->fd, SOL_SOCKET, SO_ERROR,
+			 &socket_error, &slen);
+
+	if (ret != 0) {
+		/*
+		 * According to Stevens this is the Solaris behaviour
+		 * in case the connection encountered an error:
+		 * getsockopt() fails, error is in errno
+		 */
+		tevent_req_error(req, errno);
 		return;
 	}
-	if (errno == EINPROGRESS) {
-		/* Try again later, leave the fde around */
+
+	if (socket_error != 0) {
+		/*
+		 * Berkeley derived implementations (including) Linux
+		 * return the pending error via socket_error.
+		 */
+		tevent_req_error(req, socket_error);
 		return;
 	}
-	tevent_req_error(req, errno);
+
+	tevent_req_done(req);
 	return;
 }
 
diff --git a/lib/async_req/wscript_build b/lib/async_req/wscript_build
index 7802935..2a338b0 100644
--- a/lib/async_req/wscript_build
+++ b/lib/async_req/wscript_build
@@ -7,3 +7,7 @@ bld.SAMBA_SUBSYSTEM('LIBASYNC_REQ',
 	deps='tevent-util socket-blocking'
 	)
 
+bld.SAMBA_BINARY('async_connect_send_test',
+                 source='async_connect_send_test.c',
+                 deps='LIBASYNC_REQ'
+)
diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index 96687ea..1d5826d 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -805,9 +805,7 @@ sub setup_env($$)
 
 	$option = "client" if $option eq "";
 
-	if ($envname eq "none") {
-		$testenv_vars = {};
-	} elsif (defined(get_running_env($envname))) {
+	if (defined(get_running_env($envname))) {
 		$testenv_vars = get_running_env($envname);
 		if (not $testenv_vars->{target}->check_env($testenv_vars)) {
 			print $testenv_vars->{target}->getlog_env($testenv_vars);
@@ -875,7 +873,6 @@ sub getlog_env($)
 sub check_env($)
 {
 	my ($envname) = @_;
-	return 1 if ($envname eq "none");
 	my $env = get_running_env($envname);
 	return $env->{target}->check_env($env);
 }
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index c95631f..ac8bfb7 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -173,6 +173,13 @@ sub setup_env($$$)
 	        return $self->{vars}->{$envname};
 	}
 
+	#
+	# Avoid hitting system krb5.conf -
+	# An env that needs Kerberos will reset this to the real
+	# value.
+	#
+	$ENV{KRB5_CONFIG} = "$path/no_krb5.conf";
+
 	if ($envname eq "s3dc") {
 		return $self->setup_s3dc("$path/s3dc");
 	} elsif ($envname eq "simpleserver") {
@@ -1362,6 +1369,13 @@ domadmins:X:$gid_domadmins:
 	$ret{LOCAL_PATH} = "$shrdir";
         $ret{LOGDIR} = $logdir;
 
+	#
+	# Avoid hitting system krb5.conf -
+	# An env that needs Kerberos will reset this to the real
+	# value.
+	#
+	$ret{KRB5_CONFIG} = abs_path($prefix) . "/no_krb5.conf";
+
 	return \%ret;
 }
 
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index 83b4e74..ab31248 100755
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -550,6 +550,7 @@ sub provision_raw_prepare($$$$$$$$$$)
 	$ctx->{smb_conf_extra_options} = "";
 
 	my @provision_options = ();
+	push (@provision_options, "KRB5_CONFIG=\"$ctx->{krb5_config}\"");
 	push (@provision_options, "NSS_WRAPPER_PASSWD=\"$ctx->{nsswrap_passwd}\"");
 	push (@provision_options, "NSS_WRAPPER_GROUP=\"$ctx->{nsswrap_group}\"");
 	push (@provision_options, "NSS_WRAPPER_HOSTS=\"$ctx->{nsswrap_hosts}\"");
@@ -1742,8 +1743,11 @@ sub getlog_env($$)
 sub check_env($$)
 {
 	my ($self, $envvars) = @_;
+	my $samba_pid = $envvars->{SAMBA_PID};
 
-	my $childpid = Samba::cleanup_child($envvars->{SAMBA_PID}, "samba");
+	return 1 if $samba_pid == -1;
+
+	my $childpid = Samba::cleanup_child($samba_pid, "samba");
 
 	return ($childpid == 0);
 }
@@ -1812,6 +1816,8 @@ sub setup_env($$$)
 		}
 		return $target3->setup_admember_rfc2307("$path/s3member_rfc2307",
 							$self->{vars}->{dc}, 34);
+	} elsif ($envname eq "none") {
+		return $self->setup_none("$path/none");
 	} else {
 		return "UNKNOWN";
 	}
@@ -2127,4 +2133,14 @@ sub setup_plugin_s4_dc($$)
 	return $env;
 }
 
+sub setup_none($$)
+{
+	my ($self, $path) = @_;
+
+	my $ret = {
+		KRB5_CONFIG => abs_path($path) . "/no_krb5.conf",
+		SAMBA_PID => -1,
+	}
+}
+
 1;
diff --git a/source3/script/tests/test_async_req.sh b/source3/script/tests/test_async_req.sh
new file mode 100644
index 0000000..a92f990
--- /dev/null
+++ b/source3/script/tests/test_async_req.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+incdir=`dirname $0`/../../../testprogs/blackbox
+. $incdir/subunit.sh
+
+failed=0
+
+testit "async_connect_send" $VALGRIND $BINDIR/async_connect_send_test ||
+	failed=`expr $failed + 1`
+
+testok $0 $failed
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 555a211..2d7ecf6 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -48,7 +48,7 @@ tests = ["FDPASS", "LOCK1", "LOCK2", "LOCK3", "LOCK4", "LOCK5", "LOCK6", "LOCK7"
         "UNLINK", "BROWSE", "ATTR", "TRANS2", "TORTURE",
         "OPLOCK1", "OPLOCK2", "OPLOCK4", "STREAMERROR",
         "DIR", "DIR1", "DIR-CREATETIME", "TCON", "TCONDEV", "RW1", "RW2", "RW3", "LARGE_READX", "RW-SIGNING",
-        "OPEN", "XCOPY", "RENAME", "DELETE", "DELETE-LN", "PROPERTIES", "W2K",
+        "OPEN", "XCOPY", "RENAME", "DELETE", "DELETE-LN", "WILDDELETE", "PROPERTIES", "W2K",
         "TCON2", "IOCTL", "CHKPATH", "FDSESS", "CHAIN1", "CHAIN2",
         "CHAIN3",
         "GETADDRINFO", "UID-REGRESSION-TEST", "SHORTNAME-TEST",
@@ -241,6 +241,9 @@ plantestsuite(
     "samba3.pthreadpool", "s3dc",
     [os.path.join(samba3srcdir, "script/tests/test_pthreadpool.sh")])
 
+plantestsuite("samba3.async_req", "nt4_dc",
+              [os.path.join(samba3srcdir, "script/tests/test_async_req.sh")])
+
 #smbtorture4 tests
 
 base = ["base.attr", "base.charset", "base.chkpath", "base.defer_open", "base.delaywrite", "base.delete",
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 8d59412..05ebe21 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -2895,6 +2895,9 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req,
 			status = NT_STATUS_OBJECT_NAME_INVALID;
 			goto out;
 		}
+		if (dirtype == 0) {
+			dirtype = FILE_ATTRIBUTE_NORMAL;
+		}
 
 		if (strequal(fname_mask,"????????.???")) {
 			TALLOC_FREE(fname_mask);
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index e723f6d..bc224b2 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -2901,7 +2901,7 @@ NTSTATUS smbd_smb2_send_oplock_break(struct smbXsrv_connection *xconn,
 	SBVAL(body, 0x08, op->global->open_persistent_id);
 	SBVAL(body, 0x10, op->global->open_volatile_id);
 
-	return smbd_smb2_send_break(xconn, session, tcon, body, sizeof(body));
+	return smbd_smb2_send_break(xconn, NULL, NULL, body, sizeof(body));
 }
 
 NTSTATUS smbd_smb2_send_lease_break(struct smbXsrv_connection *xconn,
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index deb0e60..594d28f 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -4414,6 +4414,72 @@ static bool run_deletetest(int dummy)
 	return correct;
 }
 
+
+/*
+  Test wildcard delete.
+ */
+static bool run_wild_deletetest(int dummy)
+{
+	struct cli_state *cli = NULL;
+	const char *dname = "\\WTEST";
+	const char *fname = "\\WTEST\\A";
+	const char *wunlink_name = "\\WTEST\\*";
+	uint16_t fnum1 = (uint16_t)-1;
+	bool correct = false;
+	NTSTATUS status;
+
+	printf("starting wildcard delete test\n");
+
+	if (!torture_open_connection(&cli, 0)) {
+		return false;
+	}
+
+	smbXcli_conn_set_sockopt(cli->conn, sockops);
+
+	cli_unlink(cli, fname, 0);
+	cli_rmdir(cli, dname);
+	status = cli_mkdir(cli, dname);
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("mkdir of %s failed %s!\n", dname, nt_errstr(status));
+		goto fail;
+	}
+	status = cli_openx(cli, fname, O_CREAT|O_RDONLY, DENY_NONE, &fnum1);
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("open of %s failed %s!\n", fname, nt_errstr(status));
+		goto fail;
+	}
+	status = cli_close(cli, fnum1);
+	fnum1 = -1;
+
+	/*
+	 * Note the unlink attribute-type of zero. This should
+	 * map into FILE_ATTRIBUTE_NORMAL at the server even
+	 * on a wildcard delete.
+	 */
+
+	status = cli_unlink(cli, wunlink_name, 0);
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("unlink of %s failed %s!\n",
+			wunlink_name, nt_errstr(status));
+		goto fail;
+	}
+
+	printf("finished wildcard delete test\n");
+
+	correct = true;
+
+  fail:
+
+	if (fnum1 != (uint16_t)-1) cli_close(cli, fnum1);
+	cli_unlink(cli, fname, 0);
+	cli_rmdir(cli, dname);
+
+	if (cli && !torture_close_connection(cli)) {
+		correct = false;
+	}
+	return correct;
+}
+
 static bool run_deletetest_ln(int dummy)
 {
 	struct cli_state *cli;
@@ -9553,6 +9619,7 @@ static struct {
 	{"XCOPY", run_xcopy, 0},
 	{"RENAME", run_rename, 0},
 	{"DELETE", run_deletetest, 0},
+	{"WILDDELETE", run_wild_deletetest, 0},
 	{"DELETE-LN", run_deletetest_ln, 0},
 	{"PROPERTIES", run_properties, 0},


-- 
Samba Shared Repository



More information about the samba-cvs mailing list