Bug 15266 - shares missing from netshareenum response in samba 4.17.4
Summary: shares missing from netshareenum response in samba 4.17.4
Status: RESOLVED FIXED
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/-...
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-19 18:27 UTC by Andrew Walker
Modified: 2023-02-16 16:37 UTC (History)
3 users (show)

See Also:


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

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
global
SHARE
mnt
EXT
SMBPROTO
```
Shares are in registry

```
root@TN3[/]# smbclient -L //127.0.0.1 -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:

a00c7395fbc7974a61a70ae54ea6ae6349933de2
f28553105be7465026bcc0fcbbed6a1a8c2133dd
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:

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

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

Thanks!
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):

658a590b3532ffab79d463d28749a480b923384e
a8934a92f1a166fb66e247b9fb2be5758f1a91fc
b1d5552f2e2808db3eeb1e3492df87be12e6b99b
Comment 18 Samba QA Contact 2023-02-16 16:37:49 UTC
This bug was referenced in samba v4-16-stable (Release samba-4.16.9):

cf2643e0209a080801daa6feb00a21a9bd5825b7
ccb8abb0e727941cb0b22cc55b2190644df81396
6434e2df11e7b5ee1d3dc11f35575808a1e6b50a