From patchwork Fri Jun 1 12:58:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Becker X-Patchwork-Id: 923989 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Sy/DjPBM"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40y4Ct60pNz9s1b for ; Fri, 1 Jun 2018 22:59:22 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 4DBEC2E899; Fri, 1 Jun 2018 12:59:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id i9aXKu5ZScxB; Fri, 1 Jun 2018 12:59:17 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 6FFC722228; Fri, 1 Jun 2018 12:59:17 +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 C148A1CF175 for ; Fri, 1 Jun 2018 12:59:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id BEB6589CB4 for ; Fri, 1 Jun 2018 12:59:16 +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 k7ETz422appK for ; Fri, 1 Jun 2018 12:59:16 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-lf0-f44.google.com (mail-lf0-f44.google.com [209.85.215.44]) by hemlock.osuosl.org (Postfix) with ESMTPS id DAA2F89CAF for ; Fri, 1 Jun 2018 12:59:15 +0000 (UTC) Received: by mail-lf0-f44.google.com with SMTP id u4-v6so14709762lff.3 for ; Fri, 01 Jun 2018 05:59:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7t6326NQEZ96/yRqYeLPI2RUO12B2od7GwO/dpSf14Q=; b=Sy/DjPBMYBICDRAq5Tw/AGwXAwb3RFSuvqd820pyYjWqyTASxObnzC21HeEhVoEbHW FV17B+6rnC6CiSVzc0KrmySskTbD05tnq27GtCNuOAV92TJ4K46RVadpIR75HNx+8ZQx x/VXxoLpTecENq4Q/pspZF8JaLQm1A1ibGTk+uDHHqQJmK1X+pP8DVkz+TDcKHthARvG o9TKV1ZBrxZo5QfSGBhmbZhskuHrIBsVI3ikvAPq0b+oc/kZiy4UnK1XBT+uNPJHQfQG sMQZM1Addq83Vp05OBSpcfb35gpGvXOHzPwEpFuoW5DDlriE0ByzwfERuZpnajlO+UeD d5aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7t6326NQEZ96/yRqYeLPI2RUO12B2od7GwO/dpSf14Q=; b=h/Lfl5cDP1ZV900L4V8K0Okq+Ji8tgg9vHXXwTHSoXbrkVVj+Mdacs4hxKm8uAlxL8 grsQu5CRvv8TPDAyPhH+qa+heORn2PvjEHJ2aiVPAjjspnAC2fqwIL43HM2zknvCPBJ8 S6J3vOB6sxT+extpmrIkqKTEsdDvsWb+7/qNJeTgrJYUc3Cy/YL5bwOYCNlC1CiDANdP jHc8TxUl+X+W52uviDcFTOF114reJ4T3RNp4C0jtEKiB9fhNpUl701Hx5Fe8U/0mVeFh 7ftwfysG9rxpS13lKcxhaW54oh36P8M5hexuSQaWg2Ee9tokIRZ5P6hc/WEoOjo/m9Cd M4NA== X-Gm-Message-State: ALKqPwfjc5FYa6Kg3au+YpN5xEXNYA5XKON4s5M2bzotHdiBW60ZuTiH wZY87X5cs2UlqVwnEe2jgStKRFduPF0= X-Google-Smtp-Source: ADUXVKKerAO+vu3I01FXLXCmel1JCE1BCATaOV9qK6x/YUjbhfyd6vmqXrNevZ3CkPGg/Rdt7VJqlw== X-Received: by 2002:a19:a68a:: with SMTP id p132-v6mr6541446lfe.89.1527857953541; Fri, 01 Jun 2018 05:59:13 -0700 (PDT) Received: from stefanb-lnx.localdomain (86-60-143-206-dyn-dsl.ssp.fi. [86.60.143.206]) by smtp.gmail.com with ESMTPSA id q18-v6sm8756027lfi.97.2018.06.01.05.59.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Jun 2018 05:59:12 -0700 (PDT) From: Stefan Becker To: buildroot@buildroot.org Date: Fri, 1 Jun 2018 15:58:59 +0300 Message-Id: <20180601125900.26400-2-chemobejk@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180601125900.26400-1-chemobejk@gmail.com> References: <20180601125900.26400-1-chemobejk@gmail.com> Subject: [Buildroot] [PATCH proposal/next 1/2] package/busybox: add host variant X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Becker , "Yann E . MORIN" , Thomas Petazzoni MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Build stripped down version of busybox for the build host to provide "mkpasswd" for the build. This is a replacement for host-mkpasswd. Signed-off-by: Stefan Becker --- fs/common.mk | 2 +- package/Config.in.host | 2 +- package/busybox/Config.in.host | 2 ++ package/busybox/busybox.mk | 28 +++++++++++++++++++ .../skeleton-init-common.mk | 2 +- 5 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 package/busybox/Config.in.host diff --git a/fs/common.mk b/fs/common.mk index 9baf367729..42d5dff569 100644 --- a/fs/common.mk +++ b/fs/common.mk @@ -63,7 +63,7 @@ ROOTFS_COMMON_TARGET_DIR = $(FS_DIR)/target ROOTFS_COMMON_DEPENDENCIES = \ host-fakeroot host-makedevs \ - $(if $(PACKAGES_USERS)$(ROOTFS_USERS_TABLES),host-mkpasswd) + $(if $(PACKAGES_USERS)$(ROOTFS_USERS_TABLES),host-busybox) $(ROOTFS_COMMON_TAR): ROOTFS=COMMON $(ROOTFS_COMMON_TAR): FAKEROOT_SCRIPT=$(FS_DIR)/fakeroot.fs diff --git a/package/Config.in.host b/package/Config.in.host index 38543e7390..c524333671 100644 --- a/package/Config.in.host +++ b/package/Config.in.host @@ -2,6 +2,7 @@ menu "Host utilities" source "package/aespipe/Config.in.host" source "package/android-tools/Config.in.host" + source "package/busybox/Config.in.host" source "package/cargo/Config.in.host" source "package/cbootimage/Config.in.host" source "package/checkpolicy/Config.in.host" @@ -31,7 +32,6 @@ menu "Host utilities" source "package/lpc3250loader/Config.in.host" source "package/lttng-babeltrace/Config.in.host" source "package/mfgtools/Config.in.host" - source "package/mkpasswd/Config.in.host" source "package/mtd/Config.in.host" source "package/mtools/Config.in.host" source "package/mxsldr/Config.in.host" diff --git a/package/busybox/Config.in.host b/package/busybox/Config.in.host new file mode 100644 index 0000000000..93774bdf60 --- /dev/null +++ b/package/busybox/Config.in.host @@ -0,0 +1,2 @@ +config BR2_PACKAGE_HOST_MKPASSWD + bool "host mkpasswd" diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk index 75fe7e137b..aa89f1cc33 100644 --- a/package/busybox/busybox.mk +++ b/package/busybox/busybox.mk @@ -302,4 +302,32 @@ $(error No BusyBox configuration file specified, check your BR2_PACKAGE_BUSYBOX_ endif endif +# +# Host version of busybox to provide "mkpasswd" for the build +# +HOST_BUSYBOX_BUILD_CONFIG = $(HOST_BUSYBOX_DIR)/.config +define HOST_BUSYBOX_CONFIGURE_CMDS + $(HOST_MAKE_ENV) $(MAKE) -C $(@D) allnoconfig + $(call KCONFIG_ENABLE_OPT,CONFIG_MKPASSWD,$(HOST_BUSYBOX_BUILD_CONFIG)) + $(call KCONFIG_ENABLE_OPT,CONFIG_USE_BB_CRYPT,$(HOST_BUSYBOX_BUILD_CONFIG)) + $(call KCONFIG_ENABLE_OPT,CONFIG_USE_BR_CRYPT_SHA,$(HOST_BUSYBOX_BUILD_CONFIG)) + $(call KCONFIG_ENABLE_OPT,CONFIG_BUILD_LIBBUSYBOX,$(HOST_BUSYBOX_BUILD_CONFIG)) + $(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_INDIVIDUAL,$(HOST_BUSYBOX_BUILD_CONFIG)) +endef + +define HOST_BUSYBOX_BUILD_CMDS + $(HOST_MAKE_ENV) $(MAKE) -C $(@D) busybox +endef + +define HOST_BUSYBOX_INSTALL_CMDS + $(HOST_MAKE_ENV) $(MAKE) \ + CONFIG_PREFIX="$(HOST_DIR)" \ + EXTRA_LDFLAGS="-Wl,-rpath,$(HOST_DIR)/lib" \ + -C $(@D) install + rm -f $(HOST_DIR)/bin/sh $(HOST_DIR)/bin/busybox +endef + $(eval $(kconfig-package)) +$(eval $(host-generic-package)) + +MKPASSWD = $(HOST_DIR)/bin/mkpasswd diff --git a/package/skeleton-init-common/skeleton-init-common.mk b/package/skeleton-init-common/skeleton-init-common.mk index e8a0522052..99c87e3861 100644 --- a/package/skeleton-init-common/skeleton-init-common.mk +++ b/package/skeleton-init-common/skeleton-init-common.mk @@ -63,7 +63,7 @@ ifneq ($(filter $$1$$% $$5$$% $$6$$%,$(SKELETON_INIT_COMMON_ROOT_PASSWD)),) SKELETON_INIT_COMMON_ROOT_PASSWORD = '$(SKELETON_INIT_COMMON_ROOT_PASSWD)' else ifneq ($(SKELETON_INIT_COMMON_ROOT_PASSWD),) # This variable will only be evaluated in the finalize stage, so we can -# be sure that host-mkpasswd will have already been built by that time. +# be sure that host-busybox will have already been built by that time. SKELETON_INIT_COMMON_ROOT_PASSWORD = "`$(MKPASSWD) -m "$(SKELETON_INIT_COMMON_PASSWD_METHOD)" "$(SKELETON_INIT_COMMON_ROOT_PASSWD)"`" endif else # !BR2_TARGET_ENABLE_ROOT_LOGIN From patchwork Fri Jun 1 12:59:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Becker X-Patchwork-Id: 923990 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="nW31JrwB"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40y4D00Y9Zz9s1b for ; Fri, 1 Jun 2018 22:59:27 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 4705887CB6; Fri, 1 Jun 2018 12:59:25 +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 4qiNGkNBeekJ; Fri, 1 Jun 2018 12:59:22 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id C052387C71; Fri, 1 Jun 2018 12:59:22 +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 47D911CF175 for ; Fri, 1 Jun 2018 12:59:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 4444289CB4 for ; Fri, 1 Jun 2018 12:59:21 +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 vLsAG4pmpBYn for ; Fri, 1 Jun 2018 12:59:19 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by hemlock.osuosl.org (Postfix) with ESMTPS id 296C189CAF for ; Fri, 1 Jun 2018 12:59:19 +0000 (UTC) Received: by mail-lf0-f68.google.com with SMTP id n3-v6so14713860lfe.12 for ; Fri, 01 Jun 2018 05:59:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=63NIDDpMWcJmh8JzQMPBQzd9gtEVQ2CdrjXEe4HMb/s=; b=nW31JrwBtf90p+aO52Y3BaQaqXByd6/uADC0H8P/o9xPqwOvS5LYooZe/RdR7oTuvU +DVQoduXvLqt6H+LJuFAk1IjRJm42CWQjCs+lf9hDlTXObDuzoe4ESvzt9K7ovK59LRK KECVnBryR1JQrZ0D5slDv1T60pLJtmeBhXkavMFCrm8mqzt5/L6TqZcuEHM6OWvGXrtw 5bb9ORTjZZEHlDk4qbBoZlxWf3T0UCtffJ4k1w+/V7r7g/1p87KzO25jvUnUeN86MXZU V6/VefBgViDXzNDhzIjUHGnw/LWXdSbISWbQjAWAAMySiAmRMkYpWDDz7IkwBjFVOcku EVMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=63NIDDpMWcJmh8JzQMPBQzd9gtEVQ2CdrjXEe4HMb/s=; b=msg3JcibRgqbsBa8KVdGXP0R/H8PBLejrwbYAs7R5n4kd9VfYdIa2vPayMs5r6RRFH GiWov7htUsNT4KxroiudutcG6iCbPZDj6BzLPnc+YpCGdNMq8mkbs0rNcDmG7uQwe6wA 3mvV5F58F3fOfni8vcf9GJfuuyPvqwZFOEWCdjUllAwyH7ihZM4f5DDQ4ktw7biIcd+4 xFIWG8on5k3U4ilvTnb5oY1e4CtWi/nbwj8MWkVhIXZnZ9oHktHcaWTWi3NLzeF/eNIT T34NSFvHuZVJqNvvGLbMInL5ZtjSQBTrilBEam2FB5bvfdqOTnjjLoDR3td5RTOwjio1 mqiA== X-Gm-Message-State: ALKqPwd2bTwn+8D/634ZdPkj3q1Eb/kUxh4XQsi/RZvJLVr74qrLRi4r PORWDNEYBPY3kSvm0cJ0Niy5kld7Ukw= X-Google-Smtp-Source: ADUXVKK2Avtxhapa6sg3CSBmk2/LTPHBSr2G2M+n3b/e3341iww8oe0nWQlskHOFWn44Rh/JfApGwQ== X-Received: by 2002:a19:1813:: with SMTP id o19-v6mr6531147lfi.14.1527857956670; Fri, 01 Jun 2018 05:59:16 -0700 (PDT) Received: from stefanb-lnx.localdomain (86-60-143-206-dyn-dsl.ssp.fi. [86.60.143.206]) by smtp.gmail.com with ESMTPSA id q18-v6sm8756027lfi.97.2018.06.01.05.59.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Jun 2018 05:59:15 -0700 (PDT) From: Stefan Becker To: buildroot@buildroot.org Date: Fri, 1 Jun 2018 15:59:00 +0300 Message-Id: <20180601125900.26400-3-chemobejk@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180601125900.26400-1-chemobejk@gmail.com> References: <20180601125900.26400-1-chemobejk@gmail.com> Subject: [Buildroot] [PATCH proposal/next 2/2] package/mkpasswd: remove obsolete package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Becker , "Yann E . MORIN" , Thomas Petazzoni MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" mkpasswd for the host is now provided by busybox. Signed-off-by: Stefan Becker --- package/mkpasswd/Config.in.host | 2 - package/mkpasswd/config.h | 95 ------- package/mkpasswd/mkpasswd.c | 461 -------------------------------- package/mkpasswd/mkpasswd.mk | 24 -- package/mkpasswd/utils.c | 96 ------- package/mkpasswd/utils.h | 56 ---- 6 files changed, 734 deletions(-) delete mode 100644 package/mkpasswd/Config.in.host delete mode 100644 package/mkpasswd/config.h delete mode 100644 package/mkpasswd/mkpasswd.c delete mode 100644 package/mkpasswd/mkpasswd.mk delete mode 100644 package/mkpasswd/utils.c delete mode 100644 package/mkpasswd/utils.h diff --git a/package/mkpasswd/Config.in.host b/package/mkpasswd/Config.in.host deleted file mode 100644 index 93774bdf60..0000000000 --- a/package/mkpasswd/Config.in.host +++ /dev/null @@ -1,2 +0,0 @@ -config BR2_PACKAGE_HOST_MKPASSWD - bool "host mkpasswd" diff --git a/package/mkpasswd/config.h b/package/mkpasswd/config.h deleted file mode 100644 index f345074121..0000000000 --- a/package/mkpasswd/config.h +++ /dev/null @@ -1,95 +0,0 @@ -/* Program version */ -#define VERSION "5.0.26" - -/* Configurable features */ - -/* Always hide legal disclaimers */ -#undef ALWAYS_HIDE_DISCL - -/* Default server */ -#define DEFAULTSERVER "whois.arin.net" - -/* Configuration file */ -/* -#define CONFIG_FILE "/etc/whois.conf" -*/ - - -/* autoconf in cpp macros */ -#ifdef linux -# define ENABLE_NLS -#endif - -#ifdef __FreeBSD__ -/* which versions? */ -# define HAVE_GETOPT_LONG -# define HAVE_GETADDRINFO -# define ENABLE_NLS -# ifndef LOCALEDIR -# define LOCALEDIR "/usr/local/share/locale" -# endif -#endif - -/* needs unistd.h */ -#if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 200112L -# define HAVE_GETADDRINFO -# define HAVE_REGEXEC -#endif - -#if defined __APPLE__ && defined __MACH__ -# define HAVE_GETOPT_LONG -# define HAVE_GETADDRINFO -#endif - -#if defined __GLIBC__ -# define HAVE_GETOPT_LONG -# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 -# define HAVE_GETADDRINFO -# endif -# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 7 -# define HAVE_SHA_CRYPT -# endif -#endif - -/* Unknown versions of Solaris */ -#if defined __SVR4 && defined __sun -# define HAVE_SHA_CRYPT -# define HAVE_SOLARIS_CRYPT_GENSALT -#endif - -/* FIXME: which systems lack this? */ -#define HAVE_GETTIMEOFDAY -/* FIXME: disabled because it does not parse addresses with a netmask length. - * The code using it needs to be either fixed or removed. -#define HAVE_INET_PTON -*/ - -/* - * Please send patches to correctly ignore old releases which lack a RNG - * and add more systems which have one. - */ -#ifdef RANDOM_DEVICE -#elif defined __GLIBC__ \ - || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ \ - /* AIX >= 5.2? */ \ - || defined _AIX52 \ - /* HP-UX >= B.11.11.09? */ \ - || defined __hpux \ - /* OS X: */ \ - || (defined __APPLE__ && defined __MACH__) \ - /* Solaris >= 9 (this is >= 7): */ \ - || (defined __SVR4 && defined __sun && defined SUSv2) \ - /* Tru64 UNIX >= 5.1B? */ \ - || defined __osf -# define RANDOM_DEVICE "/dev/urandom" -#endif - -#ifdef ENABLE_NLS -# ifndef NLS_CAT_NAME -# define NLS_CAT_NAME "whois" -# endif -# ifndef LOCALEDIR -# define LOCALEDIR "/usr/share/locale" -# endif -#endif - diff --git a/package/mkpasswd/mkpasswd.c b/package/mkpasswd/mkpasswd.c deleted file mode 100644 index fd16230468..0000000000 --- a/package/mkpasswd/mkpasswd.c +++ /dev/null @@ -1,461 +0,0 @@ -/* - * Copyright (C) 2001-2008 Marco d'Itri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* for crypt, snprintf and strcasecmp */ -#define _XOPEN_SOURCE -#define _BSD_SOURCE - -/* System library */ -#include -#include -#include -#include "config.h" -#ifdef HAVE_GETOPT_LONG -#include -#endif -#include -#include -#include -#include -#ifdef HAVE_XCRYPT -#include -#include -#endif -#ifdef HAVE_LINUX_CRYPT_GENSALT -#define _OW_SOURCE -#include -#endif -#ifdef HAVE_GETTIMEOFDAY -#include -#endif - -/* glibc without crypt() */ -#ifndef _XOPEN_CRYPT -#include -#endif - -/* Application-specific */ -#include "utils.h" - -/* Global variables */ -#ifdef HAVE_GETOPT_LONG -static const struct option longopts[] = { - {"method", optional_argument, NULL, 'm'}, - /* for backward compatibility with versions < 4.7.25 (< 20080321): */ - {"hash", optional_argument, NULL, 'H'}, - {"help", no_argument, NULL, 'h'}, - {"password-fd", required_argument, NULL, 'P'}, - {"stdin", no_argument, NULL, 's'}, - {"salt", required_argument, NULL, 'S'}, - {"rounds", required_argument, NULL, 'R'}, - {"version", no_argument, NULL, 'V'}, - {NULL, 0, NULL, 0 } -}; -#else -extern char *optarg; -extern int optind; -#endif - -static const char valid_salts[] = "abcdefghijklmnopqrstuvwxyz" -"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./"; - -struct crypt_method { - const char *method; /* short name used by the command line option */ - const char *prefix; /* salt prefix */ - const unsigned int minlen; /* minimum salt length */ - const unsigned int maxlen; /* maximum salt length */ - const unsigned int rounds; /* supports a variable number of rounds */ - const char *desc; /* long description for the methods list */ -}; - -static const struct crypt_method methods[] = { - /* method prefix minlen, maxlen rounds description */ - { "des", "", 2, 2, 0, - N_("standard 56 bit DES-based crypt(3)") }, - { "md5", "$1$", 8, 8, 0, "MD5" }, -#if defined OpenBSD || defined FreeBSD || (defined __SVR4 && defined __sun) - { "bf", "$2a$", 22, 22, 1, "Blowfish" }, -#endif -#if defined HAVE_LINUX_CRYPT_GENSALT - { "bf", "$2a$", 22, 22, 1, "Blowfish, system-specific on 8-bit chars" }, - /* algorithm 2y fixes CVE-2011-2483 */ - { "bfy", "$2y$", 22, 22, 1, "Blowfish, correct handling of 8-bit chars" }, -#endif -#if defined FreeBSD - { "nt", "$3$", 0, 0, 0, "NT-Hash" }, -#endif -#if defined HAVE_SHA_CRYPT - /* http://people.redhat.com/drepper/SHA-crypt.txt */ - { "sha-256", "$5$", 8, 16, 1, "SHA-256" }, - { "sha-512", "$6$", 8, 16, 1, "SHA-512" }, -#endif - /* http://www.crypticide.com/dropsafe/article/1389 */ - /* - * Actually the maximum salt length is arbitrary, but Solaris by default - * always uses 8 characters: - * http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/ \ - * usr/src/lib/crypt_modules/sunmd5/sunmd5.c#crypt_gensalt_impl - */ -#if defined __SVR4 && defined __sun - { "sunmd5", "$md5$", 8, 8, 1, "SunMD5" }, -#endif - { NULL, NULL, 0, 0, 0, NULL } -}; - -void generate_salt(char *const buf, const unsigned int len); -void *get_random_bytes(const int len); -void display_help(int error); -void display_version(void); -void display_methods(void); - -int main(int argc, char *argv[]) -{ - int ch, i; - int password_fd = -1; - unsigned int salt_minlen = 0; - unsigned int salt_maxlen = 0; - unsigned int rounds_support = 0; - const char *salt_prefix = NULL; - const char *salt_arg = NULL; - unsigned int rounds = 0; - char *salt = NULL; - char rounds_str[30]; - char *password = NULL; - -#ifdef ENABLE_NLS - setlocale(LC_ALL, ""); - bindtextdomain(NLS_CAT_NAME, LOCALEDIR); - textdomain(NLS_CAT_NAME); -#endif - - /* prepend options from environment */ - argv = merge_args(getenv("MKPASSWD_OPTIONS"), argv, &argc); - - while ((ch = GETOPT_LONGISH(argc, argv, "hH:m:5P:R:sS:V", longopts, 0)) - > 0) { - switch (ch) { - case '5': - optarg = (char *) "md5"; - /* fall through */ - case 'm': - case 'H': - if (!optarg || strcaseeq("help", optarg)) { - display_methods(); - exit(0); - } - for (i = 0; methods[i].method != NULL; i++) - if (strcaseeq(methods[i].method, optarg)) { - salt_prefix = methods[i].prefix; - salt_minlen = methods[i].minlen; - salt_maxlen = methods[i].maxlen; - rounds_support = methods[i].rounds; - break; - } - if (!salt_prefix) { - fprintf(stderr, _("Invalid method '%s'.\n"), optarg); - exit(1); - } - break; - case 'P': - { - char *p; - password_fd = strtol(optarg, &p, 10); - if (p == NULL || *p != '\0' || password_fd < 0) { - fprintf(stderr, _("Invalid number '%s'.\n"), optarg); - exit(1); - } - } - break; - case 'R': - { - char *p; - rounds = strtol(optarg, &p, 10); - if (p == NULL || *p != '\0' || rounds < 0) { - fprintf(stderr, _("Invalid number '%s'.\n"), optarg); - exit(1); - } - } - break; - case 's': - password_fd = 0; - break; - case 'S': - salt_arg = optarg; - break; - case 'V': - display_version(); - exit(0); - case 'h': - display_help(EXIT_SUCCESS); - default: - fprintf(stderr, _("Try '%s --help' for more information.\n"), - argv[0]); - exit(1); - } - } - argc -= optind; - argv += optind; - - if (argc == 2 && !salt_arg) { - password = argv[0]; - salt_arg = argv[1]; - } else if (argc == 1) { - password = argv[0]; - } else if (argc == 0) { - } else { - display_help(EXIT_FAILURE); - } - - /* default: DES password */ - if (!salt_prefix) { - salt_minlen = methods[0].minlen; - salt_maxlen = methods[0].maxlen; - salt_prefix = methods[0].prefix; - } - - if (streq(salt_prefix, "$2a$") || streq(salt_prefix, "$2y$")) { - /* OpenBSD Blowfish and derivatives */ - if (rounds <= 5) - rounds = 5; - /* actually for 2a/2y it is the logarithm of the number of rounds */ - snprintf(rounds_str, sizeof(rounds_str), "%02u$", rounds); - } else if (rounds_support && rounds) - snprintf(rounds_str, sizeof(rounds_str), "rounds=%u$", rounds); - else - rounds_str[0] = '\0'; - - if (salt_arg) { - unsigned int c = strlen(salt_arg); - if (c < salt_minlen || c > salt_maxlen) { - if (salt_minlen == salt_maxlen) - fprintf(stderr, ngettext( - "Wrong salt length: %d byte when %d expected.\n", - "Wrong salt length: %d bytes when %d expected.\n", c), - c, salt_maxlen); - else - fprintf(stderr, ngettext( - "Wrong salt length: %d byte when %d <= n <= %d" - " expected.\n", - "Wrong salt length: %d bytes when %d <= n <= %d" - " expected.\n", c), - c, salt_minlen, salt_maxlen); - exit(1); - } - while (c-- > 0) { - if (strchr(valid_salts, salt_arg[c]) == NULL) { - fprintf(stderr, _("Illegal salt character '%c'.\n"), - salt_arg[c]); - exit(1); - } - } - - salt = NOFAIL(malloc(strlen(salt_prefix) + strlen(rounds_str) - + strlen(salt_arg) + 1)); - *salt = '\0'; - strcat(salt, salt_prefix); - strcat(salt, rounds_str); - strcat(salt, salt_arg); - } else { -#ifdef HAVE_SOLARIS_CRYPT_GENSALT -#error "This code path is untested on Solaris. Please send a patch." - salt = crypt_gensalt(salt_prefix, NULL); - if (!salt) - perror(stderr, "crypt_gensalt"); -#elif defined HAVE_LINUX_CRYPT_GENSALT - void *entropy = get_random_bytes(64); - - salt = crypt_gensalt(salt_prefix, rounds, entropy, 64); - if (!salt) { - fprintf(stderr, "crypt_gensalt failed.\n"); - exit(2); - } - free(entropy); -#else - unsigned int salt_len = salt_maxlen; - - if (salt_minlen != salt_maxlen) { /* salt length can vary */ - srand(time(NULL) + getpid()); - salt_len = rand() % (salt_maxlen - salt_minlen + 1) + salt_minlen; - } - - salt = NOFAIL(malloc(strlen(salt_prefix) + strlen(rounds_str) - + salt_len + 1)); - *salt = '\0'; - strcat(salt, salt_prefix); - strcat(salt, rounds_str); - generate_salt(salt + strlen(salt), salt_len); -#endif - } - - if (password) { - } else if (password_fd != -1) { - FILE *fp; - char *p; - - if (isatty(password_fd)) - fprintf(stderr, _("Password: ")); - password = NOFAIL(malloc(128)); - fp = fdopen(password_fd, "r"); - if (!fp) { - perror("fdopen"); - exit(2); - } - if (!fgets(password, 128, fp)) { - perror("fgets"); - exit(2); - } - - p = strpbrk(password, "\n\r"); - if (p) - *p = '\0'; - } else { - password = getpass(_("Password: ")); - if (!password) { - perror("getpass"); - exit(2); - } - } - - { - const char *result; - result = crypt(password, salt); - /* xcrypt returns "*0" on errors */ - if (!result || result[0] == '*') { - fprintf(stderr, "crypt failed.\n"); - exit(2); - } - /* yes, using strlen(salt_prefix) on salt. It's not - * documented whether crypt_gensalt may change the prefix */ - if (!strneq(result, salt, strlen(salt_prefix))) { - fprintf(stderr, _("Method not supported by crypt(3).\n")); - exit(2); - } - printf("%s\n", result); - } - - exit(0); -} - -#ifdef RANDOM_DEVICE -void* get_random_bytes(const int count) -{ - char *buf; - int fd; - - buf = NOFAIL(malloc(count)); - fd = open(RANDOM_DEVICE, O_RDONLY); - if (fd < 0) { - perror("open(" RANDOM_DEVICE ")"); - exit(2); - } - if (read(fd, buf, count) != count) { - if (count < 0) - perror("read(" RANDOM_DEVICE ")"); - else - fprintf(stderr, "Short read of %s.\n", RANDOM_DEVICE); - exit(2); - } - close(fd); - - return buf; -} -#endif - -#ifdef RANDOM_DEVICE - -void generate_salt(char *const buf, const unsigned int len) -{ - unsigned int i; - - unsigned char *entropy = get_random_bytes(len * sizeof(unsigned char)); - for (i = 0; i < len; i++) - buf[i] = valid_salts[entropy[i] % (sizeof valid_salts - 1)]; - buf[i] = '\0'; -} - -#else /* RANDOM_DEVICE */ - -void generate_salt(char *const buf, const unsigned int len) -{ - unsigned int i; - -# ifdef HAVE_GETTIMEOFDAY - struct timeval tv; - - gettimeofday(&tv, NULL); - srand(tv.tv_sec ^ tv.tv_usec); - -# else /* HAVE_GETTIMEOFDAY */ -# warning "This system lacks a strong enough random numbers generator!" - - /* - * The possible values of time over one year are 31536000, which is - * two orders of magnitude less than the allowed entropy range (2^32). - */ - srand(time(NULL) + getpid()); - -# endif /* HAVE_GETTIMEOFDAY */ - - for (i = 0; i < len; i++) - buf[i] = valid_salts[rand() % (sizeof valid_salts - 1)]; - buf[i] = '\0'; -} - -#endif /* RANDOM_DEVICE */ - -void display_help(int error) -{ - fprintf((EXIT_SUCCESS == error) ? stdout : stderr, - _("Usage: mkpasswd [OPTIONS]... [PASSWORD [SALT]]\n" - "Crypts the PASSWORD using crypt(3).\n\n")); - fprintf(stderr, _( -" -m, --method=TYPE select method TYPE\n" -" -5 like --method=md5\n" -" -S, --salt=SALT use the specified SALT\n" -" -R, --rounds=NUMBER use the specified NUMBER of rounds\n" -" -P, --password-fd=NUM read the password from file descriptor NUM\n" -" instead of /dev/tty\n" -" -s, --stdin like --password-fd=0\n" -" -h, --help display this help and exit\n" -" -V, --version output version information and exit\n" -"\n" -"If PASSWORD is missing then it is asked interactively.\n" -"If no SALT is specified, a random one is generated.\n" -"If TYPE is 'help', available methods are printed.\n" -"\n" -"Report bugs to %s.\n"), ""); - exit(error); -} - -void display_version(void) -{ - printf("mkpasswd %s\n\n", VERSION); - puts("Copyright (C) 2001-2008 Marco d'Itri\n" -"This is free software; see the source for copying conditions. There is NO\n" -"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."); -} - -void display_methods(void) -{ - unsigned int i; - - printf(_("Available methods:\n")); - for (i = 0; methods[i].method != NULL; i++) - printf("%s\t%s\n", methods[i].method, methods[i].desc); -} - diff --git a/package/mkpasswd/mkpasswd.mk b/package/mkpasswd/mkpasswd.mk deleted file mode 100644 index b013390572..0000000000 --- a/package/mkpasswd/mkpasswd.mk +++ /dev/null @@ -1,24 +0,0 @@ -################################################################################ -# -# mkpasswd -# -################################################################################ - -# source included in buildroot, taken from -# https://github.com/rfc1036/whois/blob/master/ -# at revision 5a0f08500fa51608b6d3b73ee338be38c692eadb -HOST_MKPASSWD_LICENSE = GPL-2.0+ - -define HOST_MKPASSWD_BUILD_CMDS - $(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS) \ - package/mkpasswd/mkpasswd.c package/mkpasswd/utils.c \ - -o $(@D)/mkpasswd -lcrypt -endef - -define HOST_MKPASSWD_INSTALL_CMDS - $(INSTALL) -D -m 755 $(@D)/mkpasswd $(HOST_DIR)/bin/mkpasswd -endef - -$(eval $(host-generic-package)) - -MKPASSWD = $(HOST_DIR)/bin/mkpasswd diff --git a/package/mkpasswd/utils.c b/package/mkpasswd/utils.c deleted file mode 100644 index 254bf2ac68..0000000000 --- a/package/mkpasswd/utils.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 1999-2008 by Marco d'Itri . - * - * do_nofail and merge_args come from the module-init-tools package. - * Copyright 2001 by Rusty Russell. - * Copyright 2002, 2003 by Rusty Russell, IBM Corporation. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -/* for strdup */ -#define _XOPEN_SOURCE 500 - -/* System library */ -#include -#include -#include -#include -#include - -/* Application-specific */ -#include "utils.h" - -void *do_nofail(void *ptr, const char *file, const int line) -{ - if (ptr) - return ptr; - - err_quit("Memory allocation failure at %s:%d.", file, line); -} - -/* Prepend options from a string. */ -char **merge_args(char *args, char *argv[], int *argc) -{ - char *arg, *argstring; - char **newargs = NULL; - unsigned int i, num_env = 0; - - if (!args) - return argv; - - argstring = NOFAIL(strdup(args)); - for (arg = strtok(argstring, " "); arg; arg = strtok(NULL, " ")) { - num_env++; - newargs = NOFAIL(realloc(newargs, - sizeof(newargs[0]) * (num_env + *argc + 1))); - newargs[num_env] = arg; - } - - if (!newargs) - return argv; - - /* Append commandline args */ - newargs[0] = argv[0]; - for (i = 1; i <= *argc; i++) - newargs[num_env + i] = argv[i]; - - *argc += num_env; - return newargs; -} - -/* Error routines */ -void err_sys(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - fprintf(stderr, ": %s\n", strerror(errno)); - va_end(ap); - exit(2); -} - -void err_quit(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - fputs("\n", stderr); - va_end(ap); - exit(2); -} - diff --git a/package/mkpasswd/utils.h b/package/mkpasswd/utils.h deleted file mode 100644 index 0f226aee2f..0000000000 --- a/package/mkpasswd/utils.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef WHOIS_UTILS_H -#define WHOIS_UTILS_H - -/* Convenience macros */ -#define streq(a, b) (strcmp(a, b) == 0) -#define strcaseeq(a, b) (strcasecmp(a, b) == 0) -#define strneq(a, b, n) (strncmp(a, b, n) == 0) -#define strncaseeq(a, b, n) (strncasecmp(a, b, n) == 0) - -#define NOFAIL(ptr) do_nofail((ptr), __FILE__, __LINE__) - -/* Portability macros */ -#ifdef __GNUC__ -# define NORETURN __attribute__((noreturn)) -#else -# define NORETURN -#endif - -#ifndef AI_IDN -# define AI_IDN 0 -#endif - -#ifndef AI_ADDRCONFIG -# define AI_ADDRCONFIG 0 -#endif - -#ifdef HAVE_GETOPT_LONG -# define GETOPT_LONGISH(c, v, o, l, i) getopt_long(c, v, o, l, i) -#else -# define GETOPT_LONGISH(c, v, o, l, i) getopt(c, v, o) -#endif - -#ifdef ENABLE_NLS -# include -# include -# define _(a) (gettext(a)) -# ifdef gettext_noop -# define N_(a) gettext_noop(a) -# else -# define N_(a) (a) -# endif -#else -# define _(a) (a) -# define N_(a) (a) -# define ngettext(a, b, c) ((c==1) ? (a) : (b)) -#endif - - -/* Prototypes */ -void *do_nofail(void *ptr, const char *file, const int line); -char **merge_args(char *args, char *argv[], int *argc); - -void err_quit(const char *fmt, ...) NORETURN; -void err_sys(const char *fmt, ...) NORETURN; - -#endif