]> git.ipfire.org Git - thirdparty/sarg.git/blob - user_limit_block
Ported r231 from branches/v2_2_7 (abort on long lines in access.log)
[thirdparty/sarg.git] / user_limit_block
1 #!/bin/sh
2 #
3 # AUTHOR: Pedro Lineu Orso pedro.orso@gmail.com
4 # 1998, 2009
5 # SARG Squid Analysis Report Generator http://sarg.sourceforge.net
6 #
7 # SARG donations:
8 # please look at http://sarg.sourceforge.net/donations.php
9 # ---------------------------------------------------------------------
10 #
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
15 #
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
24 #
25 #
26
27 conf="/usr/local/sarg/sarg.conf"
28 squid_password_file="/usr/local/squid/etc/passwd"
29 tmp="/tmp/sarg_limit.$$"
30
31 limit_file=`grep "per_user_limit" $conf|grep -v "#"|awk '{print $2}'`
32
33 if [ "$limit_file" != "" ]; then
34 rm -rf $tmp
35 cat $limit_file|while read key; do
36 uline=`grep $key $squid_password_file`
37 grep -v $key $squid_password_file > $tmp
38 echo $uline|sed 's/:/:*/g' >> $tmp
39 cat $tmp > $squid_password_file
40 rm -rf $tmp
41 done
42 fi