Sync from SUSE:SLFO:Main nss-mdns revision 7d03bc0512417f9212c672502d4ec7c8

This commit is contained in:
Adrian Schröter 2024-05-03 17:06:10 +02:00
commit 5847a0af08
6 changed files with 547 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

3
baselibs.conf Normal file
View File

@ -0,0 +1,3 @@
nss-mdns
requires "nss-mdns = <version>"
supplements "packageand(nss-mdns:glibc-<targettype>)"

BIN
nss-mdns-0.15.1.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

244
nss-mdns-config Normal file
View File

@ -0,0 +1,244 @@
#!/bin/sh
# vim: set ts=2 sw=2 et:
#
# Copyright (c) 2012, Novell, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the <ORGANIZATION> nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#
# (Licensed under the simplified BSD license)
#
# Authors: Vincent Untz <vuntz@opensuse.org>
#
NSSWITCH=/etc/nsswitch.conf
NSSWITCH_VENDOR=/usr/etc/nsswitch.conf
usage() {
echo "nss-mdns-config [--enable|--disable] [-4|-6] [--no-backup]"
}
ENABLE=0
DISABLE=0
IPv4=0
IPv6=0
IPvALL=0
BACKUP=1
while test $# -gt 0; do
case "$1" in
--enable) ENABLE=1; shift;;
--disable) DISABLE=1; shift;;
-4) IPv4=1; shift;;
-6) IPv6=1; shift;;
--no-backup) BACKUP=0; shift;;
*) usage; exit 1;;
esac
done
if test "$ENABLE" -eq 1 -a "$DISABLE" -eq 1; then
usage
exit 1
fi
if test "$IPv4" -eq 1 -a "$IPv6" -eq 1; then
# Supporting -4 and -6 at the same time would make --enable more complex,
# since we'd like it to add both mdns4_minimal and mdns6_minimal. So just
# don't do it for now.
usage
exit 1
fi
if test "$IPv4" -ne 1 -a "$IPv6" -ne 1; then
IPv4=1
IPv6=1
IPvALL=1
fi
if test ! -f "$NSSWITCH" && test ! -f "$NSSWITCH_VENDOR"; then
if test "$ENABLE" -ne 1 -a "$DISABLE" -ne 1; then
echo "No $NSSWITCH file."
fi
exit 0
fi
if test ! -f "$NSSWITCH"; then
NSSWITCH_IN=$NSSWITCH_VENDOR
else
NSSWITCH_IN=$NSSWITCH
fi
HOSTS=$(grep -m1 "^\s*hosts:" "$NSSWITCH_IN")
if test $? -ne 0; then
echo "No hosts configuration in $NSSWITCH."
exit 0
fi
VALUE=$(echo $HOSTS | sed "s/^\s*hosts:\s*//g")
if test "$ENABLE" -ne 1 -a "$DISABLE" -ne 1; then
IPv4_ENABLED=0
IPv6_ENABLED=0
ENABLED=0
for ITEM in $VALUE; do
if [ "$ITEM" = "mdns4_minimal" -o "$ITEM" = "mdns4" ]; then
IPv4_ENABLED=1
elif [ "$ITEM" = "mdns6_minimal" -o "$ITEM" = "mdns6" ]; then
IPv6_ENABLED=1
elif [ "$ITEM" = "mdns_minimal" -o "$ITEM" = "mdns" ]; then
ENABLED=1
fi
done
if test "$ENABLED" -eq 1; then
echo "Full support for nss-mdns is enabled."
elif test "$IPv4_ENABLED" -eq 1 -a "$IPv6_ENABLED" -eq 1; then
echo "Support for nss-mdns is enabled for IPv4 and IPv6."
elif test "$IPv4_ENABLED" -eq 1; then
echo "Support for nss-mdns is enabled for IPv4."
elif test "$IPv6_ENABLED" -eq 1; then
echo "Support for nss-mdns is enabled for IPv6."
else
echo "Support for nss-mdns is disabled."
fi
elif test "$DISABLE" -eq 1; then
NEWVALUE=""
DROPACTION=0
for ITEM in $VALUE; do
if [ "$ITEM" = "mdns4_minimal" -o "$ITEM" = "mdns4" ] && [ "$IPv4" -eq 1 ]; then
DROPACTION=1
elif [ "$ITEM" = "mdns6_minimal" -o "$ITEM" = "mdns6" ] && [ "$IPv6" -eq 1 ]; then
DROPACTION=1
elif [ "$ITEM" = "mdns_minimal" -o "$ITEM" = "mdns" ]; then
if test "$IPvALL" -eq 1; then
DROPACTION=1
elif test "$IPv4" -eq 1; then
NEWVALUE="$NEWVALUE `echo $ITEM | sed 's:mdns:mdns6:'`"
DROPACTION=0
elif test "$IPv6" -eq 1; then
NEWVALUE="$NEWVALUE `echo $ITEM | sed 's:mdns:mdns4:'`"
DROPACTION=0
else
echo "Internal error when disabling $ITEM."
exit 1
fi
elif [ "${ITEM#[}" != "$ITEM" -a "$DROPACTION" -eq 1 ]; then
DROPACTION=0
else
NEWVALUE="$NEWVALUE $ITEM"
DROPACTION=0
fi
done
NEWVALUE=$(echo $NEWVALUE | sed "s/^\s*//;s/^\s*$//")
if test "$NSSWITCH_IN" = "$NSSWITCH_VENDOR"; then
cp -a "$NSSWITCH_IN" "$NSSWITCH"
elif test "$BACKUP" -eq 1; then
cp -a "$NSSWITCH" "${NSSWITCH}bak"
fi
sed -i "s/\(^\s*hosts:\s*\).*/\1$NEWVALUE/" "$NSSWITCH"
elif test "$ENABLE" -eq 1; then
NEWVALUE=""
FOUND=0
FOUND_DNS=0
DROPACTION=0
for ITEM in $VALUE; do
if [ "$ITEM" = "mdns_minimal" -o "$ITEM" = "mdns4_minimal" -o "$ITEM" = "mdns6_minimal" ]; then
if test "$FOUND_DNS" -eq 1; then
# don't keep *_minimal after dns; it's not desired there
DROPACTION=1
else
if [ "$IPvALL" -eq 1 ] && [ "$ITEM" = "mdns4_minimal" -o "$ITEM" = "mdns6_minimal" ]; then
# no need to keep mdns[46]_minimal since we'll add mdns_minimal
DROPACTION=1
else
if [ "$ITEM" = "mdns_minimal" ]; then
FOUND=1
elif [ "$ITEM" = "mdns4_minimal" -a "$IPv4" -eq 1 ]; then
FOUND=1
elif [ "$ITEM" = "mdns6_minimal" -a "$IPv6" -eq 1 ]; then
FOUND=1
fi
# force the use of [NOTFOUND=return] after *_minimal
NEWVALUE="$NEWVALUE $ITEM [NOTFOUND=return]"
DROPACTION=1
fi
fi
elif [ "$ITEM" = "mdns" -o "$ITEM" = "mdns4" -o "$ITEM" = "mdns6" ]; then
# we simply don't use the non-minimal version in our setup, so drop it
DROPACTION=1
elif [ "$ITEM" = "dns" ]; then
FOUND_DNS=1
DROPACTION=0
if test "$FOUND" -ne 1; then
FOUND=1
if test "$IPvALL" -eq 1; then
NEWVALUE="$NEWVALUE mdns_minimal [NOTFOUND=return] $ITEM"
elif test "$IPv4" -eq 1; then
NEWVALUE="$NEWVALUE mdns4_minimal [NOTFOUND=return] $ITEM"
elif test "$IPv6" -eq 1; then
NEWVALUE="$NEWVALUE mdns6_minimal [NOTFOUND=return] $ITEM"
else
echo "Internal error when enabling."
exit 1
fi
else
NEWVALUE="$NEWVALUE $ITEM"
fi
elif [ "${ITEM#[}" != "$ITEM" -a "$DROPACTION" -eq 1 ]; then
DROPACTION=0
else
NEWVALUE="$NEWVALUE $ITEM"
DROPACTION=0
fi
done
if test "$FOUND_DNS" -ne 1; then
echo "No dns service for hosts configuration in $NSSWITCH."
exit 0
fi
NEWVALUE=$(echo $NEWVALUE | sed "s/^\s*//;s/^\s*$//")
if test "$NSSWITCH_IN" = "$NSSWITCH_VENDOR"; then
cp -a "$NSSWITCH_IN" "$NSSWITCH"
elif test "$BACKUP" -eq 1; then
cp -a "$NSSWITCH" "${NSSWITCH}bak"
fi
sed -i "s/\(^\s*hosts:\s*\).*/\1$NEWVALUE/" "$NSSWITCH"
fi

