SQL help from someone who groks c, please?

Phil Mayers p.mayers at imperial.ac.uk
Mon Feb 5 09:56:08 CET 2007


Dan Mahoney, System Admin wrote:
> 
> I assume you mean the core SQL module, and nothing driver specific, yes?

Yep. The relevant code is in rlm_sql.c so it's driver-independent.

> 
>> However, in the CVS version of FreeRadius, the SQL code works much more
>> like you'd expect:
> 
> Also, for the edification of anyone who might stumble on this, the CVS 
> code relevant to which version?  I.e. would this be a 2.x branch thing? 

Sorry my bad - should have been more precise. The code I am looking at 
is a checkout of HEAD. I'm not familiar with the dev/release plans for 
2.0 - hopefully one of the devs will chip in here.

> advanced examples if need be.  The concept of group ownership is still 
> good, but with SQL working the way you describe, and fall-through working 
> right, it's not strictly as necessary as it was: in theory it's possible 
> with the new code to select ALL rows, and read the whole table just like 
> an old-style users-file, no (waste of processor and resources aside).

Very good point - removing the "where username=" bit from the group 
membership query would return each group in turn (ordered by precedence).

> 
>> ...with appropriate check/reply items (e.g. check item might be
>> huntgroup or nas-ip-address). The groups would contain one user - in the
>> previous example, jeremy.
> 
> Okay -- do you know anything about if the semicolon is intentionally 
> ignored?  I tried doing multiple queries in a single statement but got an 
> error (thank god for UNION).

I hazily recall a discussion w.r.t. MySQL and (I think) the 
SQL_MULTI_STATEMENT option not being on in the driver, but here we reach 
the limit of my knowledge. As far as I can tell from the source, rlm_sql 
just passes the xlat'ed string to the driver, so any handling of lack 
therefore of multiple statements would be in there.

> 
> -Dan
> 
> --
> 
> --------Dan Mahoney--------
> Techie,  Sysadmin,  WebGeek
> Gushi on efnet/undernet IRC
> ICQ: 13735144   AIM: LarpGM
> Site:  http://www.gushi.org
> ---------------------------
> 
> - 
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html




More information about the Freeradius-Users mailing list