[PATCH] return notfound from rlm_sql

Dmitry Borodaenko angdraug at gmail.com
Tue May 3 15:31:07 CEST 2011


The attached patch makes rlm_sql return RLM_MODULE_NOTFOUND when no rows
were affected by the accounting queries, and modifies acct.c and
modcall.c to recognize notfound as a valid accounting return status. As
far as I can tell, this patch shouldn't affect any existing
configurations which don't expect notfound for accounting packets.

The scenario where this is useful is a staged migration from a legacy
Radius platform to a new FreeRadius setup. During migration phase, new
users are created in the new database, existing users are gradually
moved from the old database to the new one. Users existing in the new
database are handled locally, auth and acct packets for users that
weren't migrated yet are proxied to the legacy platform.

To make use of the attached patch in such scenario, accounting INSERT
queries in dialup.conf are changed into:

<same set of values>
FROM radcheck
WHERE username = '%{SQL-User-Name}'

In the server configuration, invocation of rlm_sql is followed by:

if(notfound) {
 update control {
   Proxy-To-Realm = legacy

Dmitry Borodaenko
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rlm_sql.acct_return_notfound.diff
Type: text/x-diff
Size: 3062 bytes
Desc: not available
URL: <http://lists.freeradius.org/pipermail/freeradius-devel/attachments/20110503/696fd298/attachment.diff>

More information about the Freeradius-Devel mailing list