debian/ 0002755 0000000 0000000 00000000000 12160543002 007161 5 ustar debian/source/ 0002755 0000000 0000000 00000000000 12144123362 010466 5 ustar debian/source/format 0000644 0000000 0000000 00000000014 12144123362 011672 0 ustar 3.0 (quilt)
debian/changelog 0000644 0000000 0000000 00000005735 12160542776 011064 0 ustar libnss-myhostname (0.3-6) unstable; urgency=low
* Fix duplicated ldconfig calls in maintainer scripts, thanks to Michael
Prokop for noticing. (Closes: #712802)
-- Joachim Breitner Thu, 20 Jun 2013 11:06:06 +0200
libnss-myhostname (0.3-5) unstable; urgency=low
* Work around #705900: Ignore link-local addresses
-- Joachim Breitner Tue, 21 May 2013 15:43:56 +0200
libnss-myhostname (0.3-4) unstable; urgency=low
* Fix Package's description to reflect changed behaviour. (Closes: #656218)
-- Joachim Breitner Tue, 17 Jan 2012 22:08:50 +0100
libnss-myhostname (0.3-3) unstable; urgency=low
* Implement Multi-Arch support
* 0004-Ensure-a-LANG-independent-generated-README.patch:
Make sure the generated html file is independent of the current LANG
-- Joachim Breitner Tue, 28 Jun 2011 12:53:59 +0200
libnss-myhostname (0.3-2) unstable; urgency=low
* Apply patch by Robert Millan, adding legacy support for BSD and hurd
kernels (Closes: #630206)
* Use dh-autoreconf to take care of autoreconfing
-- Joachim Breitner Fri, 17 Jun 2011 09:53:40 +0200
libnss-myhostname (0.3-1) unstable; urgency=low
* Fix typo in package description (Closes: #624526)
* New upstream release (Closes: #630009)
* Bump standard version, no change
* Install myshostname directly after "files" in /etc/nsswitch.conf.
This avoids an annoying delay when dns fails and one wants to use sudo to
fix it. Is also closer to having the hostname in /etc/hosts, which is the
behaviour myhostname tries to mimic. Existing installations are not
modified.
-- Joachim Breitner Fri, 10 Jun 2011 23:04:56 +0200
libnss-myhostname (0.2-5) unstable; urgency=low
* Bump standards version, no change
* Do not run dh_shlibps for .so files in /lib32 or /lib64, avoids dependency
on (e.g.) libc6-amd64 (Closes: #587918)
-- Joachim Breitner Wed, 07 Jul 2010 17:31:34 +0200
libnss-myhostname (0.2-4) unstable; urgency=low
* Try to pass a more correct --build parameter to ./configure when building
multilib variants.
-- Joachim Breitner Mon, 21 Jun 2010 14:58:27 +0200
libnss-myhostname (0.2-3) unstable; urgency=low
* Typo in description (Closes: #584640)
* Build-Depend on lynx for README creation
* Actually use -m64 option when building 64bit libraries
-- Joachim Breitner Sun, 20 Jun 2010 23:16:34 +0200
libnss-myhostname (0.2-2) unstable; urgency=low
* Fix VCS URL in controls file
* Use 127.0.1.1 for consistency with Debian’s default /etc/hosts (Closes:
#583624)
* Amend configure.ac to cater for non-defined MAX_HOST_NAME
-- Joachim Breitner Fri, 04 Jun 2010 12:59:21 +0200
libnss-myhostname (0.2-1) unstable; urgency=low
* Initial release (Closes: #574800)
-- Joachim Breitner Thu, 06 May 2010 15:34:50 +0200
debian/.git-dpm 0000644 0000000 0000000 00000000434 12144123373 010531 0 ustar # see git-dpm(1) from git-dpm package
cce547eac7d27b4476e646bfead3ba14b57a6ccc
cce547eac7d27b4476e646bfead3ba14b57a6ccc
11676c6b78abe9fe5bfb1224422dd7dc696d6a47
11676c6b78abe9fe5bfb1224422dd7dc696d6a47
libnss-myhostname_0.3.orig.tar.gz
d62b0daffa7d37bb1c94b3aa25c75a97e5cf0d47
330031
debian/postrm 0000644 0000000 0000000 00000001265 12160542664 010447 0 ustar #!/bin/sh
set -e
#DEBHELPER#
# This code was taken from nss-mdns:
log() {
echo "$*"
}
remove_nss_entry() {
log "Checking NSS setup..."
# abort if /etc/nsswitch.conf does not exist
if ! [ -e /etc/nsswitch.conf ]; then
log "Could not find /etc/nsswitch.conf."
return
fi
perl -i -pe '
my @remove=(
"myhostname",
);
sub remove {
my $s=shift;
foreach my $bit (@remove) {
$s=~s/\s+\Q$bit\E//g;
}
return $s;
}
s/^(hosts:)(.*)/$1.remove($2)/e;
' /etc/nsswitch.conf
}
action="$1"
if [ "$action" = remove ]; then
remove_nss_entry
fi
debian/rules 0000755 0000000 0000000 00000003141 12144123362 010243 0 ustar #!/usr/bin/make -f
STAMP_DIR := debian/stampdir
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
configure_flags += \
--prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--docdir=/usr/share/doc/libnss-myhostname \
--sysconfdir=/etc \
--localstatedir=/var \
--libexecdir=/lib/nss-myhostname \
--libdir=/lib/$(DEB_HOST_MULTIARCH)
CFLAGS := -Wall -g -O$(if $(findstring noopt,$(DEB_BUILD_OPTIONS)),0,2)
LDFLAGS += -Wl,-z,defs
$(STAMP_DIR)/autoreconf-stamp:
dh_autoreconf
-mkdir -p $(STAMP_DIR)
touch $@
$(STAMP_DIR)/configure-stamp: $(STAMP_DIR)/autoreconf-stamp
dh_testdir
CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ./configure $(configure_flags)
-mkdir -p $(STAMP_DIR)
touch $@
configure: configure-stamp
$(STAMP_DIR)/build-stamp: $(STAMP_DIR)/configure-stamp
dh_testdir
$(MAKE)
touch $@
build: $(STAMP_DIR)/build-stamp
$(STAMP_DIR)/install-stamp: $(STAMP_DIR)/build-stamp
$(MAKE) install DESTDIR=$(CURDIR)/debian/libnss-myhostname
touch $@
install: $(STAMP_DIR)/install-stamp
clean:
dh_testdir
dh_testroot
# remove install and build dirs
[ ! -e Makefile ] || $(MAKE) distclean
-rm -rf $(STAMP_DIR)
dh_autoreconf_clean
dh_clean
binary-indep: build install
binary-arch: build install
dh_testdir
dh_testroot
dh_installchangelogs -s
dh_installdocs -s
dh_install -s
dh_installman -s
dh_link -s
dh_strip -s
dh_compress -s
dh_fixperms -s
dh_makeshlibs -s
dh_installdeb -s
dh_shlibdeps -s
dh_gencontrol -s
dh_md5sums -s
dh_builddeb -s
binary: binary-indep binary-arch
.PHONY: configure build install clean binary-indep binary-arch binary
debian/control 0000644 0000000 0000000 00000002165 12144123362 010573 0 ustar Source: libnss-myhostname
Section: admin
Priority: extra
Maintainer: Joachim Breitner
Build-Depends:
debhelper (>= 8.1.3),
dh-autoreconf,
pkg-config,
lynx
Standards-Version: 3.9.2
Homepage: http://0pointer.de/lennart/projects/nss-myhostname/
VCS-Git: git://git.nomeata.de/libnss-myhostname.git
VCS-Browser: http://git.nomeata.de/?p=libnss-myhostname.git
Package: libnss-myhostname
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Description: nss module providing fallback resolution for the current hostname
This package contains a plugin for the Name Service Switch, providing host
name resolution for the locally configured system hostname as returned by
gethostname(2). It returns all locally configured public IP addresses or -- if
none are configured, the IPv4 address 127.0.1.1 (which is on the local
loopback) and the IPv6 address ::1 (which is the local host).
.
A lot of software relies on that the local host name is resolvable. This
package provides an alternative to the fragile and error-prone manual editing
of /etc/hosts.
debian/patches/ 0002755 0000000 0000000 00000000000 12144123373 010617 5 ustar debian/patches/0005-Ignore-link-local-addresses.patch 0000644 0000000 0000000 00000001624 12144123362 017442 0 ustar From cce547eac7d27b4476e646bfead3ba14b57a6ccc Mon Sep 17 00:00:00 2001
From: Joachim Breitner
Date: Mon, 13 May 2013 10:34:57 +0200
Subject: Ignore link-local addresses
Closes: #705900
---
netlink.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/netlink.c b/netlink.c
index 29f38e3..9bbed7e 100644
--- a/netlink.c
+++ b/netlink.c
@@ -178,6 +178,12 @@ int ifconf_acquire_addresses(struct address **_list, unsigned *_n_list) {
if (!address)
continue;
+ // Avoid link-local address
+ // http://bugs.debian.org/705900
+ if (ifaddrmsg->ifa_family == AF_INET6 &&
+ IN6_IS_ADDR_LINKLOCAL((const struct in6_addr *)address))
+ continue;
+
list = realloc(list, (n_list+1) * sizeof(struct address));
if (!list) {
r = -ENOMEM;
debian/patches/0004-Ensure-a-LANG-independent-generated-README.patch 0000644 0000000 0000000 00000001267 12144123362 021603 0 ustar From b8ca226377b65009687b951505ec934632583456 Mon Sep 17 00:00:00 2001
From: Joachim Breitner
Date: Tue, 28 Jun 2011 12:52:48 +0200
Subject: Ensure a LANG-independent generated README
---
doc/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 4f773ac..749efe2 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -27,7 +27,7 @@ dist_doc_DATA = README
MAINTAINERCLEANFILES += README
README: README.html
- lynx --dump $^ | sed 's,file://localhost/.*/doc/README.html,README,' > $@
+ LANG=C lynx --dump $^ | sed 's,file://localhost/.*/doc/README.html,README,' > $@
CLEANFILES += README
endif
debian/patches/0003-Use-legacy-getifaddrs-on-GNU-kFreeBSD.patch 0000644 0000000 0000000 00000025142 12144123362 020754 0 ustar From ae8333c7c8ab5c3b0ffadd2c2621429d2a7c072f Mon Sep 17 00:00:00 2001
From: Robert Millan
Date: Fri, 17 Jun 2011 09:32:35 +0200
Subject: Use legacy getifaddrs() on GNU/kFreeBSD.
---
Makefile.am | 9 ++++--
configure.ac | 7 +++++
ifconf.h | 74 ++++++++++++++++++++++++++++++++++++++++++++
legacy.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
netlink.c | 27 ++--------------
netlink.h | 48 -----------------------------
nss-myhostname.c | 8 ++---
7 files changed, 188 insertions(+), 79 deletions(-)
create mode 100644 ifconf.h
create mode 100644 legacy.c
delete mode 100644 netlink.h
diff --git a/Makefile.am b/Makefile.am
index 7f2f3a3..f82b8d4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -43,8 +43,13 @@ homepage: all dist
libnss_myhostname_la_SOURCES = \
nss-myhostname.c \
- netlink.c \
- netlink.h
+ ifconf.h
+
+if LEGACY
+libnss_myhostname_la_SOURCES += legacy.c
+else
+libnss_myhostname_la_SOURCES += netlink.c
+endif
libnss_myhostname_la_LDFLAGS = \
-avoid-version \
diff --git a/configure.ac b/configure.ac
index a766d7a..3f4263e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,6 +33,13 @@ AC_SUBST(PACKAGE_URL, [http://0pointer.de/lennart/projects/nss-myhostname/])
ac_default_prefix="/"
+AC_CANONICAL_HOST
+case "$host_os" in
+ linux*) legacy=false ;;
+ *) legacy=true ;;
+esac
+AM_CONDITIONAL([LEGACY], [test x$legacy = xtrue])
+
# Checks for programs.
AC_PROG_CC
AC_PROG_CC_C99
diff --git a/ifconf.h b/ifconf.h
new file mode 100644
index 0000000..6b2c83f
--- /dev/null
+++ b/ifconf.h
@@ -0,0 +1,74 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+#ifndef fooifconfhfoo
+#define fooifconfhfoo
+
+#include
+
+/***
+ This file is part of nss-myhostname.
+
+ Copyright 2008-2011 Lennart Poettering
+
+ nss-myhostname 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.1 of
+ the License, or (at your option) any later version.
+
+ nss-myhostname 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with nss-myhostname; If not, see
+ .
+***/
+
+#include
+#include
+#include
+
+struct address {
+ unsigned char family;
+ uint8_t address[16];
+ unsigned char scope;
+ int ifindex;
+};
+
+#define _public_ __attribute__ ((visibility("default")))
+#define _hidden_ __attribute__ ((visibility("hidden")))
+
+int ifconf_acquire_addresses(struct address **_list, unsigned *_n_list) _hidden_;
+
+static inline size_t PROTO_ADDRESS_SIZE(int proto) {
+ assert(proto == AF_INET || proto == AF_INET6);
+
+ return proto == AF_INET6 ? 16 : 4;
+}
+
+static inline int address_compare(const void *_a, const void *_b) {
+ const struct address *a = _a, *b = _b;
+
+ /* Order lowest scope first, IPv4 before IPv6, lowest interface index first */
+
+ if (a->scope < b->scope)
+ return -1;
+ if (a->scope > b->scope)
+ return 1;
+
+ if (a->family == AF_INET && b->family == AF_INET6)
+ return -1;
+ if (a->family == AF_INET6 && b->family == AF_INET)
+ return 1;
+
+ if (a->ifindex < b->ifindex)
+ return -1;
+ if (a->ifindex > b->ifindex)
+ return 1;
+
+ return 0;
+}
+
+
+#endif
diff --git a/legacy.c b/legacy.c
new file mode 100644
index 0000000..8e705c7
--- /dev/null
+++ b/legacy.c
@@ -0,0 +1,94 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+ This file is part of nss-myhostname.
+
+ Copyright 2008-2011 Lennart Poettering
+ Copyright 2011 Robert millan
+
+ nss-myhostname 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.1 of
+ the License, or (at your option) any later version.
+
+ nss-myhostname 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with nss-myhostname; If not, see
+ .
+***/
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "ifconf.h"
+
+int ifconf_acquire_addresses(struct address **_list, unsigned *_n_list) {
+
+ struct address *list = NULL;
+ unsigned n_list = 0;
+
+ struct ifaddrs *ifa = NULL;
+ int r = 1;
+ struct ifaddrs *i;
+ int ifindex = 0;
+
+ if (getifaddrs(&ifa) == -1) {
+ r = -errno;
+ goto finish;
+ }
+
+ for (i = ifa; i != NULL; i = i->ifa_next) {
+ int af;
+ const void *cp;
+ struct sockaddr_in6 *in6 = (struct sockaddr_in6 *) i->ifa_addr;
+ struct sockaddr_in *in = (struct sockaddr_in *) i->ifa_addr;
+
+ if (! i->ifa_addr)
+ continue;
+
+ af = i->ifa_addr->sa_family;
+
+ if (af != AF_INET && af != AF_INET6)
+ continue;
+
+ list = realloc(list, (n_list+1) * sizeof(struct address));
+ if (!list) {
+ r = -ENOMEM;
+ goto finish;
+ }
+
+ if (af == AF_INET6)
+ cp = &in6->sin6_addr;
+ else
+ cp = &in->sin_addr;
+
+ list[n_list].family = af;
+ list[n_list].scope = 0;
+ memcpy(list[n_list].address, cp, af == AF_INET ? 4 : 16);
+ list[n_list].ifindex = ifindex++;
+ n_list++;
+ }
+
+finish:
+ if (ifa)
+ freeifaddrs(ifa);
+
+ if (r < 0)
+ free(list);
+ else {
+ qsort(list, n_list, sizeof(struct address), address_compare);
+
+ *_list = list;
+ *_n_list = n_list;
+ }
+
+ return r;
+}
diff --git a/netlink.c b/netlink.c
index e7a3863..29f38e3 100644
--- a/netlink.c
+++ b/netlink.c
@@ -35,32 +35,9 @@
#include
#include
-#include "netlink.h"
+#include "ifconf.h"
-static int address_compare(const void *_a, const void *_b) {
- const struct address *a = _a, *b = _b;
-
- /* Order lowest scope first, IPv4 before IPv6, lowest interface index first */
-
- if (a->scope < b->scope)
- return -1;
- if (a->scope > b->scope)
- return 1;
-
- if (a->family == AF_INET && b->family == AF_INET6)
- return -1;
- if (a->family == AF_INET6 && b->family == AF_INET)
- return 1;
-
- if (a->ifindex < b->ifindex)
- return -1;
- if (a->ifindex > b->ifindex)
- return 1;
-
- return 0;
-}
-
-int netlink_acquire_addresses(struct address **_list, unsigned *_n_list) {
+int ifconf_acquire_addresses(struct address **_list, unsigned *_n_list) {
struct {
struct nlmsghdr hdr;
diff --git a/netlink.h b/netlink.h
deleted file mode 100644
index 4f00248..0000000
--- a/netlink.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-#ifndef foonetlinkhfoo
-#define foonetlinkhfoo
-
-/***
- This file is part of nss-myhostname.
-
- Copyright 2008-2011 Lennart Poettering
-
- nss-myhostname 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.1 of
- the License, or (at your option) any later version.
-
- nss-myhostname 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with nss-myhostname; If not, see
- .
-***/
-
-#include
-#include
-#include
-
-struct address {
- unsigned char family;
- uint8_t address[16];
- unsigned char scope;
- int ifindex;
-};
-
-#define _public_ __attribute__ ((visibility("default")))
-#define _hidden_ __attribute__ ((visibility("hidden")))
-
-int netlink_acquire_addresses(struct address **_list, unsigned *_n_list) _hidden_;
-
-static inline size_t PROTO_ADDRESS_SIZE(int proto) {
- assert(proto == AF_INET || proto == AF_INET6);
-
- return proto == AF_INET6 ? 16 : 4;
-}
-
-#endif
diff --git a/nss-myhostname.c b/nss-myhostname.c
index 5a7aa80..2e46c36 100644
--- a/nss-myhostname.c
+++ b/nss-myhostname.c
@@ -32,7 +32,7 @@
#include
#include
-#include "netlink.h"
+#include "ifconf.h"
/* We use 127.0.0.2 as IPv4 address. This has the advantage over
* 127.0.0.1 that it can be translated back to the local hostname. For
@@ -120,7 +120,7 @@ enum nss_status _nss_myhostname_gethostbyname4_r(
}
/* If this fails, n_addresses is 0. Which is fine */
- netlink_acquire_addresses(&addresses, &n_addresses);
+ ifconf_acquire_addresses(&addresses, &n_addresses);
/* If this call fails we fill in 0 as scope. Which is fine */
lo_ifi = if_nametoindex(LOOPBACK_INTERFACE);
@@ -206,7 +206,7 @@ static enum nss_status fill_in_hostent(
alen = PROTO_ADDRESS_SIZE(af);
- netlink_acquire_addresses(&addresses, &n_addresses);
+ ifconf_acquire_addresses(&addresses, &n_addresses);
for (a = addresses, n = 0, c = 0; n < n_addresses; a++, n++)
if (af == a->family)
@@ -405,7 +405,7 @@ enum nss_status _nss_myhostname_gethostbyaddr2_r(
return NSS_STATUS_UNAVAIL;
}
- netlink_acquire_addresses(&addresses, &n_addresses);
+ ifconf_acquire_addresses(&addresses, &n_addresses);
for (a = addresses, n = 0; n < n_addresses; n++, a++) {
if (af != a->family)
debian/patches/0002-Use-172.0.1.1.patch 0000644 0000000 0000000 00000003532 12144123362 013715 0 ustar From 00c1e329b6ec9eaa0ba0fcb6cf233fea597fb30b Mon Sep 17 00:00:00 2001
From: Joachim Breitner
Date: Fri, 4 Jun 2010 12:45:57 +0200
Subject: Use 172.0.1.1
---
doc/README.html.in | 8 ++++----
nss-myhostname.c | 4 +++-
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/doc/README.html.in b/doc/README.html.in
index f786182..7a2084e 100644
--- a/doc/README.html.in
+++ b/doc/README.html.in
@@ -70,7 +70,7 @@ a writable /etc file system and is fragile because the file
might be edited by the administrator at the same
time. nss-myhostname simply returns all locally configure
public IP addresses, or -- if none are configured -- the IPv4
-address 127.0.0.2 (wich is on the local loopback) and the
+address 127.0.1.1 (wich is on the local loopback) and the
IPv6 address ::1 (which is the local host) for whatever
system hostname is configured locally. Patching /etc/hosts
is thus no longer necessary.
@@ -116,9 +116,9 @@ use glibc's getent tool:
::1 STREAM omega
::1 DGRAM
::1 RAW
-127.0.0.2 STREAM
-127.0.0.2 DGRAM
-127.0.0.2 RAW
+127.0.1.1 STREAM
+127.0.1.1 DGRAM
+127.0.1.1 RAW
In this case the local host name is omega.
diff --git a/nss-myhostname.c b/nss-myhostname.c
index 293166c..5a7aa80 100644
--- a/nss-myhostname.c
+++ b/nss-myhostname.c
@@ -39,7 +39,9 @@
* IPv6 we use ::1 which unfortunately will not translate back to the
* hostname but instead something like "localhost6" or so. */
-#define LOCALADDRESS_IPV4 (htonl(0x7F000002))
+/* DEBIAN: Default /etc/hosts uses 172.0.1.1, so that is what we use as well */
+
+#define LOCALADDRESS_IPV4 (htonl(0x7F000101))
#define LOCALADDRESS_IPV6 &in6addr_loopback
#define LOOPBACK_INTERFACE "lo"
debian/patches/0001-Fix-building-on-kFreeBSD-MAX_HOST_NAME.patch 0000644 0000000 0000000 00000002070 12144123362 020607 0 ustar From 818479cdd74dd257bf53d013c03aa404ed47331b Mon Sep 17 00:00:00 2001
From: Joachim Breitner
Date: Fri, 4 Jun 2010 11:27:46 +0200
Subject: Fix building on kFreeBSD (MAX_HOST_NAME)
---
configure.ac | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/configure.ac b/configure.ac
index 38cd58f..a766d7a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,6 +69,16 @@ AC_FUNC_MALLOC
AC_FUNC_SELECT_ARGTYPES
AC_CHECK_FUNCS([gethostbyaddr gethostbyname gettimeofday inet_ntoa memset select socket strcspn strdup strerror strncasecmp strcasecmp strspn])
+# HOST_NAME_MAX not available on BSD-Kernels
+# first call to AC_CHECK_DECL can not be nested, thus add a dummy call here
+AC_CHECK_DECL(DUMMY,[],[])
+AC_CHECK_DECL(HOST_NAME_MAX,[],
+ AC_CHECK_DECL(_POSIX_HOST_NAME_MAX,
+ AC_DEFINE(HOST_NAME_MAX, _POSIX_HOST_NAME_MAX, []),
+ AC_DEFINE(HOST_NAME_MAX, 256, [Define to 256 if neither have HOST_NAME_MAX nor _POSIX_HOST_NAME_MAX]),
+ [[#include ]]),
+[[#include ]])
+
# LYNX documentation generation
ZP_LYNX_DOC
debian/patches/series 0000644 0000000 0000000 00000000331 12144123373 012027 0 ustar 0001-Fix-building-on-kFreeBSD-MAX_HOST_NAME.patch
0002-Use-172.0.1.1.patch
0003-Use-legacy-getifaddrs-on-GNU-kFreeBSD.patch
0004-Ensure-a-LANG-independent-generated-README.patch
0005-Ignore-link-local-addresses.patch
debian/postinst 0000644 0000000 0000000 00000002676 12160542654 011014 0 ustar #!/bin/sh
set -e
#DEBHELPER#
# This code was taken from nss-mdns:
log() {
echo "$*"
}
# try to insert myhostname entries to the "hosts" line in /etc/nsswitch.conf to
# automatically enable libnss-myhostname support; do not change the
# configuration if the "hosts" line already references some myhostname lookups
insert_nss_entry() {
log "Checking NSS setup..."
# abort if /etc/nsswitch.conf does not exist
if ! [ -e /etc/nsswitch.conf ]; then
log "Could not find /etc/nsswitch.conf."
return
fi
perl -i -pe '
sub insert {
# this also splits on tab
my @bits=split(" ", shift);
# do not break configuration if the "hosts" line already references
# myhostname
if (grep { $_ eq "myhostname"} @bits) {
return join " ", @bits;
}
# change "files" into "files myhostname"
return join " ", map {
$_ eq "files" ? ("$_","myhostname") : $_
} @bits;
}
s/^(hosts:\s+)(.*)/$1.insert($2)/e;
' /etc/nsswitch.conf
}
action="$1"
if [ configure = "$action" ]; then
if [ -z "$2" ]; then
log "First installation detected..."
# first install: setup the recommended configuration (unless
# nsswitch.conf already contains myhostname entries)
insert_nss_entry
else
# upgrade
version="$2"
# Nothing to do here yet
fi
fi
debian/compat 0000644 0000000 0000000 00000000002 12144123362 010362 0 ustar 8
debian/watch 0000644 0000000 0000000 00000000133 12144123362 010212 0 ustar version=3
http://0pointer.de/lennart/projects/nss-myhostname/ nss-myhostname-(.*)\.tar\.gz
debian/copyright 0000644 0000000 0000000 00000002372 12144123362 011123 0 ustar This is libnss-myhostname. Packaged for Debian by Joachim Breitner
Copyright © 2005-2011 Lennart Poettering
This program 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.1 of the License, or
(at your option) any later version.
This program 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 Lesser
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License with
the Debian GNU/Linux distribution in file /usr/share/common-licenses/LGPL-2.1;
if not, write to the Free Software Foundation, Inc., 51 Franklin Street,
Fifth Floor, Boston, MA 02110-1301 USA
The debian/rules file is derived from the respective file in nss-mdns, created
by Jeff Waugh, with some additions from the debian/rules file of
libnss-extrausers, © 2001,2002,2009 Bernhard R. Link, licenced under the terms
of the GPL-2.
The debian/postinst, debian/postrm files were adapted from the files found in
the nss-mdns package, created by Jeff Waugh.