Blank spaces after username - problem with accounting - MySql database.

Marinko Tarlac mangia81 at gmail.com
Tue Jan 22 00:33:44 CET 2008


Hi there... It is me again... Few days ago, I wrote about my problem 
with accounting. Problem is that accounting doesn't work for some users. 
In this case it is "test.user"... After some investigation with log 
files (holly radiusd -X), I can see that problem is in username. As you 
can see (line marked with *-*-*-*-*-*-*), some blank spaces were added 
to username. I'm not sure how is this possible and who adds this blank 
spaces (Mikrotik as nas or radius server?).

Log file is truncated but I believe you can see where is the problem.

------------------------------------------------------------------------------------------------- 
LOG STARTS
Finished request 13
Going to the next request
Waking up in 5 seconds...
rad_recv: Access-Request packet from host 192.168.15.2:48263, id=86, 
length=145
       Service-Type = Framed-User
       Framed-Protocol = PPP
       NAS-Port = 23427
       NAS-Port-Type = Ethernet
       User-Name = "test.user  "  *-*-*-*-*-*-* (notice blank spaces 
before closing ")
       ....
   rlm_realm: No '@' in User-Name = "test.user  ", looking up realm 
NULL  *-*-*-*-*-*-* (NOTICE BLANK SPACE BEFORE CLOSING ")
....
...
radius_xlat:  'test.user  ' *-*-*-*-*-*-* (NOTICE BLANK SPACE BEFORE 
CLOSING ")
rlm_sql (sql): sql_set_user escaped user --> 'test.user  ' *-*-*-*-*-*-* 
(NOTICE BLANK SPACE BEFORE CLOSING ")
radius_xlat:  'SELECT id, UserName, Attribute, Value, op           FROM 
radcheck           WHERE Username = 'test.user  '           ORDER BY id' 
*-*-*-*-*-*-* (NOTICE BLANK SPACE BEFORE CLOSING ")
.....
 rad_check_password:  Found Auth-Type CHAP
auth: type "CHAP"
 Processing the authenticate section of radiusd.conf
modcall: entering group CHAP for request 14
 rlm_chap: login attempt by "test.user  " with CHAP password 
*-*-*-*-*-*-* (NOTICE BLANK SPACE BEFORE CLOSING ")
 rlm_chap: Using clear text password "testpassword" for user test.user 
 authentication.
 rlm_chap: chap user test.user   authenticated succesfully *-*-*-*-*-*-* 
(user with blank spaces doesn't exist anywhere and especially not in 
radcheck table and authentication was successful ????)
 modcall[authenticate]: module "chap" returns ok for request 14
modcall: leaving group CHAP (returns ok) for request 14
..............
radius_xlat:  'INSERT into radacct (AcctSessionId, AcctUniqueId, 
UserName, Realm, NASIPAddress, NASPortId, NASPortType, AcctStartTime, 
AcctStopTime, AcctSessionTime, AcctAuthentic, ConnectInfo_start, 
ConnectInfo_stop, AcctInputOctets, AcctOutputOctets, CalledStationId, 
CallingStationId, AcctTerminateCause, ServiceType, FramedProtocol, 
FramedIPAddress, AcctStartDelay, AcctStopDelay) values('814054d0', 
'8ff2e3a7022d4a99', 'test.user  ', '', '192.168.15.2', '23427', 
'Ethernet', '2008-01-21 23:41:06', '0', '0', 'RADIUS', '', '', '0', '0', 
'ht1', '00:19:66:11:59:F7', '', 'Framed-User', 'PPP', '192.168.15.212', 
'0', '0')'

------------------------------------------------------------------------------------------------- 
LOG ENDS

p.s. As I can see in debug lines, raddacct table has been filled with 
wrong username so I searched for username "test.user  " and I can see 
his traffic. I can solve this problem with small scheduler script who 
will replace "test.user  " with "test.user" but who knows... Maybe 
tomorrow I will have more spaces and other signs in username ???

One is sure. MySql seems fine and only solution I can do now is to make 
querry "UPDATE radacct SET UserName='test.user' WHERE 
UserName='test.user  '";

FR is 1.1.4 and I will update it and see what's going on...



More information about the Freeradius-Users mailing list