[SCM] Samba Shared Repository - branch master updated

2021-08-17 Thread Ralph Böhme
The branch, master has been updated
   via  4809f4a6ee9 registry: check for running as root in clustering mode
   via  fd19cae8d2f s3/lib/dbwrap: check if global_messaging_context() 
succeeded
  from  1ce08f72a9e testsuite: Fix build with gcc >= 11.1.1

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


- Log -
commit 4809f4a6ee971bcd9767839c729b636b7582fc02
Author: Ralph Boehme 
Date:   Sat Aug 7 10:52:28 2021 +

registry: check for running as root in clustering mode

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14787
RN:  net conf list crashes when run as normal user

Signed-off-by: Ralph Boehme 
Reviewed-by: Andreas Schneider 

Autobuild-User(master): Ralph Böhme 
Autobuild-Date(master): Tue Aug 17 11:23:15 UTC 2021 on sn-devel-184

commit fd19cae8d2f21977d8285efd3f29e2b480d241e9
Author: Ralph Boehme 
Date:   Sat Aug 7 10:51:38 2021 +

s3/lib/dbwrap: check if global_messaging_context() succeeded

The subsequent messaging_ctdb_connection() will fail an assert if messaging 
is
not up and running, maybe it's a bit better to add a check if
global_messaging_context() actually succeeded.

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

Signed-off-by: Ralph Boehme 
Reviewed-by: Andreas Schneider 

---

Summary of changes:
 source3/lib/dbwrap/dbwrap_open.c  | 4 
 source3/registry/reg_backend_db.c | 9 +
 2 files changed, 13 insertions(+)


Changeset truncated at 500 lines:

diff --git a/source3/lib/dbwrap/dbwrap_open.c b/source3/lib/dbwrap/dbwrap_open.c
index 1d8c40af75e..52c8a94aeff 100644
--- a/source3/lib/dbwrap/dbwrap_open.c
+++ b/source3/lib/dbwrap/dbwrap_open.c
@@ -149,6 +149,10 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
 * to be initialized.
 */
msg_ctx = global_messaging_context();
+   if (msg_ctx == NULL) {
+   DBG_ERR("Failed to initialize messaging\n");
+   return NULL;
+   }
 
conn = messaging_ctdb_connection();
if (conn == NULL) {
diff --git a/source3/registry/reg_backend_db.c 
b/source3/registry/reg_backend_db.c
index c870dc57ed6..423b310fe8a 100644
--- a/source3/registry/reg_backend_db.c
+++ b/source3/registry/reg_backend_db.c
@@ -733,6 +733,15 @@ WERROR regdb_init(void)
return WERR_OK;
}
 
