[SCM] Samba Shared Repository - branch master updated

2023-10-27 Thread Jeremy Allison
The branch, master has been updated
   via  952d6c2cf48 smbd: Fix read_symlink_reparse()
   via  cc1657c5857 tests: Get a file through an absolute symlink within a 
subdirectory
  from  03af1176938 gp_pol: Test multiple values multi_sz roundtrip

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


- Log -
commit 952d6c2cf48b19807e96a49b95c19c224bd6e732
Author: Volker Lendecke 
Date:   Thu Oct 26 16:12:29 2023 +0200

smbd: Fix read_symlink_reparse()

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

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

Autobuild-User(master): Jeremy Allison 
Autobuild-Date(master): Fri Oct 27 21:19:35 UTC 2023 on atb-devel-224

commit cc1657c5857f22d41830898ef2eb384d5fc52a42
Author: Volker Lendecke 
Date:   Thu Oct 26 16:16:29 2023 +0200

tests: Get a file through an absolute symlink within a subdirectory

This shows that read_symlink_reparse() is broken when trying to
replace an absolute with a relative filename within a
share.

read_symlink_reparse() is used only in openat_pathref_fsp_nosymlink()
so far to chase symlinks for non-lcomp path components. Chasing lcomp
symlinks is done through non_widelink_open(), which gets it right.

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

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

---

Summary of changes:
 source3/script/tests/test_smbclient_s3.sh | 39 +++
 source3/smbd/files.c  | 14 ---
 2 files changed, 50 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/script/tests/test_smbclient_s3.sh 
b/source3/script/tests/test_smbclient_s3.sh
index cbff5026ee7..e4b05b12dfa 100755
--- a/source3/script/tests/test_smbclient_s3.sh
+++ b/source3/script/tests/test_smbclient_s3.sh
@@ -1492,6 +1492,17 @@ EOF
return
fi
 
+   # Create a file to be accessed behind the symlink
+   touch $local_slink_target_dir/x
+   ret=$?
+   if [ $ret -ne 0 ]; then
+   echo "$out"
+   echo "failed - unable to create file"
+   ls -la $local_test_dir
+   false
+   return
+   fi
+
# Can we cd into the symlink name and ls ?
tmpfile=$PREFIX/smbclient_interactive_prompt_commands
cat >$tmpfile <$tmpfile conn->connectpath;
+   char *subdir_path = NULL;
char *abs_target_canon = NULL;
const char *relative = NULL;
bool in_share;
 
+   subdir_path = talloc_asprintf(talloc_tos(),
+ "%s/%s",
+ dirfsp->conn->connectpath,
+ dirfsp->fsp_name->base_name);
+   if (subdir_path == NULL) {
+   goto nomem;
+   }
+
abs_target_canon =
canonicalize_absolute_path(talloc_tos(),
   symlink->substitute_name);
@@ -764,8 +772,8 @@ NTSTATUS read_symlink_reparse(
goto nomem;
}
 
