]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
6 weeks agosmbd: Make file_name_hash() return bool
Volker Lendecke [Thu, 23 Oct 2025 17:27:13 +0000 (19:27 +0200)] 
smbd: Make file_name_hash() return bool

There's only the ENOMEM failure condition

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 weeks agoprinting: Fix coverity issue CID#1669074 (Unchecked return value)
Vinit Agnihotri [Fri, 14 Nov 2025 06:00:20 +0000 (11:30 +0530)] 
printing: Fix coverity issue CID#1669074 (Unchecked return value)

A new coverity issue (Unchecked return value) is flagged as a regression
due to commit#e9a7dce599e.
This could have been present prior to comit#e9a7dce599e, however got missed.

This change fixes this issue by checking return value.

Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Mon Nov 17 08:31:24 UTC 2025 on atb-devel-224

6 weeks agopython:tests: Take INTERDOMAIN_TRUST into account
Andreas Schneider [Tue, 11 Nov 2025 06:26:16 +0000 (07:26 +0100)] 
python:tests: Take INTERDOMAIN_TRUST into account

If we run e.g. fl2008rc2 env before we run this test, we have a trust account
for this domain.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Nov 14 19:23:38 UTC 2025 on atb-devel-224

6 weeks agopython:tests: Add debug output to test_query_filter_enum()
Andreas Schneider [Fri, 7 Nov 2025 12:23:34 +0000 (13:23 +0100)] 
python:tests: Add debug output to test_query_filter_enum()

This test runs relatively late in 'make test'. It finds some accounts which are
neither a computer nor a user account and complains that the overall account
count doesn't match.

Add some debug so we can find out more about the accounts.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 weeks agopython:tests: Use random users for domain_auth_silo.py
Andreas Schneider [Mon, 10 Nov 2025 10:11:28 +0000 (11:11 +0100)] 
python:tests: Use random users for domain_auth_silo.py

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 weeks agopython:tests: Use random users for user_auth_silo.py
Andreas Schneider [Mon, 10 Nov 2025 10:06:11 +0000 (11:06 +0100)] 
python:tests: Use random users for user_auth_silo.py

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 weeks agopython:tests: Use random users for user_auth_policy.py
Andreas Schneider [Mon, 10 Nov 2025 10:01:05 +0000 (11:01 +0100)] 
python:tests: Use random users for user_auth_policy.py

We should not work on alice, bob and joe. We should use random user so we can
clean up afterwards. If we don't do this the dbcheck tests will fails with:

UNEXPECTED(failure): samba4.blackbox.dbcheck(ad_dc).dbcheck(ad_dc:local)
REASON: Exception: Exception: Checking 21449 objects
WARNING: target DN is deleted for msDS-AssignedAuthNPolicy in object CN=alice,CN=Users,DC=addom,DC=samba,DC=example,DC=com - <GUID=66bd1f51-084f-4259-a769-efa59adb6e31>;<RMD_ADDTIM
E=134051822550000000>;<RMD_CHANGETIME=134051822550000000>;<RMD_FLAGS=1>;<RMD_INVOCID=b5064b02-c91e-40c0-bc1f-a92a0105a810>;<RMD_LOCAL_USN=14061>;<RMD_ORIGINATING_USN=14061>;<RMD_VE
RSION=2>;CN=User Policy,CN=AuthN Policies,CN=AuthN Policy Configuration,CN=Services,CN=Configuration,DC=addom,DC=samba,DC=example,DC=com
Target GUID points at deleted DN 'CN=User Policy\\0ADEL:66bd1f51-084f-4259-a769-efa59adb6e31,CN=Deleted Objects,CN=Configuration,DC=addom,DC=samba,DC=example,DC=com'
Not removing
WARNING: target DN is deleted for msDS-AssignedAuthNPolicySilo in object CN=alice,CN=Users,DC=addom,DC=samba,DC=example,DC=com - <GUID=287d6c3d-bea8-4c06-bdf8-7d4b579bc0e9>;<RMD_AD
DTIME=134051822560000000>;<RMD_CHANGETIME=134051822560000000>;<RMD_FLAGS=1>;<RMD_INVOCID=b5064b02-c91e-40c0-bc1f-a92a0105a810>;<RMD_LOCAL_USN=14081>;<RMD_ORIGINATING_USN=14081>;<RM
D_VERSION=2>;CN=Developers,CN=AuthN Silos,CN=AuthN Policy Configuration,CN=Services,CN=Configuration,DC=addom,DC=samba,DC=example,DC=com
Target GUID points at deleted DN 'CN=Developers\\0ADEL:287d6c3d-bea8-4c06-bdf8-7d4b579bc0e9,CN=Deleted Objects,CN=Configuration,DC=addom,DC=samba,DC=example,DC=com'
Not removing
WARNING: target DN is deleted for msDS-AssignedAuthNPolicy in object CN=bob,CN=Users,DC=addom,DC=samba,DC=example,DC=com - <GUID=66bd1f51-084f-4259-a769-efa59adb6e31>;<RMD_ADDTIME=
134051822550000000>;<RMD_CHANGETIME=134051822550000000>;<RMD_FLAGS=1>;<RMD_INVOCID=b5064b02-c91e-40c0-bc1f-a92a0105a810>;<RMD_LOCAL_USN=14065>;<RMD_ORIGINATING_USN=14065>;<RMD_VERS
ION=4>;CN=User Policy,CN=AuthN Policies,CN=AuthN Policy Configuration,CN=Services,CN=Configuration,DC=addom,DC=samba,DC=example,DC=com
Target GUID points at deleted DN 'CN=User Policy\\0ADEL:66bd1f51-084f-4259-a769-efa59adb6e31,CN=Deleted Objects,CN=Configuration,DC=addom,DC=samba,DC=example,DC=com'
Not removing
WARNING: target DN is deleted for msDS-AssignedAuthNPolicySilo in object CN=bob,CN=Users,DC=addom,DC=samba,DC=example,DC=com - <GUID=1a1e5cdf-b92e-4a80-bc35-cccad8e9f865>;<RMD_ADDT
IME=134051822560000000>;<RMD_CHANGETIME=134051822560000000>;<RMD_FLAGS=1>;<RMD_INVOCID=b5064b02-c91e-40c0-bc1f-a92a0105a810>;<RMD_LOCAL_USN=14085>;<RMD_ORIGINATING_USN=14085>;<RMD_
VERSION=4>;CN=QA,CN=AuthN Silos,CN=AuthN Policy Configuration,CN=Services,CN=Configuration,DC=addom,DC=samba,DC=example,DC=com
Target GUID points at deleted DN 'CN=QA\\0ADEL:1a1e5cdf-b92e-4a80-bc35-cccad8e9f865,CN=Deleted Objects,CN=Configuration,DC=addom,DC=samba,DC=example,DC=com'
Not removing
Checked 21449 objects (4 errors)

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 weeks agoselftest: Create libdir in setup_clusteredmember()
Andreas Schneider [Mon, 10 Nov 2025 14:49:59 +0000 (15:49 +0100)] 
selftest: Create libdir in setup_clusteredmember()

