aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rwxr-xr-xvpn/svpnsh10
2 files changed, 9 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 2446d88..6894c0e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
+2009-08-03 Sergey Poznyakoff <gray@gnu.org.ua>
+
+ * vpn/svpnsh: Fix concurrent login recognition.
+
2009-03-19 Sergey Poznyakoff <gray@gnu.org.ua>
Bugfix in sv_sync_www
* cvs/sv_sync_www.c (do_sync): Do not sort the array. This causes
malfunction on newly committed hierarchies.
diff --git a/vpn/svpnsh b/vpn/svpnsh
index 0185fc2..35f4eb1 100755
--- a/vpn/svpnsh
+++ b/vpn/svpnsh
@@ -1,9 +1,9 @@
#! /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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
@@ -17,25 +17,25 @@
PAIR=`sed -n "s/^${USER%%+vpn}=\([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}:[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\).*/\1/p" /usr/local/etc/vpn.conf`
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"
if [ -z "$PAIR" ]; then
logmsg notice "$USER: access denied"
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
fi
logmsg notice "$USER: starting ppp"

Return to:

Send suggestions and report system problems to the System administrator.