summaryrefslogtreecommitdiffstats
path: root/usr.sbin/nologin/nologin.c
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2003-11-17 06:39:38 +0000
committerdas <das@FreeBSD.org>2003-11-17 06:39:38 +0000
commit9c28e36b31f58fe487d9161add02ca0f5a4ece8d (patch)
tree6d98b8a183924032dff61b0974f2daf716fc09ba /usr.sbin/nologin/nologin.c
parentd29883b254f7a8b1b5b751f0d467645a6c461fe0 (diff)
downloadFreeBSD-src-9c28e36b31f58fe487d9161add02ca0f5a4ece8d.zip
FreeBSD-src-9c28e36b31f58fe487d9161add02ca0f5a4ece8d.tar.gz
Reimplement nologin(8) as a C program. This allows us to statically
link it at low cost and avoid environment poisoning attacks associated with LD_LIBRARY_PATH. Suggested by: rwatson
Diffstat (limited to 'usr.sbin/nologin/nologin.c')
-rw-r--r--usr.sbin/nologin/nologin.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/usr.sbin/nologin/nologin.c b/usr.sbin/nologin/nologin.c
new file mode 100644
index 0000000..2454df4
--- /dev/null
+++ b/usr.sbin/nologin/nologin.c
@@ -0,0 +1,21 @@
+/*-
+ * This program is in the public domain. I couldn't bring myself to
+ * declare Copyright on a variant of Hello World.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <unistd.h>
+
+#define MESSAGE "This account is currently not available.\n"
+
+int
+main(int argc, char *argv[])
+{
+
+ write(STDOUT_FILENO, MESSAGE, sizeof(MESSAGE));
+ _exit(1);
+}
OpenPOWER on IntegriCloud