# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#
-# Copyright (C) 2008 Alan DeKok <aland@deployingradius.com>
+# Copyright (C) 2009 Network RADIUS SARL <info@networkradius.com>
#
######################################################################
#
#
#
+usage() {
+ printf "Usage: %s: [-c condition] [-d directory] [-i client-ip-address] [-I client-ipv6-address] [-f socket_file] [-t timeout] [-u user]\n" $(basename $0) >&2
+ exit 2
+}
+
extra=
-filename=
condition=1
-timeout=10
-while getopts 'c:i:I:f:t:u:' OPTION
+timeout=60
+while getopts 'd:c:i:I:f:t:u:' OPTION
do
case $OPTION in
c) condition="$OPTARG"
;;
+ d) [ "$extra" = "" ] || usage
+ extra="-d $OPTARG"
+ ;;
i) condition="(Packet-Src-IP-Address == $OPTARG)"
;;
I) condition="(Packet-Src-IPv6-Address == $OPTARG)"
;;
- f) filename="$OPTARG"
- extra="-f $filename"
+ f) [ "$extra" = "" ] || usage
+ extra="-f $OPTARG"
;;
t) timeout="$OPTARG"
;;
u) condition="(User-Name == $OPTARG)"
;;
- ?) printf "Usage: %s: [-c condition] [-i client-ip-address] [-I client-ipv6-address] [-f socket_file] [-t timeout] [-u user]\n" $(basename $0) >&2
- exit 2
+ ?) usage
;;
esac
done
shift $(($OPTIND - 1))
-radmin="/Users/alandekok/git/2_1_x.git.freeradius.org/src/main/radmin $extra"
+radmin="radmin $extra"
#
# Start off by turning off debugging.
#
# Debug to a file, and then tell us where the file is.
#
-outfile=`$radmin -e "debug file radmin.debug" -e "show debug file"`
+outfile=`$radmin -e "debug file radmin.debug.$$" -e "show debug file"`
#
# If there was an error setting the debug output, re-set the