Hello community, here is the log from the commit of package nss-myhostname for openSUSE:Factory checked in at Wed Jun 1 11:35:07 CEST 2011.
-------- New Changes file: --- /dev/null 2010-08-26 16:28:41.000000000 +0200 +++ /mounts/work_src_done/STABLE/nss-myhostname/nss-myhostname.changes 2011-05-20 16:24:39.000000000 +0200 @@ -0,0 +1,5 @@ +------------------------------------------------------------------- +Fri May 20 14:15:05 UTC 2011 - [email protected] + +- new package version 0.3 based on Fedora's + calling whatdependson for head-i586 New: ---- 0001-optionally-warn-if-nss-myhostname-is-called.diff baselibs.conf nss-myhostname-0.3.tar.gz nss-myhostname-config nss-myhostname.changes nss-myhostname.rpmlintrc nss-myhostname.spec ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nss-myhostname.spec ++++++ # # spec file for package nss-myhostname # # Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. # # 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 http://bugs.opensuse.org/ # # icecream 0 Name: nss-myhostname Summary: Plugin for local system host name resolution Version: 0.3 Release: 1 License: LGPLv2+ Url: http://0pointer.de/lennart/projects/nss-myhostname/ Group: System/Libraries Source: http://0pointer.de/lennart/projects/nss-myhostname/nss-myhostname-%{version}.tar.gz Source1: nss-myhostname-config Patch0: 0001-optionally-warn-if-nss-myhostname-is-called.diff PreReq: sed %description nss-myhostname is a plugin for the GNU Name Service Switch (NSS) functionality of the GNU C Library (glibc) providing host name resolution for the locally configured system hostname as returned by gethostname(2). Various software relies on an always resolvable local host name. When using dynamic hostnames this is usually achieved by patching /etc/hosts at the same time as changing the host name. This however is not ideal since it requires 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 configured public IP addresses, or -- if none are configured -- the IPv4 address 127.0.0.2 (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. Note that nss-myhostname only provides a workaround for broken software. If nss-myhostname is trigged by an application a message is logged to /var/log/messages. Please check whether that's worth a bug report then. %prep %setup -q %patch0 -p1 %build autoreconf %configure --libdir=/%{_lib} --with-warning make %{?_smp_mflags} %install make DESTDIR=%{buildroot} install install -D -m 755 %SOURCE1 %{buildroot}%{_sbindir}/nss-myhostname-config rm -rf %{buildroot}/usr/share/doc/nss-myhostname %clean rm -rf $RPM_BUILD_ROOT %preun if [ "$1" -eq 0 -a -f /etc/nsswitch.conf ] ; then %{_sbindir}/nss-myhostname-config --disable fi %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files %defattr(-, root, root) %doc README %doc LICENSE %{_sbindir}/nss-myhostname-config /%{_lib}/* %changelog ++++++ 0001-optionally-warn-if-nss-myhostname-is-called.diff ++++++ >From 84a26d4ad7e43bd1c6675b8bd59e856b7e938f71 Mon Sep 17 00:00:00 2001 From: Ludwig Nussel <[email protected]> Date: Fri, 20 May 2011 15:38:46 +0200 Subject: [PATCH nss-myhostname] optionally warn if nss-myhostname is called --- configure.ac | 9 +++++++++ nss-myhostname.c | 28 +++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletions(-) diff --git a/configure.ac b/configure.ac index 38cd58f..e8c1503 100644 --- a/configure.ac +++ b/configure.ac @@ -72,6 +72,15 @@ AC_CHECK_FUNCS([gethostbyaddr gethostbyname gettimeofday inet_ntoa memset select # LYNX documentation generation ZP_LYNX_DOC +AC_MSG_CHECKING([log warning messages]) +AC_ARG_WITH(warning, AS_HELP_STRING([--with-warning], [log warning to syslog when nss-myhostname is called (default=no)]),[],[with_warning=no]) +AC_MSG_RESULT([$with_warning]) + +if test x$with_warning != xno; then + AC_CHECK_HEADERS([syslog.h]) + AC_DEFINE([LOG_WARNING],[1],[whether to log warning message]) +fi + AC_CONFIG_FILES([Makefile doc/Makefile doc/README.html ]) AC_OUTPUT diff --git a/nss-myhostname.c b/nss-myhostname.c index 293166c..9d0e688 100644 --- a/nss-myhostname.c +++ b/nss-myhostname.c @@ -31,6 +31,9 @@ #include <net/if.h> #include <stdlib.h> #include <arpa/inet.h> +#if LOG_WARNING +#include <syslog.h> +#endif #include "netlink.h" @@ -45,6 +48,8 @@ #define ALIGN(a) (((a+sizeof(void*)-1)/sizeof(void*))*sizeof(void*)) +static void warn(const char* hn); + enum nss_status _nss_myhostname_gethostbyname4_r( const char *name, struct gaih_addrtuple **pat, @@ -117,6 +122,8 @@ enum nss_status _nss_myhostname_gethostbyname4_r( return NSS_STATUS_NOTFOUND; } + warn(hn); + /* If this fails, n_addresses is 0. Which is fine */ netlink_acquire_addresses(&addresses, &n_addresses); @@ -333,6 +340,8 @@ enum nss_status _nss_myhostname_gethostbyname3_r( return NSS_STATUS_NOTFOUND; } + warn(hn); + return fill_in_hostent(hn, af, host, buffer, buflen, errnop, h_errnop, ttlp, canonp); } @@ -430,8 +439,9 @@ found: return NSS_STATUS_UNAVAIL; } - return fill_in_hostent(hn, af, host, buffer, buflen, errnop, h_errnop, ttlp, NULL); + warn(hn); + return fill_in_hostent(hn, af, host, buffer, buflen, errnop, h_errnop, ttlp, NULL); } enum nss_status _nss_myhostname_gethostbyaddr_r( @@ -449,3 +459,19 @@ enum nss_status _nss_myhostname_gethostbyaddr_r( errnop, h_errnop, NULL); } + +void warn(const char* hn) { +#if LOG_WARNING + if (strstr(program_invocation_short_name, "nscd")) { + syslog(LOG_WARNING, + "Some application tried to resolve hostname \"%s\" which is not in DNS. Stop nscd to find out which one.\n", + hn); + } else { + syslog(LOG_WARNING, + "%s(%u) tried to resolve hostname \"%s\" which is not in DNS. This might be the reason for the delays you experience.\n", + program_invocation_short_name, + getpid(), + hn); + } +#endif +} -- 1.7.3.4 ++++++ baselibs.conf ++++++ nss-myhostname ++++++ nss-myhostname-config ++++++ #!/bin/bash # sed calls copied from fedora package set -e case "$1" in --help) echo "$0 [--enable|--disable]" exit 0 ;; --enable) sed -i.bak -e ' /^hosts:/ !b /\<myhostname\>/ b s/[[:blank:]]*$/ myhostname/ ' /etc/nsswitch.conf ;; --disable) sed -i.bak -e ' /^hosts:/ !b s/[[:blank:]]\+myhostname\>// ' /etc/nsswitch.conf ;; "") if grep -q "^hosts:.*\<myhostname\>" /etc/nsswitch.conf; then echo "enabled" else echo "disabled" fi ;; *) echo "invalid argument $1"; exit 1 ;; esac ++++++ nss-myhostname.rpmlintrc ++++++ # TODO: clarify if shlib policy applies to nss plugins setBadness("shlib-policy-name-error", 0) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
