[SCM] Samba Shared Repository - branch master updated

2021-08-11 Thread Jeremy Allison
The branch, master has been updated
   via  289b7a1595a s3:libsmb: close the temporary IPC$ connection in 
cli_full_connection()
   via  21302649c46 s3:libsmb: start encryption as soon as possible after 
the session setup
  from  c0135096807 s3: smbd: For FSCTL calls that go async, add the 
outstanding tevent_reqs to the aio list on the file handle.

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 289b7a1595ab13a200cfb327604e4b9296fa81e0
Author: Stefan Metzmacher 
Date:   Wed Aug 11 15:30:12 2021 +0200

s3:libsmb: close the temporary IPC$ connection in cli_full_connection()

We don't need the temporary IPC$ connection used for the
SMB1 UNIX CIFS extensions encryption setup anymore,
so we can also let the server close it.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14793

Signed-off-by: Stefan Metzmacher 
Reviewed-by: Jeremy Allison 

Autobuild-User(master): Jeremy Allison 
Autobuild-Date(master): Wed Aug 11 23:03:11 UTC 2021 on sn-devel-184

commit 21302649c46441ea325c66457294225ddb1d6235
Author: Stefan Metzmacher 
Date:   Wed Aug 11 14:33:24 2021 +0200

s3:libsmb: start encryption as soon as possible after the session setup

For the SMB1 UNIX CIFS extensions we create a temporary IPC$ tcon,
if there's no tcon yet.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14793

Signed-off-by: Stefan Metzmacher 
Reviewed-by: Jeremy Allison 

---

Summary of changes:
 source3/libsmb/cliconnect.c | 39 +--
 source3/libsmb/clidfs.c | 56 -
 2 files changed, 77 insertions(+), 18 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index e5274e05c40..63c505f8ed5 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -3369,6 +3369,8 @@ static void cli_full_connection_creds_enc_start(struct 
tevent_req *req);
 static void cli_full_connection_creds_enc_tcon(struct tevent_req *subreq);
 static void cli_full_connection_creds_enc_ver(struct tevent_req *subreq);
 static void cli_full_connection_creds_enc_done(struct tevent_req *subreq);
+static void cli_full_connection_creds_enc_tdis(struct tevent_req *req);
+static void cli_full_connection_creds_enc_finished(struct tevent_req *subreq);
 static void cli_full_connection_creds_tcon_start(struct tevent_req *req);
 static void cli_full_connection_creds_tcon_done(struct tevent_req *subreq);
 
