SQL Insert Problem for attribute values including "#"

denizaydin deniz.aydin at turknet.net.tr
Wed Sep 21 11:01:55 CEST 2011


Hi,

I have called-station-id attribute in accounting requests like ;
Calling-Station-Id = "#AXDI_06ULUS_15 atm 1/1/06/01:8.35"

While inserting to database freeradius inserts it like "=23AXDI_06ULUS_15
atm 1/1/06/01:8.35". It replaces # with = .

I have tried with other attributes like Connect-Info and its the same.

rad_recv: Accounting-Request packet from host X.X.X.X port 57241, id=187,
length=209
        User-Name = "ccotesist06adsl at netonesdsl"
        Service-Type = Framed-User
        NAS-IP-Address = X.X.X.X
        NAS-Identifier = "203.63.154.1"
        NAS-Port = 1234
        NAS-Port-Type = Async
        Acct-Session-Id = "00001234"
        Acct-Status-Type = Stop
        Called-Station-Id = "123456789"
        Calling-Station-Id = "987654321"
        Acct-Delay-Time = 0
        Acct-Session-Time = 1000
        Acct-Input-Octets = 20000
        Acct-Output-Octets = 30000
        Calling-Station-Id = "#AXDI_06ULUS_15 atm 1/1/06/01:8.35"
        Acct-Session-Id = "#12333124"
        Framed-IP-Address = 1.1.1.1
        Connect-Info = "#122dA"
# Executing section preacct from file
/usr/local/etc/raddb/sites-enabled/default
+- entering group preacct {...}
++[preprocess] returns ok
[acct_unique] Hashing 'NAS-Port = 1234,Client-IP-Address =
X.X.X.X,NAS-IP-Address = X.X.X.X,Acct-Session-Id = "00001234",User-Name =
"ccotesist06adsl at netonesdsl"'
[acct_unique] Acct-Unique-Session-ID = "b56a03aa1856feec".
++[acct_unique] returns ok
[suffix] Looking up realm "netonesdsl" for User-Name =
"ccotesist06adsl at netonesdsl"
[suffix] Found realm "netonesdsl"
[suffix] Adding Stripped-User-Name = "ccotesist06adsl"
[suffix] Adding Realm = "netonesdsl"
[suffix] Accounting realm is LOCAL.
++[suffix] returns ok
[files] acct_users: Matched entry DEFAULT at line 24
++[files] returns ok
++? if ("%{request:Cisco-AVPair[*]}" =~
/(^|\n)(client-mac-address=([^\n]*))/)
        expand: %{request:Cisco-AVPair[*]} ->
? Evaluating ("%{request:Cisco-AVPair[*]}" =~
/(^|\n)(client-mac-address=([^\n]*))/) -> FALSE
++? if ("%{request:Cisco-AVPair[*]}" =~
/(^|\n)(client-mac-address=([^\n]*))/) -> FALSE
++? if ("%{request:Cisco-Account-Info[*]}" =~ /(^|\n)(S([^\n]*))/)
        expand: %{request:Cisco-Account-Info[*]} ->
? Evaluating ("%{request:Cisco-Account-Info[*]}" =~ /(^|\n)(S([^\n]*))/) ->
FALSE
++? if ("%{request:Cisco-Account-Info[*]}" =~ /(^|\n)(S([^\n]*))/) -> FALSE
  Found Acct-Type SQL
