Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package nss-mdns for openSUSE:Factory checked in at 2022-12-07 17:33:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/nss-mdns (Old) and /work/SRC/openSUSE:Factory/.nss-mdns.new.1835 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "nss-mdns" Wed Dec 7 17:33:34 2022 rev:30 rq:1040189 version:0.15.1 Changes: -------- --- /work/SRC/openSUSE:Factory/nss-mdns/nss-mdns.changes 2020-05-26 17:15:08.347432551 +0200 +++ /work/SRC/openSUSE:Factory/.nss-mdns.new.1835/nss-mdns.changes 2022-12-07 17:33:55.636198201 +0100 @@ -1,0 +2,9 @@ +Sun Dec 4 14:15:39 UTC 2022 - Dirk Müller <dmuel...@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`). + +------------------------------------------------------------------- Old: ---- nss-mdns-0.14.1.tar.gz New: ---- nss-mdns-0.15.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nss-mdns.spec ++++++ --- /var/tmp/diff_new_pack.7C2pv6/_old 2022-12-07 17:33:57.220206874 +0100 +++ /var/tmp/diff_new_pack.7C2pv6/_new 2022-12-07 17:33:57.224206896 +0100 @@ -1,7 +1,7 @@ # # spec file for package nss-mdns # -# Copyright (c) 2020 SUSE LLC +# 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 @@ -17,7 +17,7 @@ Name: nss-mdns -Version: 0.14.1 +Version: 0.15.1 Release: 0 Summary: Host Name Resolution Via Multicast DNS (Zeroconf) for glibc License: LGPL-2.1-or-later ++++++ nss-mdns-0.14.1.tar.gz -> nss-mdns-0.15.1.tar.gz ++++++ ++++ 7506 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nss-mdns-0.14.1/ACKNOWLEDGEMENTS.md new/nss-mdns-0.15.1/ACKNOWLEDGEMENTS.md --- old/nss-mdns-0.14.1/ACKNOWLEDGEMENTS.md 2018-02-13 04:26:52.000000000 +0100 +++ new/nss-mdns-0.15.1/ACKNOWLEDGEMENTS.md 2018-07-21 19:25:23.000000000 +0200 @@ -6,4 +6,4 @@ - Philipp Zabel, for ARM support - Bruce M Simpson, for porting it to FreeBSD - Trent Lloyd, for migrating to GitHub -- Adam Goode (ago...@google.com), for patches +- Google LLC, for patches diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nss-mdns-0.14.1/Makefile.am new/nss-mdns-0.15.1/Makefile.am --- old/nss-mdns-0.14.1/Makefile.am 2018-02-19 16:33:31.000000000 +0100 +++ new/nss-mdns-0.15.1/Makefile.am 2021-06-12 16:51:13.000000000 +0200 @@ -26,6 +26,15 @@ AM_LDFLAGS=-avoid-version -module -export-dynamic +if FREEBSD_NSS +lib_LTLIBRARIES = \ + nss_mdns.la \ + nss_mdns4.la \ + nss_mdns6.la \ + nss_mdns_minimal.la \ + nss_mdns4_minimal.la \ + nss_mdns6_minimal.la +else lib_LTLIBRARIES = \ libnss_mdns.la \ libnss_mdns4.la \ @@ -33,10 +42,12 @@ libnss_mdns_minimal.la \ libnss_mdns4_minimal.la \ libnss_mdns6_minimal.la +endif + check_PROGRAMS = nss-test avahi-test -libnss_mdns_la_SOURCES=src/util.c src/util.h src/avahi.c src/avahi.h src/nss.c +libnss_mdns_la_SOURCES=src/util.c src/util.h src/avahi.c src/avahi.h src/nss.c src/nss.h libnss_mdns_la_CFLAGS=$(AM_CFLAGS) libnss_mdns_la_LDFLAGS=$(AM_LDFLAGS) -shrext .so.2 -Wl,-version-script=$(srcdir)/src/map-file @@ -60,6 +71,30 @@ libnss_mdns6_minimal_la_CFLAGS=$(libnss_mdns_la_CFLAGS) -DNSS_IPV6_ONLY=1 -DMDNS_MINIMAL libnss_mdns6_minimal_la_LDFLAGS=$(libnss_mdns_la_LDFLAGS) +nss_mdns_la_SOURCES=$(libnss_mdns_la_SOURCES) src/bsdnss.c +nss_mdns_la_CFLAGS=$(AM_CFLAGS) +nss_mdns_la_LDFLAGS=$(AM_LDFLAGS) -shrext .so.1 + +nss_mdns_minimal_la_SOURCES=$(nss_mdns_la_SOURCES) +nss_mdns_minimal_la_CFLAGS=$(nss_mdns_la_CFLAGS) -DMDNS_MINIMAL +nss_mdns_minimal_la_LDFLAGS=$(nss_mdns_la_LDFLAGS) + +nss_mdns4_la_SOURCES=$(nss_mdns_la_SOURCES) +nss_mdns4_la_CFLAGS=$(nss_mdns_la_CFLAGS) -DNSS_IPV4_ONLY=1 +nss_mdns4_la_LDFLAGS=$(nss_mdns_la_LDFLAGS) + +nss_mdns4_minimal_la_SOURCES=$(nss_mdns_la_SOURCES) +nss_mdns4_minimal_la_CFLAGS=$(nss_mdns_la_CFLAGS) -DNSS_IPV4_ONLY=1 -DMDNS_MINIMAL +nss_mdns4_minimal_la_LDFLAGS=$(nss_mdns_la_LDFLAGS) + +nss_mdns6_la_SOURCES=$(nss_mdns_la_SOURCES) +nss_mdns6_la_CFLAGS=$(nss_mdns_la_CFLAGS) -DNSS_IPV6_ONLY=1 +nss_mdns6_la_LDFLAGS=$(nss_mdns_la_LDFLAGS) + +nss_mdns6_minimal_la_SOURCES=$(nss_mdns_la_SOURCES) +nss_mdns6_minimal_la_CFLAGS=$(nss_mdns_la_CFLAGS) -DNSS_IPV6_ONLY=1 -DMDNS_MINIMAL +nss_mdns6_minimal_la_LDFLAGS=$(nss_mdns_la_LDFLAGS) + avahi_test_SOURCES = \ src/avahi.c src/avahi.h \ src/util.c src/util.h \ @@ -75,6 +110,8 @@ rm -f $(DESTDIR)$(libdir)/libnss_mdns4_minimal.la rm -f $(DESTDIR)$(libdir)/libnss_mdns6.la rm -f $(DESTDIR)$(libdir)/libnss_mdns6_minimal.la + rm -f $(DESTDIR)$(libdir)/nss_mdns.la + rm -f $(DESTDIR)$(libdir)/nss_mdns_minimal.la uninstall-hook: rm -f $(DESTDIR)$(libdir)/libnss_mdns.so.2 @@ -83,6 +120,8 @@ rm -f $(DESTDIR)$(libdir)/libnss_mdns4_minimal.so.2 rm -f $(DESTDIR)$(libdir)/libnss_mdns6.so.2 rm -f $(DESTDIR)$(libdir)/libnss_mdns6_minimal.so.2 + rm -f $(DESTDIR)$(libdir)/nss_mdns.so.2 + rm -f $(DESTDIR)$(libdir)/nss_mdns_minimal.so.2 # tests diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nss-mdns-0.14.1/NEWS.md new/nss-mdns-0.15.1/NEWS.md --- old/nss-mdns-0.14.1/NEWS.md 2018-03-18 23:29:02.000000000 +0100 +++ new/nss-mdns-0.15.1/NEWS.md 2021-06-12 17:00:39.000000000 +0200 @@ -1,5 +1,23 @@ # News +## Sat Jun 12 2021: + +[Version 0.15.1](https://github.com/lathiat/nss-mdns/releases/tag/v0.15.1) +released. Highlights: + +* This fixes the broken previous release by restoring the missing + `src/nss.h` file. If you are using 0.15, you must upgrade to this + version, or downgrade to a previous one. + +## Mon May 10 2021: + +[Version 0.15](https://github.com/lathiat/nss-mdns/releases/tag/v0.15) +released. Highlights: + +* Updated README.md for clarity +* The return of BSD support! +* Support for `AVAHI_SOCKET` in `/run` (instead of legacy `/var/run`) + ## Sun Mar 18 2018: [Version 0.14.1](https://github.com/lathiat/nss-mdns/releases/tag/v0.14.1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nss-mdns-0.14.1/README.md new/nss-mdns-0.15.1/README.md --- old/nss-mdns-0.14.1/README.md 2018-02-13 04:26:52.000000000 +0100 +++ new/nss-mdns-0.15.1/README.md 2018-07-21 19:25:23.000000000 +0200 @@ -56,6 +56,8 @@ ## Documentation +### Libraries + After compiling and installing `nss-mdns` you'll find six new NSS modules in `/lib`: @@ -89,6 +91,8 @@ creating no extra burden on DNS servers with always failing requests) and use it as fallback for everything else. +### Activation + To activate one of the NSS modules you have to edit `/etc/nsswitch.conf` and add `mdns4` and `mdns4_minimal` (resp. `mdns`, `mdns6`) to the @@ -138,39 +142,60 @@ of labels, (including `.local`) will still be served authoritatively from `nss-mdns` if specified in `/etc/mdns.allow`.) -Starting with version 0.5, `nss-mdns` has a simple -configuration file `/etc/mdns.allow` for enabling name lookups -via mDNS in other domains than `.local`. The file contains -valid domain suffixes, seperated by newlines. Empty lines are ignored -as are comments starting with #. To enable mDNS lookups of all names, -regardless of the domain suffix add a line consisting of `*` -only (similar to `nss-mdns` mode of operation of versions <= 0.4): +### `/etc/mdns.allow` + +`nss-mdns` has a simple configuration file `/etc/mdns.allow` for +enabling name lookups via mDNS in other domains than `.local`. + +> Note: The "minimal" version of `nss-mdns` does not read `/etc/mdns.allow` +> under any circumstances. It behaves as if the file does not exist. + +In the recommended configuration, no `/etc/mdns.allow` file is +present. In this case: + +* If the request does not end with `.local` or `.local.`, it is rejected. + Example: `example.test` is rejected. + +* If the request has more than two labels, it is rejected. Example: + `foo.bar.local` is rejected. **This is the two-label limit heuristic.** + +* If, during a request, the system-configured unicast DNS (specified + in `/etc/resolv.conf`) reports an `SOA` record for the top-level + `local` name, the request is rejected. Example: `host -t SOA local` + returns something other than `Host local not found: + 3(NXDOMAIN)`. **This is the unicast SOA heuristic.** + +* Otherwise, the request is processed. + +If present, the file should contain valid domain suffixes, seperated +by newlines. Empty lines are ignored as are comments starting with +`#`. + +To disable the two heuristics described above, and force all `.local` +domains to be resolved regardless of label count or unicast SOA +records, use this configuration file: ``` # /etc/mdns.allow -* +.local. +.local ``` -If the configuration file is absent or unreadable -`nss-mdns` behaves mostly as if a configuration file with the following -contents is read: +To enable mDNS lookups of all names regardless of the domain suffix +and disabling the two heuristics, add a line consisting of `*` only: ``` # /etc/mdns.allow -.local. -.local +* +``` + +To complete disable mDNS name lookups, use an empty file: +``` +# /etc/mdns.allow ``` -i.e. only hostnames ending with `.local` are resolved via mDNS. Note -that this is not exactly the same as having no such file, since we will -always be authoritative for the entries in the file. (The heuristics -of checking for SOA and requiring two-label names do not apply if the -configuration file is used.) - -If the configuration file is existent but empty, mDNS name lookups are -disabled completely. Please note that usually mDNS is not used for -anything but `.local`, hence you usually don't want to touch this -file. +Again, remember that changing this file has no effect on the "minimal" +version of `nss-mdns`. ## Requirements diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nss-mdns-0.14.1/ar-lib new/nss-mdns-0.15.1/ar-lib --- old/nss-mdns-0.14.1/ar-lib 2018-03-18 23:33:12.000000000 +0100 +++ new/nss-mdns-0.15.1/ar-lib 2021-05-11 03:39:59.000000000 +0200 @@ -2,9 +2,9 @@ # Wrapper for Microsoft lib.exe me=ar-lib -scriptversion=2012-03-01.08; # UTC +scriptversion=2019-07-04.01; # UTC -# Copyright (C) 2010-2017 Free Software Foundation, Inc. +# Copyright (C) 2010-2020 Free Software Foundation, Inc. # Written by Peter Rosin <p...@lysator.liu.se>. # # This program is free software; you can redistribute it and/or modify @@ -18,7 +18,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -53,7 +53,7 @@ MINGW*) file_conv=mingw ;; - CYGWIN*) + CYGWIN* | MSYS*) file_conv=cygwin ;; *) @@ -65,7 +65,7 @@ mingw) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin) + cygwin | msys) file=`cygpath -m "$file" || echo "$file"` ;; wine) @@ -224,10 +224,11 @@ esac done else - $AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member - do - $AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $? - done + $AR -NOLOGO -LIST "$archive" | tr -d '\r' | sed -e 's/\\/\\\\/g' \ + | while read member + do + $AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $? + done fi elif test -n "$quick$replace"; then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nss-mdns-0.14.1/bootstrap.sh new/nss-mdns-0.15.1/bootstrap.sh --- old/nss-mdns-0.14.1/bootstrap.sh 2018-02-13 04:26:52.000000000 +0100 +++ new/nss-mdns-0.15.1/bootstrap.sh 2021-06-12 16:50:20.000000000 +0200 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # This file is part of nss-mdns. # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nss-mdns-0.14.1/compile new/nss-mdns-0.15.1/compile --- old/nss-mdns-0.14.1/compile 2018-03-18 23:33:12.000000000 +0100 +++ new/nss-mdns-0.15.1/compile 2021-05-11 03:39:59.000000000 +0200 @@ -1,9 +1,9 @@ #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. -scriptversion=2016-01-11.22; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2017 Free Software Foundation, Inc. +# Copyright (C) 1999-2020 Free Software Foundation, Inc. # Written by Tom Tromey <tro...@cygnus.com>. # # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -53,7 +53,7 @@ MINGW*) file_conv=mingw ;; - CYGWIN*) + CYGWIN* | MSYS*) file_conv=cygwin ;; *) @@ -67,7 +67,7 @@ mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin/*) + cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) @@ -340,7 +340,7 @@ # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nss-mdns-0.14.1/configure.ac new/nss-mdns-0.15.1/configure.ac --- old/nss-mdns-0.14.1/configure.ac 2018-03-18 23:29:02.000000000 +0100 +++ new/nss-mdns-0.15.1/configure.ac 2021-06-12 16:51:24.000000000 +0200 @@ -18,7 +18,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA AC_PREREQ([2.69]) -AC_INIT([nss-mdns],[0.14.1],[https://github.com/lathiat/nss-mdns/issues]) +AC_INIT([nss-mdns],[0.15.1],[https://github.com/lathiat/nss-mdns/issues]) AC_CONFIG_SRCDIR([src/nss.c]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([foreign 1.9 -Wall subdir-objects]) @@ -55,7 +55,7 @@ AC_ARG_VAR([AVAHI_SOCKET], [Full path to the avahi-daemon socket, overriding default]) AS_IF([test "x$AVAHI_SOCKET" = x], - [AVAHI_SOCKET="${localstatedir}/run/avahi-daemon/socket"]) + [AVAHI_SOCKET="${runstatedir}/avahi-daemon/socket"]) AC_ARG_VAR([MDNS_ALLOW_FILE], [Full path to the mdns.allow file, overriding default]) @@ -84,5 +84,12 @@ AC_SEARCH_LIBS([__res_nquery], [resolv]) AC_CHECK_FUNCS([gethostbyaddr gethostbyname gettimeofday inet_ntoa memset select socket strcspn strdup strerror strncasecmp strcasecmp strspn]) +# FreeBSD has a slightly different NSS interface +case ${host} in + *-freebsd*) freebsd="yes" ;; +esac + +AM_CONDITIONAL([FREEBSD_NSS], [test "x$freebsd" = "xyes"]) + AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nss-mdns-0.14.1/missing new/nss-mdns-0.15.1/missing --- old/nss-mdns-0.14.1/missing 2018-03-18 23:33:12.000000000 +0100 +++ new/nss-mdns-0.15.1/missing 2021-05-11 03:39:59.000000000 +0200 @@ -1,9 +1,9 @@ #! /bin/sh # Common wrapper for a few potentially missing GNU programs. -scriptversion=2016-01-11.22; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2017 Free Software Foundation, Inc. +# Copyright (C) 1996-2020 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard <pin...@iro.umontreal.ca>, 1996. # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -101,9 +101,9 @@ exit $st fi -perl_URL=http://www.perl.org/ -flex_URL=http://flex.sourceforge.net/ -gnu_software_URL=http://www.gnu.org/software +perl_URL=https://www.perl.org/ +flex_URL=https://github.com/westes/flex +gnu_software_URL=https://www.gnu.org/software program_details () { @@ -207,7 +207,7 @@ exit $st # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nss-mdns-0.14.1/src/bsdnss.c new/nss-mdns-0.15.1/src/bsdnss.c --- old/nss-mdns-0.14.1/src/bsdnss.c 1970-01-01 01:00:00.000000000 +0100 +++ new/nss-mdns-0.15.1/src/bsdnss.c 2021-05-11 03:25:39.000000000 +0200 @@ -0,0 +1,374 @@ +/* + This file is part of nss-mdns. + + nss-mdns is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + nss-mdns is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with nss-mdns; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/* Original author: Bruce M. Simpson <b...@freebsd.org> */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <sys/param.h> +#include <sys/types.h> +#include <sys/time.h> +#include <sys/uio.h> +#include <sys/socket.h> +#include <sys/ktrace.h> + +#include <stdarg.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <errno.h> +#include <pwd.h> +#include <grp.h> +#include <nss.h> + +#include <netinet/in.h> +#include <netdb.h> + +#include "avahi.h" +#include "config.h" +#include "util.h" +#include "nss.h" + +#ifdef MDNS_MINIMAL +/* + * FreeBSD support prefers Avahi. + */ +#endif + +/* + * To turn on utrace() records, compile with -DDEBUG_UTRACE. + */ +#ifdef DEBUG_UTRACE +#define _NSS_UTRACE(msg) \ + do { \ + static const char __msg[] = msg; \ + (void)utrace(__msg, sizeof(__msg)); \ + } while (0) +#else +#define _NSS_UTRACE(msg) +#endif + +ns_mtab* nss_module_register(const char* source, unsigned int* mtabsize, + nss_module_unregister_fn* unreg); + +typedef enum nss_status (*_bsd_nsstub_fn_t)(const char*, struct hostent*, char*, + size_t, int*, int*); + +static NSS_METHOD_PROTOTYPE(__nss_bsdcompat_getaddrinfo); +static NSS_METHOD_PROTOTYPE(__nss_bsdcompat_gethostbyaddr_r); +static NSS_METHOD_PROTOTYPE(__nss_bsdcompat_gethostbyname2_r); +static NSS_METHOD_PROTOTYPE(__nss_bsdcompat_ghbyaddr); +static NSS_METHOD_PROTOTYPE(__nss_bsdcompat_ghbyname); + +static ns_mtab methods[] = { + /* database, name, method, mdata */ + {NSDB_HOSTS, "getaddrinfo", __nss_bsdcompat_getaddrinfo, NULL}, + {NSDB_HOSTS, "gethostbyaddr_r", __nss_bsdcompat_gethostbyaddr_r, NULL}, + {NSDB_HOSTS, "gethostbyname2_r", __nss_bsdcompat_gethostbyname2_r, NULL}, + {NSDB_HOSTS, "ghbyaddr", __nss_bsdcompat_ghbyaddr, NULL}, + {NSDB_HOSTS, "ghbyname", __nss_bsdcompat_ghbyname, NULL}, +}; + +ns_mtab* nss_module_register(const char* source, unsigned int* mtabsize, + nss_module_unregister_fn* unreg) { + + *mtabsize = sizeof(methods) / sizeof(methods[0]); + *unreg = NULL; + return (methods); +} + +/* + * Calling convention: + * ap: const char *name (optional), struct addrinfo *pai (hints, optional) + * retval: struct addrinfo ** + * + * name must always be specified by libc; pai is allocated + * by libc and must always be specified. + * + * We can malloc() addrinfo instances and hang them off ai->next; + * canonnames may also be malloc()'d. + * libc is responsible for mapping our ns error return to gai_strerror(). + * + * libc calls us only to look up qualified hostnames. We don't need to + * worry about port numbers; libc will call getservbyname() and explore + * the appropriate maps configured in nsswitch.conf(5). + * + * _errno and _h_errno are unused by getaddrinfo(), as it is + * [mostly] OS independent interface implemented by Win32. + */ +static int __nss_bsdcompat_getaddrinfo(void* retval, void* mdata __unused, + va_list ap) { + enum nss_status status; + int _errno = 0; + int _h_errno = 0; + struct addrinfo sentinel = {0}, *curp = &sentinel; + const char* name; + const struct addrinfo* pai; + struct addrinfo** resultp; + userdata_t u; + + _NSS_UTRACE("__nss_bsdcompat_getaddrinfo: called"); + + name = va_arg(ap, const char*); + pai = va_arg(ap, struct addrinfo*); + resultp = (struct addrinfo**)retval; + + if (name == NULL || pai == NULL) { + *resultp = NULL; + return (NS_UNAVAIL); + } + + extern enum nss_status _nss_mdns_gethostbyname_impl( + const char* name, int af, userdata_t* u, int* errnop, int* h_errnop); + + status = _nss_mdns_gethostbyname_impl(name, pai->ai_family, &u, &_errno, + &_h_errno); + status = __nss_compat_result(status, _errno); + if (status != NS_SUCCESS) { + return (status); + } + + for (int i = 0; i < u.count; i++) { + struct addrinfo* ai = (struct addrinfo*)malloc( + sizeof(struct addrinfo) + sizeof(struct sockaddr_storage)); + if (ai == NULL) { + if (sentinel.ai_next != NULL) + freeaddrinfo(sentinel.ai_next); + *resultp = NULL; + return (NS_UNAVAIL); + } + struct sockaddr* psa = (struct sockaddr*)(ai + 1); + + memset(ai, 0, sizeof(struct addrinfo)); + ai->ai_flags = pai->ai_flags; + ai->ai_socktype = pai->ai_socktype; + ai->ai_protocol = pai->ai_protocol; + ai->ai_family = u.result[i].af; + memset(psa, 0, sizeof(struct sockaddr_storage)); + psa->sa_len = ai->ai_addrlen; + psa->sa_family = ai->ai_family; + ai->ai_addr = psa; + switch (ai->ai_family) { + case AF_INET: + ai->ai_addrlen = sizeof(struct sockaddr_in); + memcpy(&((struct sockaddr_in*)psa)->sin_addr, &u.result[i].address, + ai->ai_addrlen); + break; + case AF_INET6: + ai->ai_addrlen = sizeof(struct sockaddr_in6); + memcpy(&((struct sockaddr_in6*)psa)->sin6_addr, + &u.result[i].address, ai->ai_addrlen); + break; + default: + ai->ai_addrlen = sizeof(struct sockaddr_storage); + memcpy(psa->sa_data, &u.result[i].address, ai->ai_addrlen); + } + + curp->ai_next = ai; + curp = ai; + } + + *resultp = sentinel.ai_next; + return (status); +} + +/* + * Calling convention: + * ap: const u_char *uaddr, socklen_t len, int af, struct hostent *hp, + * char *buf, size_t buflen, int ret_errno, int *h_errnop + * retval: should be set to NULL or hp passed in + */ +static int __nss_bsdcompat_gethostbyaddr_r(void* retval, void* mdata __unused, + va_list ap) { + void* addr; + char* buf; + int* h_errnop; + struct hostent* hp; + struct hostent** resultp; + int af; + size_t buflen; + int len; + int ret_errno; + enum nss_status status; + + addr = va_arg(ap, void*); + len = va_arg(ap, socklen_t); + af = va_arg(ap, int); + hp = va_arg(ap, struct hostent*); + buf = va_arg(ap, char*); + buflen = va_arg(ap, size_t); + ret_errno = va_arg(ap, int); + h_errnop = va_arg(ap, int*); + resultp = (struct hostent**)retval; + + *resultp = NULL; + status = _nss_mdns_gethostbyaddr_r(addr, len, af, hp, buf, buflen, + &ret_errno, h_errnop); + + status = __nss_compat_result(status, *h_errnop); + if (status == NS_SUCCESS) + *resultp = hp; + return (status); +} + +/* + * Calling convention: + * ap: const char *name, int af, struct hostent *hp, char *buf, + * size_t buflen, int ret_errno, int *h_errnop + * retval is a struct hostent **result passed in by the libc client, + * which is responsible for allocating storage. + */ +static int __nss_bsdcompat_gethostbyname2_r(void* retval, void* mdata __unused, + va_list ap) { + char* buf; + const char* name; + int* h_errnop; + struct hostent* hp; + struct hostent** resultp; + int af; + size_t buflen; + int ret_errno; + enum nss_status status; + + name = va_arg(ap, char*); + af = va_arg(ap, int); + hp = va_arg(ap, struct hostent*); + buf = va_arg(ap, char*); + buflen = va_arg(ap, size_t); + ret_errno = va_arg(ap, int); + h_errnop = va_arg(ap, int*); + resultp = (struct hostent**)retval; + + *resultp = NULL; + if (hp == NULL) + return (NS_UNAVAIL); + + status = _nss_mdns_gethostbyname2_r(name, af, hp, buf, buflen, &ret_errno, + h_errnop); + + status = __nss_compat_result(status, *h_errnop); + if (status == NS_SUCCESS) + *resultp = hp; + return (status); +} + +/* + * Used by getipnodebyaddr(3). + * + * Calling convention: + * ap: struct in[6]_addr *src, size_t len, int af, int *errp + * retval: pointer to a pointer to an uninitialized struct hostent, + * in which should be returned a single pointer to on-heap storage. + * + * This function is responsible for allocating on-heap storage. + * The caller is responsible for calling freehostent() on the returned + * storage. + */ +static int __nss_bsdcompat_ghbyaddr(void* retval, void* mdata __unused, + va_list ap) { + char* buffer; + void* bufp; + int* errp; + struct hostent* hp; + struct hostent** resultp; + void* src; + int af; + size_t buflen = 1024; + size_t len; + int h_errnop; + enum nss_status status; + + src = va_arg(ap, void*); + len = va_arg(ap, size_t); + af = va_arg(ap, int); + errp = va_arg(ap, int*); + resultp = (struct hostent**)retval; + + _NSS_UTRACE("__nss_bsdcompat_ghbyaddr: called"); + + bufp = malloc((sizeof(struct hostent) + buflen)); + if (bufp == NULL) { + *resultp = NULL; + return (NS_UNAVAIL); + } + hp = (struct hostent*)bufp; + buffer = (char*)(hp + 1); + + status = _nss_mdns_gethostbyaddr_r(src, len, af, hp, buffer, buflen, errp, + &h_errnop); + + status = __nss_compat_result(status, *errp); + if (status != NS_SUCCESS) { + free(bufp); + hp = NULL; + } + *resultp = hp; + return (status); +} + +/* + * Used by getipnodebyname(3). + * + * Calling convention: + * ap: const char *name, int af, int *errp + * retval: pointer to a pointer to an uninitialized struct hostent. + * + * This function is responsible for allocating on-heap storage. + * The caller is responsible for calling freehostent() on the returned + * storage. + */ +static int __nss_bsdcompat_ghbyname(void* retval, void* mdata __unused, + va_list ap) { + char* buffer; + void* bufp; + int* errp; + struct hostent* hp; + struct hostent** resultp; + char* name; + int af; + size_t buflen = 1024; + int h_errnop; + enum nss_status status; + + name = va_arg(ap, char*); + af = va_arg(ap, int); + errp = va_arg(ap, int*); + resultp = (struct hostent**)retval; + + bufp = malloc((sizeof(struct hostent) + buflen)); + if (bufp == NULL) { + *resultp = NULL; + return (NS_UNAVAIL); + } + hp = (struct hostent*)bufp; + buffer = (char*)(hp + 1); + + status = + _nss_mdns_gethostbyname_r(name, hp, buffer, buflen, errp, &h_errnop); + + status = __nss_compat_result(status, *errp); + if (status != NS_SUCCESS) { + free(bufp); + hp = NULL; + } + *resultp = hp; + return (status); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nss-mdns-0.14.1/src/nss-test.c new/nss-mdns-0.15.1/src/nss-test.c --- old/nss-mdns-0.14.1/src/nss-test.c 2018-02-19 16:33:31.000000000 +0100 +++ new/nss-mdns-0.15.1/src/nss-test.c 2021-05-11 03:25:39.000000000 +0200 @@ -26,6 +26,9 @@ #include <sys/socket.h> #include <string.h> #include <arpa/inet.h> +#ifdef __FreeBSD__ +#include <netinet/in.h> +#endif static int gai(const char* node) { struct addrinfo hints; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nss-mdns-0.14.1/src/nss.c new/nss-mdns-0.15.1/src/nss.c --- old/nss-mdns-0.14.1/src/nss.c 2018-02-19 16:33:31.000000000 +0100 +++ new/nss-mdns-0.15.1/src/nss.c 2021-05-11 03:25:39.000000000 +0200 @@ -33,52 +33,7 @@ #include "avahi.h" #include "util.h" - -#if defined(NSS_IPV4_ONLY) && !defined(MDNS_MINIMAL) -#define _nss_mdns_gethostbyname4_r _nss_mdns4_gethostbyname4_r -#define _nss_mdns_gethostbyname3_r _nss_mdns4_gethostbyname3_r -#define _nss_mdns_gethostbyname2_r _nss_mdns4_gethostbyname2_r -#define _nss_mdns_gethostbyname_r _nss_mdns4_gethostbyname_r -#define _nss_mdns_gethostbyaddr_r _nss_mdns4_gethostbyaddr_r -#elif defined(NSS_IPV4_ONLY) && defined(MDNS_MINIMAL) -#define _nss_mdns_gethostbyname4_r _nss_mdns4_minimal_gethostbyname4_r -#define _nss_mdns_gethostbyname3_r _nss_mdns4_minimal_gethostbyname3_r -#define _nss_mdns_gethostbyname2_r _nss_mdns4_minimal_gethostbyname2_r -#define _nss_mdns_gethostbyname_r _nss_mdns4_minimal_gethostbyname_r -#define _nss_mdns_gethostbyaddr_r _nss_mdns4_minimal_gethostbyaddr_r -#elif defined(NSS_IPV6_ONLY) && !defined(MDNS_MINIMAL) -#define _nss_mdns_gethostbyname4_r _nss_mdns6_gethostbyname4_r -#define _nss_mdns_gethostbyname3_r _nss_mdns6_gethostbyname3_r -#define _nss_mdns_gethostbyname2_r _nss_mdns6_gethostbyname2_r -#define _nss_mdns_gethostbyname_r _nss_mdns6_gethostbyname_r -#define _nss_mdns_gethostbyaddr_r _nss_mdns6_gethostbyaddr_r -#elif defined(NSS_IPV6_ONLY) && defined(MDNS_MINIMAL) -#define _nss_mdns_gethostbyname4_r _nss_mdns6_minimal_gethostbyname4_r -#define _nss_mdns_gethostbyname3_r _nss_mdns6_minimal_gethostbyname3_r -#define _nss_mdns_gethostbyname2_r _nss_mdns6_minimal_gethostbyname2_r -#define _nss_mdns_gethostbyname_r _nss_mdns6_minimal_gethostbyname_r -#define _nss_mdns_gethostbyaddr_r _nss_mdns6_minimal_gethostbyaddr_r -#elif defined(MDNS_MINIMAL) -#define _nss_mdns_gethostbyname4_r _nss_mdns_minimal_gethostbyname4_r -#define _nss_mdns_gethostbyname3_r _nss_mdns_minimal_gethostbyname3_r -#define _nss_mdns_gethostbyname2_r _nss_mdns_minimal_gethostbyname2_r -#define _nss_mdns_gethostbyname_r _nss_mdns_minimal_gethostbyname_r -#define _nss_mdns_gethostbyaddr_r _nss_mdns_minimal_gethostbyaddr_r -#endif - -// Define prototypes for nss function we're going to export (fixes GCC warnings) -enum nss_status _nss_mdns_gethostbyname4_r(const char*, struct gaih_addrtuple**, - char*, size_t, int*, int*, int32_t*); -enum nss_status _nss_mdns_gethostbyname3_r(const char*, int, struct hostent*, - char*, size_t, int*, int*, int32_t*, - char**); -enum nss_status _nss_mdns_gethostbyname2_r(const char*, int, struct hostent*, - char*, size_t, int*, int*); -enum nss_status _nss_mdns_gethostbyname_r(const char*, struct hostent*, char*, - size_t, int*, int*); -enum nss_status _nss_mdns_gethostbyaddr_r(const void*, int, int, - struct hostent*, char*, size_t, int*, - int*); +#include "nss.h" static avahi_resolve_result_t do_avahi_resolve_name(int af, const char* name, userdata_t* userdata) { @@ -126,9 +81,9 @@ } } -static enum nss_status gethostbyname_impl(const char* name, int af, - userdata_t* u, int* errnop, - int* h_errnop) { +enum nss_status _nss_mdns_gethostbyname_impl(const char* name, int af, + userdata_t* u, int* errnop, + int* h_errnop) { int name_allowed; FILE* mdns_allow_file = NULL; @@ -192,6 +147,7 @@ } } +#ifndef __FreeBSD__ enum nss_status _nss_mdns_gethostbyname4_r(const char* name, struct gaih_addrtuple** pat, char* buffer, size_t buflen, @@ -204,13 +160,14 @@ buffer_t buf; enum nss_status status = - gethostbyname_impl(name, AF_UNSPEC, &u, errnop, h_errnop); + _nss_mdns_gethostbyname_impl(name, AF_UNSPEC, &u, errnop, h_errnop); if (status != NSS_STATUS_SUCCESS) { return status; } buffer_init(&buf, buffer, buflen); return convert_userdata_to_addrtuple(&u, name, pat, &buf, errnop, h_errnop); } +#endif enum nss_status _nss_mdns_gethostbyname3_r(const char* name, int af, struct hostent* result, char* buffer, @@ -234,7 +191,7 @@ #endif } - enum nss_status status = gethostbyname_impl(name, af, &u, errnop, h_errnop); + enum nss_status status = _nss_mdns_gethostbyname_impl(name, af, &u, errnop, h_errnop); if (status != NSS_STATUS_SUCCESS) { return status; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nss-mdns-0.14.1/src/nss.h new/nss-mdns-0.15.1/src/nss.h --- old/nss-mdns-0.14.1/src/nss.h 1970-01-01 01:00:00.000000000 +0100 +++ new/nss-mdns-0.15.1/src/nss.h 2021-05-11 03:25:39.000000000 +0200 @@ -0,0 +1,52 @@ +#ifndef src_nss_h +#define src_nss_h + +#if defined(NSS_IPV4_ONLY) && !defined(MDNS_MINIMAL) +#define _nss_mdns_gethostbyname4_r _nss_mdns4_gethostbyname4_r +#define _nss_mdns_gethostbyname3_r _nss_mdns4_gethostbyname3_r +#define _nss_mdns_gethostbyname2_r _nss_mdns4_gethostbyname2_r +#define _nss_mdns_gethostbyname_r _nss_mdns4_gethostbyname_r +#define _nss_mdns_gethostbyaddr_r _nss_mdns4_gethostbyaddr_r +#elif defined(NSS_IPV4_ONLY) && defined(MDNS_MINIMAL) +#define _nss_mdns_gethostbyname4_r _nss_mdns4_minimal_gethostbyname4_r +#define _nss_mdns_gethostbyname3_r _nss_mdns4_minimal_gethostbyname3_r +#define _nss_mdns_gethostbyname2_r _nss_mdns4_minimal_gethostbyname2_r +#define _nss_mdns_gethostbyname_r _nss_mdns4_minimal_gethostbyname_r +#define _nss_mdns_gethostbyaddr_r _nss_mdns4_minimal_gethostbyaddr_r +#elif defined(NSS_IPV6_ONLY) && !defined(MDNS_MINIMAL) +#define _nss_mdns_gethostbyname4_r _nss_mdns6_gethostbyname4_r +#define _nss_mdns_gethostbyname3_r _nss_mdns6_gethostbyname3_r +#define _nss_mdns_gethostbyname2_r _nss_mdns6_gethostbyname2_r +#define _nss_mdns_gethostbyname_r _nss_mdns6_gethostbyname_r +#define _nss_mdns_gethostbyaddr_r _nss_mdns6_gethostbyaddr_r +#elif defined(NSS_IPV6_ONLY) && defined(MDNS_MINIMAL) +#define _nss_mdns_gethostbyname4_r _nss_mdns6_minimal_gethostbyname4_r +#define _nss_mdns_gethostbyname3_r _nss_mdns6_minimal_gethostbyname3_r +#define _nss_mdns_gethostbyname2_r _nss_mdns6_minimal_gethostbyname2_r +#define _nss_mdns_gethostbyname_r _nss_mdns6_minimal_gethostbyname_r +#define _nss_mdns_gethostbyaddr_r _nss_mdns6_minimal_gethostbyaddr_r +#elif defined(MDNS_MINIMAL) +#define _nss_mdns_gethostbyname4_r _nss_mdns_minimal_gethostbyname4_r +#define _nss_mdns_gethostbyname3_r _nss_mdns_minimal_gethostbyname3_r +#define _nss_mdns_gethostbyname2_r _nss_mdns_minimal_gethostbyname2_r +#define _nss_mdns_gethostbyname_r _nss_mdns_minimal_gethostbyname_r +#define _nss_mdns_gethostbyaddr_r _nss_mdns_minimal_gethostbyaddr_r +#endif + +// Define prototypes for nss function we're going to export (fixes GCC warnings) +#ifndef __FreeBSD__ +enum nss_status _nss_mdns_gethostbyname4_r(const char*, struct gaih_addrtuple**, + char*, size_t, int*, int*, int32_t*); +#endif +enum nss_status _nss_mdns_gethostbyname3_r(const char*, int, struct hostent*, + char*, size_t, int*, int*, int32_t*, + char**); +enum nss_status _nss_mdns_gethostbyname2_r(const char*, int, struct hostent*, + char*, size_t, int*, int*); +enum nss_status _nss_mdns_gethostbyname_r(const char*, struct hostent*, char*, + size_t, int*, int*); +enum nss_status _nss_mdns_gethostbyaddr_r(const void*, int, int, + struct hostent*, char*, size_t, int*, + int*); + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nss-mdns-0.14.1/src/util.c new/nss-mdns-0.15.1/src/util.c --- old/nss-mdns-0.14.1/src/util.c 2018-03-18 20:04:05.000000000 +0100 +++ new/nss-mdns-0.15.1/src/util.c 2021-05-11 03:25:39.000000000 +0200 @@ -115,7 +115,10 @@ } int local_soa(void) { - struct __res_state state; + /* FreeBSD requires the state to be zeroed before calling res_ninit() */ + struct __res_state state = { + 0, + }; int result; unsigned char answer[NS_MAXMSG]; @@ -208,6 +211,7 @@ return NSS_STATUS_SUCCESS; } +#ifndef __FreeBSD__ enum nss_status convert_userdata_to_addrtuple(const userdata_t* u, const char* name, struct gaih_addrtuple** pat, @@ -266,6 +270,7 @@ return NSS_STATUS_SUCCESS; } +#endif static char* aligned_ptr(char* p) { uintptr_t ptr = (uintptr_t)p; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nss-mdns-0.14.1/src/util.h new/nss-mdns-0.15.1/src/util.h --- old/nss-mdns-0.14.1/src/util.h 2018-02-19 16:33:31.000000000 +0100 +++ new/nss-mdns-0.15.1/src/util.h 2021-05-11 03:25:39.000000000 +0200 @@ -25,6 +25,9 @@ #include <netdb.h> #include <nss.h> #include <stdio.h> +#ifdef __FreeBSD__ +#include <netinet/in.h> +#endif #include <resolv.h> #include "avahi.h" @@ -105,11 +108,13 @@ // Converts from the userdata struct into the gaih_addrtuple format, used by // gethostbyaddr4_r. +#ifndef __FreeBSD__ enum nss_status convert_userdata_to_addrtuple(const userdata_t* u, const char* name, struct gaih_addrtuple** pat, buffer_t* buf, int* errnop, int* h_errnop); +#endif // Appends a query_address_result to userdata. void append_address_to_userdata(const query_address_result_t* result, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nss-mdns-0.14.1/test-driver new/nss-mdns-0.15.1/test-driver --- old/nss-mdns-0.14.1/test-driver 2018-03-18 23:33:12.000000000 +0100 +++ new/nss-mdns-0.15.1/test-driver 2021-05-11 03:39:59.000000000 +0200 @@ -1,9 +1,9 @@ #! /bin/sh # test-driver - basic testsuite driver script. -scriptversion=2016-01-11.22; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 2011-2017 Free Software Foundation, Inc. +# Copyright (C) 2011-2020 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -140,7 +140,7 @@ # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/nss-mdns-0.14.1/tests/check_util.c new/nss-mdns-0.15.1/tests/check_util.c --- old/nss-mdns-0.14.1/tests/check_util.c 2018-03-18 23:29:02.000000000 +0100 +++ new/nss-mdns-0.15.1/tests/check_util.c 2021-05-11 03:25:39.000000000 +0200 @@ -546,6 +546,7 @@ return result; } +#ifndef __FreeBSD__ static void validate_addrtuples(struct gaih_addrtuple* pat, const char* expected_name, int expected_count) { int i = 0; @@ -573,6 +574,7 @@ } ck_assert_int_eq(i, expected_count); } +#endif static userdata_t create_address_userdata(int num_addresses, int af) { ck_assert_int_le(num_addresses, MAX_ENTRIES); @@ -629,6 +631,7 @@ // Tests for convert_userdata_to_addrtuple. +#ifndef __FreeBSD__ START_TEST(test_userdata_to_addrtuple_returns_tuples) { userdata_t u = create_address_userdata(16, AF_UNSPEC); struct gaih_addrtuple* pat = NULL; @@ -709,6 +712,7 @@ validate_addrtuples(&tuple, "example.local", 16); } END_TEST +#endif // Tests for convert_userdata_for_name_to_hostent. @@ -973,6 +977,7 @@ tcase_add_test(tc_buffer, test_buffer_alloc_returns_zeroed_memory); suite_add_tcase(s, tc_buffer); +#ifndef __FreeBSD__ TCase* tc_userdata_to_addrtuple = tcase_create("userdata_to_addrtuple"); tcase_add_test(tc_userdata_to_addrtuple, test_userdata_to_addrtuple_returns_tuples); @@ -983,6 +988,7 @@ tcase_add_test(tc_userdata_to_addrtuple, test_userdata_to_addrtuple_nonnull_pat_is_used); suite_add_tcase(s, tc_userdata_to_addrtuple); +#endif TCase* tc_userdata_for_name_to_hostent = tcase_create("userdata_for_name_to_hostent");