This fixes:

can't open st/clusteredmember/lib/krb5.conf at selftest/target/Samba.pm line 328.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 weeks agoselftest: Add blackbox claims test to knownfail_mit_kdc
Andreas Schneider [Mon, 10 Nov 2025 09:40:52 +0000 (10:40 +0100)] 
selftest: Add blackbox claims test to knownfail_mit_kdc

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 weeks agobootstrap: Remove libtracker-sparql-2
Andreas Schneider [Tue, 11 Nov 2025 10:48:10 +0000 (11:48 +0100)] 
bootstrap: Remove libtracker-sparql-2

This is not used anymore.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Nov 14 16:34:48 UTC 2025 on atb-devel-224

6 weeks agos3:mdssvc: Remove support for tracker sparql support
Andreas Schneider [Tue, 11 Nov 2025 10:45:23 +0000 (11:45 +0100)] 
s3:mdssvc: Remove support for tracker sparql support

This only support v2 of tracker sparql which is only avilable on the Ubuntu
20.04 runner. All newer distributions provide only tracker sparql v3.

Also the tevent glib stopped working on Fedora 43.

Time to remove it.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 weeks agodocs-xml: Improve the samba-bgqd manpage
Andreas Schneider [Thu, 23 Oct 2025 09:00:38 +0000 (11:00 +0200)] 
docs-xml: Improve the samba-bgqd manpage

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Nov 14 15:05:11 UTC 2025 on atb-devel-224

6 weeks agos3:printing: Load the shares for [printers] in samba-bgqd
Andreas Schneider [Thu, 23 Oct 2025 08:49:31 +0000 (10:49 +0200)] 
s3:printing: Load the shares for [printers] in samba-bgqd

One of the main functions of bgqd is:

        delete_and_reload_printers_full()

It isn't able to do its work, if we don't load the shares. Normally bgqd was
forked from smbd and this loaded the shares. But with the introduction of
samba-dcerpcd it is a standalone service now. As a standalone service it is
responsible to load the shares if it needs to work on them.

The following message is printed if delete_and_reload_printers_full() tries to
do its job:

[2025/10/23 09:57:27,  7, pid=41935, effective(0, 0), real(0, 0)] ../../source3/param/loadparm.c:4419(lp_servicenumber)
  lp_servicenumber: couldn't find printers
[2025/10/23 09:57:27,  7, pid=41935, effective(0, 0), real(0, 0)] ../../source3/param/loadparm.c:4419(lp_servicenumber)
  lp_servicenumber: couldn't find printers

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agos3:smbd: Fix segfault in smb2_reply
Andreas Schneider [Fri, 14 Nov 2025 09:59:19 +0000 (10:59 +0100)] 
s3:smbd: Fix segfault in smb2_reply

This is triggered by: make test TESTS="samba3.smb2.streams.simpleserver

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

Pair-Programmed-With: Ralph Boehme <slow@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
6 weeks agos4:kdc always include the PAC
Gary Lockyer [Mon, 20 Oct 2025 00:03:31 +0000 (13:03 +1300)] 
s4:kdc always include the PAC

Set the heimdal always_include_pac configuration flag, based on the samba
kdc always include pac option

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Thu Nov 13 23:12:55 UTC 2025 on atb-devel-224

6 weeks agos4:kdc:tests: support "kdc always generate pac"
Gary Lockyer [Thu, 30 Oct 2025 19:31:33 +0000 (08:31 +1300)] 
s4:kdc:tests: support "kdc always generate pac"