@@ -3596,7 +3598,8 @@ static void cli_full_connection_creds_enc_ver(struct 
tevent_req *subreq)
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
if (encryption_state < SMB_ENCRYPTION_REQUIRED) {
-   cli_full_connection_creds_tcon_start(req);
+   /* disconnect ipc$ followed by the real tree connect */
+   cli_full_connection_creds_enc_tdis(req);
return;
}
DEBUG(10, ("%s: cli_unix_extensions_version "
@@ -3607,7 +3610,8 @@ static void cli_full_connection_creds_enc_ver(struct 
tevent_req *subreq)
 
if (!(caplow & CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP)) {
if (encryption_state < SMB_ENCRYPTION_REQUIRED) {
-   cli_full_connection_creds_tcon_start(req);
+   /* disconnect ipc$ followed by the real tree connect */
+   cli_full_connection_creds_enc_tdis(req);
return;
}
DEBUG(10, ("%s: CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP "
@@ -3639,6 +3643,37 @@ static void cli_full_connection_creds_enc_done(struct 
tevent_req *subreq)
return;
}
 
+   /* disconnect ipc$ followed by the real tree connect */
+   cli_full_connection_creds_enc_tdis(req);
+}
+
+static void cli_full_connection_creds_enc_tdis(struct tevent_req *req)
+{
+   struct cli_full_connection_creds_state *state = tevent_req_data(
+   req, struct cli_full_connection_creds_state);
+   struct tevent_req *subreq = NULL;
+
+   subreq = cli_tdis_send(state, state->ev, state->cli);
+   if (tevent_req_nomem(subreq, req)) {
+   return;
+   }
+   tevent_req_set_callback(subreq,
+   cli_full_connection_creds_enc_finished,
+   req);
+}
+
+static void cli_full_connection_creds_enc_finished(struct tevent_req *subreq)
+{
+   struct tevent_req *req = tevent_req_callback_data(
+   subreq, struct tevent_req);
+   NTSTATUS status;
+
+   status = cli_tdis_recv(subreq);
+   TALLOC_FREE(subreq);
+   if (tevent_req_nterror(req, status)) {
+   return;
+   }
+

[SCM] Samba Shared Repository - branch master updated

2021-08-11 Thread Ralph Böhme
The branch, master has been updated
   via  c0135096807 s3: smbd: For FSCTL calls that go async, add the 
outstanding tevent_reqs to the aio list on the file handle.
   via  7e7ea761a37 s4: torture: Add test for smb2.ioctl.bug14769.
   via  c551d33c6bd s3: smbd: Call smbd_fsctl_torture_async_sleep() when we 
get FSCTL_SMBTORTURE_FSP_ASYNC_SLEEP.
   via  0f4a8d26888 s3: smbd: Add smbd_fsctl_torture_async_sleep() 
server-side code.
   via  62cd95096a7 s3: libcli: Add FSCTL_SMBTORTURE_FSP_ASYNC_SLEEP.
   via  6b6770c2ba8 s3: smbd: Split out smb2_ioctl_smbtorture() into a 
separate file.
  from  4354823c514 libreplace: properly execute SYS_copy_file_range check

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit c013509680742ff45b2f5965a5564015da7d466b
Author: Jeremy Allison 
Date:   Fri Aug 6 23:33:06 2021 -0700

s3: smbd: For FSCTL calls that go async, add the outstanding tevent_reqs to 
the aio list on the file handle.

Remove knownfails.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14769
RN: smbd panic on force-close share during offload write

Signed-off-by: Jeremy Allison 
Reviewed-by: Ralph Boehme 

Autobuild-User(master): Ralph Böhme 
Autobuild-Date(master): Wed Aug 11 20:02:57 UTC 2021 on sn-devel-184

commit 7e7ea761a37f46f758582981bc40404ffd815513
Author: Jeremy Allison 
Date:   Fri Aug 6 10:54:31 2021 -0700

s4: torture: Add test for smb2.ioctl.bug14769.

Add knownfails.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14769

Signed-off-by: Jeremy Allison 
Reviewed-by: Ralph Boehme 

commit c551d33c6bd2e74ea3a36bec5575a70d6833b98a
Author: Jeremy Allison 
Date:   Thu Aug 5 16:07:09 2021 -0700

s3: smbd: Call smbd_fsctl_torture_async_sleep() when we get 
FSCTL_SMBTORTURE_FSP_ASYNC_SLEEP.

Now all we need is the client-side test.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14769

Signed-off-by: Jeremy Allison 
Reviewed-by: Ralph Boehme 

commit 0f4a8d26888ec156979a00480ed9886dcac7d426
Author: Jeremy Allison 
Date:   Thu Aug 5 16:04:38 2021 -0700

s3: smbd: Add smbd_fsctl_torture_async_sleep() server-side code.

Commented out as not yet called.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14769

Signed-off-by: Jeremy Allison 
Reviewed-by: Ralph Boehme 

commit 62cd95096a76d5064b105c1b4971fa3eabd5f85d
Author: Jeremy Allison 
Date:   Thu Aug 5 11:01:44 2021 -0700

s3: libcli: Add FSCTL_SMBTORTURE_FSP_ASYNC_SLEEP.

Prepare for async FSCTL tests on an fsp.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14769

Signed-off-by: Jeremy Allison 
Reviewed-by: Ralph Boehme 

commit 6b6770c2ba83bf25da31623443c19a8de34e5ba4
Author: Jeremy Allison 
Date:   Thu Aug 5 13:14:16 2021 -0700

s3: smbd: Split out smb2_ioctl_smbtorture() into a separate file.

We will be adding async supporting code to this, and we don't want to
clutter up smb2_ioctl.c.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14769

Signed-off-by: Jeremy Allison 
Reviewed-by: Ralph Boehme 

---

Summary of changes:
 libcli/smb/smb_constants.h   |   2 +
 selftest/knownfail   |   1 +
 source3/smbd/smb2_ioctl.c|  83 +++--
 source3/smbd/smb2_ioctl_private.h|   5 +
 source3/smbd/smb2_ioctl_smbtorture.c | 230 +++
 source3/wscript_build|   1 +
 source4/torture/smb2/ioctl.c |  80 
 7 files changed, 334 insertions(+), 68 deletions(-)
 create mode 100644 source3/smbd/smb2_ioctl_smbtorture.c


Changeset truncated at 500 lines:

diff --git a/libcli/smb/smb_constants.h b/libcli/smb/smb_constants.h
index a12086e602b..a043cbc883e 100644
--- a/libcli/smb/smb_constants.h
+++ b/libcli/smb/smb_constants.h
@@ -599,6 +599,8 @@ enum csc_policy {
(FSCTL_SMBTORTURE | FSCTL_ACCESS_WRITE | 0x0010 | FSCTL_METHOD_NEITHER)
 #define FSCTL_SMBTORTURE_GLOBAL_READ_RESPONSE_BODY_PADDING8 \
(FSCTL_SMBTORTURE | FSCTL_ACCESS_WRITE | 0x0020 | FSCTL_METHOD_NEITHER)
+#define FSCTL_SMBTORTURE_FSP_ASYNC_SLEEP \
+   (FSCTL_SMBTORTURE | FSCTL_ACCESS_WRITE | 0x0040 | FSCTL_METHOD_NEITHER)
 
 /*
  * A few values from [MS-FSCC] 2.1.2.1 Reparse Tags
diff --git a/selftest/knownfail b/selftest/knownfail
index b2c09e73393..9f362c02b47 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -198,6 +198,7 @@
 ^samba4.smb2.ioctl.req_two_resume_keys\(ad_dc_ntvfs\) # not supported by s4 
ntvfs server
 ^samba4.smb2.ioctl.copy_chunk_\w*\(ad_dc_ntvfs\)   # not supported by s4 
ntvfs server
 ^samba4.smb2.ioctl.copy-chunk streams\(ad_dc_ntvfs\) # not supported by s4 
ntvfs server
+^samba4.smb2.ioctl.bug14769\(ad_dc_ntvfs\) # not supported by s4 ntvfs server
 

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

2021-08-11 Thread Jule Anger
The branch, v4-14-test has been updated
   via  9c470eb6cd7 dosmode: retry reading dos attributes as root for 
unreadable files
   via  99bca25289e vfs: Fix the FreeBSD build
   via  0fca66858de vfs_default: use fsp_get_io_fd() for copy_file_range()
   via  f9bcec6298d vfs_default: use copy_file_range()
   via  c44d2e8dbdc smbd: use sys_io_ranges_overlap() in 
fsctl_dup_extents_check_overlap()
   via  a25b75b2ca2 lib: add sys_io_ranges_overlap()
   via  0772ff448fc vfs_default: properly track written bytes for copy-chunk
   via  d5d6bbaa939 replace: copy_file_range()
  from  340aff1c8f4 s3: lib: sysacls: Fix argument numbers for 
sys_acl_set_fd() for untested OS builds.

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


- Log -
commit 9c470eb6cd7f7782c81fe7bd39dd9b4c4e893747
Author: Björn Jacke 
Date:   Thu Mar 4 19:37:37 2021 +0100

dosmode: retry reading dos attributes as root for unreadable files

if there are files that the user can't access, he is still allowed to read 
the
dos attributes information, so we need to try reading them as root also.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14654

Signed-off-by: Bjoern Jacke 
Reviewed-by: Ralph Boehme 
Reviewed-by: Jeremy Allison 
(cherry picked from commit 4288319770bc1bde28b1e9ac4bb287e29853378d)

Autobuild-User(v4-14-test): Jule Anger 
Autobuild-Date(v4-14-test): Wed Aug 11 10:55:24 UTC 2021 on sn-devel-184

commit 99bca25289e0e772afa887f1d70dbe1997f01917
Author: Volker Lendecke 
Date:   Mon Jan 25 09:55:40 2021 +0100

vfs: Fix the FreeBSD build

fd_handle is private now

Signed-off-by: Volker Lendecke 
Reviewed-by: Ralph Boehme 

Autobuild-User(master): Volker Lendecke 
Autobuild-Date(master): Mon Jan 25 12:16:11 UTC 2021 on sn-devel-184

(cherry picked from commit da3b00f5511d83bdc347eaff9c031390fea41802)

commit 0fca66858de2df9b832ac257a2ccd104f90e3b74
Author: Ralph Boehme 
Date:   Thu Jul 1 15:19:56 2021 +0200

vfs_default: use fsp_get_io_fd() for copy_file_range()

Unintentionally used fsp_get_pathref_fd() in the initial patchset.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12033

Signed-off-by: Ralph Boehme 
Reviewed-by: Jeremy Allison 

Autobuild-User(master): Jeremy Allison 
Autobuild-Date(master): Thu Jul  1 17:45:49 UTC 2021 on sn-devel-184

(cherry picked from commit 0e3ddc27ed6d603a21cb2b187f3295506d560604)

commit f9bcec6298d3ba42963b3c30f280c1f7ff5d20de
Author: Ralph Boehme 
Date:   Thu Jun 24 16:21:42 2021 +0200

vfs_default: use copy_file_range()

Original file on an XFS filesystem:

  $ ls -l /mnt/test/1048578-file
  -rw-rw-r--. 1 slow slow 1048578 Jun 25 11:40 /mnt/test/1048578-file

  $ xfs_bmap /mnt/test/1048578-file
  /mnt/test/1048578-file:
  0: [0..2055]: 192..2247

Copy created with cp --reflink=never:

  $ xfs_bmap /mnt/test/1048578-file-reflink-never
  /mnt/test/1048578-file-reflink-never:
  0: [0..2055]: 2248..4303

Copy created with cp --reflink=always

  $ xfs_bmap /mnt/test/1048578-file-reflink-always
  /mnt/test/1048578-file-reflink-always:
  0: [0..2055]: 192..2247

Copy done from a Windows client:

  $ xfs_bmap /mnt/test/1048578-file\ -\ Copy
  /mnt/test/1048578-file - Copy:
  0: [0..2055]: 192..2247

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12033
RN: smbd should support copy_file_range() for FSCTL_SRV_COPYCHUNK

Signed-off-by: Ralph Boehme 
Reviewed-by: Jeremy Allison 

Autobuild-User(master): Jeremy Allison 
Autobuild-Date(master): Wed Jun 30 17:40:23 UTC 2021 on sn-devel-184

(cherry picked from commit accaa2f1f67a7f064a4ce03a120d7b2f8e847ccf)

commit c44d2e8dbdc4e2828e4fb233d67d05bca7bd0779
Author: Ralph Boehme 
Date:   Mon Jun 28 15:50:32 2021 +0200

smbd: use sys_io_ranges_overlap() in fsctl_dup_extents_check_overlap()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12033

Signed-off-by: Ralph Boehme 
Reviewed-by: Jeremy Allison 
(cherry picked from commit e72be5213335ab1ea0f9f396ab071669231c151b)

commit a25b75b2ca26f02a05ac318a837475bb6835a081
Author: Ralph Boehme 
Date:   Sat Jun 26 12:21:19 2021 +0200

lib: add sys_io_ranges_overlap()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12033

Signed-off-by: Ralph Boehme 
Reviewed-by: Jeremy Allison 
(cherry picked from commit 4f1a02909b8694dcc30fd5c7c6772fcfa1092ed9)

commit 0772ff448fc054250e580a6e2e48b69485eca506
Author: Ralph Boehme 
Date:   Fri Jun 25 15:47:38 2021 +0200

vfs_default: properly track written bytes for copy-chunk

No change in behavour, this just makes the logic slightly more
understandable. In theory it would