[SCM] Samba Shared Repository - branch master updated

2023-09-20 Thread Martin Schwenke
The branch, master has been updated
   via  8b9f464420b ctdb-daemon: Call setproctitle_init()
  from  3481bbfede5 smbd: Fix BZ15481

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


- Log -
commit 8b9f464420b66cebaf00654cf8b19165b301b8b6
Author: Martin Schwenke 
Date:   Tue Sep 19 17:47:36 2023 +1000

ctdb-daemon: Call setproctitle_init()

Commit 19c82c19c009eefe975ae95c8b709fc93f5f4c39 changed the behaviour
of prctl_set_comment() so it now calls setproctitle(3bsd) by default.

In some Linux distributions (e.g. Rocky Linux 8.8), this results in
messages like this spamming the logs:

  ctdbd: setproctitle not initialized, please either call 
setproctitle_init() or link against libbsd-ctor.

Most Samba daemons seem to call setproctitle_init(), so do it here.

In the longer term CTDB should also switch to using lib/util's
process_set_title(), like the rest of Samba, for more flexible process
names.

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

Signed-off-by: Martin Schwenke 
Reviewed-by: Ralph Boehme 

Autobuild-User(master): Martin Schwenke 
Autobuild-Date(master): Thu Sep 21 00:46:50 UTC 2023 on atb-devel-224

---

Summary of changes:
 ctdb/server/ctdbd.c | 2 ++
 1 file changed, 2 insertions(+)


Changeset truncated at 500 lines:

diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c
index 10541cb21f1..a388bff1598 100644
--- a/ctdb/server/ctdbd.c
+++ b/ctdb/server/ctdbd.c
@@ -170,6 +170,8 @@ int main(int argc, const char *argv[])
const char *test_mode;
bool ok;
 
+   setproctitle_init(argc, discard_const(argv), environ);
+
/*
 * Basic setup
 */


-- 
Samba Shared Repository



[SCM] Samba Shared Repository - branch master updated

2023-09-20 Thread Jeremy Allison
The branch, master has been updated
   via  3481bbfede5 smbd: Fix BZ15481
   via  56df75d4479 tests: Add reproducer for BZ15481
  from  11280f1705c s3: smbd: Ensure we remove any pending aio values for 
named pipes on forced shutdown.

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


- Log -
commit 3481bbfede5127e3664bcf464a0ae3dec9247ab7
Author: Volker Lendecke 
Date:   Tue Sep 19 17:44:56 2023 -0700

smbd: Fix BZ15481

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15481

Signed-off-by: Volker Lendecke 
Reviewed-by: Jeremy Allison 

Autobuild-User(master): Jeremy Allison 
Autobuild-Date(master): Wed Sep 20 22:42:48 UTC 2023 on atb-devel-224

commit 56df75d44795582dcecb8676a0d80d6f4a46c7e9
Author: Volker Lendecke 
Date:   Wed Sep 20 10:53:52 2023 -0700

tests: Add reproducer for BZ15481

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15481

Signed-off-by: Volker Lendecke 
Reviewed-by: Jeremy Allison 

---

Summary of changes:
 python/samba/tests/libsmb-basic.py | 27 +++
 source3/smbd/filename.c| 12 +++-
 2 files changed, 38 insertions(+), 1 deletion(-)


Changeset truncated at 500 lines:

diff --git a/python/samba/tests/libsmb-basic.py 
b/python/samba/tests/libsmb-basic.py
index cbe7cce5bae..163c5b09ea9 100644
--- a/python/samba/tests/libsmb-basic.py
+++ b/python/samba/tests/libsmb-basic.py
@@ -215,6 +215,33 @@ class LibsmbTestCase(samba.tests.libsmb.LibsmbTests):
 c1.unlink("x")
 c1 = None
 
