[patch] radtest PPPhint option is not parsed properly
Brian Candler
B.Candler at pobox.com
Wed Sep 26 22:59:54 CEST 2012
On Wed, Sep 26, 2012 at 03:55:14PM -0400, John Dennis wrote:
> - if [ "$6" ]
> + if [ ! -z "$6" ] && [[ $6 =~ ^[0-9]+$ ]] && [ $6 -gt 0 ]
radtest starts with /bin/sh, not /bin/bash. Are you sure this
regexp-matching stuff is in a vanilla POSIX shell? I don't think it is.
$ /bin/dash -c '[[ "aaa" =~ "a" ]] && echo "yo"'
/bin/dash: [[: not found
Also you forgot to quote $6 (in case it contains spaces).
Personally I would just go with:
if [ ! -z "$6" -a "$6" -gt 0 ]
This bombs out if you give a non-numeric value, but then that's your fault
for passing bad data. A more backwards-compatible approach is simply:
if [ "$6" != "" -a "$6" != "0" ]
Regards,
Brian.
More information about the Freeradius-Devel
mailing list