blaq...@netscape.net wrote:
> 
> I'm trying to get mac authentication to a mysql database where the mac 
> addresses are stripped of all special characters.
> 
> If I add this line to the /sql/mysql/dialup.conf file
> 
> sql_user_name = "%{Calling-Station-Id}"
> 
> the calling-station-id (username passed to mysql) is the correct mac 
> address however, it has still needs to have all the special characters 
> (hyphens) removed.
> 
> Can someone show me an example of how to modify the 
> calling-station-id?  I suppose using rlm_perl would be the best way as 
> I could modify it using perl.
>
I like to RFCise my attributes, so instead slip into policy.conf the 
following: 
----
rewrite.calling_station_id {
        if( "%{request:Calling-Station-Id}" =~ 
/^([0-9a-f]{2}).?([0-9a-f]{2}).?([0-9a-f]{2}).?([0-9a-f]{2}).?([0-9a-f]{2}).?([0-9a-f]{2})$/i
 ){
                update request {
                        Calling-Station-Id := "%{1}-%{2}-%{3}-%{4}-%{5}-%{6}"
                }
        }
        else {
                noop
        }
}
----

After you call 'preprocess' in authorize, call 
'rewrite.calling_station_id' and you should be good.  Trivial to amend 
to your needs.  I also recommend in your SQL syntax you wrap it in a 
call to LOWER() so then everything is in lowercase in your table.

Cheers

-- 
Alexander Clouter
.sigmonster says: Snoopy: No problem is so big that it can't be run away from.

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

Reply via email to