diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-08-03 09:18:19 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-08-03 09:18:19 +0000 |
commit | 5f392fc3cf8e94112ed7b15b2038e51f1b2b3800 (patch) | |
tree | 05042f0fe25431266bb325a14f6904ab4d4d68f4 | |
parent | ce1f26c5f10d4a1a2c4c0de789371fedf2d4c88d (diff) | |
download | gsc-5f392fc3cf8e94112ed7b15b2038e51f1b2b3800.tar.gz gsc-5f392fc3cf8e94112ed7b15b2038e51f1b2b3800.tar.bz2 |
vpn/svpnsh: Fix concurrent login recognition
git-svn-id: file:///svnroot/gsc/trunk@338 d2de0444-eb31-0410-8365-af798a554d48
-rw-r--r-- | ChangeLog | 4 | ||||
-rwxr-xr-x | vpn/svpnsh | 10 |
2 files changed, 9 insertions, 5 deletions
@@ -1,2 +1,6 @@ +2009-08-03 Sergey Poznyakoff <gray@gnu.org.ua> + + * vpn/svpnsh: Fix concurrent login recognition. + 2009-03-19 Sergey Poznyakoff <gray@gnu.org.ua> @@ -1,5 +1,5 @@ #! /bin/sh # svpnsh -- a simple vpn-only shell -# Copyright (C) 2007 Sergey Poznyakoff +# Copyright (C) 2007, 2009 Sergey Poznyakoff # # This program is free software; you can redistribute it and/or modify @@ -21,5 +21,5 @@ logmsg() { prio=$1 shift - /usr/bin/logger -t vpnsh -p auth.$prio $* + /usr/bin/logger -t svpnsh -p auth.$prio $* } @@ -31,7 +31,7 @@ if [ -z "$PAIR" ]; then fi -NLOGINS=`who -q | sed '2,$d' | tr ' ' '\n' | sort | sed '1d' | uniq -c | - awk "\\$2==\"$USER\" { print \\$1 }"` -if [ ${NLOGINS:-0} -gt 1 ] +sdup=`who -q | sed '/^#/d' | tr -s ' ' '\n' | sort | uniq -d | grep "$USER"` + +if [ -n "$sdup" ] then logmsg notice "$USER: too many concurrent logins" |