xlat expansion of absent VPs

Stelian Ionescu sionescu at cddr.org
Sat Jun 15 17:47:19 CEST 2013


In processing a request that does not contain Called-Station-Id, I
noticed that absent VPs now get expanded to an underscore instead of the
usual empty string:

xlat aprint 0
xlat aprint 1
xlat aprint 0
xlat aprint 3
expand attr Called-Station-Id --> '_'
[...]
(14) sql :      expand: 'INSERT INTO radacct (acct_session_id, acct_unique_id, flow_id, username, realm, inner_id, nas_ip_address, acct_start_time, last_update, called_station_id, calling_station_id, bs_sector_id, framed_ip_address, acct_status) VALUES(NULLIF('%{Acct-Session-Id}', ''), NULLIF('%{Acct-Unique-Session-Id}', ''), COALESCE(NULLIF('%{WiMAX-PDFID}', ''), '0')::smallint, '%{SQL-User-Name}', '%{Realm}', '%{SQL-User-Name}' || '@' || '%{Realm}', NULLIF('%{NAS-IP-Address}', '')::inet, COALESCE(NULLIF('%{Event-Timestamp}', ''), '%S')::timestamptz, COALESCE(NULLIF('%{Event-Timestamp}', ''), '%S')::timestamptz, NULLIF('%{Called-Station-Id}', '')::inet, NULLIF('%{Calling-Station-Id}', '')::macaddr, COALESCE(parse_bssid(NULLIF('%{WiMAX-BS-Id}', '')), '000000000000'), COALESCE(NULLIF('%{Framed-IP-Address}', ''), '0.0.0.0')::inet, 1);' -> 'INSERT INTO radacct (acct_session_id, acct_unique_id, flow_id, username, realm, inner_id, nas_ip_address, acct_start_time, last_update, called_station_id, calling_station_id, bs_sector_id, framed_ip_address, acct_status) VALUES(NULLIF('13031C4B', ''), NULLIF('ebc3aef1f75ee8853b33a08e42dd364f', ''), COALESCE(NULLIF('0', ''), '0')::smallint, 'test', 'fr3', 'test' || '@' || 'fr3', NULLIF('172.20.10.121', '')::inet, COALESCE(NULLIF('Jun 15 2013 16:32:46 CEST', ''), '2013-06-15 16:30:54')::timestamptz, COALESCE(NULLIF('Jun 15 2013 16:32:46 CEST', ''), '2013-06-15 16:30:54')::timestamptz, NULLIF('_', '')::inet, NULLIF('0C4C399C58F7', '')::macaddr, COALESCE(parse_bssid(NULLIF('0x303030303230303630313030', '')), '000000000000'), COALESCE(NULLIF('109.236.16.222', ''), '0.0.0.0')::inet, 1);'
rlm_sql (sql): Executing query: 'INSERT INTO radacct (acct_session_id, acct_unique_id, flow_id, username, realm, inner_id, nas_ip_address, acct_start_time, last_update, called_station_id, calling_station_id, bs_sector_id, framed_ip_address, acct_status) VALUES(NULLIF('13031C4B', ''), NULLIF('ebc3aef1f75ee8853b33a08e42dd364f', ''), COALESCE(NULLIF('0', ''), '0')::smallint, 'test', 'fr3', 'test' || '@' || 'fr3', NULLIF('172.20.10.121', '')::inet, COALESCE(NULLIF('Jun 15 2013 16:32:46 CEST', ''), '2013-06-15 16:30:54')::timestamptz, COALESCE(NULLIF('Jun 15 2013 16:32:46 CEST', ''), '2013-06-15 16:30:54')::timestamptz, NULLIF('_', '')::inet, NULLIF('0C4C399C58F7', '')::macaddr, COALESCE(parse_bssid(NULLIF('0x303030303230303630313030', '')), '000000000000'), COALESCE(NULLIF('109.236.16.222', ''), '0.0.0.0')::inet, 1);'
rlm_sql_postgresql: Status: PGRES_FATAL_ERROR
rlm_sql_postgresql: Error invalid input syntax for type inet: "_"
rlm_sql_postgresql: Postgresql Fatal Error: [22P02: INVALID TEXT REPRESENTATION] Occurred!!
rlm_sql (sql): Database query error: ERROR:  invalid input syntax for type inet: "_" 



Same thing with a request that doesn't contain User-Name:

rad_recv: Status-Server packet from host 172.20.23.31 port 1814, id=27, length=70
        Message-Authenticator = 0x6ec50145d350c17813778026ac2f2a4a
        NAS-Identifier = "Status Check 0. Are you alive?"
(18) # Executing section post-auth from file /etc/raddb/sites-enabled/default
(18)   group post-auth {
(18)  - entering group post-auth {...}
(18)   [exec] = noop
(18)   update reply {
LITERAL: %{User-Name}
LITERAL: %{User-Name} --> %{User-Name}
EXPANSION: %{User-Name}
Looking for attribute name in User-Name
xlat aprint 3
expand attr User-Name --> '_'
(18)    expand: '%{User-Name}' -> '_'
(18)            WiMAX-MN-NAI := "_"
LITERAL: %{md5:%{User-Name}}
LITERAL: %{md5:%{User-Name}} --> %{md5:%{User-Name}}
EXPANSION: %{md5:%{User-Name}}
MOD: md5 -->
LITERAL: %{User-Name}}
LITERAL: %{User-Name}} --> %{User-Name}}
EXPANSION: %{User-Name}}
Looking for attribute name in User-Name
LITERAL: }
xlat aprint 2
xlat aprint 3
expand attr User-Name --> '_'
expand mod md5 --> '_'

-- 
Stelian Ionescu a.k.a. fe[nl]ix
Quidquid latine dictum sit, altum videtur.
http://common-lisp.net/project/iolib

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freeradius.org/pipermail/freeradius-devel/attachments/20130615/e2d1a05e/attachment.pgp>


More information about the Freeradius-Devel mailing list