+def test_gencache_pollution_bz15481(self):
+c = libsmb.Conn(self.server_ip, "tmp", self.lp, self.creds)
+fh = c.create("file",
+  DesiredAccess=security.SEC_STD_DELETE,
+  CreateDisposition=libsmb.FILE_CREATE)
+
+# prime the gencache File->file
+fh_upper = c.create("File",
+DesiredAccess=security.SEC_FILE_READ_ATTRIBUTE,
+CreateDisposition=libsmb.FILE_OPEN)
+c.close(fh_upper)
+
+c.delete_on_close(fh, 1)
+c.close(fh)
+
+fh = c.create("File",
+  DesiredAccess=security.SEC_STD_DELETE,
+  CreateDisposition=libsmb.FILE_CREATE)
+
+directory = c.list("\\", "File")
+
+c.delete_on_close(fh, 1)
+c.close(fh)
+
+# Without the bugfix for 15481 we get 'file' not 'File'
+self.assertEqual(directory[0]['name'], 'File')
+
 if __name__ == "__main__":
 import unittest
 unittest.main()
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index dcd08a06947..3c54ab17762 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -784,6 +784,7 @@ static NTSTATUS openat_pathref_fsp_case_insensitive(
 
if (lp_stat_cache()) {
char *base_name = smb_fname_rel->base_name;
+   char *original_relname = NULL;
DATA_BLOB value = { .data = NULL };
 
ok = get_real_filename_cache_key(
@@ -805,7 +806,13 @@ static NTSTATUS openat_pathref_fsp_case_insensitive(
}
DO_PROFILE_INC(statcache_hits);
 
-   TALLOC_FREE(smb_fname_rel->base_name);
+   /*
+* For the "new filename" case we need to preserve the
+* capitalization the client sent us, see
+* https://bugzilla.samba.org/show_bug.cgi?id=15481
+*/
+   original_relname = smb_fname_rel->base_name;
+
smb_fname_rel->base_name = talloc_memdup(
smb_fname_rel, value.data, value.length);
if (smb_fname_rel->base_name == NULL) {
@@ -823,10 +830,13 @@ static NTSTATUS openat_pathref_fsp_case_insensitive(
status = openat_pathref_fsp(dirfsp, smb_fname_rel);
if (NT_STATUS_IS_OK(status)) {
TALLOC_FREE(cache_key.data);
+   TALLOC_FREE(original_relname);
return NT_STATUS_OK;
}
 
memcache_delete(NULL, GETREALFILENAME_CACHE, cache_key);
+   TALLOC_FREE(smb_fname_rel->base_name);
+   smb_fname_rel->base_name = original_relname;
}
 
 lookup:


-- 
Samba Shared Repository



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

2023-09-20 Thread Jule Anger
The branch, v4-18-test has been updated
   via  f869013c616 s3: smbd: Ensure we remove any pending aio values for 
named pipes on forced shutdown.
   via  db1fbcc0263 s3: torture: Add a new SMB2 test: 
SMB2-PIPE-READ-ASYNC-DISCONNECT
   via  721513a219d s3: smbd: named pipe writes are async. Use the same 
logic as for named pipe transacts to avoid crashes on shutdown.
   via  b3a881f89ae s3: smbd: named pipe reads are async. Use the same 
logic as for named pipe transacts to avoid crashes on shutdown.
   via  4baff9de6b2 s3: smbd: Add some DEVELOPER-only code to panic if the 
destructor for an aio_lnk is called and the associated fsp doesn't exist.
  from  82d6f8a6ce3 nsswitch/wb_common.c: fix socket fd and memory leaks of 
global state

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


- Log -
commit f869013c616d706007f11ebfcaa0f8af4cadc230
Author: Jeremy Allison 
Date:   Tue Sep 19 14:36:45 2023 -0700

s3: smbd: Ensure we remove any pending aio values for named pipes on forced 
shutdown.

Matches file and directory closes.

Remove knownfail.

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

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

Autobuild-User(master): Jeremy Allison 
Autobuild-Date(master): Wed Sep 20 02:43:18 UTC 2023 on atb-devel-224

(cherry picked from commit 11280f1705c0faa1729f5aeaa1b6a1f79ab5a199)

Autobuild-User(v4-18-test): Jule Anger 
Autobuild-Date(v4-18-test): Wed Sep 20 21:38:55 UTC 2023 on atb-devel-224

commit db1fbcc0263d8ce3854a65bda5b54b38a9d4d66d
Author: Jeremy Allison 
Date:   Tue Sep 19 14:30:26 2023 -0700

s3: torture: Add a new SMB2 test: SMB2-PIPE-READ-ASYNC-DISCONNECT

Shows the server crashes if we open a named pipe, do an async read
and then disconnect.

Adds knownfail:

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

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

commit 721513a219d8b543a3f6a284d05ddc2c99717afe
Author: Jeremy Allison 
Date:   Mon Sep 18 17:37:44 2023 -0700

s3: smbd: named pipe writes are async. Use the same logic as for named pipe 
transacts to avoid crashes on shutdown.

Noticed by Metze.

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

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

commit b3a881f89ae089e3ec8e603e96eda5b1388e0cb0
Author: Jeremy Allison 
Date:   Mon Sep 18 17:09:00 2023 -0700

s3: smbd: named pipe reads are async. Use the same logic as for named pipe 
transacts to avoid crashes on shutdown.

Noticed by Metze.

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

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

commit 4baff9de6b2dc93d81c25874c78f31f91b16d260
Author: Jeremy Allison 
Date:   Mon Sep 18 14:43:23 2023 -0700

s3: smbd: Add some DEVELOPER-only code to panic if the destructor for an 
aio_lnk is called and the associated fsp doesn't exist.

Make this DEVELOPER-only as it walks the entire open
file list on every file close (with associated aio).

This helps catch really subtle problems with orphaned
aio lnk structs.

Reproducer test case to follow.

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

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

---

Summary of changes:
 ...torture_s3.sh => test_smbtorture_nocrash_s3.sh} |  12 +++
 source3/selftest/tests.py  |  16 +++
 source3/smbd/close.c   |   8 ++
 source3/smbd/smb2_aio.c|  24 +
 source3/smbd/smb2_read.c   |  13 +++
 source3/smbd/smb2_write.c  |  13 +++
 source3/torture/proto.h|   1 +
 source3/torture/test_smb2.c| 117 +
 source3/torture/torture.c  |   4 +
 9 files changed, 208 insertions(+)
 copy source3/script/tests/{test_smbtorture_s3.sh => 
test_smbtorture_nocrash_s3.sh} (62%)


Changeset truncated at 500 lines:

diff --git a/source3/script/tests/test_smbtorture_s3.sh 
b/source3/script/tests/test_smbtorture_nocrash_s3.sh
similarity index 62%
copy from source3/script/tests/test_smbtorture_s3.sh
copy to source3/script/tests/test_smbtorture_nocrash_s3.sh
index 4376f4a7199..b6ef1391262 100755
--- a/source3/script/tests/test_smbtorture_s3.sh
+++ 

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

2023-09-20 Thread Jule Anger
The branch, v4-19-test has been updated
   via  d70374c3479 s3: libsmb: Add a missing return statement in the 
timeout case.
  from  374ba0d2c9a nsswitch/wb_common.c: fix socket fd and memory leaks of 
global state

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


- Log -
commit d70374c347953d64e9a6cf56db178d42f985227d
Author: Jeremy Allison 
Date:   Wed Aug 16 17:24:37 2023 -0700

s3: libsmb: Add a missing return statement in the timeout case.

Obvious fix (needs a malicious server to recreate).

Found by Robert Morris 

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

Signed-off-by: Jeremy Allison 
(cherry picked from commit d27c2f2a47dc488ee32dd28d01697bfc409dff77)

Autobuild-User(v4-19-test): Jule Anger 
Autobuild-Date(v4-19-test): Wed Sep 20 16:23:32 UTC 2023 on atb-devel-224

---

Summary of changes:
 source3/libsmb/clidfs.c | 1 +
 1 file changed, 1 insertion(+)


Changeset truncated at 500 lines:

diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c
index 4321c216473..6696ed3ea05 100644
--- a/source3/libsmb/clidfs.c
+++ b/source3/libsmb/clidfs.c
@@ -202,6 +202,7 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx,
 c->timeout,
 smbXcli_conn_remote_name(c->conn));
cli_shutdown(c);
+   return status;
} else if (!NT_STATUS_IS_OK(status)) {
d_printf("Protocol negotiation to server %s (for a protocol 
between %s and %s) failed: %s\n",
 smbXcli_conn_remote_name(c->conn),


-- 
Samba Shared Repository