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,6 +1,10 @@ | |||
1 | 2009-08-03 Sergey Poznyakoff <gray@gnu.org.ua> | ||
2 | |||
3 | * vpn/svpnsh: Fix concurrent login recognition. | ||
4 | |||
1 | 2009-03-19 Sergey Poznyakoff <gray@gnu.org.ua> | 5 | 2009-03-19 Sergey Poznyakoff <gray@gnu.org.ua> |
2 | 6 | ||
3 | Bugfix in sv_sync_www | 7 | Bugfix in sv_sync_www |
4 | 8 | ||
5 | * cvs/sv_sync_www.c (do_sync): Do not sort the array. This causes | 9 | * cvs/sv_sync_www.c (do_sync): Do not sort the array. This causes |
6 | malfunction on newly committed hierarchies. | 10 | malfunction on newly committed hierarchies. |
@@ -1,9 +1,9 @@ | |||
1 | #! /bin/sh | 1 | #! /bin/sh |
2 | # svpnsh -- a simple vpn-only shell | 2 | # svpnsh -- a simple vpn-only shell |
3 | # Copyright (C) 2007 Sergey Poznyakoff | 3 | # Copyright (C) 2007, 2009 Sergey Poznyakoff |
4 | # | 4 | # |
5 | # This program is free software; you can redistribute it and/or modify | 5 | # This program is free software; you can redistribute it and/or modify |
6 | # it under the terms of the GNU General Public License as published by | 6 | # it under the terms of the GNU General Public License as published by |
7 | # the Free Software Foundation; either version 3 of the License, or | 7 | # the Free Software Foundation; either version 3 of the License, or |
8 | # (at your option) any later version. | 8 | # (at your option) any later version. |
9 | # | 9 | # |
@@ -17,25 +17,25 @@ | |||
17 | 17 | ||
18 | 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` | 18 | 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` |
19 | 19 | ||
20 | logmsg() { | 20 | logmsg() { |
21 | prio=$1 | 21 | prio=$1 |
22 | shift | 22 | shift |
23 | /usr/bin/logger -t vpnsh -p auth.$prio $* | 23 | /usr/bin/logger -t svpnsh -p auth.$prio $* |
24 | } | 24 | } |
25 | 25 | ||
26 | logmsg debug "USER=$USER, PAIR=$PAIR" | 26 | logmsg debug "USER=$USER, PAIR=$PAIR" |
27 | 27 | ||
28 | if [ -z "$PAIR" ]; then | 28 | if [ -z "$PAIR" ]; then |
29 | logmsg notice "$USER: access denied" | 29 | logmsg notice "$USER: access denied" |
30 | exit 1 | 30 | exit 1 |
31 | fi | 31 | fi |
32 | 32 | ||
33 | NLOGINS=`who -q | sed '2,$d' | tr ' ' '\n' | sort | sed '1d' | uniq -c | | 33 | sdup=`who -q | sed '/^#/d' | tr -s ' ' '\n' | sort | uniq -d | grep "$USER"` |
34 | awk "\\$2==\"$USER\" { print \\$1 }"` | 34 | |
35 | if [ ${NLOGINS:-0} -gt 1 ] | 35 | if [ -n "$sdup" ] |
36 | then | 36 | then |
37 | logmsg notice "$USER: too many concurrent logins" | 37 | logmsg notice "$USER: too many concurrent logins" |
38 | exit 1 | 38 | exit 1 |
39 | fi | 39 | fi |
40 | 40 | ||
41 | logmsg notice "$USER: starting ppp" | 41 | logmsg notice "$USER: starting ppp" |