<div dir="ltr"><div><div>Hi,<br><br>Thanks - that was just was just what I was looking for, although I assume something like the following would go into /etc/freeradius/sites-enabled/default<br><br></div>authorize<br>{<br>
...<br> ntlm_auth<br> {<br> if (User-Password =~ /^(.+)([0-9]{6})$/) {<br><br> update request {<br> User-Password = "%{1}"<br> Some-PIN-Attr = "%{2}"<br>
}<br> }<br> }<br>...<br><br></div>Although it complains in the debug (radiusd -XXX) about the following:<br><br>Wed Apr 17 12:47:23 2013 : Debug: including configuration file /etc/freeradius/sites-enabled/default<br>
Wed Apr 17 12:47:23 2013 : Error: /etc/freeradius/sites-enabled/default[216]: Too many closing braces<br>Wed Apr 17 12:47:23 2013 : Error: Errors reading /etc/freeradius/radiusd.conf<br><br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Wed, Apr 17, 2013 at 12:00 PM, Phil Mayers <span dir="ltr"><<a href="mailto:p.mayers@imperial.ac.uk" target="_blank">p.mayers@imperial.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 17/04/13 11:45, P. Manton wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Is there a way I could trim a variable (such as a password variable)<br>
within a configuration file. I saw a few examples manipulating variables<br>
using unlang here: <a href="http://freeradius.org/radiusd/man/unlang.html#lbAB" target="_blank">http://freeradius.org/radiusd/<u></u>man/unlang.html#lbAB</a><br>
but could not find anything about trimming variables.<br>
</blockquote>
<br></div>
Use a regexp:<br>
<br>
authorize {<br>
...<br>
if (User-Password =~ /^(.+)([0-9]{6})$/) {<div class="im"><br>
update request {<br>
User-Password = "%{1}"<br></div>
Some-PIN-Attr = "%{2}"<br>
}<br>
}<br>
...<br>
}<br>
<br>
If you mean "trim when expanding" you can't; you must transform the variable into another one, then use that. If you don't want to mangle User-Password, define another attribute in the dictionary, taking note of the correct attribute numbers to use (as defined in the comments)<div class="HOEnZb">
<div class="h5"><br>
-<br>
List info/subscribe/unsubscribe? See <a href="http://www.freeradius.org/list/users.html" target="_blank">http://www.freeradius.org/<u></u>list/users.html</a><br>
</div></div></blockquote></div><br></div>