Update the tests to check the "kdc always generate pac" configuration and
expect the presence of a PAC accordingly.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
6 weeks agos4:kdc:test add tgs tests to fl2008r2dc env
Gary Lockyer [Thu, 30 Oct 2025 19:38:08 +0000 (08:38 +1300)] 
s4:kdc:test add tgs tests to fl2008r2dc env

Add kdc_tgs tests to the fl2008r2dc test environment, to ensure that they are
run with "kdc always generate pac" set to no

Note: This required updating known_fail_mit/kdc_tgs to handle the
      expected failures for the fl2008r2dc environment when run against
      the MIT kdc

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
6 weeks agoselftest:fl2008r2dc set "kdc always generate pac"" to no
Gary Lockyer [Thu, 30 Oct 2025 19:36:50 +0000 (08:36 +1300)] 
selftest:fl2008r2dc set "kdc always generate pac"" to no

Set the new configuration option "kdc always generate pac" to "no" in the
fl2008r2dc test environment

This will ensure that kdc will be run with the option set to "no", the default
is "yes".

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
6 weeks agoconfig: add kdc always include pac
Gary Lockyer [Mon, 20 Oct 2025 00:01:14 +0000 (13:01 +1300)] 
config: add kdc always include pac

This option over-rides the PA-PAC-REQUEST received from the client.  When
enabled (the default) a PAC will always be included in the response.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
6 weeks agothird_party:heimdal: import lorikeet-heimdal-202510192136
Gary Lockyer [Sun, 19 Oct 2025 22:44:26 +0000 (11:44 +1300)] 
third_party:heimdal: import lorikeet-heimdal-202510192136

(commit 041c5049eb0e97edaa422ec240ccfe7380667190)

Add a new flag always_include_pac to the krb5_kdc_configuration.

If set this over-rides the PA-PAC-REQUEST and the PAC is always included in
the response.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
6 weeks agoprinting: Fix use of time_t CID#1509005
Vinit Agnihotri [Tue, 16 Sep 2025 06:00:57 +0000 (11:30 +0530)] 
printing: Fix use of time_t CID#1509005

 - This Fixes coverity issue Y2K38_SAFTY in print_queue_update(),
   with use of fetch/store_share_cache_time helper function.
 - Additional changes: Use helper functions fetch/store_share_cache_time for tdb
   key==MSG_PENDING for print_cache_expired()

Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Wed Nov 12 16:04:43 UTC 2025 on atb-devel-224

6 weeks agoprinting: Fix use of time_t CID#1509036
Vinit Agnihotri [Mon, 15 Sep 2025 12:11:52 +0000 (17:41 +0530)] 
printing: Fix use of time_t CID#1509036

 - Use format specifier 'D' for time_t
 - This fixes covery reported issue Y2K38_SAFTY for pjob_store()

Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agoprinting: Fix use of time_t CID#1508987
Vinit Agnihotri [Mon, 15 Sep 2025 13:08:32 +0000 (18:38 +0530)] 
printing: Fix use of time_t CID#1508987

 - This fixes coverity issue Y2K38_SAFTY for print_update_queue_internal()

Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agoprinting: Define and use methods to fetch/store time in share cache
Vinit Agnihotri [Tue, 16 Sep 2025 05:03:50 +0000 (10:33 +0530)] 
printing: Define and use methods to fetch/store time in share cache

Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agoprinting: Update version for print database
Vinit Agnihotri [Tue, 16 Sep 2025 08:55:40 +0000 (14:25 +0530)] 
printing: Update version for print database

Updating version to change time_t related store/fetch from exisiting
uint32_t values to time_t (64-bit) values.

Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agolib:util: Add APIs for fetch/store int64/uint64 values to/from tdb
Vinit Agnihotri [Wed, 24 Sep 2025 07:14:07 +0000 (12:44 +0530)] 
lib:util: Add APIs for fetch/store int64/uint64 values to/from tdb

Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agos3:lib:util_tdb: Add format identifier for 64-bit integer pack/unpack
Vinit Agnihotri [Wed, 24 Sep 2025 06:19:15 +0000 (11:49 +0530)] 
s3:lib:util_tdb: Add format identifier for 64-bit integer pack/unpack

Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 weeks agolib:replace: Remove memset_s()
Andreas Schneider [Thu, 16 Oct 2025 09:22:46 +0000 (11:22 +0200)] 
lib:replace: Remove memset_s()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Nov 11 14:51:45 UTC 2025 on atb-devel-224

6 weeks agoReplace memset_s() with memset_explicit()
Andreas Schneider [Thu, 16 Oct 2025 09:19:51 +0000 (11:19 +0200)] 
Replace memset_s() with memset_explicit()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 weeks agolib:replace: Add test for memset_explicit()
Douglas Bagnall [Thu, 30 Oct 2025 15:01:36 +0000 (16:01 +0100)] 
lib:replace: Add test for memset_explicit()

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 weeks agolib:replace: Implement memset_explicit()
Andreas Schneider [Thu, 16 Oct 2025 09:06:56 +0000 (11:06 +0200)] 
lib:replace: Implement memset_explicit()

The memset_s() implementation is a bit obscure, as it requires a
constraint handler to be set up. You don't really find any
implmentations out there.

With C23 memset_explicit() was added and this has been implemented
for glibc 2.43 and also in FreeBSD.

