From 7553795ec2d735c01dbdde129a65b7f45d5aa999 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Tue, 27 Feb 2018 14:34:02 -0600 Subject: Add harmony/ repo for packages still being discussed See https://wiki.adelielinux.org/wiki/Project:Harmony --- harmony/busybox/nologin.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 harmony/busybox/nologin.c (limited to 'harmony/busybox/nologin.c') diff --git a/harmony/busybox/nologin.c b/harmony/busybox/nologin.c new file mode 100644 index 000000000..e0a4c56c7 --- /dev/null +++ b/harmony/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 + +#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; +} + -- cgit v1.2.3-70-g09d2