From patchwork Wed Dec 2 14:56:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Kehn X-Patchwork-Id: 551393 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id C4D6514029E for ; Thu, 3 Dec 2015 01:56:47 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=yahoo.com header.i=@yahoo.com header.b=DC1jLg/J; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 4D95087F8E; Wed, 2 Dec 2015 14:56:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EJefmXN6gQU3; Wed, 2 Dec 2015 14:56:45 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 41B3387FF5; Wed, 2 Dec 2015 14:56:45 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 61EDF1C0A72 for ; Wed, 2 Dec 2015 14:56:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 60E9886BCB for ; Wed, 2 Dec 2015 14:56:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Q7bHGZk38pey for ; Wed, 2 Dec 2015 14:56:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from nm21-vm3.bullet.mail.ne1.yahoo.com (nm21-vm3.bullet.mail.ne1.yahoo.com [98.138.91.151]) by hemlock.osuosl.org (Postfix) with ESMTPS id 59649869B8 for ; Wed, 2 Dec 2015 14:56:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1449068201; bh=lyjiRYtGP0bHHeCn2uG1SUUgxx1nvbpUt97wFZrjDgI=; h=From:To:Cc:Subject:Date:From:Subject; b=DC1jLg/JqY9yj03mmKp332TuIjjDIW4IUavm9i1h39NsrUrtuwzZyR+xPkEJLdLfigpBVfPT6eWqCWhF0koA1k79EFmx3Qmwporc1YdCAnmHQkM+Wu9S5khuYRHYArirD5avbJl2mZmz37S1+SCG7bITIHN5jxynBBrHM8w5Pxs61Fjho28O/prFv6FAORxsvbsVwWRNZj0+c1nzi8+9PtL+w1AytLOUHFP8IB6Jvmv3e/g9TugEqqQ5DOwJ78pHbV4a6qZGKbuT6WfQuH+/i4s/9nPQc/xnPNsiwOvtUjP1416ZOGoGFRoe/G2SMt45w4aljj1oS0DL6MyzLZRS+g== Received: from [98.138.100.102] by nm21.bullet.mail.ne1.yahoo.com with NNFMP; 02 Dec 2015 14:56:41 -0000 Received: from [98.138.226.56] by tm101.bullet.mail.ne1.yahoo.com with NNFMP; 02 Dec 2015 14:56:41 -0000 Received: from [127.0.0.1] by smtp207.mail.ne1.yahoo.com with NNFMP; 02 Dec 2015 14:56:41 -0000 X-Yahoo-Newman-Id: 346199.82015.bm@smtp207.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: tikU4XAVM1nNfV2cgp90F5QlJuHJyKXgtOLhWfkVYZp1hGZ LPKobzEROmuFpw7BrvvInmoQK.dU69i6uotTwPIv.AQlK8L9pVLLV9Xc3JT4 mVDEiMg3XRJenIT6W_HSlb7lHLVCt7qKZAsZlHseVXwYH4vfN5fUdnzMcVsz .ZUtH_3OTrVqMCXcKqelpdp4jL3hf6adjarq5xT0jyZeXXFc9ywIy.2O7VMf Yj3mdCBSjiMvnpJ7TWA3jlVltmpoeEAMs2PG6p3y7hEPS6gRWWbwzeVGwUJc 4jf9zMTquA0T90U2Q9Hda913uKOkWCupjYc7AJLwXFKh109BJKnyaHCp264U J5zBjjlmeuswPzqxRpfUvXo.ZHf0yD3sjevZLUUC0qwpksMZkDQ_9tgvMu0t VUmFzdT0r.0OfhqN2PzDqFOHMY7t6CcJ1AmES73tvyt3JGsorL0hB2.mCQCb REh_cYBso4gabtAUistvT6gWG1JTkgLc6E2OTr1a6xXGugHvsc2uXjMoo7Gn q8xy5WcvMmftwNwEBrFKmbsTFcFa0Hw-- X-Yahoo-SMTP: tVp.douswBADms9I1_pvnFcs0w-- From: Doug Kehn To: buildroot@buildroot.org Date: Wed, 2 Dec 2015 08:56:17 -0600 Message-Id: <1449068177-24100-1-git-send-email-rdkehn@yahoo.com> X-Mailer: git-send-email 2.6.2 Cc: thomas.petazzoni@free-electrons.com, yann.morin.1998@free.fr Subject: [Buildroot] [PATCH v7 1/1] package/unscd: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" 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 Cc: Arnout Vandecappelle Cc: Thomas Petazzoni Signed-off-by: Doug Kehn Reviewed-by: Arnout Vandecappelle (Essensium/Mind) --- Changes v6 -> v7 - Re-add package/Config.in (Arnout). - Reword config help test (Arnout). - Remove commented params in nscd.conf (Arnout). - Rework BUILD_CMDS (Arnout/Thomas). - Reword commit log (Arnout). Changes v5 -> v6 - Remove toolchain patch/BR2_GLIBC_NSCD (Thomas). - Change source site from Debian to upstream (Thomas). - Update to version 0.52 (Thomas). Changes v4 -> v5 - Reincorporate $(APPLY_PATCHES) suggestion after update by Arnout. Changes v3 -> v4 - Incorporate feedback/suggestions by Yann and Maxime. Changes v2 -> v3 - Remove trailing '/' from UNSCD_SITE. - Whitespace cleanup. Changes v1 -> v2 - Incorporate feedback/suggestions by Yann (from nss-pam-ldapd patch). --- package/Config.in | 1 + package/unscd/Config.in | 25 +++++++++++++++++++++++++ package/unscd/S46unscd | 24 ++++++++++++++++++++++++ package/unscd/nscd.conf | 33 +++++++++++++++++++++++++++++++++ package/unscd/unscd.hash | 2 ++ package/unscd/unscd.mk | 36 ++++++++++++++++++++++++++++++++++++ 6 files changed, 121 insertions(+) create mode 100644 package/unscd/Config.in create mode 100644 package/unscd/S46unscd create mode 100644 package/unscd/nscd.conf create mode 100644 package/unscd/unscd.hash create mode 100644 package/unscd/unscd.mk diff --git a/package/Config.in b/package/Config.in index 2bdad01..e56a318 100644 --- a/package/Config.in +++ b/package/Config.in @@ -1542,6 +1542,7 @@ if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS source "package/sysvinit/Config.in" source "package/tar/Config.in" endif + source "package/unscd/Config.in" source "package/util-linux/Config.in" endmenu diff --git a/package/unscd/Config.in b/package/unscd/Config.in new file mode 100644 index 0000000..e979c30 --- /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 0000000..7d18f94 --- /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 0000000..3eb08ab --- /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 0000000..ab8ffdc --- /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 0000000..54caeb1 --- /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))