SHA256
1
0
forked from pool/systemd
systemd/optionally-warn-if-nss-myhostname-is-called.patch
Frederic Crozat 37527bb454 Accepting request 184036 from home:elvigia:branches:Base:System
- version 206 , highlights:
* Unit files now understand the new %v specifier which
  resolves to the kernel version string as returned by "uname-r".
* "journalctl -b" may now be used to look for boot output of a
   specific boot. Try "journalctl -b -1"
* Creation of "dead" device nodes has been moved from udev
  into kmod and tmpfiles.
*  The udev "keymap" data files and tools to apply keyboard
   specific mappings of scan to key codes, and force-release
   scan code lists have been entirely replaced by a udev
   "keyboard" builtin and a hwdb data file.
- remove patches now in upstream
- systemd now requires libkmod >=14 and cryptsetup >= 1.6.0
- systemd now require the kmod tool in addition to the library.

- version 206 , highlights:
* Unit files now understand the new %v specifier which
  resolves to the kernel version string as returned by "uname-r".
* "journalctl -b" may now be used to look for boot output of a
   specific boot. Try "journalctl -b -1"
* Creation of "dead" device nodes has been moved from udev
  into kmod and tmpfiles.
*  The udev "keymap" data files and tools to apply keyboard
   specific mappings of scan to key codes, and force-release
   scan code lists have been entirely replaced by a udev
   "keyboard" builtin and a hwdb data file.
- remove patches now in upstream
- systemd now requires libkmod >=14 and cryptsetup >= 1.6.0
- systemd now require the kmod tool in addition to the library. (forwarded request 184035 from elvigia)

OBS-URL: https://build.opensuse.org/request/show/184036
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=416
2013-07-23 09:21:21 +00:00

103 lines
3.5 KiB
Diff

From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Fri, 20 May 2011 15:38:46 +0200
Subject: optionally warn if nss-myhostname is called
---
configure.ac | 11 +++++++++++
src/nss-myhostname/nss-myhostname.c | 32 ++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
--- systemd-206.orig/configure.ac
+++ systemd-206/configure.ac
@@ -803,6 +803,17 @@ if test "x$enable_myhostname" != "xno";
fi
AM_CONDITIONAL(HAVE_MYHOSTNAME, [test "$have_myhostname" = "yes"])
+if test "x$have_myhostname" != "xno"; then
+ AC_MSG_CHECKING([log warning messages for nss-myhostname])
+ AC_ARG_WITH(nss-my-hostname-warning, AS_HELP_STRING([--with-nss-my-hostname-warning], [log warning to syslog when nss-myhostname is called (default=no)]),[],[with_nss_my_hostname_warning=no])
+ AC_MSG_RESULT([$with_nss_my_hostname_warning])
+
+ if test x$with_nss_my_hostname_warning != xno; then
+ AC_CHECK_HEADERS([syslog.h])
+ AC_DEFINE([LOG_NSS_MY_HOSTNAME_WARNING],[1],[whether to log warning message for nss-myhostname])
+ fi
+fi
+
# ------------------------------------------------------------------------------
AC_ARG_WITH(firmware-path,
AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
--- systemd-206.orig/src/nss-myhostname/nss-myhostname.c
+++ systemd-206/src/nss-myhostname/nss-myhostname.c
@@ -29,6 +29,9 @@
#include <net/if.h>
#include <stdlib.h>
#include <arpa/inet.h>
+#ifdef LOG_NSS_MY_HOSTNAME_WARNING
+#include <syslog.h>
+#endif
#include "ifconf.h"
#include "macro.h"
@@ -47,6 +50,10 @@
#define LOCALADDRESS_IPV6 &in6addr_loopback
#define LOOPBACK_INTERFACE "lo"
+#ifdef LOG_NSS_MY_HOSTNAME_WARNING
+static void warn(const char* hn);
+#endif
+
enum nss_status _nss_myhostname_gethostbyname4_r(
const char *name,
struct gaih_addrtuple **pat,
@@ -129,6 +136,9 @@ enum nss_status _nss_myhostname_gethostb
return NSS_STATUS_NOTFOUND;
}
+#ifdef LOG_NSS_MY_HOSTNAME_WARNING
+ warn(hn);
+#endif
/* If this fails, n_addresses is 0. Which is fine */
ifconf_acquire_addresses(&addresses, &n_addresses);
@@ -382,6 +392,9 @@ enum nss_status _nss_myhostname_gethostb
local_address_ipv4 = LOCALADDRESS_IPV4;
}
+#ifdef LOG_NSS_MY_HOSTNAME_WARNING
+ warn(hn);
+#endif
return fill_in_hostent(
canonical, additional,
af,
@@ -509,6 +522,9 @@ found:
canonical = hn;
}
+#ifdef LOG_NSS_MY_HOSTNAME_WARNING
+ warn(hn);
+#endif
return fill_in_hostent(
canonical, additional,
af,
@@ -537,3 +553,19 @@ enum nss_status _nss_myhostname_gethostb
errnop, h_errnop,
NULL);
}
+
+#ifdef LOG_NSS_MY_HOSTNAME_WARNING
+static void warn(const char* hn) {
+ 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