- Enforced no user or agent with UUID 0 on agent DB insertion
parent
9a200da0d2
commit
72725a0894
|
@ -617,6 +617,10 @@ namespace OpenSim.Data.MySQL
|
||||||
/// <param name="agent">The agent to create</param>
|
/// <param name="agent">The agent to create</param>
|
||||||
public override void AddNewUserAgent(UserAgentData agent)
|
public override void AddNewUserAgent(UserAgentData agent)
|
||||||
{
|
{
|
||||||
|
UUID zero = UUID.Zero;
|
||||||
|
if (agent.ProfileID == zero || agent.SessionID == zero)
|
||||||
|
return;
|
||||||
|
|
||||||
MySQLSuperManager dbm = GetLockedConnection();
|
MySQLSuperManager dbm = GetLockedConnection();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -567,6 +567,10 @@ namespace OpenSim.Data.SQLite
|
||||||
/// <param name="agent">The agent to add to the database</param>
|
/// <param name="agent">The agent to add to the database</param>
|
||||||
override public void AddNewUserAgent(UserAgentData agent)
|
override public void AddNewUserAgent(UserAgentData agent)
|
||||||
{
|
{
|
||||||
|
UUID zero = UUID.Zero;
|
||||||
|
if (agent.SessionID == zero || agent.ProfileID == zero)
|
||||||
|
return;
|
||||||
|
|
||||||
DataTable agents = ds.Tables["useragents"];
|
DataTable agents = ds.Tables["useragents"];
|
||||||
lock (ds)
|
lock (ds)
|
||||||
{
|
{
|
||||||
|
|
|
@ -144,7 +144,7 @@ namespace OpenSim.Data.Tests
|
||||||
UserProfileData u1 = db.GetUserByName(fname1,lname1);
|
UserProfileData u1 = db.GetUserByName(fname1,lname1);
|
||||||
UserProfileData u2 = db.GetUserByName(fname2,lname2);
|
UserProfileData u2 = db.GetUserByName(fname2,lname2);
|
||||||
UserProfileData u3 = db.GetUserByName(fname3,lname3);
|
UserProfileData u3 = db.GetUserByName(fname3,lname3);
|
||||||
Assert.That(user1,Is.EqualTo(u1.ID)); //??
|
Assert.That(user1,Is.EqualTo(u1.ID));
|
||||||
Assert.That(user2,Is.EqualTo(u2.ID));
|
Assert.That(user2,Is.EqualTo(u2.ID));
|
||||||
Assert.That(user3,Is.EqualTo(u3.ID));
|
Assert.That(user3,Is.EqualTo(u3.ID));
|
||||||
}
|
}
|
||||||
|
@ -219,12 +219,8 @@ namespace OpenSim.Data.Tests
|
||||||
UserAgentData a4 = NewAgent(zero,agent4);
|
UserAgentData a4 = NewAgent(zero,agent4);
|
||||||
db.AddNewUserAgent(a0);
|
db.AddNewUserAgent(a0);
|
||||||
db.AddNewUserAgent(a4);
|
db.AddNewUserAgent(a4);
|
||||||
UserAgentData a0a = db.GetAgentByUUID(user4);
|
Assert.That(db.GetAgentByUUID(user4),Is.Null);
|
||||||
UserAgentData a4a = db.GetAgentByUUID(zero);
|
Assert.That(db.GetAgentByUUID(zero),Is.Null);
|
||||||
Assert.That(zero,Is.EqualTo(a0a.SessionID));
|
|
||||||
Assert.That(user4,Is.EqualTo(a0a.ProfileID));
|
|
||||||
Assert.That(agent4,Is.EqualTo(a4a.SessionID));
|
|
||||||
Assert.That(zero,Is.EqualTo(a4a.ProfileID));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
Loading…
Reference in New Issue