Initial commit
This commit is contained in:
commit
495785d561
13
LICENSE
Normal file
13
LICENSE
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
Copyright (c) 2018, Thomas L <tom@dl6tom.de>
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
10
Makefile
Normal file
10
Makefile
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
.PHONY: all install
|
||||||
|
|
||||||
|
PREFIX ?= /usr
|
||||||
|
LIBEXECDIR ?= ${PREFIX}/libexec
|
||||||
|
|
||||||
|
all:
|
||||||
|
|
||||||
|
install:
|
||||||
|
install -o root -g wheel -m 750 -d "$(DESTDIR)$(LIBEXECDIR)/auth"
|
||||||
|
install -o root -g auth -m 555 login_-sober "$(DESTDIR)$(LIBEXECDIR)/auth/login_-sober"
|
||||||
29
login_-sober
Executable file
29
login_-sober
Executable file
|
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/ksh
|
||||||
|
|
||||||
|
while getopts 'v:s:' opt; do
|
||||||
|
case "$opt" in
|
||||||
|
v)
|
||||||
|
;;
|
||||||
|
s)
|
||||||
|
if [ 'login' != "$OPTARG" ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
test_sentence="Please, type _exactly_ this sentence as fast as you can."
|
||||||
|
temp_file=$(mktemp)
|
||||||
|
echo "$test_sentence"
|
||||||
|
{ time -p read user_sentence; } 2> "$temp_file"
|
||||||
|
user_time=$(sed -ne 's/real *\([^.]*\).*/\1/p' < "$temp_file")
|
||||||
|
rm -f "$temp_file"
|
||||||
|
|
||||||
|
if [ "$test_sentence" == "$user_sentence" -a "$user_time" -le 15 ]; then
|
||||||
|
exec /usr/libexec/auth/login_passwd "$@"
|
||||||
|
fi
|
||||||
|
echo "Too slow or inaccurate typing."
|
||||||
|
echo reject >&3
|
||||||
Loading…
Reference in a new issue