See https://sourceware.org/bugzilla/show_bug.cgi?id=32378
See https://reviews.freebsd.org/D47286

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 weeks agolib:replace: Remove trailing spaces in README
Andreas Schneider [Thu, 16 Oct 2025 09:09:29 +0000 (11:09 +0200)] 
lib:replace: Remove trailing spaces in README

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 weeks agolib: Introduce cp_smb_basename() helper function
Volker Lendecke [Sat, 8 Nov 2025 09:37:55 +0000 (10:37 +0100)] 
lib: Introduce cp_smb_basename() helper function

I always had to look up the sequence of NULLs and 0s. Save lines.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Nov 10 14:33:28 UTC 2025 on atb-devel-224

7 weeks agosmbd: Move file_fsp() to smb1_utils.c
Volker Lendecke [Thu, 23 Oct 2025 15:18:16 +0000 (17:18 +0200)] 
smbd: Move file_fsp() to smb1_utils.c

16-bit file ids are a smb1 thing

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agodfs_server: Modernize DEBUGs
Volker Lendecke [Mon, 20 Oct 2025 18:24:06 +0000 (20:24 +0200)] 
dfs_server: Modernize DEBUGs

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agodfs_server: Use talloc_asprintf_strlower_m()
Volker Lendecke [Mon, 20 Oct 2025 16:08:12 +0000 (18:08 +0200)] 
dfs_server: Use talloc_asprintf_strlower_m()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agolib: Fix trailing whitespace
Volker Lendecke [Mon, 20 Oct 2025 15:42:40 +0000 (17:42 +0200)] 
lib: Fix trailing whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agosmbd: Save lines in conn_new()
Volker Lendecke [Mon, 20 Oct 2025 14:35:09 +0000 (16:35 +0200)] 
smbd: Save lines in conn_new()

"nomem" is the only failure condition here

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agoexamples: Fix trailing whitespace
Volker Lendecke [Sun, 19 Oct 2025 10:02:14 +0000 (12:02 +0200)] 
examples: Fix trailing whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agosmbd: Fix some whitespace
Volker Lendecke [Wed, 22 Oct 2025 09:15:08 +0000 (11:15 +0200)] 
smbd: Fix some whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agosmbd: Replace a ZERO_STRUCT with a direct struct initialization
Volker Lendecke [Wed, 22 Oct 2025 09:13:18 +0000 (11:13 +0200)] 
smbd: Replace a ZERO_STRUCT with a direct struct initialization

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agovfs: Fix trailing whitespace
Volker Lendecke [Thu, 23 Oct 2025 18:45:04 +0000 (20:45 +0200)] 
vfs: Fix trailing whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agosmbd: README.Coding for file_name_hash()
Volker Lendecke [Thu, 23 Oct 2025 17:26:27 +0000 (19:26 +0200)] 
smbd: README.Coding for file_name_hash()

Initialize pointers

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agosmbd: Modernize a DEBUG
Volker Lendecke [Thu, 23 Oct 2025 17:24:42 +0000 (19:24 +0200)] 
smbd: Modernize a DEBUG

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agosmbd: Make file_name_hash() static
Volker Lendecke [Thu, 23 Oct 2025 17:22:03 +0000 (19:22 +0200)] 
smbd: Make file_name_hash() static

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agovfs: Remove some code duplication
Volker Lendecke [Thu, 23 Oct 2025 16:53:11 +0000 (18:53 +0200)] 
vfs: Remove some code duplication

We do the chdir in both cases

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agoauth: Simplify check_account()
Volker Lendecke [Thu, 16 Oct 2025 11:07:23 +0000 (13:07 +0200)] 
auth: Simplify check_account()

We have strlower_talloc() for this

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agolib: Fix whitespace
Volker Lendecke [Thu, 16 Oct 2025 10:54:14 +0000 (12:54 +0200)] 
lib: Fix whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agosmbd: Fix a typo
Volker Lendecke [Mon, 13 Oct 2025 16:48:11 +0000 (18:48 +0200)] 
smbd: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agosamr_server: Remove an obsolete and confusing comment
Volker Lendecke [Mon, 13 Oct 2025 16:24:34 +0000 (18:24 +0200)] 
samr_server: Remove an obsolete and confusing comment

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agolib: Add some const to bitmap functions
Volker Lendecke [Wed, 29 Oct 2025 12:45:18 +0000 (13:45 +0100)] 
lib: Add some const to bitmap functions

The unusual use of const comes from bitmap_copy :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agolib: Fix bitmap_talloc()'s parameter to unsigned
Volker Lendecke [Wed, 29 Oct 2025 12:41:30 +0000 (13:41 +0100)] 
lib: Fix bitmap_talloc()'s parameter to unsigned

It does not make sense to allocate a negative number of bits

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agolib: Simplify num_parameters() with ARRAY_SIZE()
Volker Lendecke [Wed, 29 Oct 2025 12:39:38 +0000 (13:39 +0100)] 
lib: Simplify num_parameters() with ARRAY_SIZE()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agolib: "boolean == true" looks strange :-)
Volker Lendecke [Sun, 21 Sep 2025 12:36:37 +0000 (14:36 +0200)] 
lib: "boolean == true" looks strange :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agolib: Remove some unused code #ifdef'ed out for more than 10 years
Volker Lendecke [Fri, 19 Sep 2025 21:02:57 +0000 (14:02 -0700)] 
lib: Remove some unused code #ifdef'ed out for more than 10 years

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agolib: Remove an ancient prototype
Volker Lendecke [Fri, 19 Sep 2025 20:50:13 +0000 (13:50 -0700)] 
lib: Remove an ancient prototype

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agosmbd: Fix a few possible buffer read overruns
Volker Lendecke [Sat, 13 Sep 2025 07:11:39 +0000 (09:11 +0200)] 
smbd: Fix a few possible buffer read overruns

