Re: Possible bugfix for authentication in rlm_mysql.c

2002-08-15 Thread Justin Schoeman

Frank Cusack wrote:
> On Tue, Aug 13, 2002 at 01:41:06PM +0200, Justin Schoeman wrote:
> 
>>if (inst->config->authenticate_query){ ...
>>
>>but in the config parsing a default of "" (empty string) is specified, 
>>so even if the config string is commented out, it still tries to 
>>authenticate. Changing this to:
>>
>>if((inst->config->authenticate_query) &&
>> (strlen(inst->config->authenticate_query) > 0)){...
>>
>>works like a charm.  Attached is a patch to implement this change, if 
>>you want it.
> 
> 
> Thanks, I've committed something along those lines.  It would be great
> if you could test it.
> 
> /fc
> 
> --- rlm_sql.c 2002/08/14 13:44:45 1.95
> +++ rlm_sql.c 2002/08/15 01:41:32 1.96
> @@ -462,4 +462,4 @@
>   pairfree(&reply_tmp);
>   pairfree(&check_tmp);
>  
> - if (inst->config->authenticate_query){
> + if (*inst->config->authenticate_query){
> 
> - 


Thanks - works great here!  I'm just a bit chicken about using pointers 
before validation, but I suppose the config parser will set it up ;-).

-justin




- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html



Possible bugfix for authentication in rlm_mysql.c

2002-08-13 Thread Justin Schoeman

Hi,

I have just been "getting to know" freeradius (using version 0.7), and 
ran into a minor problem... I wanted to use sql to set the attributes, 
but do the password authentication in another module, so I commented out 
  "authenticate_query" in sql.conf. This did not work... On closer 
inspection, rlm_sql.c has the test:

if (inst->config->authenticate_query){ ...

but in the config parsing a default of "" (empty string) is specified, 
so even if the config string is commented out, it still tries to 
authenticate. Changing this to:

if((inst->config->authenticate_query) &&
 (strlen(inst->config->authenticate_query) > 0)){...

works like a charm.  Attached is a patch to implement this change, if 
you want it.

Thanks,

-justin

PS. Aside from this glitch, my experience with freeradius is wholly 
positive. Well documented, easy to use, very flexible, etc... Great work!


--- freeradius-0.7/src/modules/rlm_sql/rlm_sql.cThu Jul 25 17:54:23 2002
+++ ../cellid/freeradius-0.7/src/modules/rlm_sql/rlm_sql.c  Tue Aug 13 12:59:00 
+2002
@@ -462,7 +462,7 @@
pairfree(&reply_tmp);
pairfree(&check_tmp);
 
-   if (inst->config->authenticate_query){
+   if ((inst->config->authenticate_query) && 
+(strlen(inst->config->authenticate_query) > 0)){
radius_xlat(querystr, MAX_QUERY_LEN, inst->config->authenticate_query, 
request, sql_escape_func);

/* Remove the username we (maybe) added above */