(RADIATOR) delete_attr('User-Name') in PreClientHook
Frank Danielson
fdanielson at csky.com
Wed Feb 22 08:36:44 CST 2006
Hi Toomas-
Radiator acutally caches the original user name in a couple of spots and
simply modifying the User-Name attribute won't work. I did some work a while
back and figured out how to do it inside of a hook. After some reflection I
think it may have been better to simply use the indentifying attribute as a
check item instead of rewriting the user name.
Ayway here's how I changed the username in a PreClientHook. In this case I
wanted to make the phone number the user name. This was a few versions of
Radiator ago so you may want to test this with the latest release.
my $p = ${$_[0]};
my $callerid=$p->get_attr('Calling-Station-Id');
my $olduser=$p->get_attr('User-Name');
####################################################
# these two lines are where the User-Name is changed
$p->{OriginalUserName}=$callerid;
$p->changeUserName($callerid);
####################################################
my $newuser=$p->get_attr('User-Name');
&main::log($main::LOG_DEBUG,"Username $olduser changed to
$newuser");
Frank Danielson
Infrastructure Architect
ClearSky Mobile Media
56 E. Pine St.
Orlando, FL 32801
USA
fdanielson at csky.com
-----Original Message-----
From: Toomas Kärner [mailto:tomkar at estpak.ee]
Sent: Wednesday, February 22, 2006 8:41 AM
To: radiator at open.com.au
Subject: (RADIATOR) delete_attr('User-Name') in PreClientHook
Hi,
For some reason I'm unable to remove User-Name attribute from incoming
Acct-Request with PreClientHook:
sub {
my $p = ${$_[0]};
my $mac_username = $p->getUserName;
if ($mac_username) {
$p->delete_attr('User-Name');
$p->add_attr('ETC-Mac',$mac_username);
&main::log($main::LOG_DEBUG,"Username attribute with value
$mac_username stripped and put into ETC-Mac");
}
}
Setup goes like this:
Redback SE sends it CLIPS accounting :
*** Received from x.x.x.x port 1812 ....
Code: Accounting-Request
Identifier: 177
Authentic: p$<226>!G<226><17><249>81<18>5<202>Ho=
Attributes:
User-Name = "00:0b:cd:8c:61:ed"
Acct-Status-Type = Stop
Acct-Session-Id = "0001FFFF780001D3-43140C10"
Class = "127828"
.
.
For that NAS, MAC is the user since it does not know any better...
Now I want to remove this username attribute and with PreClientHook
and insert a real username based on information from sessionDB like
this:
<AuthBy SQL>
Identifier GetDataFromSession
DBSource dbi:mysql:xx:x.x.x.x
DBUsername xxx
DBAuth xxx
AuthenticateAccounting
AuthSelect SELECT \
username \
from wnsession where \
class_id = '%{Class}'
AuthColumnDef 0, User-Name, request
NoDefault
</AuthBy SQL>
But for some reason I still get the MAC later into accounting as the
username.
I have some workarounds but I dont like them very much and I got
interested what I'm doing wrong...
Rgds.
Toomas
--
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.
--
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.
More information about the radiator
mailing list