... only happens with invalid smb.conf settings....

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agosmbd: Modernize DEBUGs
Volker Lendecke [Mon, 27 Oct 2025 12:23:29 +0000 (13:23 +0100)] 
smbd: Modernize DEBUGs

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agosmbd: Fix a comment
Volker Lendecke [Wed, 22 Oct 2025 09:07:10 +0000 (11:07 +0200)] 
smbd: Fix a comment

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agolib: Remove duplicate #define of TALLOC_FREE()
Volker Lendecke [Fri, 17 Oct 2025 12:46:48 +0000 (14:46 +0200)] 
lib: Remove duplicate #define of TALLOC_FREE()

These days talloc.h has it.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agos3: Remove TALLOC_REALLOC() macro
Volker Lendecke [Fri, 17 Oct 2025 12:44:56 +0000 (14:44 +0200)] 
s3: Remove TALLOC_REALLOC() macro

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agos3: talloc_destroy() -> TALLOC_FREE()
Volker Lendecke [Fri, 17 Oct 2025 12:39:18 +0000 (14:39 +0200)] 
s3: talloc_destroy() -> TALLOC_FREE()

Sweeping change, I know. Should not change compiled code in most
cases, the compiler should be smart enough to elide the assignment
right before a return. In the cases where this is not right before the
return, TALLOC_FREE() is safer as it makes use-after-free crash.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agos3: Replace TALLOC_SIZE() with talloc_size()
Volker Lendecke [Fri, 17 Oct 2025 12:28:40 +0000 (14:28 +0200)] 
s3: Replace TALLOC_SIZE() with talloc_size()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agovfs: Fix trailing whitespace
Volker Lendecke [Fri, 17 Oct 2025 12:27:32 +0000 (14:27 +0200)] 
vfs: Fix trailing whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agos3: Remove the now-unused TALLOC() macro
Volker Lendecke [Fri, 17 Oct 2025 12:26:32 +0000 (14:26 +0200)] 
s3: Remove the now-unused TALLOC() macro

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agos3: Replace a few calls to TALLOC() with talloc_size()
Volker Lendecke [Fri, 17 Oct 2025 12:26:00 +0000 (14:26 +0200)] 
s3: Replace a few calls to TALLOC() with talloc_size()

That does the same

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agos3: Replace a few calls to TALLOC() with talloc_array()
Volker Lendecke [Fri, 17 Oct 2025 12:24:02 +0000 (14:24 +0200)] 
s3: Replace a few calls to TALLOC() with talloc_array()

No explicit cast necessary

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agoprinting: Fix trailing whitespace
Volker Lendecke [Fri, 17 Oct 2025 12:12:12 +0000 (14:12 +0200)] 
printing: Fix trailing whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agosmbd: Remove an obsolete comment
Volker Lendecke [Fri, 17 Oct 2025 12:02:42 +0000 (14:02 +0200)] 
smbd: Remove an obsolete comment

This does not apply anymore for a pretty long time

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agosmbd: Make get_real_filename_full_scan_at() static
Volker Lendecke [Mon, 27 Oct 2025 11:26:27 +0000 (12:26 +0100)] 
smbd: Make get_real_filename_full_scan_at() static

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agovfs: Simplify vfs_gpfs_get_real_filename_at()
Volker Lendecke [Mon, 27 Oct 2025 11:25:42 +0000 (12:25 +0100)] 
vfs: Simplify vfs_gpfs_get_real_filename_at()

The mangled case is handled in the caller

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agosmbd: Remove an unused struct member
Volker Lendecke [Fri, 7 Nov 2025 12:01:33 +0000 (13:01 +0100)] 
smbd: Remove an unused struct member

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agovfs: Remove audit_file function
Volker Lendecke [Sun, 9 Nov 2025 10:19:03 +0000 (11:19 +0100)] 
vfs: Remove audit_file function

Added in 2012 with 0dc3f423d25d3a, but I could not find any user of
that call.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agovfs: Remove connectpath function
Volker Lendecke [Fri, 7 Nov 2025 12:38:58 +0000 (13:38 +0100)] 
vfs: Remove connectpath function

Nobody called this

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agovfs: Fix smb_full_audit_parent_pathname()
Volker Lendecke [Fri, 7 Nov 2025 12:21:23 +0000 (13:21 +0100)] 
vfs: Fix smb_full_audit_parent_pathname()

Make it log the right name

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agos3:winbind: Improve logging for query_user_list()
Andreas Schneider [Wed, 5 Nov 2025 11:28:39 +0000 (12:28 +0100)] 
s3:winbind: Improve logging for query_user_list()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Nov  7 16:06:50 UTC 2025 on atb-devel-224

7 weeks agos3-client: Use the passed down memory context for cli_connect_nb()
Andreas Schneider [Wed, 29 Oct 2025 10:16:53 +0000 (11:16 +0100)] 
s3-client: Use the passed down memory context for cli_connect_nb()

