diff options
author | Kiyoshi Aman <kiyoshi.aman+adelie@gmail.com> | 2019-02-22 22:51:35 -0600 |
---|---|---|
committer | Kiyoshi Aman <kiyoshi.aman+adelie@gmail.com> | 2019-02-22 22:51:35 -0600 |
commit | 4618f5695b7bd00c07d656e965db11b31f0d8b36 (patch) | |
tree | 9a3b5f59245e5e3e1183fd56ae907a06c588d1f1 /legacy/busybox/nologin.c | |
parent | d397ab02f9c6c4e5a0ac0a2d5331999d056ae27b (diff) | |
download | packages-4618f5695b7bd00c07d656e965db11b31f0d8b36.tar.gz packages-4618f5695b7bd00c07d656e965db11b31f0d8b36.tar.bz2 packages-4618f5695b7bd00c07d656e965db11b31f0d8b36.tar.xz packages-4618f5695b7bd00c07d656e965db11b31f0d8b36.zip |
{system => legacy}/busybox: fucking inflatable fucking busybox
Diffstat (limited to 'legacy/busybox/nologin.c')
-rw-r--r-- | legacy/busybox/nologin.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/legacy/busybox/nologin.c b/legacy/busybox/nologin.c new file mode 100644 index 000000000..75ad89eda --- /dev/null +++ b/legacy/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 UNUSED_PARAM) +{ + 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; +} + |