Bug 257188

Summary: net/samba4*: samba_server service file force runs all daemons if called with 'onestart'
Product: Ports & Packages Reporter: Emrion <kmachine>
Component: Individual Port(s)Assignee: Mateusz Piotrowski <0mp>
Status: In Progress ---    
Severity: Affects Some People CC: 0mp, kmachine, miwi, ports-bugs, samba, timur, vlad-fbsd, zurvan.akarana
Priority: --- Keywords: needs-qa
Version: LatestFlags: linimon: maintainer-feedback? (samba)
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch to get the same behavour with start or onestart command none

Description Emrion 2021-07-14 16:57:45 UTC
+++ This bug was initially created as a clone of Bug #209660 +++

This clause in /usr/local/etc/rc.d/samba_server (lines 120-122):

>     if [ -n "${_rc_prefix}" -a "${_rc_prefix}" = "one" ] || [ -n "${rc_force}" ] || [ -n "${rc_fast}" ]; then
>         force_run=yes
>     fi

forces nmbd and winbindd to be started regardless of the values of nmbd_enable and winbindd_enable in /etc/rc.conf.

If one wants to start samba_server manually (without having set samba_server_enable="YES") after boot they have no option but to use 'onestart' but then that will ignore disabling of nmbd and winbindd in rc.conf; even in situations where 'disable netbios = yes' is explicitly set in smb4.conf.

This leaves one with no option to start only smbd manually after boot without forcibly launching nmbd and winbindd which many not be desired in some scenarios.

This was checked with samba_server script shipped with samba41-4.1.22_2.
Comment 1 Emrion 2021-07-14 17:00:53 UTC
Created attachment 226466 [details]
patch to get the same behavour with start or onestart command
Comment 2 Emrion 2021-07-14 17:04:44 UTC
(In reply to Emrion from comment #1)
This patch is intended to be applied on /usr/local/etc/rc.d/samba_server
Comment 3 Mateusz Piotrowski freebsd_committer freebsd_triage 2024-10-21 14:56:46 UTC
Thank you for bringing this patch to our attention, Mark!
Comment 4 Mateusz Piotrowski freebsd_committer freebsd_triage 2024-10-21 15:00:57 UTC
Note: The patch does not apply cleanly against net/samba419 anymore. We'll need to do some extra work before we can commit it.
Comment 5 Emrion 2024-10-21 16:11:10 UTC
Indeed, it's a little old. :-)
It was intended for Samba 410 at this time.
Happy to contribute to this port.
Comment 6 Mateusz Piotrowski freebsd_committer freebsd_triage 2024-10-21 17:04:56 UTC
(In reply to Emrion from comment #5)
That would be amazing :) I'll be happy to review the patch.