[RadiusNT] Semi-bug in SetLastUsed stored procedure

Graeme Slogrove ( Graeme@na.co.za )
Tue, 25 Apr 2000 15:46:52 +0200

A bug will exist in the RadSetLastUsed procedure if you do not have domain
stripping set for Radius. The stored procedure COULD read as follows
(removing the domain), but it still does not take into account same username
in different domains.

Ideally it should pick up the group the user belongs to, and update the
correct record.

CREATE PROCEDURE RadSetLastUsed AS

CREATE TABLE #tmpusers
(
Username VARCHAR(32),
CallDate DATETIME
)

INSERT INTO #tmpusers (Username,CallDate)
SELECT Username=CASE WHEN CharIndex('@',username) > 0 Then
left(username,CharIndex('@',username)-1) ELSE username END,MAX(CallDate)
FROM Calls
WHERE CallDate > DATEADD(dd,-1,getdate())
GROUP BY Username

UPDATE sa
SET sa.LastUsed = t.CallDate
FROM SubAccounts sa, #tmpusers t
WHERE sa.Login = t.Username

DROP TABLE #tmpusers

Regards,
Graeme

---Graeme Slogrove, BSc (Eng) Elec (Wits)Director, Systems Development & Value Added ServicesNetActive InternetTel: 011-719-0333    Fax: 011-719-0444Support: 011-719-0300

For more information about this list (including removal) go to:http://www.iea-software.com/support/maillists/liststart