[SCM] Samba Shared Repository - branch master updated

2023-04-12 Thread Stefan Metzmacher
The branch, master has been updated
   via  53f0a292f80 selftest:Samba3: use the correct NSS_WRAPPER_HOSTNAME
  from  2ff55b3da71 selftest: Catch error codes from failing testsuites

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


- Log -
commit 53f0a292f8057a63ddee951058e380b43b9d2916
Author: Stefan Metzmacher 
Date:   Wed Apr 12 17:22:02 2023 +0200

selftest:Samba3: use the correct NSS_WRAPPER_HOSTNAME

The value of NSS_WRAPPER_HOSTNAME needs to match value
we put into the NSS_WRAPPER_HOSTS file.

We had a mismatch of
idmapridmember.samba.example.com
vs.
idmapridmember.addom.samba.example.com

This causes getaddrinfo() in nss_wrapper to fallback to
the libc version, which talks to a dns server.
It's not clear if recent glibc code will reach resolve/socket wrapper.
So it's not unlikely that idmapridmember.samba.example.com will
be passed via the internet, which causes delays up to 20 seconds.

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

Signed-off-by: Stefan Metzmacher 
Reviewed-by: Ralph Boehme 

Autobuild-User(master): Stefan Metzmacher 
Autobuild-Date(master): Wed Apr 12 20:29:05 UTC 2023 on atb-devel-224

---

Summary of changes:
 selftest/target/Samba3.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index ab0b61279ef..717091cc8cf 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -3677,7 +3677,7 @@ jacknomappergroup:x:$gid_jacknomapper:jacknomapper
