aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-02-02 15:16:30 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2012-02-02 15:16:30 +0000
commit1a7dacd2b946f0fce327179a2eec84c4aaeb60d3 (patch)
treedcbeedab30ec9ab0b64ebff7d7d2edba447c01f9 /main
parent13155070b8b08528e1344453ef825c654d5d8c13 (diff)
downloadaports-1a7dacd2b946f0fce327179a2eec84c4aaeb60d3.tar.bz2
aports-1a7dacd2b946f0fce327179a2eec84c4aaeb60d3.tar.xz
main/busybox: add support for nologin applet
This will never be upstreamed, I have tried. It is fairly simple to maintain separately so I think we will try that.
Diffstat (limited to 'main')
-rw-r--r--main/busybox/APKBUILD8
-rw-r--r--main/busybox/busyboxconfig1
-rw-r--r--main/busybox/nologin.c38
3 files changed, 45 insertions, 2 deletions
diff --git a/main/busybox/APKBUILD b/main/busybox/APKBUILD
index d692046c3f..b0bf4b7070 100644
--- a/main/busybox/APKBUILD
+++ b/main/busybox/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=busybox
pkgver=1.19.3
-pkgrel=4
+pkgrel=5
pkgdesc="Size optimized toolbox of many common UNIX utilities"
url=http://busybox.net
arch="all"
@@ -13,6 +13,7 @@ triggers="busybox.trigger=/bin:/usr/bin:/sbin:/usr/sbin:/lib/modules/*"
source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2
bbsuid.c
+ nologin.c
$pkgname-1.11.1-bb.patch
busybox-uname-is-not-gnu.patch
bb-app-location.patch
@@ -40,6 +41,8 @@ prepare() {
*.patch) msg $p; patch -p1 -i "$srcdir"/$p || return 1;;
esac
done
+
+ cp "$srcdir"/nologin.c loginutils/
}
build() {
@@ -84,6 +87,7 @@ static() {
md5sums="c3938e1ac59602387009bbf1dd1af7f6 busybox-1.19.3.tar.bz2
b7b06c7d5cff6935e4ff68a245cc64b5 bbsuid.c
+d64b58a30892c558bdbab7f0d0997577 nologin.c
4c0f3b486eaa0674961b7ddcd0c60a9b busybox-1.11.1-bb.patch
b5375210f13fd6e1ca61a565e8fabd35 busybox-uname-is-not-gnu.patch
754916e52fa11d3fe7c29c93248b6707 bb-app-location.patch
@@ -93,4 +97,4 @@ b5375210f13fd6e1ca61a565e8fabd35 busybox-uname-is-not-gnu.patch
41636628e481f22b8774b6bee1eebfb1 busybox-1.19.3-modinfo.patch
cb48bffc0e1e3be527cd4ff67324a2a2 busybox-1.19.3-wget.patch
7c809b9cd30f40354be90663d5f18bef busybox-1.19.3-mdev.patch
-453614d903ed3f39aa0a4b78f94bc7a5 busyboxconfig"
+42e2f49483e650193c0e142ade7de142 busyboxconfig"
diff --git a/main/busybox/busyboxconfig b/main/busybox/busyboxconfig
index 65bb6bf0aa..025ca20654 100644
--- a/main/busybox/busyboxconfig
+++ b/main/busybox/busyboxconfig
@@ -439,6 +439,7 @@ CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP=y
#
CONFIG_ADD_SHELL=y
CONFIG_REMOVE_SHELL=y
+CONFIG_NOLOGIN=y
CONFIG_FEATURE_SHADOWPASSWDS=y
CONFIG_USE_BB_PWD_GRP=y
CONFIG_USE_BB_SHADOW=y
diff --git a/main/busybox/nologin.c b/main/busybox/nologin.c
new file mode 100644
index 0000000000..e0a4c56c77
--- /dev/null
+++ b/main/busybox/nologin.c
@@ -0,0 +1,38 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * nologin implementation for busybox
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
+ */
+
+//config:config NOLOGIN
+//config: bool "nologin"
+//config: default n
+//config: help
+//config: nologin is a tool that is supposed to be the shell for user accounts
+//config: that are not supposed to login.
+
+//applet:IF_NOLOGIN(APPLET(nologin, BB_DIR_SBIN, BB_SUID_DROP))
+//kbuild:lib-$(CONFIG_NOLOGIN) += nologin.o
+
+//usage:#define nologin_trivial_usage
+//usage: ""
+//usage:#define nologin_full_usage "\n\n"
+//usage: "politely refuse a login\n"
+
+#include "libbb.h"
+#include <syslog.h>
+
+#define _NOLOGIN_TXT "/etc/nologin.txt"
+
+int nologin_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+int nologin_main(int argc UNUSED_PARAM, char **argv)
+{
+ int fd;
+ fd = open(_NOLOGIN_TXT, O_RDONLY);
+ if (bb_copyfd_eof(fd, STDOUT_FILENO) == -1)
+ bb_error_msg_and_die("this account is not available");
+ close(fd);
+ return 1;
+}
+