-   in_share = subdir_of(connectpath,
-strlen(connectpath),
+   in_share = subdir_of(subdir_path,
+strlen(subdir_path),
 abs_target_canon,
 );
if (in_share) {


-- 
Samba Shared Repository



[SCM] Samba Shared Repository - branch master updated

2023-10-27 Thread David Mulder
The branch, master has been updated
   via  03af1176938 gp_pol: Test multiple values multi_sz roundtrip
   via  d5d96bed02f gp_pol: Allow null data for REG_MULTI_SZ
   via  9c5a9244281 gp_pol: Test empty multi_sz roundtrip
  from  d1d2a03d73b s3:utils: Initialize the memcache for smbpasswd

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


- Log -
commit 03af117693852262b3f5ead4aaa62314d6f3ca45
Author: Gabriel Nagy 
Date:   Fri Oct 27 11:21:50 2023 +0300

gp_pol: Test multiple values multi_sz roundtrip

Signed-off-by: Gabriel Nagy 
Reviewed-by: Andrew Bartlett 
Reviewed-by: David Mulder 

Autobuild-User(master): David Mulder 
Autobuild-Date(master): Fri Oct 27 14:45:28 UTC 2023 on atb-devel-224

commit d5d96bed02fab78386fad908e4dd18c1adcd4795
Author: Gabriel Nagy 
Date:   Tue Oct 24 12:47:02 2023 +0300

gp_pol: Allow null data for REG_MULTI_SZ

The parser is able to convert data from binary to XML (it generates an
empty  tag) but not the other way around. This is a common
occurrence for empty multitext fields.

Signed-off-by: Gabriel Nagy 
Reviewed-by: Andrew Bartlett 
Reviewed-by: David Mulder 

commit 9c5a924428181604e1abc513415037369e79d75b
Author: Gabriel Nagy 
Date:   Tue Oct 24 12:26:42 2023 +0300

gp_pol: Test empty multi_sz roundtrip

Signed-off-by: Gabriel Nagy 
Reviewed-by: Andrew Bartlett 
Reviewed-by: David Mulder 

---

Summary of changes:
 python/samba/gp_parse/gp_pol.py |  6 +++-
 python/samba/tests/gpo.py   | 66 -
 2 files changed, 70 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/python/samba/gp_parse/gp_pol.py b/python/samba/gp_parse/gp_pol.py
index 8a3d5f58ec1..1d5f348176b 100644
--- a/python/samba/gp_parse/gp_pol.py
+++ b/python/samba/gp_parse/gp_pol.py
@@ -77,7 +77,11 @@ class GPPolParser(GPParser):
 
 if misc.REG_MULTI_SZ == entry_type:
 values = [x.text for x in e.findall('Value')]
-entry.data = (u'\x00'.join(values) + 
u'\x00\x00').encode('utf-16le')
+if values == [None]:
+data = u'\x00'
+else:
+data = u'\x00'.join(values) + u'\x00\x00'
+entry.data = data.encode('utf-16le')
 elif (misc.REG_NONE == entry_type):
 pass
 elif (misc.REG_SZ == entry_type or
diff --git a/python/samba/tests/gpo.py b/python/samba/tests/gpo.py
index d68f11233a6..33be897405b 100644
--- a/python/samba/tests/gpo.py
+++ b/python/samba/tests/gpo.py
@@ -14,7 +14,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see .
 
-import os, grp, pwd
+import os, grp, pwd, re
 import errno
 from samba import gpo, tests
 from samba.gp.gpclass import register_gp_extension, list_gp_extensions, \
@@ -5015,6 +5015,32 @@ drive_maps_xml = b"""
 
 """
 
+empty_multi_sz_reg_pol = \
+br"""
+
+
+
+KeyName
+ValueName
+
+
+
+"""
+
+multiple_values_multi_sz_reg_pol = \
+br"""
+
+
+
+KeyName
+ValueName
+Value1
+Value2
+Value3
+
+
+"""
+
 def days2rel_nttime(val):
 seconds = 60
 minutes = 60
@@ -8015,3 +8041,41 @@ class GPOTests(tests.TestCase):
 pass
 else:
 self.fail('Undefined variable %s caused no error' % undef_var)
+
+def test_parser_roundtrip_empty_multi_sz(self):
+with TemporaryDirectory() as dname:
+reg_pol_xml = os.path.join(dname, 'REGISTRY.POL.XML')
+
+parser = GPPolParser()
+try:
+
parser.load_xml(etree.fromstring(empty_multi_sz_reg_pol.strip()))
+except Exception as e:
+self.fail(str(e))
+parser.write_xml(reg_pol_xml)
+
+with open(reg_pol_xml, 'r') as f:
+pol_xml_data = f.read()
+
+# Strip whitespace characters due to indentation differences
+expected_xml_data = re.sub(r"\s+", "", 
empty_multi_sz_reg_pol.decode(), flags=re.UNICODE)
+actual_xml_data = re.sub(r"\s+", "", pol_xml_data, 
flags=re.UNICODE)
+self.assertEqual(expected_xml_data, actual_xml_data, 'XML data 
mismatch')
+
+def test_parser_roundtrip_multiple_values_multi_sz(self):
+with TemporaryDirectory() as dname:
+reg_pol_xml = os.path.join(dname, 'REGISTRY.POL.XML')
+
+parser = GPPolParser()
+try:
+
parser.load_xml(etree.fromstring(multiple_values_multi_sz_reg_pol.strip()))
+except Exception as e:
+self.fail(str(e))
+parser.write_xml(reg_pol_xml)
+
+with open(reg_pol_xml, 'r') 

[SCM] Samba Shared Repository - branch master updated

2023-10-27 Thread Andreas Schneider
The branch, master has been updated
   via  d1d2a03d73b s3:utils: Initialize the memcache for smbpasswd
   via  89e376c69a3 s3:util: Add gfree_memcache() to gfree_all()
   via  cdcaac148f3 lib:util: Add a gfree_memcache()
   via  b3234c55743 s3:passdb: Do not leak memory if memcache add fails
   via  842d2eca91b lib:util: Add boolean return type for 
memcache_add_talloc()
   via  200a5b7617d lib:util: Add boolean return type for memcache_add()
   via  a2a31519fb5 s3:utils: Initialize row variable in wspsearch
  from  0bb67a3a7e7 python: silos: add support for allowed to authenticate 
from silo shortcut

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


- Log -
commit d1d2a03d73b376d54aa6d010e521282746b068fe
Author: Andreas Schneider 
Date:   Thu Oct 26 14:37:29 2023 +0200

s3:utils: Initialize the memcache for smbpasswd

Signed-off-by: Andreas Schneider 
Reviewed-by: Andrew Bartlett 

Autobuild-User(master): Andreas Schneider 
Autobuild-Date(master): Fri Oct 27 06:51:48 UTC 2023 on atb-devel-224

commit 89e376c69a39175684dfb7b7cbaea9dcd996dd63
Author: Andreas Schneider 
Date:   Thu Oct 26 14:36:02 2023 +0200

s3:util: Add gfree_memcache() to gfree_all()

Signed-off-by: Andreas Schneider 
Reviewed-by: Andrew Bartlett 

commit cdcaac148f3b42d8bdf415a5ce0ef77031c2d0f5
Author: Andreas Schneider 
Date:   Thu Oct 26 14:35:44 2023 +0200

lib:util: Add a gfree_memcache()

Signed-off-by: Andreas Schneider 
Reviewed-by: Andrew Bartlett 

commit b3234c55743d8329ba1d387943865b23233e22c7
Author: Andreas Schneider 
Date:   Thu Oct 26 14:28:19 2023 +0200

s3:passdb: Do not leak memory if memcache add fails

Indirect leak of 496 byte(s) in 1 object(s) allocated from:
#0 0x7ffb062dc03f in malloc (/lib64/libasan.so.8+0xdc03f) (BuildId: 
3e1694ad218c99a8b1b69231666a27df63cf19d0)
#1 0x7ffb06025b3e in __talloc_with_prefix ../../lib/talloc/talloc.c:783
#2 0x7ffb06027512 in __talloc ../../lib/talloc/talloc.c:825
#3 0x7ffb06027512 in _talloc_named_const ../../lib/talloc/talloc.c:982
#4 0x7ffb06027512 in _talloc_zero ../../lib/talloc/talloc.c:2421
#5 0x7ffb05a0332c in samu_new ../../source3/passdb/passdb.c:63
#6 0x7ffb05a2031f in pdb_getsampwnam 
../../source3/passdb/pdb_interface.c:351
#7 0x7ffb05a0540b in local_password_change 
../../source3/passdb/passdb.c:752
#8 0x56291ddd4b8b in password_change ../../source3/utils/smbpasswd.c:273
#9 0x56291ddd5b59 in process_root ../../source3/utils/smbpasswd.c:478
#10 0x56291ddd5b59 in main ../../source3/utils/smbpasswd.c:661
#11 0x7ffb024281af in __libc_start_call_main 
../sysdeps/nptl/libc_start_call_main.h:58

Signed-off-by: Andreas Schneider 
Reviewed-by: Andrew Bartlett 

commit 842d2eca91be3682ba7194501cafa6a0c2152be6
Author: Andreas Schneider 
Date:   Thu Oct 26 14:26:57 2023 +0200

lib:util: Add boolean return type for memcache_add_talloc()

Signed-off-by: Andreas Schneider 
Reviewed-by: Andrew Bartlett 

commit 200a5b7617d6f12a3907702bf0473f7ddda1c53b
Author: Andreas Schneider 
Date:   Thu Oct 26 14:26:26 2023 +0200

lib:util: Add boolean return type for memcache_add()

Signed-off-by: Andreas Schneider 
Reviewed-by: Andrew Bartlett 

commit a2a31519fb5f0313c6dcf3b251180530c9006802
Author: Andreas Schneider 
Date:   Thu Oct 26 14:09:33 2023 +0200

s3:utils: Initialize row variable in wspsearch

../../source3/utils/wspsearch.c:331:25: error: ‘row’ may be used
uninitialized [-Werror=maybe-uninitialized]
  331 | *rows_processed = row;
  | ^

Signed-off-by: Andreas Schneider 
Reviewed-by: Andrew Bartlett 

---

Summary of changes:
 lib/util/memcache.c| 24 
 lib/util/memcache.h|  6 --
 source3/lib/util.c |  3 +++
 source3/passdb/pdb_interface.c | 10 +++---
 source3/utils/smbpasswd.c  |  9 +
 source3/utils/wspsearch.c  |  2 +-
 6 files changed, 40 insertions(+), 14 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/memcache.c b/lib/util/memcache.c
index 7b0b27eaddb..98e317c66fb 100644
--- a/lib/util/memcache.c
+++ b/lib/util/memcache.c
@@ -265,7 +265,7 @@ void memcache_delete(struct memcache *cache, enum 
memcache_number n,
memcache_delete_element(cache, e);
 }
 
-void memcache_add(struct memcache *cache, enum memcache_number n,
+bool memcache_add(struct memcache *cache, enum memcache_number n,
  DATA_BLOB key, DATA_BLOB value)
 {
struct memcache_element *e;
@@ -278,11 +278,11 @@ void memcache_add(struct memcache *cache, enum 
memcache_number n,
cache = global_cache;
}
if