aboutsummaryrefslogtreecommitdiff
path: root/vpn/svpnsh
diff options
context:
space:
mode:
Diffstat (limited to 'vpn/svpnsh')
-rwxr-xr-xvpn/svpnsh10
1 files changed, 5 insertions, 5 deletions
diff --git a/vpn/svpnsh b/vpn/svpnsh
index 0185fc2..35f4eb1 100755
--- a/vpn/svpnsh
+++ b/vpn/svpnsh
@@ -1,6 +1,6 @@
#! /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
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ PAIR=`sed -n "s/^${USER%%+vpn}=\([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]
logmsg() {
prio=$1
shift
- /usr/bin/logger -t vpnsh -p auth.$prio $*
+ /usr/bin/logger -t svpnsh -p auth.$prio $*
}
logmsg debug "USER=$USER, PAIR=$PAIR"
@@ -30,9 +30,9 @@ if [ -z "$PAIR" ]; then
exit 1
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"
exit 1

Return to:

Send suggestions and report system problems to the System administrator.