#!/bin/sh

conf="/usr/local/sarg/sarg.conf"
squid_password_file="/usr/local/squid/etc/passwd"
tmp="/tmp/sarg_limit.$$"

limit_file=`grep "per_user_limit" $conf|grep -v "#"|awk '{print $2}'`

if [ "$limit_file" != "" ]; then
   rm -rf $tmp
   cat $limit_file|while read key; do
      uline=`grep $key $squid_password_file`
      grep -v $key $squid_password_file > $tmp
      echo $uline|sed 's/:/:*/g' >> $tmp
      cat $tmp > $squid_password_file
      rm -rf $tmp
   done
fi
