freeradius fail redundant

Herwin Weststrate herwin at quarantainenet.nl
Tue Feb 2 16:39:58 CET 2016


On 02-02-16 16:20, Дмитрий wrote:
> mysql Stored procedure returns a "Query OK, 0 row affected"
> radius believes it is not correct
> so decided.
> 
> in freeradius-server-2.2.9 / src / modules / rlm_sql / rlm_sql.c replaced
> 
> -if ( numaffected < 1 ) {
> -ret = RLM_MODULE_NOOP;
> -}
> 
> +if ( (numaffected < 1 && !strstr(querystr,"call")) || (numaffected < 0 && strstr(querystr,"call") ) ) {
> +ret = RLM_MODULE_NOOP;
> +}

That looks like a terrible hack. If I had named my table accouting_call
this would match too. And I'm not even sure if the return value could
possibly be smaller that 0 (it calls a mysql function, which is
documented as "Because mysql_affected_rows() returns an unsigned value,
you can check for -1 by comparing the return value to (my_ulonglong)-1
(or to (my_ulonglong)~0, which is equivalent).", because that makes
everything clearer).

I'm not sure how much alike stored procedures in mysql are compared to
postgresql, but wouldn't it be easier to just return a value in that
stored procedure?

-- 
Herwin Weststrate



More information about the Freeradius-Users mailing list