With the patches coming before this patch, we can use main talloc
context to allocate the connections on and make sure we only free them
after we don't need them anymore.

This fixes a lot of memory leaks found by LeakSanitizer. One example is:

==838668==ERROR: LeakSanitizer: detected memory leaks

Indirect leak of 4784 byte(s) in 13 object(s) allocated from:
    #0 0x7fdb1ef21c2b in malloc (/lib64/libasan.so.8+0x121c2b) (BuildId: cbfe49f3b7600c4f194d4c54774c977296e9d98a)
    #1 0x7fdb1ebbb6a0 in __talloc_with_prefix ../../lib/talloc/talloc.c:783
    #2 0x7fdb1ebbcf75 in __talloc ../../lib/talloc/talloc.c:825
    #3 0x7fdb1ebbcf75 in _talloc_named_const ../../lib/talloc/talloc.c:982
    #4 0x7fdb1ebbcf75 in _talloc_zero ../../lib/talloc/talloc.c:2421
    #5 0x7fdb1cfd1b25 in idr_pre_get ../../lib/util/idtree.c:98
    #6 0x7fdb1cfd1b25 in idr_get_new_above_int ../../lib/util/idtree.c:202
    #7 0x7fdb1cfd2c30 in idr_get_new_above ../../lib/util/idtree.c:368
    #8 0x7fdb1de3246f in map_smb2_handle_to_fnum ../../source3/libsmb/cli_smb2_fnum.c:95
    #9 0x7fdb1de3246f in cli_smb2_create_fnum_done ../../source3/libsmb/cli_smb2_fnum.c:438
    #10 0x7fdb1dbaca05 in _tevent_req_notify_callback ../../lib/tevent/tevent_req.c:177
    #11 0x7fdb1dbacc3c in tevent_req_finish ../../lib/tevent/tevent_req.c:234
    #12 0x7fdb1dbacca4 in _tevent_req_done ../../lib/tevent/tevent_req.c:240
    #13 0x7fdb1ed0eb35 in smb2cli_create_done ../../libcli/smb/smb2cli_create.c:483
    #14 0x7fdb1dbaca05 in _tevent_req_notify_callback ../../lib/tevent/tevent_req.c:177
    #15 0x7fdb1dbacc3c in tevent_req_finish ../../lib/tevent/tevent_req.c:234
    #16 0x7fdb1dbacd74 in tevent_req_trigger ../../lib/tevent/tevent_req.c:291
    #17 0x7fdb1dbaad1e in tevent_common_invoke_immediate_handler ../../lib/tevent/tevent_immediate.c:190
    #18 0x7fdb1dbaad5b in tevent_common_loop_immediate ../../lib/tevent/tevent_immediate.c:236
    #19 0x7fdb1dbbe42f in epoll_event_loop_once ../../lib/tevent/tevent_epoll.c:908
    #20 0x7fdb1dbb7787 in std_event_loop_once ../../lib/tevent/tevent_standard.c:110
    #21 0x7fdb1dba7466 in _tevent_loop_once ../../lib/tevent/tevent.c:860
    #22 0x7fdb1dbad082 in tevent_req_poll ../../lib/tevent/tevent_req.c:342
    #23 0x7fdb1eaa93d4 in tevent_req_poll_ntstatus ../../lib/util/tevent_ntstatus.c:109
    #24 0x7fdb1de138bb in cli_list ../../source3/libsmb/clilist.c:1188
    #25 0x000000239f0f in do_list ../../source3/client/client.c:853
    #26 0x00000023a93a in cmd_dir ../../source3/client/client.c:936
    #27 0x00000023f090 in process_stdin ../../source3/client/client.c:6215
    #28 0x00000023f090 in process ../../source3/client/client.c:6269
    #29 0x00000023f090 in main ../../source3/client/client.c:6811
    #30 0x7fdb1ac2b2fa in __libc_start_call_main (/lib64/libc.so.6+0x2b2fa) (BuildId: 8523b213e7586a93ab00f6dd476418b1e521e62c)
    #31 0x7ffd7d5613af  ([stack]+0x3a3af)

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Thu Nov  6 09:58:52 UTC 2025 on atb-devel-224

7 weeks agos3:libsmb: Use a long living context for cli_resolve_path()
Andreas Schneider [Thu, 30 Oct 2025 10:03:35 +0000 (11:03 +0100)] 
s3:libsmb: Use a long living context for cli_resolve_path()

Signed-off-by: Andreas Schneider <asn@samba.org>
v

7 weeks agos3:libsmb: Add a talloc context to the internal data structure
Andreas Schneider [Thu, 30 Oct 2025 09:56:43 +0000 (10:56 +0100)] 
s3:libsmb: Add a talloc context to the internal data structure

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agos3:client: Use a long living memory context for cli_cm_open()
Andreas Schneider [Wed, 29 Oct 2025 14:11:37 +0000 (15:11 +0100)] 
s3:client: Use a long living memory context for cli_cm_open()

