From 72725a08940cb087e54ddb847224c0039e5d617b Mon Sep 17 00:00:00 2001
From: Sean Dague
Date: Thu, 16 Oct 2008 15:57:59 +0000
Subject: - Enforced no user or agent with UUID 0 on agent DB insertion
---
OpenSim/Data/MySQL/MySQLUserData.cs | 4 ++++
OpenSim/Data/SQLite/SQLiteUserData.cs | 4 ++++
OpenSim/Data/Tests/BasicUserTest.cs | 12 ++++--------
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs
index 3a088cf..ecd534a 100644
--- a/OpenSim/Data/MySQL/MySQLUserData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserData.cs
@@ -617,6 +617,10 @@ namespace OpenSim.Data.MySQL
/// The agent to create
public override void AddNewUserAgent(UserAgentData agent)
{
+ UUID zero = UUID.Zero;
+ if (agent.ProfileID == zero || agent.SessionID == zero)
+ return;
+
MySQLSuperManager dbm = GetLockedConnection();
try
{
diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs
index 448ef85..94dc1d3 100644
--- a/OpenSim/Data/SQLite/SQLiteUserData.cs
+++ b/OpenSim/Data/SQLite/SQLiteUserData.cs
@@ -567,6 +567,10 @@ namespace OpenSim.Data.SQLite
/// The agent to add to the database
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)
{
diff --git a/OpenSim/Data/Tests/BasicUserTest.cs b/OpenSim/Data/Tests/BasicUserTest.cs
index 726ae84..3830915 100644
--- a/OpenSim/Data/Tests/BasicUserTest.cs
+++ b/OpenSim/Data/Tests/BasicUserTest.cs
@@ -143,8 +143,8 @@ 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)); //??
+ UserProfileData u3 = db.GetUserByName(fname3,lname3);
+ 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]
--
cgit v1.1