aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie Thielker2009-06-14 21:44:34 +0000
committerMelanie Thielker2009-06-14 21:44:34 +0000
commit664dd58cd9a8318c14fc3e3a3950c3e29cf97ba8 (patch)
tree41db60d59a2f0b46388e1e598679265dafc9d247
parentUpdate svn properties. (diff)
downloadopensim-SC_OLD-664dd58cd9a8318c14fc3e3a3950c3e29cf97ba8.zip
opensim-SC_OLD-664dd58cd9a8318c14fc3e3a3950c3e29cf97ba8.tar.gz
opensim-SC_OLD-664dd58cd9a8318c14fc3e3a3950c3e29cf97ba8.tar.bz2
opensim-SC_OLD-664dd58cd9a8318c14fc3e3a3950c3e29cf97ba8.tar.xz
Fixes Mantis #3793 . Committing thomax/Snoopy's patch to allow deeding of objects, with changes:
- Set OwnerID = GroupID for deeded objects. - Close a security loophole that would have allowed a user with deed rights in a group to deed ANY object to that group, even if it's not owned by them and/or not set to that group - Set LastOwnerID correctly. Handle objects vs. prims correctly.
-rw-r--r--OpenSim/Data/MSSQL/MSSQLAssetData.cs2
-rw-r--r--OpenSim/Data/MSSQL/MSSQLEstateData.cs61
-rw-r--r--OpenSim/Data/MSSQL/MSSQLRegionData.cs38
-rw-r--r--OpenSim/Data/MSSQL/MSSQLUserData.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs42
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs17
7 files changed, 107 insertions, 74 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs
index 69474b1..ba2b816 100644
--- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs
@@ -39,7 +39,7 @@ namespace OpenSim.Data.MSSQL
39 /// <summary> 39 /// <summary>
40 /// A MSSQL Interface for the Asset server 40 /// A MSSQL Interface for the Asset server
41 /// </summary> 41 /// </summary>
42 internal class MSSQLAssetData : AssetDataBase 42 public class MSSQLAssetData : AssetDataBase
43 { 43 {
44 private const string _migrationStore = "AssetStore"; 44 private const string _migrationStore = "AssetStore";
45 45
diff --git a/OpenSim/Data/MSSQL/MSSQLEstateData.cs b/OpenSim/Data/MSSQL/MSSQLEstateData.cs
index 29aa2c0..c0c6349 100644
--- a/OpenSim/Data/MSSQL/MSSQLEstateData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLEstateData.cs
@@ -124,16 +124,11 @@ namespace OpenSim.Data.MSSQL
124 } 124 }
125 else if (_FieldMap[name].GetValue(es) is UUID) 125 else if (_FieldMap[name].GetValue(es) is UUID)
126 { 126 {
127// UUID uuid;
128// UUID.TryParse(reader[name].ToString(), out uuid);
129
130 _FieldMap[name].SetValue(es, new UUID((Guid) reader[name])); // uuid); 127 _FieldMap[name].SetValue(es, new UUID((Guid) reader[name])); // uuid);
131 } 128 }
132 else 129 else
133 { 130 {
134 es.EstateID = Convert.ToUInt32(reader["EstateID"].ToString()); 131 es.EstateID = Convert.ToUInt32(reader["EstateID"].ToString());
135 //Problems converting a Int32 to a UInt32
136 //_FieldMap[name].SetValue(es, reader["EstateID"]);
137 } 132 }
138 } 133 }
139 } 134 }
@@ -163,28 +158,7 @@ namespace OpenSim.Data.MSSQL
163 foreach (string name in names) 158 foreach (string name in names)
164 { 159 {
165 insertCommand.Parameters.Add(_Database.CreateParameter("@" + name, _FieldMap[name].GetValue(es))); 160 insertCommand.Parameters.Add(_Database.CreateParameter("@" + name, _FieldMap[name].GetValue(es)));
166// if (_FieldMap[name].GetValue(es) is bool)
167// {
168// SqlParameter tempBool = new SqlParameter("@" + name, SqlDbType.Bit);
169//
170// if ((bool) _FieldMap[name].GetValue(es))
171// tempBool.Value = 1;
172// else
173// tempBool.Value = 0;
174//
175// insertCommand.Parameters.Add(tempBool);
176// }
177// else
178// {
179// //cmd.Parameters.AddWithValue("@" + name, _FieldMap[name].GetValue(es));
180// SqlParameter tempPar = new SqlParameter("@" + name,
181// _Database.DbtypeFromType(_FieldMap[name].FieldType));
182// tempPar.Value = _FieldMap[name].GetValue(es).ToString();
183//
184// insertCommand.Parameters.Add(tempPar);
185// }
186 } 161 }
187// insertCommand.Parameters.Add(_Database.CreateParameter("@ID", es.EstateID, true));
188 SqlParameter idParameter = new SqlParameter("@ID", SqlDbType.Int); 162 SqlParameter idParameter = new SqlParameter("@ID", SqlDbType.Int);
189 idParameter.Direction = ParameterDirection.Output; 163 idParameter.Direction = ParameterDirection.Output;
190 insertCommand.Parameters.Add(idParameter); 164 insertCommand.Parameters.Add(idParameter);
@@ -211,7 +185,6 @@ namespace OpenSim.Data.MSSQL
211 } 185 }
212 186
213 // Munge and transfer the ban list 187 // Munge and transfer the ban list
214 //
215 188
216 sql = string.Format("insert into estateban select {0}, bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = @UUID", es.EstateID); 189 sql = string.Format("insert into estateban select {0}, bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = @UUID", es.EstateID);
217 using (AutoClosingSqlCommand cmd = _Database.Query(sql)) 190 using (AutoClosingSqlCommand cmd = _Database.Query(sql))
@@ -253,7 +226,7 @@ namespace OpenSim.Data.MSSQL
253 226
254 names.Remove("EstateID"); 227 names.Remove("EstateID");
255 228
256 string sql = string.Format("UPDATE estate_settings SET ") ; // ({0}) values ( @{1}) WHERE EstateID = @EstateID", String.Join(",", names.ToArray()), String.Join(", @", names.ToArray())); 229 string sql = string.Format("UPDATE estate_settings SET ") ;
257 foreach (string name in names) 230 foreach (string name in names)
258 { 231 {
259 sql += name + " = @" + name + ", "; 232 sql += name + " = @" + name + ", ";
@@ -266,33 +239,9 @@ namespace OpenSim.Data.MSSQL
266 foreach (string name in names) 239 foreach (string name in names)
267 { 240 {
268 cmd.Parameters.Add(_Database.CreateParameter("@" + name, _FieldMap[name].GetValue(es))); 241 cmd.Parameters.Add(_Database.CreateParameter("@" + name, _FieldMap[name].GetValue(es)));
269// if (_FieldMap[name].GetValue(es) is bool)
270// {
271// SqlParameter tempBool = new SqlParameter("@" + name, SqlDbType.Bit);
272//
273// if ((bool)_FieldMap[name].GetValue(es))
274// tempBool.Value = 1;
275// else
276// tempBool.Value = 0;
277//
278// cmd.Parameters.Add(tempBool);
279// }
280// else
281// {
282// //cmd.Parameters.AddWithValue("@" + name, _FieldMap[name].GetValue(es));
283// SqlParameter tempPar = new SqlParameter("@" + name,
284// _Database.DbtypeFromType(_FieldMap[name].FieldType));
285// tempPar.Value = _FieldMap[name].GetValue(es).ToString();
286//
287// cmd.Parameters.Add(tempPar);
288// }
289 } 242 }
290 243
291 cmd.Parameters.Add(_Database.CreateParameter("@EstateID", es.EstateID)); 244 cmd.Parameters.Add(_Database.CreateParameter("@EstateID", es.EstateID));
292// SqlParameter idParameter = new SqlParameter("@EstateID", SqlDbType.Int);
293// idParameter.Value = es.EstateID;
294// cmd.Parameters.Add(idParameter);
295
296 cmd.ExecuteNonQuery(); 245 cmd.ExecuteNonQuery();
297 } 246 }
298 247
@@ -329,9 +278,6 @@ namespace OpenSim.Data.MSSQL
329 { 278 {
330 EstateBan eb = new EstateBan(); 279 EstateBan eb = new EstateBan();
331 280
332// UUID uuid;
333// UUID.TryParse(reader["bannedUUID"].ToString(), out uuid);
334
335 eb.BannedUserID = new UUID((Guid)reader["bannedUUID"]); //uuid; 281 eb.BannedUserID = new UUID((Guid)reader["bannedUUID"]); //uuid;
336 eb.BannedHostAddress = "0.0.0.0"; 282 eb.BannedHostAddress = "0.0.0.0";
337 eb.BannedHostIPMask = "0.0.0.0"; 283 eb.BannedHostIPMask = "0.0.0.0";
@@ -355,11 +301,6 @@ namespace OpenSim.Data.MSSQL
355 { 301 {
356 while (reader.Read()) 302 while (reader.Read())
357 { 303 {
358 // EstateBan eb = new EstateBan();
359
360// UUID uuid;
361// UUID.TryParse(reader["uuid"].ToString(), out uuid);
362
363 uuids.Add(new UUID((Guid)reader["uuid"])); //uuid); 304 uuids.Add(new UUID((Guid)reader["uuid"])); //uuid);
364 } 305 }
365 } 306 }
diff --git a/OpenSim/Data/MSSQL/MSSQLRegionData.cs b/OpenSim/Data/MSSQL/MSSQLRegionData.cs
index a171853..bd7a281 100644
--- a/OpenSim/Data/MSSQL/MSSQLRegionData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLRegionData.cs
@@ -317,7 +317,7 @@ IF EXISTS (SELECT UUID FROM prims WHERE UUID = @UUID)
317 CameraAtOffsetY = @CameraAtOffsetY, CameraAtOffsetZ = @CameraAtOffsetZ, ForceMouselook = @ForceMouselook, 317 CameraAtOffsetY = @CameraAtOffsetY, CameraAtOffsetZ = @CameraAtOffsetZ, ForceMouselook = @ForceMouselook,
318 ScriptAccessPin = @ScriptAccessPin, AllowedDrop = @AllowedDrop, DieAtEdge = @DieAtEdge, SalePrice = @SalePrice, 318 ScriptAccessPin = @ScriptAccessPin, AllowedDrop = @AllowedDrop, DieAtEdge = @DieAtEdge, SalePrice = @SalePrice,
319 SaleType = @SaleType, ColorR = @ColorR, ColorG = @ColorG, ColorB = @ColorB, ColorA = @ColorA, ParticleSystem = @ParticleSystem, 319 SaleType = @SaleType, ColorR = @ColorR, ColorG = @ColorG, ColorB = @ColorB, ColorA = @ColorA, ParticleSystem = @ParticleSystem,
320 ClickAction = @ClickAction, Material = @Material, CollisionSound = @CollisionSound, CollisionSoundVolume = @CollisionSoundVolume, 320 ClickAction = @ClickAction, Material = @Material, CollisionSound = @CollisionSound, CollisionSoundVolume = @CollisionSoundVolume, PassTouches = @PassTouches,
321 LinkNumber = @LinkNumber 321 LinkNumber = @LinkNumber
322 WHERE UUID = @UUID 322 WHERE UUID = @UUID
323 END 323 END
@@ -333,7 +333,7 @@ ELSE
333 PayPrice, PayButton1, PayButton2, PayButton3, PayButton4, LoopedSound, LoopedSoundGain, TextureAnimation, OmegaX, 333 PayPrice, PayButton1, PayButton2, PayButton3, PayButton4, LoopedSound, LoopedSoundGain, TextureAnimation, OmegaX,
334 OmegaY, OmegaZ, CameraEyeOffsetX, CameraEyeOffsetY, CameraEyeOffsetZ, CameraAtOffsetX, CameraAtOffsetY, CameraAtOffsetZ, 334 OmegaY, OmegaZ, CameraEyeOffsetX, CameraEyeOffsetY, CameraEyeOffsetZ, CameraAtOffsetX, CameraAtOffsetY, CameraAtOffsetZ,
335 ForceMouselook, ScriptAccessPin, AllowedDrop, DieAtEdge, SalePrice, SaleType, ColorR, ColorG, ColorB, ColorA, 335 ForceMouselook, ScriptAccessPin, AllowedDrop, DieAtEdge, SalePrice, SaleType, ColorR, ColorG, ColorB, ColorA,
336 ParticleSystem, ClickAction, Material, CollisionSound, CollisionSoundVolume, LinkNumber 336 ParticleSystem, ClickAction, Material, CollisionSound, CollisionSoundVolume, PassTouches, LinkNumber
337 ) VALUES ( 337 ) VALUES (
338 @UUID, @CreationDate, @Name, @Text, @Description, @SitName, @TouchName, @ObjectFlags, @OwnerMask, @NextOwnerMask, @GroupMask, 338 @UUID, @CreationDate, @Name, @Text, @Description, @SitName, @TouchName, @ObjectFlags, @OwnerMask, @NextOwnerMask, @GroupMask,
339 @EveryoneMask, @BaseMask, @PositionX, @PositionY, @PositionZ, @GroupPositionX, @GroupPositionY, @GroupPositionZ, @VelocityX, 339 @EveryoneMask, @BaseMask, @PositionX, @PositionY, @PositionZ, @GroupPositionX, @GroupPositionY, @GroupPositionZ, @VelocityX,
@@ -343,7 +343,7 @@ ELSE
343 @PayPrice, @PayButton1, @PayButton2, @PayButton3, @PayButton4, @LoopedSound, @LoopedSoundGain, @TextureAnimation, @OmegaX, 343 @PayPrice, @PayButton1, @PayButton2, @PayButton3, @PayButton4, @LoopedSound, @LoopedSoundGain, @TextureAnimation, @OmegaX,
344 @OmegaY, @OmegaZ, @CameraEyeOffsetX, @CameraEyeOffsetY, @CameraEyeOffsetZ, @CameraAtOffsetX, @CameraAtOffsetY, @CameraAtOffsetZ, 344 @OmegaY, @OmegaZ, @CameraEyeOffsetX, @CameraEyeOffsetY, @CameraEyeOffsetZ, @CameraAtOffsetX, @CameraAtOffsetY, @CameraAtOffsetZ,
345 @ForceMouselook, @ScriptAccessPin, @AllowedDrop, @DieAtEdge, @SalePrice, @SaleType, @ColorR, @ColorG, @ColorB, @ColorA, 345 @ForceMouselook, @ScriptAccessPin, @AllowedDrop, @DieAtEdge, @SalePrice, @SaleType, @ColorR, @ColorG, @ColorB, @ColorA,
346 @ParticleSystem, @ClickAction, @Material, @CollisionSound, @CollisionSoundVolume, @LinkNumber 346 @ParticleSystem, @ClickAction, @Material, @CollisionSound, @CollisionSoundVolume, @PassTouches, @LinkNumber
347 ) 347 )
348 END"; 348 END";
349 349
@@ -723,7 +723,8 @@ VALUES
723,[elevation_1_ne] = @elevation_1_ne ,[elevation_2_ne] = @elevation_2_ne ,[elevation_1_se] = @elevation_1_se ,[elevation_2_se] = @elevation_2_se 723,[elevation_1_ne] = @elevation_1_ne ,[elevation_2_ne] = @elevation_2_ne ,[elevation_1_se] = @elevation_1_se ,[elevation_2_se] = @elevation_2_se
724,[elevation_1_sw] = @elevation_1_sw ,[elevation_2_sw] = @elevation_2_sw ,[water_height] = @water_height ,[terrain_raise_limit] = @terrain_raise_limit 724,[elevation_1_sw] = @elevation_1_sw ,[elevation_2_sw] = @elevation_2_sw ,[water_height] = @water_height ,[terrain_raise_limit] = @terrain_raise_limit
725,[terrain_lower_limit] = @terrain_lower_limit ,[use_estate_sun] = @use_estate_sun ,[fixed_sun] = @fixed_sun ,[sun_position] = @sun_position 725,[terrain_lower_limit] = @terrain_lower_limit ,[use_estate_sun] = @use_estate_sun ,[fixed_sun] = @fixed_sun ,[sun_position] = @sun_position
726,[covenant] = @covenant , [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox WHERE [regionUUID] = @regionUUID"; 726,[covenant] = @covenant , [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_date] = @loaded_creation_date, [loaded_creation_time] = @loaded_creation_time, [loaded_creation_id] = @loaded_creation_id
727 WHERE [regionUUID] = @regionUUID";
727 728
728 using (AutoClosingSqlCommand cmd = _Database.Query(sql)) 729 using (AutoClosingSqlCommand cmd = _Database.Query(sql))
729 { 730 {
@@ -776,13 +777,14 @@ VALUES
776 [block_show_in_search],[agent_limit],[object_bonus],[maturity],[disable_scripts],[disable_collisions],[disable_physics], 777 [block_show_in_search],[agent_limit],[object_bonus],[maturity],[disable_scripts],[disable_collisions],[disable_physics],
777 [terrain_texture_1],[terrain_texture_2],[terrain_texture_3],[terrain_texture_4],[elevation_1_nw],[elevation_2_nw],[elevation_1_ne], 778 [terrain_texture_1],[terrain_texture_2],[terrain_texture_3],[terrain_texture_4],[elevation_1_nw],[elevation_2_nw],[elevation_1_ne],
778 [elevation_2_ne],[elevation_1_se],[elevation_2_se],[elevation_1_sw],[elevation_2_sw],[water_height],[terrain_raise_limit], 779 [elevation_2_ne],[elevation_1_se],[elevation_2_se],[elevation_1_sw],[elevation_2_sw],[water_height],[terrain_raise_limit],
779 [terrain_lower_limit],[use_estate_sun],[fixed_sun],[sun_position],[covenant],[sunvectorx], [sunvectory], [sunvectorz],[Sandbox]) 780 [terrain_lower_limit],[use_estate_sun],[fixed_sun],[sun_position],[covenant],[sunvectorx], [sunvectory], [sunvectorz],[Sandbox], [loaded_creation_date], [loaded_creation_time], [loaded_creation_id]
781 )
780 VALUES 782 VALUES
781 (@regionUUID,@block_terraform,@block_fly,@allow_damage,@restrict_pushing,@allow_land_resell,@allow_land_join_divide, 783 (@regionUUID,@block_terraform,@block_fly,@allow_damage,@restrict_pushing,@allow_land_resell,@allow_land_join_divide,
782 @block_show_in_search,@agent_limit,@object_bonus,@maturity,@disable_scripts,@disable_collisions,@disable_physics, 784 @block_show_in_search,@agent_limit,@object_bonus,@maturity,@disable_scripts,@disable_collisions,@disable_physics,
783 @terrain_texture_1,@terrain_texture_2,@terrain_texture_3,@terrain_texture_4,@elevation_1_nw,@elevation_2_nw,@elevation_1_ne, 785 @terrain_texture_1,@terrain_texture_2,@terrain_texture_3,@terrain_texture_4,@elevation_1_nw,@elevation_2_nw,@elevation_1_ne,
784 @elevation_2_ne,@elevation_1_se,@elevation_2_se,@elevation_1_sw,@elevation_2_sw,@water_height,@terrain_raise_limit, 786 @elevation_2_ne,@elevation_1_se,@elevation_2_se,@elevation_1_sw,@elevation_2_sw,@water_height,@terrain_raise_limit,
785 @terrain_lower_limit,@use_estate_sun,@fixed_sun,@sun_position,@covenant,@sunvectorx,@sunvectory, @sunvectorz, @Sandbox)"; 787 @terrain_lower_limit,@use_estate_sun,@fixed_sun,@sun_position,@covenant,@sunvectorx,@sunvectory, @sunvectorz, @Sandbox, @loaded_creation_date, @loaded_creation_time, @loaded_creation_id )";
786 788
787 using (AutoClosingSqlCommand cmd = _Database.Query(sql)) 789 using (AutoClosingSqlCommand cmd = _Database.Query(sql))
788 { 790 {
@@ -843,6 +845,20 @@ VALUES
843 ); 845 );
844 newSettings.Covenant = new UUID((Guid)row["covenant"]); 846 newSettings.Covenant = new UUID((Guid)row["covenant"]);
845 847
848 if (row["loaded_creation_date"] is DBNull)
849 newSettings.LoadedCreationDate = "";
850 else
851 newSettings.LoadedCreationDate = (String)row["loaded_creation_date"];
852
853 if (row["loaded_creation_time"] is DBNull)
854 newSettings.LoadedCreationTime = "";
855 else
856 newSettings.LoadedCreationTime = (String)row["loaded_creation_time"];
857
858 if (row["loaded_creation_id"] is DBNull)
859 newSettings.LoadedCreationID = "";
860 else
861 newSettings.LoadedCreationID = (String)row["loaded_creation_id"];
846 return newSettings; 862 return newSettings;
847 } 863 }
848 864
@@ -1064,7 +1080,8 @@ VALUES
1064 1080
1065 prim.CollisionSound = new UUID((Guid)primRow["CollisionSound"]); 1081 prim.CollisionSound = new UUID((Guid)primRow["CollisionSound"]);
1066 prim.CollisionSoundVolume = Convert.ToSingle(primRow["CollisionSoundVolume"]); 1082 prim.CollisionSoundVolume = Convert.ToSingle(primRow["CollisionSoundVolume"]);
1067 1083 if (Convert.ToInt16(primRow["PassTouches"]) != 0)
1084 prim.PassTouches = true;
1068 prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]); 1085 prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]);
1069 1086
1070 return prim; 1087 return prim;
@@ -1240,6 +1257,9 @@ VALUES
1240 parameters.Add(_Database.CreateParameter("sunvectory", settings.SunVector.Y)); 1257 parameters.Add(_Database.CreateParameter("sunvectory", settings.SunVector.Y));
1241 parameters.Add(_Database.CreateParameter("sunvectorz", settings.SunVector.Z)); 1258 parameters.Add(_Database.CreateParameter("sunvectorz", settings.SunVector.Z));
1242 parameters.Add(_Database.CreateParameter("covenant", settings.Covenant)); 1259 parameters.Add(_Database.CreateParameter("covenant", settings.Covenant));
1260 parameters.Add(_Database.CreateParameter("LoadedCreationDate", settings.LoadedCreationDate));
1261 parameters.Add(_Database.CreateParameter("LoadedCreationTime", settings.LoadedCreationTime));
1262 parameters.Add(_Database.CreateParameter("LoadedCreationID", settings.LoadedCreationID));
1243 1263
1244 return parameters.ToArray(); 1264 return parameters.ToArray();
1245 } 1265 }
@@ -1442,6 +1462,10 @@ VALUES
1442 1462
1443 parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound)); 1463 parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound));
1444 parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume)); 1464 parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume));
1465 if (prim.PassTouches)
1466 parameters.Add(_Database.CreateParameter("PassTouches", 1));
1467 else
1468 parameters.Add(_Database.CreateParameter("PassTouches", 0));
1445 parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); 1469 parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
1446 1470
1447 return parameters.ToArray(); 1471 return parameters.ToArray();
diff --git a/OpenSim/Data/MSSQL/MSSQLUserData.cs b/OpenSim/Data/MSSQL/MSSQLUserData.cs
index c04dbda..6efb89d 100644
--- a/OpenSim/Data/MSSQL/MSSQLUserData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLUserData.cs
@@ -1125,6 +1125,10 @@ ELSE
1125 retval.ID = new UUID((Guid)reader["UUID"]); 1125 retval.ID = new UUID((Guid)reader["UUID"]);
1126 retval.FirstName = (string)reader["username"]; 1126 retval.FirstName = (string)reader["username"];
1127 retval.SurName = (string)reader["lastname"]; 1127 retval.SurName = (string)reader["lastname"];
1128 if (reader.IsDBNull(reader.GetOrdinal("email")))
1129 retval.Email = "";
1130 else
1131 retval.Email = (string)reader["email"];
1128 1132
1129 retval.PasswordHash = (string)reader["passwordHash"]; 1133 retval.PasswordHash = (string)reader["passwordHash"];
1130 retval.PasswordSalt = (string)reader["passwordSalt"]; 1134 retval.PasswordSalt = (string)reader["passwordSalt"];
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index d786df8..380104d 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -184,6 +184,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
184 m_scene.Permissions.OnAbandonParcel += CanAbandonParcel; 184 m_scene.Permissions.OnAbandonParcel += CanAbandonParcel;
185 m_scene.Permissions.OnReclaimParcel += CanReclaimParcel; 185 m_scene.Permissions.OnReclaimParcel += CanReclaimParcel;
186 m_scene.Permissions.OnDeedParcel += CanDeedParcel; 186 m_scene.Permissions.OnDeedParcel += CanDeedParcel;
187 m_scene.Permissions.OnDeedObject += CanDeedObject;
187 m_scene.Permissions.OnIsGod += IsGod; 188 m_scene.Permissions.OnIsGod += IsGod;
188 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; 189 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject;
189 m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED 190 m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED
@@ -818,6 +819,20 @@ namespace OpenSim.Region.CoreModules.World.Permissions
818 return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandDeed); 819 return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandDeed);
819 } 820 }
820 821
822 private bool CanDeedObject(UUID user, UUID group, Scene scene)
823 {
824 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
825 if (m_bypassPermissions) return m_bypassPermissionsValue;
826
827 ScenePresence sp = scene.GetScenePresence(user);
828 IClientAPI client = sp.ControllingClient;
829
830 if((client.GetGroupPowers(group) & (ulong)GroupPowers.DeedObject) == 0)
831 return false;
832
833 return true;
834 }
835
821 private bool IsGod(UUID user, Scene scene) 836 private bool IsGod(UUID user, Scene scene)
822 { 837 {
823 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 838 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
@@ -846,7 +861,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
846 861
847 if (part.GroupID != UUID.Zero) 862 if (part.GroupID != UUID.Zero)
848 { 863 {
849 if ((part.OwnerID == UUID.Zero) && ((owner != part.LastOwnerID) || ((part.GroupMask & PERM_TRANS) == 0))) 864 if ((part.OwnerID == part.GroupID) && ((owner != part.LastOwnerID) || ((part.GroupMask & PERM_TRANS) == 0)))
850 return false; 865 return false;
851 866
852 if ((part.GroupMask & PERM_COPY) == 0) 867 if ((part.GroupMask & PERM_COPY) == 0)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 8e3c688..1a40a0d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2682,16 +2682,48 @@ namespace OpenSim.Region.Framework.Scenes
2682 void ObjectOwner(IClientAPI remoteClient, UUID ownerID, UUID groupID, List<uint> localIDs) 2682 void ObjectOwner(IClientAPI remoteClient, UUID ownerID, UUID groupID, List<uint> localIDs)
2683 { 2683 {
2684 if (!Permissions.IsGod(remoteClient.AgentId)) 2684 if (!Permissions.IsGod(remoteClient.AgentId))
2685 return; 2685 {
2686 if (ownerID != UUID.Zero)
2687 return;
2688
2689 if (!Permissions.CanDeedObject(remoteClient.AgentId, groupID))
2690 return;
2691 }
2692
2693 List<SceneObjectGroup> groups = new List<SceneObjectGroup>();
2686 2694
2687 foreach (uint localID in localIDs) 2695 foreach (uint localID in localIDs)
2688 { 2696 {
2689 SceneObjectPart part = GetSceneObjectPart(localID); 2697 SceneObjectPart part = GetSceneObjectPart(localID);
2690 if (part != null && part.ParentGroup != null) 2698 if (!groups.Contains(part.ParentGroup))
2699 groups.Add(part.ParentGroup);
2700 }
2701
2702 foreach (SceneObjectGroup sog in groups)
2703 {
2704 if (ownerID != null)
2691 { 2705 {
2692 part.ParentGroup.SetOwnerId(ownerID); 2706 sog.SetOwnerId(ownerID);
2693 part.Inventory.ChangeInventoryOwner(ownerID); 2707 sog.SetGroup(groupID, remoteClient);
2694 part.ParentGroup.SetGroup(groupID, remoteClient); 2708
2709 foreach (SceneObjectPart child in sog.Children.Values)
2710 child.Inventory.ChangeInventoryOwner(ownerID);
2711 }
2712 else
2713 {
2714 if (!Permissions.CanEditObject(sog.UUID, remoteClient.AgentId))
2715 continue;
2716
2717 if (sog.GroupID != groupID)
2718 continue;
2719
2720 foreach (SceneObjectPart child in sog.Children.Values)
2721 {
2722 child.LastOwnerID = child.OwnerID;
2723 child.Inventory.ChangeInventoryOwner(groupID);
2724 }
2725
2726 sog.SetOwnerId(groupID);
2695 } 2727 }
2696 } 2728 }
2697 } 2729 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index d0da618..226ec15 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -69,6 +69,7 @@ namespace OpenSim.Region.Framework.Scenes
69 public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene); 69 public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene);
70 public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene); 70 public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene);
71 public delegate bool DeedParcelHandler(UUID user, ILandObject parcel, Scene scene); 71 public delegate bool DeedParcelHandler(UUID user, ILandObject parcel, Scene scene);
72 public delegate bool DeedObjectHandler(UUID user, UUID group, Scene scene);
72 public delegate bool BuyLandHandler(UUID user, ILandObject parcel, Scene scene); 73 public delegate bool BuyLandHandler(UUID user, ILandObject parcel, Scene scene);
73 public delegate bool LinkObjectHandler(UUID user, UUID objectID); 74 public delegate bool LinkObjectHandler(UUID user, UUID objectID);
74 public delegate bool DelinkObjectHandler(UUID user, UUID objectID); 75 public delegate bool DelinkObjectHandler(UUID user, UUID objectID);
@@ -127,6 +128,7 @@ namespace OpenSim.Region.Framework.Scenes
127 public event AbandonParcelHandler OnAbandonParcel; 128 public event AbandonParcelHandler OnAbandonParcel;
128 public event ReclaimParcelHandler OnReclaimParcel; 129 public event ReclaimParcelHandler OnReclaimParcel;
129 public event DeedParcelHandler OnDeedParcel; 130 public event DeedParcelHandler OnDeedParcel;
131 public event DeedObjectHandler OnDeedObject;
130 public event BuyLandHandler OnBuyLand; 132 public event BuyLandHandler OnBuyLand;
131 public event LinkObjectHandler OnLinkObject; 133 public event LinkObjectHandler OnLinkObject;
132 public event DelinkObjectHandler OnDelinkObject; 134 public event DelinkObjectHandler OnDelinkObject;
@@ -735,6 +737,21 @@ namespace OpenSim.Region.Framework.Scenes
735 return true; 737 return true;
736 } 738 }
737 739
740 public bool CanDeedObject(UUID user, UUID group)
741 {
742 DeedObjectHandler handler = OnDeedObject;
743 if (handler != null)
744 {
745 Delegate[] list = handler.GetInvocationList();
746 foreach (DeedObjectHandler h in list)
747 {
748 if (h(user, group, m_scene) == false)
749 return false;
750 }
751 }
752 return true;
753 }
754
738 public bool CanBuyLand(UUID user, ILandObject parcel) 755 public bool CanBuyLand(UUID user, ILandObject parcel)
739 { 756 {
740 BuyLandHandler handler = OnBuyLand; 757 BuyLandHandler handler = OnBuyLand;