#!/bin/sh if [ -z "$4" ] then echo "Usage: $0 [options] user password server[:port] secret" echo " [nas-port [dnis [cli [ppphint [nasip [nasid]]]]]]" echo echo "Options: -v give more verbose output" echo " -i ip bind to ip before sending request" echo " -chap perform CHAP authentication instead of PAP" exit 1 fi args=-nq iffl= passattr=User-Password while expr "$1" : "\-" >/dev/null do case "$1" in -v) args= ;; -i) iffl="-i $2" ; shift ;; -chap) passattr=CHAP-Password ;; esac shift done dir=`dirname $0` ( echo User-Name=\""$1"\" echo $passattr=\""$2"\" [ "$5" ] && echo NAS-Port=$5 [ "$6" ] && echo Called-Station-Id=\""$6"\" [ "$7" ] && echo Calling-Station-Id=\""$7"\" [ "$8" ] && echo Service-Type=Framed && echo Framed-Protocol=PPP [ "$9" ] && echo NAS-IP-Address=$9 [ "${10}" ] && echo NAS-Identifier=\""${10}"\" ) | $dir/radclient $args $iffl "$3" "$4" | grep -v '^ RAD-[^C]'