how to call stored procedure in free-radius server

Arran Cudbard-Bell a.cudbardb at freeradius.org
Tue Jan 15 13:10:33 CET 2013


On 15 Jan 2013, at 11:30, Lakshmi Narayana Baliah <LB0074453 at techmahindra.com> wrote:

> Hi Arran,
> 
> Thanks for your reply.... have created stored procedure(myS1Request) in oracle database 11g as shown below, procedure takes input and output parameters.
> The below procedure should be called in the SQL module in Free-radius for Authentication and Authorization purpose.
> 
> PROCEDURE myS1Request(
>        UserName         IN  VARCHAR2,
>        MessageType      IN  LONG,
>        RemoteAddress    IN  LONG,
>        FemtoAp          IN  VARCHAR2,
>        RadCoverageInd   IN  LONG,
>        RadCellId        IN  LONG,
>        Rad3GCellId      IN  LONG,
>        RadGeoCord       IN  LONG,
>        RadAltDirection  IN  LONG,
>        HNBIPAddress     IN  LONG,
>        RadPLMNId        IN  LONG,
>        HNBCellIdentity  IN  LONG,
>        RadLocAreaLAC    IN  LONG,
>        RadRoutAreaCode  IN  LONG,
>        RadServiceArCode IN  LONG,
> 	  RadCSGId         IN  LONG,
>        RadUECap         IN  LONG,
>        Result           OUT VARCHAR2,
>        RadRegRejCau     OUT LONG,
>        RadLocBlacklInd  OUT LONG,
>        HNBCellId        OUT LONG,
>        RadServiceAreaC  OUT LONG,
>        RadLocationAreaI OUT LONG,
>        RadRoutAreaC     OUT LONG
>         ) 
> 
> 
> please help me how can proceed...........

Just use the syntax that you usually would for calling stored procedures. Or if that doesn't work because oracle has a special function that needs to be called, submit patches.

For adding attributes to the reply list, you want to modify the authorize_reply_query.

As per the examples you can use %{attribute} syntax to specify parts of the SQL query string to replace with attribute values from the request. 

You need to return a result set in the format

https://github.com/FreeRADIUS/freeradius-server/blob/master/src/modules/rlm_sql/sql.c#L147

expects.

That is, one row per attribute that needs to be added to the reply, with the columns:
id, username, attribute, value, op

Id and username aren't used IIRC so they can be anything.

If you feel like getting into the server code, I think there'd be some value for SQL and LDAP to be able to register 'mapping' xlat functions, which when called with a query maps columns in the result to a RADIUS attributes, with a default operator specified by the map.

Sort of like the shim code you'd find in some FFI (foreign function interface) implementations. Actually i'd be interested in getting other people's opinion on that.

-Arran


More information about the Freeradius-Users mailing list