- Enforced no user or agent with UUID 0 on agent DB insertion

0.6.0-stable
Sean Dague 2008-10-16 15:57:59 +00:00
parent 9a200da0d2
commit 72725a0894
3 changed files with 12 additions and 8 deletions

View File

@ -617,6 +617,10 @@ namespace OpenSim.Data.MySQL
/// <param name="agent">The agent to create</param>
public override void AddNewUserAgent(UserAgentData agent)
{
UUID zero = UUID.Zero;
if (agent.ProfileID == zero || agent.SessionID == zero)
return;
MySQLSuperManager dbm = GetLockedConnection();
try
{

View File

@ -567,6 +567,10 @@ namespace OpenSim.Data.SQLite
/// <param name="agent">The agent to add to the database</param>
override public void AddNewUserAgent(UserAgentData agent)
{
UUID zero = UUID.Zero;
if (agent.SessionID == zero || agent.ProfileID == zero)
return;
DataTable agents = ds.Tables["useragents"];
lock (ds)
{

View File

@ -144,7 +144,7 @@ namespace OpenSim.Data.Tests
UserProfileData u1 = db.GetUserByName(fname1,lname1);
UserProfileData u2 = db.GetUserByName(fname2,lname2);
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(user3,Is.EqualTo(u3.ID));
}
@ -219,12 +219,8 @@ namespace OpenSim.Data.Tests
UserAgentData a4 = NewAgent(zero,agent4);
db.AddNewUserAgent(a0);
db.AddNewUserAgent(a4);
UserAgentData a0a = db.GetAgentByUUID(user4);
UserAgentData a4a = db.GetAgentByUUID(zero);
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));
Assert.That(db.GetAgentByUUID(user4),Is.Null);
Assert.That(db.GetAgentByUUID(zero),Is.Null);
}
[Test]