+/*
+ * Clustered Samba can only work as root because we need messaging to
+ * talk to ctdb which only works as root.
+ */
+if (lp_clustering() && geteuid() != 0) {
+DBG_ERR("Cluster mode requires running as root.\n");
+   return WERR_ACCESS_DENIED;
+}
+
db_path = state_path(talloc_tos(), "registry.tdb");
if (db_path == NULL) {
return WERR_NOT_ENOUGH_MEMORY;


-- 
Samba Shared Repository



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

2021-08-17 Thread Jule Anger
The branch, v4-13-test has been updated
   via  7c9aabe2dd0 s3: smbd: For FSCTL calls that go async, add the 
outstanding tevent_reqs to the aio list on the file handle.
  from  aa64f02ca94 configure: Do not put arguments into double quotes

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


- Log -
commit 7c9aabe2dd01e77442d95582f17037b006bac9dd
Author: Jeremy Allison 
Date:   Wed Aug 11 13:58:13 2021 -0700

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

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

Back-ported from c013509680742ff45b2f5965a5564015da7d466b.

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

Autobuild-User(v4-13-test): Jule Anger 
Autobuild-Date(v4-13-test): Tue Aug 17 10:30:21 UTC 2021 on sn-devel-184

---

Summary of changes:
 source3/smbd/smb2_ioctl.c | 15 +++
 1 file changed, 15 insertions(+)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/smb2_ioctl.c b/source3/smbd/smb2_ioctl.c
index d29ff5d0303..3d65a96368c 100644
--- a/source3/smbd/smb2_ioctl.c
+++ b/source3/smbd/smb2_ioctl.c
@@ -230,6 +230,21 @@ NTSTATUS smbd_smb2_request_process_ioctl(struct 
smbd_smb2_request *req)
if (subreq == NULL) {
return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
}
+
+   /*
+* If the FSCTL has gone async on a file handle, remember
+* to add it to the list of async requests we need to wait
+* for on file handle close.
+*/
+   if (in_fsp != NULL && tevent_req_is_in_progress(subreq)) {
+   bool ok;
+
+   ok = aio_add_req_to_fsp(in_fsp, subreq);
+   if (!ok) {
+   return smbd_smb2_request_error(req, 
NT_STATUS_NO_MEMORY);
+   }
+   }
+
tevent_req_set_callback(subreq, smbd_smb2_request_ioctl_done, req);
 
return smbd_smb2_request_pending_queue(req, subreq, 1000);


-- 
Samba Shared Repository



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

2021-08-17 Thread Karolin Seeger
The branch, v4-14-test has been updated
   via  3228383d8ae vfs_shadow_copy2: ensure we call convert_sbuf() in 
shadow_copy2_*stat() on already converted paths with absolute path
   via  8222ff1110c vfs_streams_xattr: ensure fstat calls NEXT fstat
   via  262d09c511a selftest: add a test for shadow:fixinodes
   via  9d6d585ca00 selftest: simplify snapshot directory creation in 
test_shadow_copy_torture.sh
   via  5ae4300a36b selftest: enable "shadow:fixinodes" in "shadow_write" 
share
   via  a2ac4ee3d71 selftest: pass smbclient arg to 
samba3.blackbox.shadow_copy_torture test
   via  93383852f0d smbd: update smb_fname statinfo from fsp
   via  e12c92d0175 smbd: canonicalize SMB_VFS_FSTAT() stat buffer
   via  46995a8b146 smbd: return correct timestamps for quota fake file
   via  b53968656ee smbd: handle fake file handles in fdos_mode()
   via  7e1d4a4b138 smbd: add dosmode_from_fake_filehandle()
   via  8abd1abca64 smbtorture: verify attributes on fake quota file handle
  from  618fd6c2594 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=v4-14-test


- Log -
commit 3228383d8ae56d53dd8d726eec8e81353b988624
Author: Ralph Boehme 
Date:   Sat Jul 3 15:46:11 2021 +0200

vfs_shadow_copy2: ensure we call convert_sbuf() in shadow_copy2_*stat() on 
already converted paths with absolute path

shadow_copy2_strip_snapshot() will happily return without modifying the 
passed
timestamp=0 if the path is already converted and refers to an object in a
snapshot, eg (first debug line from extra debugging patch [1]):

[10 2021/07/02 08:19:28.811424 pid=738290 
../../source3/modules/vfs_shadow_copy2.c:1303 shadow_copy2_fstat]
  shadow_copy2_fstat: fsp [test.txt {@GMT-2000.01.02-03.04.05}]
[10 2021/07/02 08:19:28.811449 pid=738290 
../../source3/modules/vfs_shadow_copy2.c:607 
_shadow_copy2_strip_snapshot_internal]
  _shadow_copy2_strip_snapshot_internal: [from shadow_copy2_fstat()] Path 
'test.txt {@GMT-2000.01.02-03.04.05}'
[10 2021/07/02 08:19:28.811474 pid=738290 
../../source3/modules/vfs_shadow_copy2.c:619 
_shadow_copy2_strip_snapshot_internal]
  _shadow_copy2_strip_snapshot_internal: abs path 
'/gpfs0/smb_snapshots2/filesetone/.snapshots/@GMT-2000.01.02-03.04.05/test.txt'
[10 2021/07/02 08:19:28.811496 pid=738290 
../../source3/modules/vfs_shadow_copy2.c:1924 shadow_copy2_snapshot_to_gmt]
  shadow_copy2_snapshot_to_gmt: match @GMT-%Y.%m.%d-%H.%M.%S: 
@GMT-2000.01.02-03.04.05
[10 2021/07/02 08:19:28.811536 pid=738290 
../../source3/modules/vfs_shadow_copy2.c:566 check_for_converted_path]
  check_for_converted_path: path 
|/gpfs0/smb_snapshots2/filesetone/.snapshots/@GMT-2000.01.02-03.04.05/test.txt| 
is already converted. connect path = 
|/gpfs0/smb_snapshots2/filesetone/.snapshots/@GMT-2000.01.02-03.04.05|

As check_for_converted_path() detects an "already converted path",
_shadow_copy2_strip_snapshot_internal() just returns without modifying the 
value
of the timestamp.

By using shadow_copy2_strip_snapshot_converted() instead of
shadow_copy2_strip_snapshot() we can check if the path is in fact referring 
to a
VSS object by checking the "converted" bool.

An alternative way would have been directly checking fsp->fsp_name->twrp != 
0,
but that would be a new semantic in the module, I'll leave this excersize 
for
the future when we clean up the usage of shadow_copy2_strip_snapshot() in 
the
whole module.

This change also switches to using the absolute paths in both place where
convert_sbuf() is called.

[1]
@@ -1309,8 +1348,16 @@ static int shadow_copy2_fstat(vfs_handle_struct 
*handle, files_struct *fsp,
saved_errno = errno;
}

+   DBG_DEBUG("fsp [%s]\n", fsp_str_dbg(fsp));

RN: vfs_shadow_copy2 fixinodes not correctly updating inode numbers
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756

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

Autobuild-User(v4-14-test): Karolin Seeger 
Autobuild-Date(v4-14-test): Tue Aug 17 10:07:42 UTC 2021 on sn-devel-184

commit 8222ff1110c3ff506e3153b3294f2979206cdbfd
Author: Ralph Boehme 
Date:   Wed Jul 28 17:16:27 2021 +0200

vfs_streams_xattr: ensure fstat calls NEXT fstat

This ensures fstat behaves the same as stat by calling the NEXT VFS stat
function. This is required for matching path and handle based inode
numbers.

This bug is currently only exposed in a special case: a VSS snapshot of a
stream.

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

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

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

2021-08-17 Thread Jule Anger
The branch, v4-14-test has been updated
   via  618fd6c2594 s3: smbd: For FSCTL calls that go async, add the 
outstanding tevent_reqs to the aio list on the file handle.
  from  3d912fe86cf s3:libsmb: close the temporary IPC$ connection in 
cli_full_connection()

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


- Log -
commit 618fd6c259458f97530fcde0fb6600e70e6f2478
Author: Jeremy Allison 
Date:   Wed Aug 11 13:58:13 2021 -0700

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

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

Back-ported from c013509680742ff45b2f5965a5564015da7d466b.

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

Autobuild-User(v4-14-test): Jule Anger 
Autobuild-Date(v4-14-test): Tue Aug 17 09:07:18 UTC 2021 on sn-devel-184

---

Summary of changes:
 source3/smbd/smb2_ioctl.c | 15 +++
 1 file changed, 15 insertions(+)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/smb2_ioctl.c b/source3/smbd/smb2_ioctl.c
index d29ff5d0303..3d65a96368c 100644
--- a/source3/smbd/smb2_ioctl.c
+++ b/source3/smbd/smb2_ioctl.c
@@ -230,6 +230,21 @@ NTSTATUS smbd_smb2_request_process_ioctl(struct 
smbd_smb2_request *req)
if (subreq == NULL) {
return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
}
+
+   /*
+* If the FSCTL has gone async on a file handle, remember
+* to add it to the list of async requests we need to wait
+* for on file handle close.
+*/
+   if (in_fsp != NULL && tevent_req_is_in_progress(subreq)) {
+   bool ok;
+
+   ok = aio_add_req_to_fsp(in_fsp, subreq);
+   if (!ok) {
+   return smbd_smb2_request_error(req, 
NT_STATUS_NO_MEMORY);
+   }
+   }
+
tevent_req_set_callback(subreq, smbd_smb2_request_ioctl_done, req);
 
return smbd_smb2_request_pending_queue(req, subreq, 1000);


-- 
Samba Shared Repository



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

2021-08-17 Thread Jule Anger
The branch, v4-15-test has been updated
   via  9a23ff2ca2b s3: smbd: For FSCTL calls that go async, add the 
outstanding tevent_reqs to the aio list on the file handle.
   via  654430f6f6f s4: torture: Add test for smb2.ioctl.bug14769.
   via  24b661c01ef s3: smbd: Call smbd_fsctl_torture_async_sleep() when we 
get FSCTL_SMBTORTURE_FSP_ASYNC_SLEEP.
   via  68ceb6c8f05 s3: smbd: Add smbd_fsctl_torture_async_sleep() 
server-side code.
   via  69c5ab71106 s3: libcli: Add FSCTL_SMBTORTURE_FSP_ASYNC_SLEEP.
   via  04af36c4916 s3: smbd: Split out smb2_ioctl_smbtorture() into a 
separate file.
  from  7c8ba49b2e9 libreplace: remove now unused USE_COPY_FILE_RANGE define

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


- Log -
commit 9a23ff2ca2b101cba5614b238afca0c58658fc77
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

(cherry picked from commit c013509680742ff45b2f5965a5564015da7d466b)

Autobuild-User(v4-15-test): Jule Anger 
Autobuild-Date(v4-15-test): Tue Aug 17 08:49:48 UTC 2021 on sn-devel-184

commit 654430f6f6f1a0c300be77e215fdb95fb808bf4e
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 
(cherry picked from commit 7e7ea761a37f46f758582981bc40404ffd815513)

commit 24b661c01ef54a01c1e73abfd7628781693a3224
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 
(cherry picked from commit c551d33c6bd2e74ea3a36bec5575a70d6833b98a)

commit 68ceb6c8f05d6c12aa2e1618ac205a9740126458
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 
(cherry picked from commit 0f4a8d26888ec156979a00480ed9886dcac7d426)

commit 69c5ab711066871b82bbb6db67642d808d104775
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 
(cherry picked from commit 62cd95096a76d5064b105c1b4971fa3eabd5f85d)

commit 04af36c4916713001a3a8b72b81946eb7a084cd1
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 
(cherry picked from commit 6b6770c2ba83bf25da31623443c19a8de34e5ba4)

---

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)