Update sections
Arran Cudbard-Bell
a.cudbardb at freeradius.org
Thu Jul 11 00:59:51 CEST 2013
On 10 Jul 2013, at 16:29, Phil Mayers <p.mayers at IMPERIAL.AC.UK> wrote:
> On 10/07/13 15:43, Arran Cudbard-Bell wrote:
>
>> Update sections may now also return fail.
>
> Can you clarify - AIUI, sql xlat can now also distinguish between empty and fail, so if I do this:
>
> update {
> request:Tmp-String-0 := "%{sql:...}"
> }
>
> ...and the SQL server is down, the xlat will fail and the update section as a whole will fail? If so - very very cool.
> -
Yes. Errors bubble from sql_xlat up to the update section. If the value returned from the SQL statement is empty, a zero length attribute will be created, as with 2.x.x, provided that the statement completed successfully.
To support the above, all xlat functions now return an ssize_t, where >= 0 is success (length of data written to buffer), and < 0 is failure.
As of a couple of minutes ago, an update section will now return two RLM_* codes, RLM_MODULE_FAIL if something has actually failed and RLM_MODULE_INVALID if an attribute or list was referenced that doesn't exist in the current request.
-Arran
Arran Cudbard-Bell <a.cudbardb at freeradius.org>
FreeRADIUS Development Team
More information about the Freeradius-Users
mailing list