183
nss-mdns.changes Normal file
View File

@ -0,0 +1,183 @@
-------------------------------------------------------------------
Sun Dec 4 14:15:39 UTC 2022 - Dirk Müller <dmueller@suse.com>
- Update to version 0.15.1:
+ Updated README.md for clarity
+ The return of BSD support!
+ Support for `AVAHI_SOCKET` in `/run` (instead of legacy
`/var/run`).
-------------------------------------------------------------------
Tue May 19 10:48:50 UTC 2020 - Andreas Schwab <schwab@suse.de>
- nss-mdns-config: Use /usr/etc/nsswitch.conf as input if
/etc/nsswitch.conf doesn't exist yet
-------------------------------------------------------------------
Thu Apr 18 18:12:46 UTC 2019 - Jan Engelhardt <jengelh@inai.de>
- Move libraries into the standard dir (/usr/lib*).
nss_winbind already lives there, which I take as an indicator
this move will work.
-------------------------------------------------------------------
Thu Mar 28 20:11:00 UTC 2019 - Bjørn Lie <bjorn.lie@gmail.com>
- Update to version 0.14.1:
+ No code changes.
+ Fix unit tests to properly work on s390x.
- Changes from version 0.14.0:
+ Fix -Wformat-truncation problem during reading of the allow
file.
- Changes from version 0.13.2:
+ No code changes.
+ Change how ./configure --enable/disable-tests works:
- --enable-tests: tests are enabled and will fail if
dependencies are not found.
- --disable-tests: tests are not enabled and will not be built
even if dependencies are found.
- no flag given: tests are conditionally enabled if
dependencies are found.
- Changes from version 0.13.1:
+ Very minor code changes (should result in no binary changes).
+ Reformat source to 80 columns.
+ Improve configure options to allow disabling tests even if the
testing libraries are present.
+ Automake is now non-recursive.
+ Hardcoded paths are now exposed as configure variables.
- Changes from version 0.13:
+ Fix an old memory leak in reverse lookup.
+ Fix the broken workaround for nscd segfaults (not all clients
would see all results).
+ Simplify buffer management.
+ More unit tests, more cleanups, and fewer gotos.
- Changes from version 0.12:
+ Fix segfault when using nscd.
+ Remove untested, unmaintained BSD support (please help out if
you would like BSD support to return!).
- Changes from version 0.11:
+ Moved to new GitHub location, docs migrated to markdown.
+ The long-deprecated LEGACY mode is removed.
+ The long-deprecated HONOUR_SEARCH_DOMAINS option is removed.
+ Unit tests are now included, with make check.
+ nss-mdns now implements standard heuristics for detecting
.local unicast resolution and will automatically disable
resolution when a local server responds to .local requests.
+ _nss_mdns_gethostbyname3_r and _nss_mdns_gethostbyname4_r are
now implemented.
+ Full dual-stack IPv4/IPv6 support is implemented.
- Run spec-cleaner, modernize spec.
- Update URL and Source to new upstream home.
- Drop unaligned.diff: Fixed upstream.
- Add pkgconfig(check) BuildRequires and make_check macro, run
buildtime tests.
-------------------------------------------------------------------
Wed Feb 28 16:37:57 UTC 2018 - dimstar@opensuse.org
- Modernize spec-file by calling spec-cleaner
-------------------------------------------------------------------
Sat Oct 18 20:14:00 UTC 2014 - Led <ledest@gmail.com>
- Fix bashisms in nss-mdns-config.
-------------------------------------------------------------------
Mon Apr 15 13:34:44 UTC 2013 - idonmez@suse.com
- Add Source URL, see https://en.opensuse.org/SourceUrls
-------------------------------------------------------------------
Wed Jul 11 13:37:10 CEST 2012 - vuntz@opensuse.org
- Add nss-mdns-config script as a source, and install it in
/usr/sbin: this script can be used to enable/disable mdns in
/etc/nsswitch.conf (-4/-6 can be used to restrict
enabling/disabling to IPv4/IPv6).
- Change %post/%preun scriptlets to use new nss-mdns-config script
instead of custom perl-fu.
- Do not restrict mdns support in /etc/nsswitch.conf to IPv4: just
pass --enable to nss-mdns-config in %post. Fix bnc#710231.
- Only call nss-mdns-config in %post on first install, to avoid
overwriting changes done by users. Fix nss-mdns side of
bnc#729796.
- Do not call sed to change /etc/nsswitch.conf to remove services
not provided by nss-mdns anymore: when we need this, we'll be
able to integrate this in nss-mdns-config.
-------------------------------------------------------------------
Tue Dec 15 22:28:46 CET 2009 - jengelh@medozas.de
- Add baselibs.conf as a source
-------------------------------------------------------------------
Fri May 1 03:32:54 CEST 2009 - vuntz@novell.com
- Remove AutoReqProv: it's default now.
- Also fix a typo in the description.
-------------------------------------------------------------------
Mon Oct 13 12:49:02 CEST 2008 - ro@suse.de
- simplify and correct baselibs.conf
-------------------------------------------------------------------
Wed May 28 15:49:14 CEST 2008 - olh@suse.de
- change the recommends for XXbit packages to a supplements
add a Conflicts: != version to the XXbit packages, to give a hint
during manual package upgrades (bnc#336678)
-------------------------------------------------------------------
Tue Apr 22 10:08:38 CEST 2008 - coolo@suse.de
- degrading the requires to recommends. It's very well possible
to install a system with just 64bit
-------------------------------------------------------------------
Thu Apr 10 12:54:45 CEST 2008 - ro@suse.de
- added baselibs.conf file to build xxbit packages
for multilib support
-------------------------------------------------------------------
Thu Apr 3 07:00:56 CEST 2008 - hpj@suse.de
- Upgraded to version 0.10:
* Ported to FreeBSD.
* Alignment fixes for SPARC.
-------------------------------------------------------------------
Tue Sep 11 00:36:14 CEST 2007 - ro@suse.de
- modify last change:
- require 32bit variant on x86_64 and s390x
- require 64bit variant on ppc
-------------------------------------------------------------------
Mon Sep 10 16:19:55 CEST 2007 - sbrabec@suse.cz
- Fixed invalid dependency for bi-arch (#309193).
-------------------------------------------------------------------
Thu Sep 6 22:27:24 CEST 2007 - mauro@suse.de
- Sync the spec with the scripts in the comment #6 of bnc #287583
-------------------------------------------------------------------
Thu Sep 6 01:25:07 CEST 2007 - mauro@suse.de
- The 64 bit version of nss-mdns will require the -32 version to
bugfix bnc #287583.
-------------------------------------------------------------------
Sat Apr 21 10:51:20 CEST 2007 - schwab@suse.de
- Fix unaligned access.
-------------------------------------------------------------------
Tue Feb 20 17:58:09 CET 2007 - sbrabec@suse.cz
- New SuSE package, version 0.9.

91
nss-mdns.spec Normal file
View File

@ -0,0 +1,91 @@
#
# spec file for package nss-mdns
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: nss-mdns
Version: 0.15.1
Release: 0
Summary: Host Name Resolution Via Multicast DNS (Zeroconf) for glibc
License: LGPL-2.1-or-later
Group: Productivity/Networking/DNS/Utilities
URL: https://github.com/lathiat/nss-mdns
Source0: https://github.com/lathiat/nss-mdns/releases/download/v%{version}/nss-mdns-%{version}.tar.gz
Source1: nss-mdns-config
Source2: baselibs.conf
BuildRequires: pkgconfig
BuildRequires: pkgconfig(check)
Requires: avahi
# FIXME: use proper Requires(pre/post/preun/...)
PreReq: grep
# needed by nss-mdns-config
PreReq: sed
%description
nss-mdns is a plug-in for the GNU Name Service Switch (NSS)
functionality of the GNU C Library (glibc) providing a hostname
resolution via Multicast DNS (aka Zeroconf, aka Apple Rendezvous, aka
Apple Bonjour), and effectively allowing name resolution by common
Unix/Linux programs in the ad-hoc mDNS domain .local.
nss-mdns provides only client functionality, which means that you have
to run a mDNS responder daemon separately from nss-mdns if you want to
register the local hostname via mDNS. I recommend Avahi.
By default, nss-mdns tries to contact a running avahi-daemon to resolve
hostnames and addresses and makes use of its superior record cacheing.
%prep
%autosetup -p1
%build
%configure
%make_build
%install
%make_install
install -D -m0755 %{SOURCE1} %{buildroot}%{_sbindir}/nss-mdns-config
%check
make %{?_smp_mflags} check || (cat ./test-suite.log; false)
%post
/sbin/ldconfig
if [ "$1" -eq 1 ] ; then
# Only enable on first install, to not overwrite changes done by users
nss-mdns-config --enable
fi
%preun
if [ "$1" -eq 0 ] ; then
# Completely disable when not upgrading (ie, fully uninstalling)
nss-mdns-config --disable
fi
%postun -p /sbin/ldconfig
%files
%license LICENSE
%doc README.md NEWS.md ACKNOWLEDGEMENTS.md
%{_sbindir}/nss-mdns-config
%{_libdir}/libnss_mdns.so.2
%{_libdir}/libnss_mdns_minimal.so.2
%{_libdir}/libnss_mdns4.so.2
%{_libdir}/libnss_mdns4_minimal.so.2
%{_libdir}/libnss_mdns6.so.2
%{_libdir}/libnss_mdns6_minimal.so.2
%changelog