Exec remote command in Preprocess

Rafal Pilos rafal.pilos at gmail.com
Fri Feb 28 23:21:39 CET 2014


Thanks, I updated config and now is accepted.

if ("%{exec:/test/script.sh %{User-Name}}" == "257"){
     update control {
                                        Auth-Type := "Accept"
                                                        }
                                     }
            else {
                    update control {
                                         Auth-Type := "Reject"
                                                        }


However theres another problem, script returns 257 but Exec: program
returned: 0




Fri Feb 28 22:59:34 2014 : Info: ++[preprocess] = ok
Fri Feb 28 22:59:34 2014 : Info: ++? if ("%{exec:/test/script.sh
%{User-Name}}" == "257")
Fri Feb 28 22:59:34 2014 : Info: Executing /test/script.sh %{User-Name}
Fri Feb 28 22:59:34 2014 : Info:        expand: %{User-Name} -> user01
Fri Feb 28 22:59:34 2014 : Debug: Exec output: 257
Fri Feb 28 22:59:34 2014 : Debug: Exec plaintext: 257
Fri Feb 28 22:59:34 2014 : Info: Exec: program returned: 0
Fri Feb 28 22:59:34 2014 : Info: result 0
Fri Feb 28 22:59:34 2014 : Info:        expand: %{exec:/test/script.sh
%{User-Name}} -> 257
Fri Feb 28 22:59:34 2014 : Info: ? Evaluating ("%{exec:/test/script.sh
%{User-Name}}" == "257") -> FALSE
Fri Feb 28 22:59:34 2014 : Info: ++? if ("%{exec:/test/script.sh
%{User-Name}}" == "257") -> FALSE
Fri Feb 28 22:59:34 2014 : Info: ++else else {
Fri Feb 28 22:59:34 2014 : Info: +++update control {


What should I do to use output from script (257) directly as result to
compare ?


2014-02-28 20:39 GMT+01:00 Alan DeKok <aland at deployingradius.com>:

> Rafal Pilos wrote:
> > if (%{exec:/path/to/script.sh} == "some numbers"){
>
>   That's wrong.  See "man unlang".
>
> > However this doesn't work.
> > Debug shows:
> > Bare %{...} is invalid in condition at: %{exec:/path/to/script.sh} ==
> > "some numbers")
> >  What im doing wrong ?
>
>   Add quotes around the exec:
>
>         if ("%{exec:...}" == "blah") {
>
> > Is there possibility to execute remote script in this place ?
>
>   Yes.
>
>   Alan DeKok.
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20140228/3da15156/attachment.html>


More information about the Freeradius-Users mailing list