summaryrefslogtreecommitdiff
path: root/package/unscd
diff options
context:
space:
mode:
authorDoug Kehn <rdkehn@yahoo.com>2015-12-02 08:56:17 -0600
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2015-12-22 20:53:32 +0100
commit1fe81f079b5a96d7561ea22f4b764f8351fb3ed9 (patch)
tree60ac20c3aef7796e017767be57563d21319a88b6 /package/unscd
parent73690cb97ace54fa6df79fe8f0d713336dcf5136 (diff)
package/unscd: new package
A daemon which handles passwd, group and host lookups for running programs and caches the results for the next query. This package is intended to replace glibc nscd. Presently, glibc nscd is not installed by Buildroot. unscd depends on glibc because it relies on glibc function __nss_disable_nscd. nscd.conf is taken from glibc with unused configurations removed. Cc: Yann E. MORIN <yann.morin.1998@free.fr> Cc: Arnout Vandecappelle <arnout@mind.be> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Doug Kehn <rdkehn@yahoo.com> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/unscd')
-rw-r--r--package/unscd/Config.in25
-rw-r--r--package/unscd/S46unscd24
-rw-r--r--package/unscd/nscd.conf33
-rw-r--r--package/unscd/unscd.hash2
-rw-r--r--package/unscd/unscd.mk36
5 files changed, 120 insertions, 0 deletions
diff --git a/package/unscd/Config.in b/package/unscd/Config.in
new file mode 100644
index 000000000..e979c3013
--- /dev/null
+++ b/package/unscd/Config.in
@@ -0,0 +1,25 @@
+config BR2_PACKAGE_UNSCD
+ bool "unscd"
+ depends on BR2_TOOLCHAIN_USES_GLIBC
+ help
+ Micro Name Service Caching Daemon
+
+ A daemon which handles passwd, group and host lookups for
+ running programs and caches the results for the next query.
+ You only need this package if you are using slow Name Services
+ like LDAP, NIS or NIS+.
+
+ This particular NSCD is a complete rewrite of the GNU glibc
+ nscd which is a single threaded server process which offloads
+ all NSS lookups to worker children; cache hits are handled by
+ the parent, and only cache misses start worker children,
+ making the parent immune to resource leaks, hangs, and crashes
+ in NSS libraries.
+
+ It should mostly be a drop-in replacement for existing
+ installs using nscd.
+
+ http://busybox.net/~vda/unscd
+
+comment "unscd needs an (e)glibc toolchain"
+ depends on !BR2_TOOLCHAIN_USES_GLIBC
diff --git a/package/unscd/S46unscd b/package/unscd/S46unscd
new file mode 100644
index 000000000..7d18f947c
--- /dev/null
+++ b/package/unscd/S46unscd
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+NAME="nscd"
+DAEMON="/usr/sbin/${NAME}"
+
+case "$1" in
+start)
+ printf "Starting ${NAME}: "
+ start-stop-daemon -S -x ${DAEMON}
+ [ $? -eq 0 ] && echo "OK" || echo "FAIL"
+ ;;
+stop)
+ printf "Stopping ${NAME}: "
+ start-stop-daemon -K -x ${DAEMON}
+ [ $? -eq 0 ] && echo "OK" || echo "FAIL"
+ ;;
+restart|reload)
+ $0 stop
+ $0 start
+ ;;
+*)
+ echo "Usage: $0 {start|stop|restart|reload}"
+ exit 1
+esac
diff --git a/package/unscd/nscd.conf b/package/unscd/nscd.conf
new file mode 100644
index 000000000..3eb08ab68
--- /dev/null
+++ b/package/unscd/nscd.conf
@@ -0,0 +1,33 @@
+# /etc/nscd.conf
+#
+# An example Name Service Cache config file. This file is needed by nscd.
+#
+server-user unscd
+debug-level 0
+
+enable-cache passwd yes
+positive-time-to-live passwd 600
+negative-time-to-live passwd 20
+suggested-size passwd 1001
+check-files passwd yes
+
+enable-cache group yes
+positive-time-to-live group 3600
+negative-time-to-live group 60
+suggested-size group 1001
+check-files group yes
+
+# hosts caching is broken with gethostby* calls, hence is now disabled
+# by default. Specifically, the caching does not obey DNS TTLs, and
+# thus could lead to problems if the positive-time-to-live is
+# significantly larger than the actual TTL.
+#
+# You should really use a caching nameserver instead of nscd for this
+# sort of request. However, you can easily re-enable this by default.
+enable-cache hosts no
+positive-time-to-live hosts 3600
+negative-time-to-live hosts 20
+suggested-size hosts 1001
+check-files hosts yes
+
+# unscd does not support services caching
diff --git a/package/unscd/unscd.hash b/package/unscd/unscd.hash
new file mode 100644
index 000000000..ab8ffdc0c
--- /dev/null
+++ b/package/unscd/unscd.hash
@@ -0,0 +1,2 @@
+# Locally computed:
+sha256 4c1f83dcd120469fceef749050cb29fa666fa4666bd308dfe92e933a4c200d55 nscd-0.52.c
diff --git a/package/unscd/unscd.mk b/package/unscd/unscd.mk
new file mode 100644
index 000000000..54caeb1f9
--- /dev/null
+++ b/package/unscd/unscd.mk
@@ -0,0 +1,36 @@
+################################################################################
+#
+# unscd
+#
+################################################################################
+
+UNSCD_VERSION = 0.52
+UNSCD_SOURCE = nscd-$(UNSCD_VERSION).c
+UNSCD_SITE = http://busybox.net/~vda/unscd
+UNSCD_LICENSE = GPLv2
+UNSCD_LICENSE_FILES = $(UNSCD_SOURCE)
+
+define UNSCD_EXTRACT_CMDS
+ cp $(DL_DIR)/$($(PKG)_SOURCE) $(@D)/
+endef
+
+define UNSCD_BUILD_CMDS
+ cd $(@D); \
+ $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) -o nscd $(UNSCD_SOURCE)
+endef
+
+define UNSCD_INSTALL_TARGET_CMDS
+ $(INSTALL) -m 755 -D $(@D)/nscd $(TARGET_DIR)/usr/sbin/nscd
+ $(INSTALL) -m 600 -D package/unscd/nscd.conf $(TARGET_DIR)/etc/nscd.conf
+endef
+
+define UNSCD_INSTALL_INIT_SYSV
+ $(INSTALL) -m 755 -D package/unscd/S46unscd \
+ $(TARGET_DIR)/etc/init.d/S46unscd
+endef
+
+define UNSCD_USERS
+ unscd -1 unscd -1 * - - - unscd user
+endef
+
+$(eval $(generic-package))