Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jun 2021 18:04:19 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 209660] net/samba4*: samba_server service file force runs all daemons if called with 'onestart'
Message-ID:  <bug-209660-7788-g9WJUmXVgh@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-209660-7788@https.bugs.freebsd.org/bugzilla/>
References:  <bug-209660-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D209660

--- Comment #3 from Emrion <kmachine@free.fr> ---
I eventually wrote a patch to get the same behaviour, whether samba_server =
is
started by 'start' or 'onestart' command.

The idea is that the variable $samba_daemons should contain only the daemon
names it is supposed to start (mainly depending on rc.conf values). I follo=
wed
all the indications I found in the code and it seems to work. In some way, =
the
code of samba_server_config_init() is even simplified.

The patch is applicable at least for samba412 & 413. Seems the code of this
script hasn't changed since long time.

Applying this patch, you get this:

--------------------------
samba_server_defaultyes()
{
    load_rc_config $1
    eval ${1}_enable=3D\${${1}_enable-YES}
    if checkyesno ${1}_enable; then
        samba_daemons=3D"$samba_daemons $1"
    fi
}

samba_server_config_init() {
    # Load configuration
    load_rc_config "${name}"
    # Defaults
    samba_server_enable=3D${samba_server_enable:=3DNO}
    samba_server_config=3D${samba_server_config=3D${samba_server_config_def=
ault}}
=20=20=20
samba_server_configfile_arg=3D${samba_server_config:+--configfile=3D"${samb=
a_server_config}"}
                  #"
    #testparm_command=3D"/usr/local/bin/samba-tool testparm --suppress-prom=
pt
--verbose ${samba_server_configfile_arg}"
    testparm_command=3D"/usr/local/bin/testparm --suppress-prompt --verbose
${samba_server_config}"
    # Determine what daemons are necessary to run Samba in the current role
    samba_server_role=3D$(${testparm_command} --parameter-name=3D'server ro=
le'
2>/dev/null)
    case "${samba_server_role}" in
        active\ directory\ domain\ controller)
            samba_server_defaultyes "samba"
            ;;
        auto|*)
            samba_server_defaultyes "nmbd"
            samba_server_defaultyes "smbd"=20=20=20=20
            # Winbindd will be active if it's set to "YES" in rc.conf
            # or if 'idmap id' is defined in smb4.conf
            load_rc_config "winbindd"
            samba_server_idmap=3D$(${testparm_command} --parameter-name=3D'=
idmap
uid' 2>/dev/null)
            if [ -n "${samba_server_idmap}" ]; then
                    winbindd_enable=3D"YES"
            fi
            if [ -n "$winbindd_enable" ] && checkyesno winbindd_enable; then
                samba_daemons=3D"${samba_daemons} winbindd"
            fi
            ;;
    esac
    # Fetch parameters from configuration file
    samba_server_lockdir=3D"$(${testparm_command} --parameter-name=3D'lock
directory' 2>/dev/null)"
    samba_server_lockdir=3D${samba_server_lockdir:=3D/var/db/samba4}
    samba_server_piddir=3D"$(${testparm_command} --parameter-name=3D'pid di=
rectory'
2>/dev/null)"
    samba_server_piddir=3D${samba_server_piddir:=3D/var/run/samba4}
    samba_server_privatedir=3D"$(${testparm_command} --parameter-name=3D'pr=
ivate
dir' 2>/dev/null)"
    samba_server_privatedir=3D${samba_server_privatedir:=3D/var/db/samba4/p=
rivate}
}
--------------------------

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-209660-7788-g9WJUmXVgh>