New build path variable
[freeradius.git] / src / main / radzap
1 #!/bin/sh
2 #
3 #       $Id$
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