diff --git a/nss-mdns.spec b/nss-mdns.spec index ea08145..3df9a68 100644 --- a/nss-mdns.spec +++ b/nss-mdns.spec @@ -1,6 +1,6 @@ Name: nss-mdns Version: 0.15.1 -Release: 3%{?dist} +Release: 3.1%{?dist} Summary: glibc plugin for .local name resolution License: LGPLv2+ @@ -42,10 +42,51 @@ rm -rf $RPM_BUILD_ROOT %{?ldconfig} %posttrans -authselect enable-feature with-mdns4 &> /dev/null || : +function mod_nss() { + if [ -f "$1" ] ; then + # sed-fu to add mdns4_minimal to the hosts line of /etc/nsswitch.conf + sed -i.bak ' + /^hosts:/ !b + /\/ b + s/\<\(files\( myhostname\)\?[[:blank:]]\+\)/\1mdns4_minimal [NOTFOUND=return] /g + ' "$1" + fi +} + +FILE="$(readlink /etc/nsswitch.conf || echo /etc/nsswitch.conf)" +if [ "$FILE" = "/etc/authselect/nsswitch.conf" ] && authselect check &>/dev/null; then + mod_nss "/etc/authselect/user-nsswitch.conf" + authselect apply-changes &> /dev/null || : +else + mod_nss "$FILE" + # also apply the same changes to user-nsswitch.conf to affect + # possible future authselect configuration + mod_nss "/etc/authselect/user-nsswitch.conf" +fi %preun -authselect disable-feature with-mdns4 &> /dev/null || : +function mod_nss() { + if [ -f "$1" ] ; then + # sed-fu to remove mdns4_minimal from the hosts line of /etc/nsswitch.conf + sed -i.bak ' + /^hosts:/ !b + s/[[:blank:]]\+mdns\(4\|6\)\?\(_minimal\( \[NOTFOUND=return\]\)\?\)\?//g + ' "$1" + fi +} + +if [ "$1" -eq 0 ] ; then + FILE="$(readlink /etc/nsswitch.conf || echo /etc/nsswitch.conf)" + if [ "$FILE" = "/etc/authselect/nsswitch.conf" ] && authselect check &>/dev/null; then + mod_nss "/etc/authselect/user-nsswitch.conf" + authselect apply-changes &> /dev/null || : + else + mod_nss "$FILE" + # also apply the same changes to user-nsswitch.conf to affect + # possible future authselect configuration + mod_nss "/etc/authselect/user-nsswitch.conf" + fi +fi %ldconfig_postun @@ -57,6 +98,9 @@ authselect disable-feature with-mdns4 &> /dev/null || : %changelog +* Tue Nov 16 2021 Pavel Březina - 0.15.1-3.1 +- authselect is too old in RHEL, switch scripts back (#2113979) + * Tue Nov 16 2021 Pavel Březina - 0.15.1-3 - Rely only on authselect for nsswitch.conf changes (#2023745)