Violation of PRIMARY KEY

Tommy Cheng ( tommycheng@pcmagic.net )
Sun, 03 May 1998 22:06:03 -0700

Dale,

After I upgraded to Radius NT 2.5.107 I get a bunch of this:

---------
Sun May 03 21:23:16 1998: ODBC Error:23000:2627:
[Microsoft][ODBC SQL Server Driver][SQL Server]Violation of PRIMARY KEY
constraint 'pk_RadLogs': Attempt to insert duplicate key in object
'RadLogs'.
Sun May 03 21:23:16 1998: User: cms Not found
Sun May 03 21:23:23 1998: ODBC Error:00000:1310760:

Sun May 03 21:23:23 1998: ODBC Error:23000:2627:
[Microsoft][ODBC SQL Server Driver][SQL Server]Violation of PRIMARY KEY
constraint 'pk_RadLogs': Attempt to insert duplicate key in object
'RadLogs'.
Sun May 03 21:23:23 1998: User: cms Not found
Sun May 03 21:23:29 1998: ODBC Error:00000:1310760:
---------

This is from a user who is not in our database.

After this person tries repeatedly to log on, Radius NT eats up 100% of
CPU processes and stops sending accounting packets.

This also happens when a user is already logon 1 times:

----
abcdefg found on-line 1 time(s).
Sending Reject of id 204 to ce751b03 (pm3-ind02.pcmagic.net)

User: abcdefg already logged onto system 1 time(s).

User: abcdefg already logged onto system 1 time(s).

SQL Statement: INSERT INTO RadLogs(RadLogMsgID, LogDate, Username,
Data) VALUES (14, GetDate(), 'empire', '1')

ODBC Error:23000:2627:
[Microsoft][ODBC SQL Server Driver][SQL Server]Violation of PRIMARY KEY
constraint 'pk_RadLogs': Attempt to insert duplicate key in object
'RadLogs'.
-----------

and when the user enters wrong password

-----------
Resp Time: 100 Auth: 87/9 -> 96 Acct: 160/0/1 -> 161
radrecv: Request from host ce751b02 code=1, id=34, length=94

User-Name = "amdk5"
Password = "\370\024\272\243\002+\325\303-\036\335N\324a\207\345"
NAS-Identifier = 206.117.27.2
NAS-Port = 12
NAS-Port-Type = Async
User-Service = Framed-User
Framed-Protocol = PPP
Connect-Info = "28800 LAPM/V42BIS"
rad_authenticate_ODBC()

Password = "\370\024\272\243\002+\325\303-\036\335N\324a\207\345"

SQL Statement: Select DateDiff(Minute, GetDate(), DateAdd(Day,
(ma.Extension+ma.OverDue+1), maExpireDate)), DateDiff(Minute, GetDate(),
DateAdd(Day, sa.Extension+1, saExpireDate)), sa.AccountID,
sa.AccountType, sa.Password, sa.Login, sa.Shell, sa.TimeLeft,
sa.LoginLimit From MasterAccounts ma, SubAccounts sa Where
(sa.Login='amdk5' or sa.Shell='amdk5' or sa.Email='amdk5') AND
ma.CustomerID=sa.CustomerID and sa.Active<>0 and ma.Active<>0

Decrypted Password: horses
Database Password: horserus
Sending Reject of id 34 to ce751b02 (pm3-ind01.pcmagic.net)

SQL Statement: INSERT INTO RadLogs(RadLogMsgID, LogDate, Username,
Data) VALUES (11, GetDate(), 'amdk5', 'horses')

ODBC Error:23000:2627:
[Microsoft][ODBC SQL Server Driver][SQL Server]Violation of PRIMARY KEY
constraint 'pk_RadLogs': Attempt to insert duplicate key in object
'RadLogs'.

User: amdk5 Bad Password

User: amdk5 Bad Password
-----------

I also get bunch of this when I login to PM3s:

--------
Resp Time: 30 Auth: 25/0 -> 25 Acct: 38/0/0 -> 38
radrecv: Request from host ce751b03 code=4, id=187, length=79

Acct-Session-Id = "090001D2"
User-Name = "admin"
NAS-Identifier = 206.117.27.3
Acct-Status-Type = Start
Acct-Authentic = Local
User-Service = Shell-User
Login-Service = Telnet
Login-Host = 206.117.211.20
Acct-Delay-Time = 45

SQL Statement: INSERT INTO Calls
(CallDate,AcctSessionId,UserName,NASIdentifier,AcctStatusType,UserService,AcctDelayTime)
VALUES (GetDate(),'090001D2','admin','206.117.27.3',1,6,45)

ODBC Error:23000:2627:
[Microsoft][ODBC SQL Server Driver][SQL Server]Violation of PRIMARY KEY
constraint 'pk_Calls': Attempt to insert duplicate key in object
'Calls'.

Sending Accounting Ack of id 187 to ce751b03 (pm3-ind02.pcmagic.net)
-----------

This happens when I try to login to multiple PM3 at the same time.

So, the question is, how do I fix this?

I've already ran radlogs.sql and rad25_up.sql prior upgrading to Radius
NT 2.5.107.

Tommy Cheng
PC Magic Network

PM3 running 3.8b13 and 3.8b15
Radius NT 2.5.107
SQL 6.5 SP4