Debian Codegraph @

src/main/radzap

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