Dave Mason <[EMAIL PROTECTED]> wrote:
> This may seem a bit unusual, but I find myself in a situation where I
> need to update the SQL authorization database from a different RLM
> module than rlm_sql. That is, in my new RLM I'll want to update the
> radcheck and usergroup tables with data that will be used by a
> subsequent authorization attempt through rlm_sql.
Is that subsequent, as in "another RADIUS request"?
If so, you can set up a post-auth section for SQL, and your module
can drop information into the REQUEST which the post-auth section can
pick up, and use to update the database.
> I see that the instantiate block of rlm_sql creates a
> client socket to the database. Ideally I would like to use this socket
> from my new RLM - is that possible?
Not really.
> If my RLM needs its own socket, I assume I can duplicate the
> rlm_sql_instantiate logic in my RLM's instantiate function? Or, maybe
> this is overkill and I should just use the APIs in mysql.h - what do you
> think?
You can do SQL xlat's: %{sql:.....}
The dynamically translated string can be almost anything, and maybe
even inserts. If so, you can have those dynamic strings as
configuration entries for your module. Your module will then call
radius_xlat(), which will take care of calling all the SQL goop. Your
module can then pretty much throw the resulting translated string
away, if the module doesn't care about the results.
> Finally, if I can't reuse the rlm_sql socket, I'll need to
> clean up the one I created, which should not be a problem - I'll just
> add the close in my rlm_detach.
Nah. Use the dynamic string translation. It takes care of all of
that for you.
Alan DeKok.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html