rlm_sql_mysql - sql_finish_select_query - multiples results sets

Jean DERAM jderam at nordnet.fr
Thu Jul 19 16:18:32 CEST 2007


Hi FR-dev,

I'm working on FR 1.1.6 and mysql 5.0

I wan't to work with stored procedure in mysql.
So as I read on this list there is some tuning of mysql connection flags
to do.
So I back ported rlm_sql_mysql from today snapshot (19/07/07) to FR 1.1.6

It works well but I have one problem:

- In mysql radreply I have an attribute which look like this : AA-NAME =
"My value"
(this is a sample).

- In sql.conf I don't do a SELECT for authorize_reply_query but I call
my stored procedure:
authorize_reply_query = "CALL
p_authorize_reply('%{SQL-User-Name}','%{NAS-IP-Address}','%{Called-Station-Id}')"


p_authorize_reply return all attributes in radreply.


AA-NAME attribute is not in dictionary so in sql.c in function
sql_getvpdata when FR try sql_userparse it failed and says : Error:
rlm_sql: Failed to create the pair: Unknown attribute "AA-NAME"

Then FR launch: (inst->module->sql_finish_select_query)(sqlsocket,
inst->config);

But sql_finish_select_query doesn't handle the fact that the statement
is perhaps a multiple results set (as sql_finish_query in today snapshot
does).


So after the sql_finish_select_query the connection throw out of sync
(error 2014) on all the next queries.
Debug: rlm_sql_mysql: MYSQL check_error: 2014 received
=> Database query error - Commands out of sync; you can't run this
command now
The connection never return to a synced state.

I've duplicated the code of sql_finish_query in sql_finish_select_query
to care of multiple results set and then it works.


What do you think about this?

Note: I know that this is the bad Attribut that break the mysql state,
but I wonder if it's right that sql_finish_select_query should care of
multiple results set as sql_finish_query or not.


Thanks


Jean DERAM



More information about the Freeradius-Devel mailing list