# Executing group from file /usr/local/etc/raddb/sites-enabled/default
+- entering group SQL {...}
[sql]   expand: %{Stripped-User-Name} -> ccotesist06adsl
[sql]   expand: %{%{Stripped-User-Name}:-%{%{User-Name}:-none}} ->
ccotesist06adsl
[sql] sql_set_user escaped user --> 'ccotesist06adsl'
[sql]   expand: %{NAS-Port} -> 1234
[sql]   expand: %{Acct-Delay-Time} -> 0
[sql]   expand: %{Acct-Session-Time} -> 1000
[sql]   expand: %{Acct-Delay-Time} -> 0
[sql]   expand: %{Acct-Input-Gigawords} ->
[sql]   ... expanding second conditional
[sql]   expand: %{Acct-Input-Octets} -> 20000
[sql]   expand: %{Acct-Output-Gigawords} ->
[sql]   ... expanding second conditional
[sql]   expand: %{Acct-Output-Octets} -> 30000
[sql]   expand: INSERT INTO radacct       (AcctSessionId, AcctUniqueId,
UserName, Realm, NASIPAddress, NASPortId, NASPortType, AcctStartTime,
AcctStopTime,       AcctSessionTime, AcctAuthentic, ConnectInfo_stop,
AcctInputOctets, AcctOutputOctets, CalledStationId,          
CallingStationId, AcctTerminateCause, ServiceType, FramedProtocol,
FramedIPAddress, AcctStopDelay,ClientMacAddress,    
AcctStatusType,AcctCookie,SubscriberIdentifier )       
values('%{Acct-Session-Id}',    '%{Acct-Unique-Session-Id}',   
'%{SQL-User-Name}',     NULLIF('%{Realm}', ''),         '%{NAS-IP-Address}',   
%{%{NAS-Port}:-NULL},           '%{NAS-Port-Type}',     ('%S'::timestamp -
'%{%{Acct-Delay-Time}:-0}'::interval -
'%{%{Acct-Session-Time}:-0}'::interval),      ('%S'::timestamp -
'%{%{Acct-Delay-Time}:-0}'::interval),       NULLIF('%{Acct-Session-Time}',
'')::bigint, '%{Acct-Authentic}',        '%{Connect-Info}',     
(('%{%{Acct-Input-Gigawords}:-0}'::bigint << 32) +
'%{%{Acct-Input-Octets}:-0}'::bigint),      
(('%{%{Acct-Output-Gigawords}:-0}'::bigint << 32) + '%{%{Acc
[sql]   expand: /usr/local/var/log/radius/sqltrace.sql ->
/usr/local/var/log/radius/sqltrace.sql
rlm_sql (sql): Reserving sql socket id: 3
rlm_sql_postgresql: query: INSERT INTO radacct    (AcctSessionId,
AcctUniqueId, UserName, Realm, NASIPAddress, NASPortId, NASPortType,
AcctStartTime, AcctStopTime,       AcctSessionTime, AcctAuthentic,
ConnectInfo_stop, AcctInputOctets, AcctOutputOctets, CalledStationId,          
CallingStationId, AcctTerminateCause, ServiceType, FramedProtocol,
FramedIPAddress, AcctStopDelay,ClientMacAddress,   
AcctStatusType,AcctCookie,SubscriberIdentifier )         values('00001234',     
'b56a03aa1856feec',     'ccotesist06adsl',      NULLIF('netonesdsl', ''),      
'X.X.X.X',       1234,          'Async',         ('2011-09-21
11:58:52'::timestamp - '0'::interval - '1000'::interval),         
('2011-09-21 11:58:52'::timestamp - '0'::interval),     NULLIF('1000',
'')::bigint, '',         '=23122dA',     (('0'::bigint << 32) +
'20000'::bigint),        (('0'::bigint << 32) + '30000'::bigint),       
'123456789',    '987654321',    '',     'Framed-User',          '',    
NULLIF('1.1.1.1', '')::inet, 0,         '',     'Stop',         '',     '')
rlm_sql_postgresql: Status: PGRES_COMMAND_OK
rlm_sql_postgresql: query affected rows = 1
rlm_sql (sql): Released sql socket id: 3
++[sql] returns ok
Sending Accounting-Response of id 187 to X.X.X.X port 57241
Finished request 58.
Cleaning up request 58 ID 187 with timestamp +1720

-----
Deniz AYDIN
Senior Network Engineer

--
View this message in context: http://freeradius.1045715.n5.nabble.com/SQL-Insert-Problem-for-attribute-values-including-tp4825658p4825658.html
Sent from the FreeRadius - User mailing list archive at Nabble.com.



More information about the Freeradius-Users mailing list