OK, I think I figured out a way that works.
Can you see any problems that using this method would create?
PreAuthHook sub { my @n = split(/@/,${$_[0]}->{OriginalUserName});\
${$_[0]}->add_attr('realm-id',$n[1]);\
my @b = split(/\\/,${$_[0]}->{OriginalUserName});\
${$_[0]}->add_attr('realm-type',$b[0]);}
AcctSQLStatement insert into accounting\
(USERNAME, TIME_STAMP, ACCTSTATUSTYPE,\
ACCTDELAYTIME, ACCTINPUTOCTETS,\
ACCTOUTPUTOCTETS,\
ACCTSESSIONID, ACCTSESSIONTIME,\
NASIDENTIFIER, NASPORT, FRAMEDIPADDRESS, \
REALM_ID, REALM_TYPE)\
values\
('%{User-Name}', '%{Timestamp}', '%{Acct-Status-Type}',\
'%{Acct-Delay-Time}', '%{Acct-Input-Octets}',\
'%{Acct-Output-Octets}',\
'%{Acct-Session-Id}', '%{Acct-Session-Time}',\
'%{NAS-Identifier}', '%{NAS-Port}', '%{Framed-Address}',\
'%{realm-id}', '%{realm-type}');
Thanks again.
Bob Saunders
At 07:50 PM 4/2/00 -0500, you wrote:
>Hello Robert,
>
>On Apr 1, 10:25pm, Robert Saunders wrote:
>> Subject: (RADIATOR) SQL accounting question
>> I would like to save realm information into rows that I have defined in
>my
>> accounting table.
>> The two new rows are:
>> realm_id
>> realm_type
>> I have been able to get the INSERT to work with no problem, but have
>> struggled with parsing the User-Name information, into variables that I can
>> then include in my INSERT statement.
>> Specifically, my users have a login that looks like either of the
>following:
>> MSNH\[EMAIL PROTECTED]
>> MSNM\[EMAIL PROTECTED]
>> In the beginning of the realm section I have re-write rules that remove
>> both the prefix and the realm leaving just the login-id.
>> What I would like to do is save the prefix MSNH or MSNM into the
>> realm_type and the domain.com into the realm_id. Then be able to INSERT
>> those values into my accounting table.
>> Any suggestions would be greatly appreciated.
>
>
>Hmmm, the realm should be available as %R,and the username as %U (including the
>MSNM\ prefix). The full original user name is available as %u. Depending on
>your SQL, you might be able to do some conversions and stripping of %u in the
>insert statement.
>
>The only other way to tackle this would be to write a hook that extracted the
>bits you want, puts them in some pseudo-variables, and then access the
>pseudo-variables in your insert statement.
>
>Hope that helps.
>
>Cheers.
>
>>
>> Bob Saunders
>> ISP Alliance, Inc.
>>
>>
>> ===
>> Archive at http://www.starport.net/~radiator/
>> Announcements on [EMAIL PROTECTED]
>> To unsubscribe, email '[EMAIL PROTECTED]' with
>> 'unsubscribe radiator' in the body of the message.
>>-- End of excerpt from Robert Saunders
>
>
>
>--
>Mike McCauley [EMAIL PROTECTED]
>Open System Consultants Pty. Ltd Unix, Perl, Motif, C++, WWW
>24 Bateman St Hampton, VIC 3188 Australia http://www.open.com.au
>Phone +61 3 9598-0985 Fax +61 3 9598-0955
>
>Radiator: the most portable, flexible and configurable RADIUS server
>anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald,
>Platypus, Freeside, TACACS+, PAM, external, etc etc on Unix, Win95/8,
>2000, NT, MacOS X
>
>
=== Archive at http://www.starport.net/~radiator/ Announcements on [EMAIL PROTECTED] To unsubscribe, email '[EMAIL PROTECTED]' with 'unsubscribe radiator' in the body of the message.
- (RADIATOR) SQL accounting question Robert Saunders
- Re: (RADIATOR) SQL accounting question Robert Saunders
- Re: (RADIATOR) SQL accounting question Robert Saunders
- Re: (RADIATOR) SQL accounting question Mike McCauley
- (RADIATOR) authby external Brandon
