<div dir="ltr">Thanks, I updated config and now is accepted.<br><br>if ("%{exec:/test/script.sh %{User-Name}}" == "257"){<br> update control {<br> Auth-Type := "Accept"<br>
}<br> }<br> else {<br> update control {<br> Auth-Type := "Reject"<br>
}<br><br><br>However theres another problem, script returns 257 but Exec: program returned: 0<br><br><br><br><br>Fri Feb 28 22:59:34 2014 : Info: ++[preprocess] = ok<br>
Fri Feb 28 22:59:34 2014 : Info: ++? if ("%{exec:/test/script.sh %{User-Name}}" == "257")<br>Fri Feb 28 22:59:34 2014 : Info: Executing /test/script.sh %{User-Name}<br>Fri Feb 28 22:59:34 2014 : Info: expand: %{User-Name} -> user01<br>
Fri Feb 28 22:59:34 2014 : Debug: Exec output: 257<br>Fri Feb 28 22:59:34 2014 : Debug: Exec plaintext: 257<br>Fri Feb 28 22:59:34 2014 : Info: Exec: program returned: 0<br>Fri Feb 28 22:59:34 2014 : Info: result 0<br>Fri Feb 28 22:59:34 2014 : Info: expand: %{exec:/test/script.sh %{User-Name}} -> 257<br>
Fri Feb 28 22:59:34 2014 : Info: ? Evaluating ("%{exec:/test/script.sh %{User-Name}}" == "257") -> FALSE<br>Fri Feb 28 22:59:34 2014 : Info: ++? if ("%{exec:/test/script.sh %{User-Name}}" == "257") -> FALSE<br>
Fri Feb 28 22:59:34 2014 : Info: ++else else {<br>Fri Feb 28 22:59:34 2014 : Info: +++update control {<br><br><br>What should I do to use output from script (257) directly as result to compare ?<br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">2014-02-28 20:39 GMT+01:00 Alan DeKok <span dir="ltr"><<a href="mailto:aland@deployingradius.com" target="_blank">aland@deployingradius.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="">Rafal Pilos wrote:<br>
> if (%{exec:/path/to/script.sh} == "some numbers"){<br>
<br>
</div> That's wrong. See "man unlang".<br>
<div class=""><br>
> However this doesn't work.<br>
> Debug shows:<br>
> Bare %{...} is invalid in condition at: %{exec:/path/to/script.sh} ==<br>
> "some numbers")<br>
> What im doing wrong ?<br>
<br>
</div> Add quotes around the exec:<br>
<br>
if ("%{exec:...}" == "blah") {<br>
<div class=""><br>
> Is there possibility to execute remote script in this place ?<br>
<br>
</div> Yes.<br>
<span class="HOEnZb"><font color="#888888"><br>
Alan DeKok.<br>
-<br>
List info/subscribe/unsubscribe? See <a href="http://www.freeradius.org/list/users.html" target="_blank">http://www.freeradius.org/list/users.html</a><br>
</font></span></blockquote></div><br></div>