Bug 15266 - shares missing from netshareenum response in samba 4.17.4
Summary: shares missing from netshareenum response in samba 4.17.4
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.17.4
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Jule Anger
QA Contact: Samba QA Contact
URL: https://gitlab.com/samba-team/samba/-...
Depends on:
Reported: 2022-12-19 18:27 UTC by Andrew Walker
Modified: 2023-01-26 17:50 UTC (History)
3 users (show)

See Also:

Patches for v4-17-test (8.99 KB, patch)
2022-12-30 12:39 UTC, Stefan Metzmacher
metze: review? (awalker)
asn: review+
Patches for v4-16-test (14.77 KB, patch)
2022-12-30 12:40 UTC, Stefan Metzmacher
metze: review? (awalker)
asn: review+

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Walker 2022-12-19 18:27:25 UTC
Fix for Bug #15243 reloads services from files, resulting in registry shares being stripped from netshareenum responses.
Comment 1 Andrew Walker 2022-12-19 18:29:06 UTC
MR with fix here: https://gitlab.com/samba-team/samba/-/merge_requests/2855
Comment 2 Andrew Walker 2022-12-20 02:59:44 UTC
Gist of fix is to reload registry shares after the aforementioned services reload.
Comment 3 Andrew Walker 2022-12-20 15:33:11 UTC
root@TN3[/]# net conf listshares
Shares are in registry

root@TN3[/]# smbclient -L // -U smbuser%Cats

	Sharename       Type      Comment
	---------       ----      -------
	IPC$            IPC       IPC Service (TrueNAS Server)
SMB1 disabled -- no workgroup available
Shares are not in netshareenum response
Comment 4 Jeremy Allison 2022-12-25 02:03:13 UTC
We probably need to add a regression test for this, to make sure we don't break it again. I'll take a look after the Christmas holidays.
Comment 5 Stefan Metzmacher 2022-12-28 12:19:47 UTC
The regression is not limited to registry shares, it also happens
if the smb.conf is not (world) readable. Which means the reload of the smb.conf
is also not possible.

As a fix we should avoid a full reload_services(), because it is designed to
be an smbd function, which has a lot of side effects, e.g. it tries to reopen the log files, which we don't want in the rpcd_classic, it should just use log.rpcd_classic
Comment 6 Andrew Walker 2022-12-28 14:12:33 UTC
Okay. Do we maybe just need to replace reload_services() with lp_load_with_registry_shares()?
Comment 7 Stefan Metzmacher 2022-12-28 15:44:25 UTC
(In reply to Andrew Walker from comment #6)

Yes, and move some stuff around in order to do everything as root.

I've pushed my version to the merge request
Comment 8 Andrew Walker 2022-12-28 15:49:56 UTC
(In reply to Stefan Metzmacher from comment #7)
Great. Thanks for doing that!
Comment 9 Samba QA Contact 2022-12-29 21:15:19 UTC
This bug was referenced in samba master:

Comment 10 Stefan Metzmacher 2022-12-30 12:39:28 UTC
Created attachment 17712 [details]
Patches for v4-17-test
Comment 11 Stefan Metzmacher 2022-12-30 12:40:05 UTC
Created attachment 17713 [details]
Patches for v4-16-test
Comment 12 Andreas Schneider 2023-01-10 07:21:42 UTC
Jule, please apply the patches to the corresponding branches. Thanks!
Comment 13 Jule Anger 2023-01-13 09:23:36 UTC
Pushed to autobuild-v4-{17,16}-test.
Comment 14 Samba QA Contact 2023-01-13 10:32:28 UTC
This bug was referenced in samba v4-16-test:

Comment 15 Samba QA Contact 2023-01-13 11:57:35 UTC
This bug was referenced in samba v4-17-test:

Comment 16 Jule Anger 2023-01-13 12:14:10 UTC
Closing out bug report.

Comment 17 Samba QA Contact 2023-01-26 17:50:38 UTC
This bug was referenced in samba v4-17-stable (Release samba-4.17.5):