$createuser_env{NSS_WRAPPER_PASSWD} = $nss_wrapper_passwd;
$createuser_env{NSS_WRAPPER_GROUP} = $nss_wrapper_group;
$createuser_env{NSS_WRAPPER_HOSTS} = $nss_wrapper_hosts;
-   $createuser_env{NSS_WRAPPER_HOSTNAME} = "${hostname}.samba.example.com";
+   $createuser_env{NSS_WRAPPER_HOSTNAME} = "${hostname}.${dns_domain}";
if ($ENV{SAMBA_DNS_FAKING}) {
$createuser_env{RESOLV_WRAPPER_HOSTS} = $dns_host_file;
} else {
@@ -3731,7 +3731,7 @@ jacknomappergroup:x:$gid_jacknomapper:jacknomapper
$ret{NSS_WRAPPER_PASSWD} = $nss_wrapper_passwd;
$ret{NSS_WRAPPER_GROUP} = $nss_wrapper_group;
$ret{NSS_WRAPPER_HOSTS} = $nss_wrapper_hosts;
-   $ret{NSS_WRAPPER_HOSTNAME} = "${hostname}.samba.example.com";
+   $ret{NSS_WRAPPER_HOSTNAME} = "${hostname}.${dns_domain}";
$ret{NSS_WRAPPER_MODULE_SO_PATH} = 
Samba::nss_wrapper_winbind_so_path($self);
$ret{NSS_WRAPPER_MODULE_FN_PREFIX} = "winbind";
if ($ENV{SAMBA_DNS_FAKING}) {


-- 
Samba Shared Repository



[SCM] Samba Shared Repository - branch master updated

2023-04-12 Thread Andreas Schneider
The branch, master has been updated
   via  2ff55b3da71 selftest: Catch error codes from failing testsuites
   via  62893486c62 selftest: Fix samba3.clustered.smb2.deny.deny2 test
   via  839ca0cd353 selftest: Only run clusteredmember tests if ctdb is 
built
   via  44d03bf4793 lib/torture: Don't overwrite test outcomes
   via  80c548437a7 s4:torture: Don't try to close the connection after 
running disconnect tests
   via  2aa9fae1f8d s4:torture: Correctly zero structure
   via  6a3accec4c7 s4:rpc_server: Ensure EnumDomainUsers() doesn't return 
a NULL array
   via  6abc50c94ec s4:rpc_server: Handle LDB_ERR_NO_SUCH_ATTRIBUTE when 
deleting group
   via  91ed2f3d5d2 selftest: Fix typo
   via  8e7abe72a82 s4:torture: Fix typo
   via  8e7c7680f38 s3:selftest: Enable winbindd for maptoguest environment
   via  aa05498b1ed s3:tests: Correct condition
   via  f407b3ec0d8 testprogs: Return correct status code
   via  4726541a789 s3:script: Always return a non-zero status code on 
failure
   via  ae5fafa902b testprogs: Have testfail() return 0 on success
   via  23d2c9cb72d testprogs: Make test_rpcclient_expect_failure_grep() 
return 0 on success
   via  dfb088aaed5 testprogs: Return correct status code
   via  b62b0bd64bd testprogs: Make test_smbclient_expect_failure() return 
0 on success
   via  60c501b387d nsswitch:tests: Remove unused functions
   via  833cefe8eeb testprogs: Make testit_expect_failure() return 0 on 
success
   via  b1df85e7d30 testprogs: Fix comparison
   via  e0db10cfc38 s3:net_usershare: Correctly escape newline in error 
message
   via  03bd1b8ee9b s4-dsdb: Handle allocation failure
   via  2de0e1dccd5 s3:net_usershare: Handle allocation failure
   via  78ca3e16da7 smbd/notify: Handle allocation failure
   via  a1e64e57378 libndr: Handle allocation failure
   via  894500b6708 pyldb: Handle allocation failure
   via  440c3e86971 ctdb:tool: Remove unnecessary strlen()
   via  fd159aaa800 librpc/ndr: Add missing newlines to error messages
   via  5b7ee73c0d7 pysmbd: Fix typo in error message
   via  f273dcf6c5c s4-drs: Don't skip over elements in uref_del_dest()
   via  b5b611d90f8 posix_acls: Don't skip ACEs in merge_default_aces()
   via  12d990ac9f0 s4-acl: Make parameter const
   via  047214be29f s4/dsdb/cracknames: Remove unneeded attribute
   via  dc7911e76b4 s4-dsdb: Check correct ldb opaque variable
   via  0ec0a04dc10 s4-dsdb: Remove is_attr_in_list()
   via  6f2bccf1f44 s4/dsdb/util: Make some arrays static
   via  6ef23456c39 ldb: Avoid undefined pointer arithmetic
   via  aedbee5fd2f ldb: Fix function documentation to be consistent
   via  0ff26aa0c5f ldb: Don't wrongly claim to return message elements
   via  cb3c344a643 ldb: Remove misleading comment
   via  3d935fdcb9c ldb: Remove old misleading comments
   via  064d8a3d123 talloc: Remove unneeded va_copy()
   via  90a042e9a97 talloc: Put comment back in appropriate place
   via  5459217bdda s4:kdc: Fix typos
   via  81bfa75257d s4:kdc: Fix typos in comments
   via  88c1b49312e s4:kdc: Allocate memory on a temporary context
   via  1469c19b74f s4:kdc: Remove unused parameter
   via  e4b81f7f6d4 samba-tool domain: Initialise variables before 
attempting to use them
   via  52e626a8d0f pytest/acl: Remove unused remnants of 
source4/dsdb/tests/python/acl.py
   via  7cb9620fc4b s4-dsdb:large_ldap: Note that we don't check that an 
error was raised
   via  ec069f1b3d3 s4-dsdb:large_ldap: Assert that we got all the entries
   via  5f24d0adc7e s4-dsdb:large_ldap: Fix disabled test
   via  1cf1e6889e5 s4-dsdb:large_ldap: Correctly increment count variable
   via  911f607ecd4 s4-dsdb:large_ldap: Fix typos in variable names
   via  45ff5a81e58 tests/krb5: Fix comment indentation
   via  91e1898f992 tests/krb5: Remove unused variable
  from  52c78466bdb vfs_fruit: avoid using 'conn->tcon->compat', we can 
just use 'conn'!

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


- Log -
commit 2ff55b3da7141d7e290f832730750e6fad10bddc
Author: Joseph Sutton 
Date:   Thu Apr 6 16:31:09 2023 +1200

selftest: Catch error codes from failing testsuites

Testsuites declared with functions such as plantestsuite() are not run
directly, but are piped through filter-subunit. The overall exit code of
the executed test command is that returned by the last command in the
pipeline (that is, filter-subunit), and thus the actual testsuite return
code is lost.

A real consequence of this is that an error in setUpClass() in a Python
testsuite causes the whole testsuite to be skipped silently.

The --fail-on-empty option partially addressed this, but didn't help if
the testsuite contained multiple test classes, only 

[SCM] Samba Shared Repository - branch master updated

2023-04-12 Thread Stefan Metzmacher
The branch, master has been updated
   via  52c78466bdb vfs_fruit: avoid using 'conn->tcon->compat', we can 
just use 'conn'!
   via  e0e58ed0e24 smbXsrv_tcon: avoid storing temporary (invalid!) 
records.
  from  d788d3d974a s3-client: Provide more information on protocol 
negotiation failures

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


- Log -
commit 52c78466bdb136998fa9d28b46ffbf18cd9b61a7
Author: Stefan Metzmacher 
Date:   Wed Apr 5 16:59:28 2023 +0200

vfs_fruit: avoid using 'conn->tcon->compat', we can just use 'conn'!

Signed-off-by: Stefan Metzmacher 
Reviewed-by: Ralph Boehme 

Autobuild-User(master): Stefan Metzmacher 
Autobuild-Date(master): Wed Apr 12 13:51:50 UTC 2023 on atb-devel-224

commit e0e58ed0e2429f01265d544b444bf0e4075549e2
Author: Stefan Metzmacher 
Date:   Wed Apr 5 16:59:44 2023 +0200

smbXsrv_tcon: avoid storing temporary (invalid!) records.

We used to store smbXsrv_tcon_global.tdb records in two steps,
first we created a record in order to allocate the tcon id.
The temporary record had a NULL share_name, which translated
into 0 bytes for the string during ndr_push_smbXsrv_tcon_global0.

The problem is that ndr_pull_smbXsrv_tcon_global0 fails on
this with something like:

Invalid record in smbXsrv_tcon_global.tdb:key '2CA0ED4A' 
ndr_pull_struct_blob(length=85) - Buffer Size Error

The blob looks like this:

[] 00 00 00 00 01 00 00 00   00 00 00 00 00 00 02 00     

[0010] 00 00 00 00 4A ED A0 2C   4A ED A0 2C 00 00 00 00   J.., J..,
[0020] F8 4B 00 00 00 00 00 00   00 00 00 00 FF FF FF FF   .K..  

[0030] 4D 59 9B 9F 83 F4 35 20   36 D2 B0 82 62 68 D9 01   MY5 6...bh..
[0040] 00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00     

[0050] 00 00 00 00 00  .

The reason for having a temporary entry was just based on
the fact, that it was easier to keep the logic in
make_connection_snum() untouched.

But we have all information available in order to store
the final record directly. We only need to do the
"max connections" check first.

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

Signed-off-by: Stefan Metzmacher 
Reviewed-by: Ralph Boehme 

---

Summary of changes:
 source3/modules/vfs_fruit.c |  4 ++--
 source3/smbd/globals.h  |  5 
 source3/smbd/smb1_service.c | 48 +++--
 source3/smbd/smb2_service.c | 15 
 source3/smbd/smb2_tcon.c| 58 ++---
 source3/smbd/smbXsrv_tcon.c | 29 +--
 6 files changed, 97 insertions(+), 62 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 4058d4834e7..637e2a1a6ed 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -849,7 +849,7 @@ static NTSTATUS check_aapl(vfs_handle_struct *handle,
 
if (req_bitmap & SMB2_CRTCTX_AAPL_SERVER_CAPS) {
if ((client_caps & SMB2_CRTCTX_AAPL_SUPPORTS_READ_DIR_ATTR) &&
-   (handle->conn->tcon->compat->fs_capabilities & 
FILE_NAMED_STREAMS)) {
+   (handle->conn->fs_capabilities & FILE_NAMED_STREAMS)) {
server_caps |= SMB2_CRTCTX_AAPL_SUPPORTS_READ_DIR_ATTR;
config->readdir_attr_enabled = true;
}
@@ -875,7 +875,7 @@ static NTSTATUS check_aapl(vfs_handle_struct *handle,
}
 
if (req_bitmap & SMB2_CRTCTX_AAPL_VOLUME_CAPS) {
-   int val = lp_case_sensitive(SNUM(handle->conn->tcon->compat));
+   int val = lp_case_sensitive(SNUM(handle->conn));
uint64_t caps = 0;
 
switch (val) {
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index ff69d95ddfb..837d3c8acd2 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -645,6 +645,8 @@ NTSTATUS smbXsrv_tcon_update(struct smbXsrv_tcon *tcon);
 NTSTATUS smbXsrv_tcon_disconnect(struct smbXsrv_tcon *tcon, uint64_t vuid);
 NTSTATUS smb1srv_tcon_table_init(struct smbXsrv_connection *conn);
 NTSTATUS smb1srv_tcon_create(struct smbXsrv_connection *conn,
+uint32_t session_global_id,
+const char *share_name,
 NTTIME now,
 struct smbXsrv_tcon **_tcon);
 NTSTATUS smb1srv_tcon_lookup(struct smbXsrv_connection *conn,
@@ -653,6 +655,9 @@ NTSTATUS smb1srv_tcon_lookup(struct smbXsrv_connection 
*conn,
 NTSTATUS smb1srv_tcon_disconnect_all(struct smbXsrv_client *client);
 NTSTATUS smb2srv_tcon_table_init(struct smbXsrv_session *session);
 NTSTATUS 

[SCM] Socket Wrapper Repository - branch master updated

2023-04-12 Thread Andreas Schneider
The branch, master has been updated
   via  b15c02f tests: New test with poll
   via  8b1b825 tests: Try larger writes and reads
  from  97fe09e cmake: Fix cmocka >= 1.1.6 find_package() in CONFIG mode

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


- Log -
commit b15c02fc0187103ddad4c05adc0ff292f774c1ef
Author: Jakub Jelen 
Date:   Thu Mar 2 10:46:53 2023 +0100

tests: New test with poll

Signed-off-by: Jakub Jelen 
Reviewed-by: Stefan Metzmacher 
Reviewed-by: Andreas Schneider 

commit 8b1b82567794470e829bd0a34e99eeec397c7e6d
Author: Jakub Jelen 
Date:   Thu Feb 23 14:55:02 2023 +0100

tests: Try larger writes and reads

Signed-off-by: Jakub Jelen 
Reviewed-by: Stefan Metzmacher 
Reviewed-by: Andreas Schneider 

---

Summary of changes:
 tests/CMakeLists.txt |   1 +
 tests/test_echo_tcp_poll.c   | 226 +++
 tests/test_echo_tcp_write_read.c |  93 +++-
 3 files changed, 292 insertions(+), 28 deletions(-)
 create mode 100644 tests/test_echo_tcp_poll.c


Changeset truncated at 500 lines:

diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 3748461..b1a3c6c 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -64,6 +64,7 @@ set(SWRAP_TESTS
 test_echo_tcp_sendmsg_recvmsg
 test_echo_tcp_sendmmsg_recvmmsg
 test_echo_tcp_write_read
+test_echo_tcp_poll
 test_echo_tcp_writev_readv
 test_echo_tcp_get_peer_sock_name
 test_echo_udp_sendto_recvfrom
diff --git a/tests/test_echo_tcp_poll.c b/tests/test_echo_tcp_poll.c
new file mode 100644
index 000..1632eae
--- /dev/null
+++ b/tests/test_echo_tcp_poll.c
@@ -0,0 +1,226 @@
+#include 
+#include 
+#include 
+#include 
+
+#include "config.h"
+#include "torture.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int setup_echo_srv_tcp_ipv4(void **state)
+{
+   torture_setup_echo_srv_tcp_ipv4(state);
+
+   return 0;
+}
+
+#ifdef HAVE_IPV6
+static int setup_echo_srv_tcp_ipv6(void **state)
+{
+   torture_setup_echo_srv_tcp_ipv6(state);
+
+   return 0;
+}
+#endif
+
+static int teardown(void **state)
+{
+   torture_teardown_echo_srv(state);
+
+   return 0;
+}
+
+static void handle_poll_loop(size_t size, int s)
+{
+   char send_buf[size];
+   char recv_buf[size];
+   int nfds, num_open_fds;
+   struct pollfd pfds[1];
+   size_t nread = 0, nwrote = 0;
+   ssize_t ret;
+   int i;
+
+   num_open_fds = nfds = 1;
+   pfds[0].fd = s;
+   pfds[0].events = POLLIN | POLLOUT;
+
+   i = 0;
+   memset(send_buf, 0, sizeof(send_buf));
+
+   while (num_open_fds > 0 && i < 10) {
+   int ready;
+
+   printf("About to poll()\n");
+   ready = poll(pfds, nfds, -1);
+   assert_int_not_equal(ready, -1);
+
+   printf("Ready: %d\n", ready);
+
+   /* Deal with array returned by poll(). */
+   for (int j = 0; j < nfds; j++) {
+   if (pfds[j].revents != 0) {
+   printf("  fd=%d; events: %s%s%s%s\n", 
pfds[j].fd,
+  (pfds[j].revents & POLLIN)  ? "POLLIN "  
: "",
+  (pfds[j].revents & POLLOUT) ? "POLLOUT " 
: "",
+  (pfds[j].revents & POLLHUP) ? "POLLHUP " 
: "",
+  (pfds[j].revents & POLLERR) ? "POLLERR " 
: "");
+   }
+
+   if (pfds[j].revents & POLLIN) {
+   ret = read(s,
+  recv_buf + nread,
+  sizeof(recv_buf) - nread);
+   printf("  fd=%d: read=%zd\n", pfds[j].fd, ret);
+   assert_int_not_equal(ret, -1);
+   nread += ret;
+   /* try to delay */
+   sleep(5);
+   }
+   if (pfds[j].revents & POLLOUT) {
+   snprintf(send_buf, sizeof(send_buf),
+"packet.%d", i);
+   ret = write(s,
+   send_buf + nwrote,
+   sizeof(send_buf) - nwrote);
+   printf("  fd=%d: wrote=%zd\n", pfds[j].fd, ret);
+   assert_int_not_equal(ret, -1);
+   nwrote += ret;
+   if (nwrote == sizeof(send_buf)) {
+   /* no more to write */
+