~ubuntu-branches/ubuntu/utopic/freeradius/utopic

« back to all changes in this revision

Viewing changes to src/main/radzap

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2006-12-16 20:45:11 UTC
  • mfrom: (3.1.10 feisty)
  • Revision ID: james.westby@ubuntu.com-20061216204511-3pbbsu4s8jtehsor
Tags: 1.1.3-3
Fix POSIX compliance problem in init script.  Closes: #403384. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
#       $Id: radzap,v 1.2.2.2 2005/05/12 22:24:07 aland Exp $
 
4
#
 
5
 
 
6
usage() {
 
7
        echo "Usage: radzap [options] server[:port] secret" >&2
 
8
        echo "       -d raddb_directory: directory where radiusd.conf is located"
 
9
        echo "       -N nas_ip_address: IP address of the NAS to zap."
 
10
        echo "       -P nas_port: NAS port that the user is logged into."
 
11
        echo "       -u username: Name of user to zap (case insensitive)."
 
12
        echo "       -U username: like -u, but case-sensitive."
 
13
        echo "       -x : more debugging output"
 
14
        exit ${1:-0}
 
15
}
 
16
 
 
17
while test "$#" != "0"
 
18
do
 
19
  case $1 in
 
20
      -h) usage;;
 
21
 
 
22
      -d) RADDB="-d $2";shift;shift;;
 
23
 
 
24
      -N) NAS_IP_ADDR="-N $2";shift;shift;;
 
25
 
 
26
      -P) NAS_PORT="-P $2";shift;shift;;
 
27
 
 
28
      -u) USER_NAME="-u $2";shift;shift;;
 
29
 
 
30
      -U) USER_NAME="-U $2";shift;shift;;
 
31
 
 
32
      -x) DEBUG="-x";shift;;
 
33
 
 
34
      *) break;;
 
35
 
 
36
  esac
 
37
done
 
38
 
 
39
if test "$#" != "2"; then
 
40
    usage 1 >&2
 
41
fi
 
42
 
 
43
 
 
44
SERVER=$1
 
45
SECRET=$2
 
46
 
 
47
#
 
48
#  Radzap is now a wrapper around radwho & radclient.
 
49
#
 
50
radwho -ZR $RADDB $NAS_IP_ADDR $NAS_PORT $USER_NAME | radclient $DEBUG $RADDB -f - $SERVER acct $SECRET