This will fix memory leaks with a later commit.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agos3:client: Pass down a talloc context to do_cd()
Andreas Schneider [Wed, 29 Oct 2025 10:21:58 +0000 (11:21 +0100)] 
s3:client: Pass down a talloc context to do_cd()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agos3:client: Pass a talloc context down to cmd_*() functions
Andreas Schneider [Wed, 29 Oct 2025 09:12:29 +0000 (10:12 +0100)] 
s3:client: Pass a talloc context down to cmd_*() functions

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agos3:client: Pass down a talloc context to process_command_string()
Andreas Schneider [Wed, 29 Oct 2025 10:07:08 +0000 (11:07 +0100)] 
s3:client: Pass down a talloc context to process_command_string()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agos3:client: Pass down a talloc context to do_tar_op()
Andreas Schneider [Wed, 29 Oct 2025 10:03:45 +0000 (11:03 +0100)] 
s3:client: Pass down a talloc context to do_tar_op()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agos3:client: Pass down a talloc context to do_message_op()
Andreas Schneider [Wed, 29 Oct 2025 10:00:18 +0000 (11:00 +0100)] 
s3:client: Pass down a talloc context to do_message_op()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agos3:client: Pass down a talloc context to do_host_query()
Andreas Schneider [Wed, 29 Oct 2025 09:58:56 +0000 (10:58 +0100)] 
s3:client: Pass down a talloc context to do_host_query()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agos3:client: Pass down a talloc context to process()
Andreas Schneider [Mon, 27 Oct 2025 14:08:53 +0000 (15:08 +0100)] 
s3:client: Pass down a talloc context to process()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agos3:client: Use a stackframe in process_command_string()
Andreas Schneider [Wed, 29 Oct 2025 09:35:16 +0000 (10:35 +0100)] 
s3:client: Use a stackframe in process_command_string()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agos3:client: Only allocate the stackframe once in process_stdin()
Andreas Schneider [Tue, 28 Oct 2025 09:01:00 +0000 (10:01 +0100)] 
s3:client: Only allocate the stackframe once in process_stdin()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agos3:client: Do not call exit() in cmd_quit()
Andreas Schneider [Wed, 29 Oct 2025 09:13:44 +0000 (10:13 +0100)] 
s3:client: Do not call exit() in cmd_quit()

We want to go through deallocation in the main function.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agos3:client: Always goto out (destructor) in do_cd()
Andreas Schneider [Tue, 28 Oct 2025 09:06:25 +0000 (10:06 +0100)] 
s3:client: Always goto out (destructor) in do_cd()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agos3:client: Make cmd_iosize() static
Andreas Schneider [Wed, 29 Oct 2025 09:25:39 +0000 (10:25 +0100)] 
s3:client: Make cmd_iosize() static

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 weeks agos3-smbd: send notifications for ACL changes
Günther Deschner [Thu, 2 Oct 2025 14:04:42 +0000 (16:04 +0200)] 
s3-smbd: send notifications for ACL changes

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

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Nov  6 02:42:06 UTC 2025 on atb-devel-224

7 weeks agos4-torture: add test for FILE_NOTIFY_CHANGE_SECURITY
Günther Deschner [Sun, 12 Oct 2025 12:25:12 +0000 (14:25 +0200)] 
s4-torture: add test for FILE_NOTIFY_CHANGE_SECURITY

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

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 weeks agowireshark-pidl: Don't warn about unused hfs used in CODE blocks
John Thacker [Sun, 12 Oct 2025 19:18:11 +0000 (15:18 -0400)] 
wireshark-pidl: Don't warn about unused hfs used in CODE blocks

From the Wireshark development branch:

    commit 4f55543f6b6e5c5d15572889a2cac2b0ec28200e
    Author: John Thacker <johnthacker@gmail.com>
    Date:   Fri Oct 10 11:10:13 2025 -0400

        pidl: Check if a hf is used in a CODE block

        If a field declared in a conformance file appears within a custom
        CODE block in the conformance file, don't warn about the hf being
        unused. This theoretically could have false negatives if a field
        is mentioned only in a comment in the CODE block; we'd have to
        remove the comments with something like Regexp::Common before
        searching to avoid that.

        The current conformance files in the Wireshark distribution don't
        have any such false negative cases, but there are dozens of false
        positives prevented by this change.

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Nov  5 11:12:35 UTC 2025 on atb-devel-224

7 weeks agowireshark-pidl: Do not calculate functions replaced by manual code
John Thacker [Sun, 12 Oct 2025 19:14:47 +0000 (15:14 -0400)] 
wireshark-pidl: Do not calculate functions replaced by manual code

From the Wireshark development branch:

    commit d2232d7e51640e0e736d7b8df1b21598a21a1c85
    Author: John Thacker <johnthacker@gmail.com>
    Date:   Fri Oct 10 23:02:58 2025 -0400

        pidl: Do not produce a function that is replaced by MANUAL code

        If a MANUAL directive in a conformance file causes a function not to be
        emitted, do not bother calculating the function that will not be used.
        This is similar to the NOEMIT directive, but has different logic because
        MANUAL only prevents emitting the function for one level of an element
        instead of all the functions and variables. This does not change the
        dissectors produced at all, only skips some unnecessary compilation.

        In particular, the messages when compiling the pidl-dissectors target:

        dnsserver.idl:159: error: Inline arrays not supported
        eventlog.idl:54: error: Inline arrays not supported

        are no longer inaccurately produced. The inline arrays in those two IDL
        files have long been supported through the MANUAL code blocks.

        Expand on the error message to suggest the use of MANUAL directives
        for implementation.

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 weeks agowireshark-pidl: Fix filter names for subcontext length fields
John Thacker [Sun, 12 Oct 2025 19:11:39 +0000 (15:11 -0400)] 
wireshark-pidl: Fix filter names for subcontext length fields

