[Bug 278595] rc.subr only reads in $_name in rc.conf.d

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 26 Apr 2024 19:47:11 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278595

            Bug ID: 278595
           Summary: rc.subr only reads in $_name in rc.conf.d
           Product: Base System
           Version: 13.3-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: conf
          Assignee: bugs@FreeBSD.org
          Reporter: freebsd@gushi.org

This may also relate to 167822, and 205393.  For us, it hit us when the startup
script for kadmin could not detect that kdc_enable was set in
/etc/rc.conf.d/kdc

Right now, when we have rc.subr load a config, it only loads $_name in
/etc/rc.conf.d -- this means that it cannot source the whole configration tree:

# If a service name was specified, attempt to load
# service-specific configuration
if [ -n "$_name" ] ; then
        for _d in /etc ${local_startup}; do
                _d=${_d%/rc.d}
                if [ -f ${_d}/rc.conf.d/"$_name" ]; then
                        debug "Sourcing ${_d}/rc.conf.d/$_name"
                        . ${_d}/rc.conf.d/"$_name"
                elif [ -d ${_d}/rc.conf.d/"$_name" ] ; then
                        local _rc
                        for _rc in ${_d}/rc.conf.d/"$_name"/* ; do
                                if [ -f "$_rc" ] ; then
                                        debug "Sourcing $_rc"
                                        . "$_rc"
                                fi
                        done
                fi
        done
fi

My proposal is that all files in /etc/rc.conf.d/* should in fact be sourced,
just as we currently read in all of rc.conf, and don't limit it to $name_*.

(I don't have a dog in tha particular way that this is done, so I'm not pushing
a patch, but it seems fairly trivial.

I mentioned this to cy@ in relation to kerberos and was asked to push a PR.

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