Using STORED PROCEDURE with Freeradius
Agus Supriyadi
sorcerershell at gmail.com
Wed Feb 8 03:54:43 CET 2006
2006/2/7, Saeed Ahmed <saeed at n-g-c.com>:
>
> Hi,
>
> For some reasons I've to use Stored procedure With Freeradius but I am
> getting following error from mysql:
>
> *Error: 1312 SQLSTATE: 0A000 (ER_SP_BADSELECT) *
>
> *Message: PROCEDURE %s can't return a result set in the given context***
>
> You can consider the following example:
>
> Instead of following authorize_check_query
>
> * authorize_check_query = "SELECT id, UserName, Attribute, Value, op,
> uid \*
>
> * FROM ${authcheck_table} \*
>
> * WHERE Username = '%{SQL-User-Name}' \*
>
> * ORDER BY id"***
>
> I want to use this:
>
> *authorize_check_query = "CALL molo('%{SQL-User-Name}')"***
>
> And this is my stored proc in mysql:
>
> *DELIMITER $$;*
>
> *DROP PROCEDURE IF EXISTS `radius`.`molo`$$*
>
> *CREATE PROCEDURE `molo`(did VARCHAR(10))*
>
> *BEGIN*
>
> *DECLARE rid INT;*
>
> *DECLARE ruid VARCHAR(15);*
>
> *DECLARE rattr VARCHAR(15);*
>
> *DECLARE rop CHAR(2);*
>
> *DECLARE rval VARCHAR(10);*
>
> *SELECT id, UserName, Attribute, Value, op INTO rid,ruid,rattr,rop,rval
> from radcheck WHERE UserName=did;*
>
> *SELECT rid,ruid,rattr,rop,rval;*
>
> *END$$*
>
> *DELIMITER;$$***
>
> I can call this stored proc From any mysql client successfully, but if Icall it from
> sql.conf it gives error: 1312.
>
> Any solution please?
>
> Thanks in advance
> Saeed Ahmed.**
>
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html
>
>
Perhaps it's happen because the field name returned by the molo procedure.
I think you have to use UserName insted of ruid because UserName field
already mapped to User-Name Attribute. Or you have to change how freeradius
map the attributes with field in your database.
Regards
Agus
--
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d(-) s:- a--- C++(+++)$>++++$ UL$>++++$ P+? L++$>$ !E--- W++ !N !o !K--
w !O M !V PS PE !Y PGP t 5 X R tv b DI D G e h r y
------END GEEK CODE BLOCK------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20060208/d161a666/attachment.html>
More information about the Freeradius-Users
mailing list