From the Wireshark development branch:

    commit e3d8636109182d7e243eea6216af7f14edda3227
    Author: John Thacker <johnthacker@gmail.com>
    Date:   Thu Oct 9 20:06:43 2025 -0400

        pidl: Fix filter names for subcontext length fields

        The Perl variable $_->{NAME} never exists at the point in the code;
        $e->{NAME} is almost surely intended instead, which makes the subcontext
        length field have the same filter name as the parent field with
        ".subcontext" added.

        This changes a few fields, including making some fields in the same
        struct or union that incorrectly shared a filter name now have unique
        filter names. Also prevents Perl warnings:

        Use of uninitialized value in concatenation (.) or string at /builds/wireshark/wireshark/tools/pid
    l/lib/Parse/Pidl/Wireshark/NDR.pm line 438.

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 weeks agowireshark-pidl: Check for undefined SwitchType first
John Thacker [Sun, 12 Oct 2025 19:07:00 +0000 (15:07 -0400)] 
wireshark-pidl: Check for undefined SwitchType first

From the Wireshark development branch:

    commit edc98c1b537cbd7b8fb35cdb8b61b7dd000a1544
    Author: John Thacker <johnthacker@gmail.com>
    Date:   Thu Oct 9 18:31:35 2025 -0400

        pidl: Check for undefined SwitchType first

        If the switch type is not defined (e.g. in a union with no
        discriminant) check for that first instead of doing a bunch of
        comparisons with an uninitialized scalar variable. Doesn't change
        the dissector results, but prevents a bunch of Perl warnings:

        Use of uninitialized value $t in hash element at /wireshark/tools/pidl/lib/Parse/Pidl/Typelist.pm
    line 194.
        Use of uninitialized value in string eq at /wireshark/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm l
    ine 480.
        Use of uninitialized value in string eq at /wireshark/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm l
    ine 482.
        Use of uninitialized value in string eq at /wireshark/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm l
    ine 484.

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 weeks agowireshark-pidl: Warn appropriately on unsupported switch_is discriminants
John Thacker [Sun, 12 Oct 2025 19:00:35 +0000 (15:00 -0400)] 
wireshark-pidl: Warn appropriately on unsupported switch_is discriminants

From the Wireshark development branch:

    commit 448a0d6a239f3f274d3a3a3a39ea9c6ce7fd2611
    Author: John Thacker <johnthacker@gmail.com>
    Date:   Thu Oct 9 10:18:07 2025 -0400

        pidl: Warn appropriately on unsupported switch_is discriminants

        Microsoft's MIDL supports switch_is discriminants which have limited
        C-language expressions including conditionals, logical, relational,
        and arithmetic expressions. [1] Some of the distributed IDL files include
        such expressions. The current handling in PIDL's Wireshark NDR.pm only
        supports a single identifier (possibly a pointer), which appears to be
        the way it is defined in the original DCE IDL. [2,3]

        In addition, the switch_is discriminant may simply be misspelled or
        otherwise not found when parsing, leading to an empty array reference.
        Test for the empty array in order to produce a helpful warning message
        with the filename and line number, instead of unhelpful Perl warnings.

        This does not provide support for the construct not affect the generated
        dissectors at all, only reduces 4 unclear warnings into a single useful
        warning.

        Before:
        Use of uninitialized value $name in string ne at /home/johnthacker/wireshark/tools/pidl/lib/Parse/
    Pidl/Wireshark/NDR.pm line 516.
        Use of uninitialized value in string eq at /home/johnthacker/wireshark/tools/pidl/lib/Parse/Pidl/W
    ireshark/NDR.pm line 525.
        Use of uninitialized value $name in string ne at /home/johnthacker/wireshark/tools/pidl/lib/Parse/
    Pidl/Wireshark/NDR.pm line 527.
        Use of uninitialized value $name in string ne at /home/johnthacker/wireshark/tools/pidl/lib/Parse/
    Pidl/Wireshark/NDR.pm line 531.

        After:
        drsuapi.idl:828: warning: ctr switch_is discriminant `level|(type<<16)' not found. (Only single id
    entifiers are supported, not expressions as in MIDL.)

        [1] - https://learn.microsoft.com/en-us/windows/win32/midl/switch-is
        [2] - https://pubs.opengroup.org/onlinepubs/9629399/chap4.htm#tagcjh_08_02_12
        [3] - https://pubs.opengroup.org/onlinepubs/9629399/chap4.htm#tagcjh_08_04

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 weeks agowireshark-pidl: Reduce Perl strict warnings
John Thacker [Sun, 12 Oct 2025 18:56:40 +0000 (14:56 -0400)] 
wireshark-pidl: Reduce Perl strict warnings

From the Wireshark git development branch:

    commit 8dee8601776175a6132bef7ab19f36ee3d589d06
    Author: John Thacker <johnthacker@gmail.com>
    Date:   Wed Oct 8 17:15:56 2025 -0400

        pidl: Use has_property to avoid comparing undef with the empty string

        Prevents a bunch of (harmless) warnings when compiling:

        Use of uninitialized value in string eq at /builds/wireshark/wireshark/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm line 521.

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>