aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/NetworkServersInfo.cs2
-rw-r--r--OpenSim/Framework/RegionInfo.cs10
-rw-r--r--OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs9
-rw-r--r--OpenSim/Region/ClientStack/RegionApplicationBase.cs26
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs55
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs34
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs30
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs8
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs2
-rw-r--r--OpenSim/Server/Base/HttpServerBase.cs32
-rw-r--r--OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs249
-rw-r--r--OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs60
-rw-r--r--OpenSim/Services/GridService/GridService.cs3
-rw-r--r--OpenSim/Services/Interfaces/IMapImageService.cs1
-rw-r--r--OpenSim/Services/MapImageService/MapImageService.cs33
22 files changed, 505 insertions, 91 deletions
diff --git a/OpenSim/Framework/NetworkServersInfo.cs b/OpenSim/Framework/NetworkServersInfo.cs
index 4b7d4c7..dfe9695 100644
--- a/OpenSim/Framework/NetworkServersInfo.cs
+++ b/OpenSim/Framework/NetworkServersInfo.cs
@@ -41,6 +41,7 @@ namespace OpenSim.Framework
41 41
42 // "Out of band" managemnt https 42 // "Out of band" managemnt https
43 public bool ssl_listener = false; 43 public bool ssl_listener = false;
44 public bool ssl_external = false;
44 public uint https_port = 0; 45 public uint https_port = 0;
45 public string cert_path = String.Empty; 46 public string cert_path = String.Empty;
46 public string cert_pass = String.Empty; 47 public string cert_pass = String.Empty;
@@ -64,6 +65,7 @@ namespace OpenSim.Framework
64 65
65 // "Out of band management https" 66 // "Out of band management https"
66 ssl_listener = config.Configs["Network"].GetBoolean("https_listener",false); 67 ssl_listener = config.Configs["Network"].GetBoolean("https_listener",false);
68 ssl_external = config.Configs["Network"].GetBoolean("https_external",false);
67 if( ssl_listener) 69 if( ssl_listener)
68 { 70 {
69 cert_path = config.Configs["Network"].GetString("cert_path",String.Empty); 71 cert_path = config.Configs["Network"].GetString("cert_path",String.Empty);
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index b9e84ac..ae2ff63 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -229,10 +229,12 @@ namespace OpenSim.Framework
229 // 229 //
230 public RegionInfo(string description, XmlNode xmlNode, bool skipConsoleConfig, IConfigSource configSource) 230 public RegionInfo(string description, XmlNode xmlNode, bool skipConsoleConfig, IConfigSource configSource)
231 { 231 {
232 // m_configSource = configSource; 232 XmlElement elem = (XmlElement)xmlNode;
233 configMember = 233 string name = elem.GetAttribute("Name");
234 new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); 234 string xmlstr = "<Nini>" + xmlNode.OuterXml + "</Nini>";
235 configMember.performConfigurationRetrieve(); 235 XmlConfigSource source = new XmlConfigSource(XmlReader.Create(new StringReader(xmlstr)));
236 ReadNiniConfig(source, name);
237
236 m_serverURI = string.Empty; 238 m_serverURI = string.Empty;
237 } 239 }
238 240
diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
index c7caf6f..65de563 100644
--- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
+++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
@@ -93,8 +93,8 @@ namespace OpenSim.Framework.RegionLoader.Web
93 xmlSource.Length); 93 xmlSource.Length);
94 XmlDocument xmlDoc = new XmlDocument(); 94 XmlDocument xmlDoc = new XmlDocument();
95 xmlDoc.LoadXml(xmlSource); 95 xmlDoc.LoadXml(xmlSource);
96 if (xmlDoc.FirstChild.Name == "Regions") 96 if (xmlDoc.FirstChild.Name == "Nini")
97 { 97 {
98 regionCount = xmlDoc.FirstChild.ChildNodes.Count; 98 regionCount = xmlDoc.FirstChild.ChildNodes.Count;
99 99
100 if (regionCount > 0) 100 if (regionCount > 0)
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index f8e2a60..f599342 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -2290,9 +2290,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2290 2290
2291 public void SendAgentDataUpdate(UUID agentid, UUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle) 2291 public void SendAgentDataUpdate(UUID agentid, UUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle)
2292 { 2292 {
2293 m_activeGroupID = activegroupid; 2293 if (agentid == AgentId)
2294 m_activeGroupName = groupname; 2294 {
2295 m_activeGroupPowers = grouppowers; 2295 m_activeGroupID = activegroupid;
2296 m_activeGroupName = groupname;
2297 m_activeGroupPowers = grouppowers;
2298 }
2296 2299
2297 AgentDataUpdatePacket sendAgentDataUpdate = (AgentDataUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentDataUpdate); 2300 AgentDataUpdatePacket sendAgentDataUpdate = (AgentDataUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentDataUpdate);
2298 sendAgentDataUpdate.AgentData.ActiveGroupID = activegroupid; 2301 sendAgentDataUpdate.AgentData.ActiveGroupID = activegroupid;
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index 853b72d..287c278 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -100,13 +100,25 @@ namespace OpenSim.Region.ClientStack
100 // "OOB" Server 100 // "OOB" Server
101 if (m_networkServersInfo.ssl_listener) 101 if (m_networkServersInfo.ssl_listener)
102 { 102 {
103 BaseHttpServer server = new BaseHttpServer( 103 if (!m_networkServersInfo.ssl_external)
104 m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path, 104 {
105 m_networkServersInfo.cert_pass); 105 BaseHttpServer server = new BaseHttpServer(
106 m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path,
107 m_networkServersInfo.cert_pass);
106 108
107 m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port); 109 m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port);
108 MainServer.AddHttpServer(server); 110 MainServer.AddHttpServer(server);
109 server.Start(); 111 server.Start();
112 }
113 else
114 {
115 BaseHttpServer server = new BaseHttpServer(
116 m_networkServersInfo.https_port);
117
118 m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0} for external HTTPS", server.Port);
119 MainServer.AddHttpServer(server);
120 server.Start();
121 }
110 } 122 }
111 123
112 base.StartupSpecific(); 124 base.StartupSpecific();
@@ -132,4 +144,4 @@ namespace OpenSim.Region.ClientStack
132 return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier); 144 return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier);
133 } 145 }
134 } 146 }
135} \ No newline at end of file 147}
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
index 2d46276..41958b3 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
@@ -40,6 +40,13 @@ using OpenSim.Region.Framework.Scenes;
40 40
41namespace OpenSim.Region.CoreModules.Avatar.InstantMessage 41namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
42{ 42{
43 public struct SendReply
44 {
45 public bool Success;
46 public string Message;
47 public int Disposition;
48 }
49
43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "OfflineMessageModule")] 50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "OfflineMessageModule")]
44 public class OfflineMessageModule : ISharedRegionModule 51 public class OfflineMessageModule : ISharedRegionModule
45 { 52 {
@@ -50,6 +57,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
50 private string m_RestURL = String.Empty; 57 private string m_RestURL = String.Empty;
51 IMessageTransferModule m_TransferModule = null; 58 IMessageTransferModule m_TransferModule = null;
52 private bool m_ForwardOfflineGroupMessages = true; 59 private bool m_ForwardOfflineGroupMessages = true;
60 private Dictionary<IClientAPI, List<UUID>> m_repliesSent= new Dictionary<IClientAPI, List<UUID>>();
53 61
54 public void Initialise(IConfigSource config) 62 public void Initialise(IConfigSource config)
55 { 63 {
@@ -169,6 +177,12 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
169 private void OnNewClient(IClientAPI client) 177 private void OnNewClient(IClientAPI client)
170 { 178 {
171 client.OnRetrieveInstantMessages += RetrieveInstantMessages; 179 client.OnRetrieveInstantMessages += RetrieveInstantMessages;
180 client.OnLogout += OnClientLoggedOut;
181 }
182
183 public void OnClientLoggedOut(IClientAPI client)
184 {
185 m_repliesSent.Remove(client);
172 } 186 }
173 187
174 private void RetrieveInstantMessages(IClientAPI client) 188 private void RetrieveInstantMessages(IClientAPI client)
@@ -228,7 +242,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
228 if (scene == null) 242 if (scene == null)
229 scene = m_SceneList[0]; 243 scene = m_SceneList[0];
230 244
231 bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>( 245 SendReply reply = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, SendReply>(
232 "POST", m_RestURL+"/SaveMessage/?scope=" + 246 "POST", m_RestURL+"/SaveMessage/?scope=" +
233 scene.RegionInfo.ScopeID.ToString(), im); 247 scene.RegionInfo.ScopeID.ToString(), im);
234 248
@@ -238,13 +252,38 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
238 if (client == null) 252 if (client == null)
239 return; 253 return;
240 254
241 client.SendInstantMessage(new GridInstantMessage( 255 if (reply.Message == String.Empty)
242 null, new UUID(im.toAgentID), 256 reply.Message = "User is not logged in. " + (reply.Success ? "Message saved." : "Message not saved");
243 "System", new UUID(im.fromAgentID), 257
244 (byte)InstantMessageDialog.MessageFromAgent, 258 bool sendReply = true;
245 "User is not logged in. "+ 259
246 (success ? "Message saved." : "Message not saved"), 260 switch (reply.Disposition)
247 false, new Vector3())); 261 {
262 case 0: // Normal
263 break;
264 case 1: // Only once per user
265 if (m_repliesSent.ContainsKey(client) && m_repliesSent[client].Contains(new UUID(im.toAgentID)))
266 {
267 sendReply = false;
268 }
269 else
270 {
271 if (!m_repliesSent.ContainsKey(client))
272 m_repliesSent[client] = new List<UUID>();
273 m_repliesSent[client].Add(new UUID(im.toAgentID));
274 }
275 break;
276 }
277
278 if (sendReply)
279 {
280 client.SendInstantMessage(new GridInstantMessage(
281 null, new UUID(im.toAgentID),
282 "System", new UUID(im.fromAgentID),
283 (byte)InstantMessageDialog.MessageFromAgent,
284 reply.Message,
285 false, new Vector3()));
286 }
248 } 287 }
249 } 288 }
250 } 289 }
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 7aa1ced..47390e7 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -96,6 +96,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
96 96
97 m_commands = new EstateManagementCommands(this); 97 m_commands = new EstateManagementCommands(this);
98 m_commands.Initialise(); 98 m_commands.Initialise();
99
100 m_regionChangeTimer.Interval = 10000;
101 m_regionChangeTimer.Elapsed += RaiseRegionInfoChange;
102 m_regionChangeTimer.AutoReset = false;
99 } 103 }
100 104
101 public void RemoveRegion(Scene scene) {} 105 public void RemoveRegion(Scene scene) {}
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 399e9b0..0e2aba9 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -546,7 +546,7 @@ namespace OpenSim.Region.CoreModules.World.Land
546 requiredPowers = GroupPowers.LandManageBanned; 546 requiredPowers = GroupPowers.LandManageBanned;
547 547
548 if (m_scene.Permissions.CanEditParcelProperties(agentID, 548 if (m_scene.Permissions.CanEditParcelProperties(agentID,
549 land, requiredPowers)) 549 land, requiredPowers, false))
550 { 550 {
551 land.UpdateAccessList(flags, transactionID, sequenceID, 551 land.UpdateAccessList(flags, transactionID, sequenceID,
552 sections, entries, remote_client); 552 sections, entries, remote_client);
@@ -908,7 +908,7 @@ namespace OpenSim.Region.CoreModules.World.Land
908 908
909 //If we are still here, then they are subdividing within one piece of land 909 //If we are still here, then they are subdividing within one piece of land
910 //Check owner 910 //Check owner
911 if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, startLandObject, GroupPowers.LandDivideJoin)) 911 if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, startLandObject, GroupPowers.LandDivideJoin, true))
912 { 912 {
913 return; 913 return;
914 } 914 }
@@ -977,7 +977,7 @@ namespace OpenSim.Region.CoreModules.World.Land
977 { 977 {
978 return; 978 return;
979 } 979 }
980 if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, masterLandObject, GroupPowers.LandDivideJoin)) 980 if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, masterLandObject, GroupPowers.LandDivideJoin, true))
981 { 981 {
982 return; 982 return;
983 } 983 }
@@ -1708,7 +1708,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1708 1708
1709 if (land == null) return; 1709 if (land == null) return;
1710 1710
1711 if (!m_scene.Permissions.CanEditParcelProperties(remoteClient.AgentId, land, GroupPowers.LandOptions)) 1711 if (!m_scene.Permissions.CanEditParcelProperties(remoteClient.AgentId, land, GroupPowers.LandOptions, false))
1712 return; 1712 return;
1713 1713
1714 land.LandData.OtherCleanTime = otherCleanTime; 1714 land.LandData.OtherCleanTime = otherCleanTime;
@@ -1808,7 +1808,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1808 if (targetAvatar.UserLevel == 0) 1808 if (targetAvatar.UserLevel == 0)
1809 { 1809 {
1810 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); 1810 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1811 if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) 1811 if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze, true))
1812 return; 1812 return;
1813 if (flags == 0) 1813 if (flags == 0)
1814 { 1814 {
@@ -1857,7 +1857,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1857 1857
1858 // Check if you even have permission to do this 1858 // Check if you even have permission to do this
1859 ILandObject land = m_scene.LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); 1859 ILandObject land = m_scene.LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
1860 if (!m_scene.Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze) && 1860 if (!m_scene.Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze, true) &&
1861 !m_scene.Permissions.IsAdministrator(client.AgentId)) 1861 !m_scene.Permissions.IsAdministrator(client.AgentId))
1862 return; 1862 return;
1863 1863
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index ce4bd0f..74c2144 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -279,7 +279,7 @@ namespace OpenSim.Region.CoreModules.World.Land
279 // ParcelFlags.ForSaleObjects 279 // ParcelFlags.ForSaleObjects
280 // ParcelFlags.LindenHome 280 // ParcelFlags.LindenHome
281 281
282 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions)) 282 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions, false))
283 { 283 {
284 allowedDelta |= (uint)(ParcelFlags.AllowLandmark | 284 allowedDelta |= (uint)(ParcelFlags.AllowLandmark |
285 ParcelFlags.AllowTerraform | 285 ParcelFlags.AllowTerraform |
@@ -294,7 +294,7 @@ namespace OpenSim.Region.CoreModules.World.Land
294 ParcelFlags.AllowFly); 294 ParcelFlags.AllowFly);
295 } 295 }
296 296
297 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandSetSale)) 297 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandSetSale, true))
298 { 298 {
299 if (args.AuthBuyerID != newData.AuthBuyerID || 299 if (args.AuthBuyerID != newData.AuthBuyerID ||
300 args.SalePrice != newData.SalePrice) 300 args.SalePrice != newData.SalePrice)
@@ -317,7 +317,7 @@ namespace OpenSim.Region.CoreModules.World.Land
317 allowedDelta |= (uint)ParcelFlags.ForSale; 317 allowedDelta |= (uint)ParcelFlags.ForSale;
318 } 318 }
319 319
320 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.FindPlaces)) 320 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.FindPlaces, false))
321 { 321 {
322 newData.Category = args.Category; 322 newData.Category = args.Category;
323 323
@@ -326,21 +326,21 @@ namespace OpenSim.Region.CoreModules.World.Land
326 ParcelFlags.MaturePublish) | (uint)(1 << 23); 326 ParcelFlags.MaturePublish) | (uint)(1 << 23);
327 } 327 }
328 328
329 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity)) 329 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity, false))
330 { 330 {
331 newData.Description = args.Desc; 331 newData.Description = args.Desc;
332 newData.Name = args.Name; 332 newData.Name = args.Name;
333 newData.SnapshotID = args.SnapshotID; 333 newData.SnapshotID = args.SnapshotID;
334 } 334 }
335 335
336 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.SetLandingPoint)) 336 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.SetLandingPoint, false))
337 { 337 {
338 newData.LandingType = args.LandingType; 338 newData.LandingType = args.LandingType;
339 newData.UserLocation = args.UserLocation; 339 newData.UserLocation = args.UserLocation;
340 newData.UserLookAt = args.UserLookAt; 340 newData.UserLookAt = args.UserLookAt;
341 } 341 }
342 342
343 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.ChangeMedia)) 343 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.ChangeMedia, false))
344 { 344 {
345 newData.MediaAutoScale = args.MediaAutoScale; 345 newData.MediaAutoScale = args.MediaAutoScale;
346 newData.MediaID = args.MediaID; 346 newData.MediaID = args.MediaID;
@@ -361,7 +361,7 @@ namespace OpenSim.Region.CoreModules.World.Land
361 ParcelFlags.UseEstateVoiceChan); 361 ParcelFlags.UseEstateVoiceChan);
362 } 362 }
363 363
364 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandManagePasses)) 364 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandManagePasses, false))
365 { 365 {
366 newData.PassHours = args.PassHours; 366 newData.PassHours = args.PassHours;
367 newData.PassPrice = args.PassPrice; 367 newData.PassPrice = args.PassPrice;
@@ -369,25 +369,27 @@ namespace OpenSim.Region.CoreModules.World.Land
369 allowedDelta |= (uint)ParcelFlags.UsePassList; 369 allowedDelta |= (uint)ParcelFlags.UsePassList;
370 } 370 }
371 371
372 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageAllowed)) 372 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageAllowed, false))
373 { 373 {
374 allowedDelta |= (uint)(ParcelFlags.UseAccessGroup | 374 allowedDelta |= (uint)(ParcelFlags.UseAccessGroup |
375 ParcelFlags.UseAccessList); 375 ParcelFlags.UseAccessList);
376 } 376 }
377 377
378 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageBanned)) 378 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageBanned, false))
379 { 379 {
380 allowedDelta |= (uint)(ParcelFlags.UseBanList | 380 allowedDelta |= (uint)(ParcelFlags.UseBanList |
381 ParcelFlags.DenyAnonymous | 381 ParcelFlags.DenyAnonymous |
382 ParcelFlags.DenyAgeUnverified); 382 ParcelFlags.DenyAgeUnverified);
383 } 383 }
384 384
385 uint preserve = LandData.Flags & ~allowedDelta; 385 if (allowedDelta != (uint)ParcelFlags.None)
386 newData.Flags = preserve | (args.ParcelFlags & allowedDelta); 386 {
387 387 uint preserve = LandData.Flags & ~allowedDelta;
388 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 388 newData.Flags = preserve | (args.ParcelFlags & allowedDelta);
389 389
390 SendLandUpdateToAvatarsOverMe(snap_selection); 390 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
391 SendLandUpdateToAvatarsOverMe(snap_selection);
392 }
391 } 393 }
392 394
393 public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) 395 public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area)
@@ -943,7 +945,7 @@ namespace OpenSim.Region.CoreModules.World.Land
943 945
944 public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client) 946 public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client)
945 { 947 {
946 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions)) 948 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions, true))
947 { 949 {
948 List<uint> resultLocalIDs = new List<uint>(); 950 List<uint> resultLocalIDs = new List<uint>();
949 try 951 try
@@ -993,7 +995,7 @@ namespace OpenSim.Region.CoreModules.World.Land
993 /// </param> 995 /// </param>
994 public void SendLandObjectOwners(IClientAPI remote_client) 996 public void SendLandObjectOwners(IClientAPI remote_client)
995 { 997 {
996 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions)) 998 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions, true))
997 { 999 {
998 Dictionary<UUID, int> primCount = new Dictionary<UUID, int>(); 1000 Dictionary<UUID, int> primCount = new Dictionary<UUID, int>();
999 List<UUID> groups = new List<UUID>(); 1001 List<UUID> groups = new List<UUID>();
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 50855fe..616fe98 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -1047,7 +1047,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1047 return GenericObjectPermission(editorID, objectID, false); 1047 return GenericObjectPermission(editorID, objectID, false);
1048 } 1048 }
1049 1049
1050 private bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p, Scene scene) 1050 private bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p, Scene scene, bool allowManager)
1051 { 1051 {
1052 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1052 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1053 if (m_bypassPermissions) return m_bypassPermissionsValue; 1053 if (m_bypassPermissions) return m_bypassPermissionsValue;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 535d87a..4d90726 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Region.Framework.Scenes
70 public delegate bool IsGridGodHandler(UUID user, Scene requestFromScene); 70 public delegate bool IsGridGodHandler(UUID user, Scene requestFromScene);
71 public delegate bool IsAdministratorHandler(UUID user); 71 public delegate bool IsAdministratorHandler(UUID user);
72 public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene); 72 public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene);
73 public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, Scene scene); 73 public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, Scene scene, bool allowManager);
74 public delegate bool SellParcelHandler(UUID user, ILandObject parcel, Scene scene); 74 public delegate bool SellParcelHandler(UUID user, ILandObject parcel, Scene scene);
75 public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene); 75 public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene);
76 public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene); 76 public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene);
@@ -763,7 +763,7 @@ namespace OpenSim.Region.Framework.Scenes
763 763
764 #region EDIT PARCEL 764 #region EDIT PARCEL
765 765
766 public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p) 766 public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p, bool allowManager)
767 { 767 {
768 EditParcelPropertiesHandler handler = OnEditParcelProperties; 768 EditParcelPropertiesHandler handler = OnEditParcelProperties;
769 if (handler != null) 769 if (handler != null)
@@ -771,7 +771,7 @@ namespace OpenSim.Region.Framework.Scenes
771 Delegate[] list = handler.GetInvocationList(); 771 Delegate[] list = handler.GetInvocationList();
772 foreach (EditParcelPropertiesHandler h in list) 772 foreach (EditParcelPropertiesHandler h in list)
773 { 773 {
774 if (h(user, parcel, p, m_scene) == false) 774 if (h(user, parcel, p, m_scene, allowManager) == false)
775 return false; 775 return false;
776 } 776 }
777 } 777 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 2420048..cfa862e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1881,25 +1881,27 @@ namespace OpenSim.Region.Framework.Scenes
1881 { 1881 {
1882 SceneObjectPart part = parts[i]; 1882 SceneObjectPart part = parts[i];
1883 1883
1884 Scene.ForEachScenePresence(sp => 1884 if (Scene != null)
1885 { 1885 {
1886 if (!sp.IsChildAgent && sp.ParentID == LocalId) 1886 Scene.ForEachRootScenePresence(delegate(ScenePresence avatar)
1887 sp.StandUp();
1888
1889 if (!silent)
1890 { 1887 {
1891 part.ClearUpdateSchedule(); 1888 if (avatar.ParentID == LocalId)
1892 if (part == m_rootPart) 1889 avatar.StandUp();
1890
1891 if (!silent)
1893 { 1892 {
1894 if (!IsAttachment 1893 part.ClearUpdateSchedule();
1895 || AttachedAvatar == sp.UUID 1894 if (part == m_rootPart)
1896 || !HasPrivateAttachmentPoint) 1895 {
1897 sp.ControllingClient.SendKillObject(new List<uint> { part.LocalId }); 1896 if (!IsAttachment
1897 || AttachedAvatar == avatar.ControllingClient.AgentId
1898 || !HasPrivateAttachmentPoint)
1899 avatar.ControllingClient.SendKillObject(new List<uint> { part.LocalId });
1900 }
1898 } 1901 }
1899 } 1902 });
1900 }); 1903 }
1901 } 1904 }
1902
1903 } 1905 }
1904 1906
1905 public void AddScriptLPS(int count) 1907 public void AddScriptLPS(int count)
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
index b05482e..38ba54d 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
@@ -639,15 +639,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
639 // TODO: EstateSettings don't seem to get propagated... 639 // TODO: EstateSettings don't seem to get propagated...
640 if (!scene.RegionInfo.EstateSettings.AllowVoice) 640 if (!scene.RegionInfo.EstateSettings.AllowVoice)
641 { 641 {
642 m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": voice not enabled in estate settings", 642 //m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": voice not enabled in estate settings",
643 scene.RegionInfo.RegionName); 643 // scene.RegionInfo.RegionName);
644 channel_uri = String.Empty; 644 channel_uri = String.Empty;
645 } 645 }
646 646
647 if ((land.Flags & (uint)ParcelFlags.AllowVoiceChat) == 0) 647 if ((land.Flags & (uint)ParcelFlags.AllowVoiceChat) == 0)
648 { 648 {
649 m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": voice not enabled for parcel", 649 //m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": voice not enabled for parcel",
650 scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName); 650 // scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName);
651 channel_uri = String.Empty; 651 channel_uri = String.Empty;
652 } 652 }
653 else 653 else
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs
index 7c662c9..40ed3fd 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs
@@ -105,9 +105,9 @@ namespace OpenSim.Region.RegionCombinerModule
105 return m_rootScene.Permissions.CanEditObject(objectid, editorid); 105 return m_rootScene.Permissions.CanEditObject(objectid, editorid);
106 } 106 }
107 107
108 public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers g, Scene scene) 108 public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers g, Scene scene, bool allowManager)
109 { 109 {
110 return m_rootScene.Permissions.CanEditParcelProperties(user, parcel, g); 110 return m_rootScene.Permissions.CanEditParcelProperties(user, parcel, g, allowManager);
111 } 111 }
112 112
113 public bool CanInstantMessage(UUID user, UUID target, Scene startscene) 113 public bool CanInstantMessage(UUID user, UUID target, Scene startscene)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index cfec630..916d841 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7186,7 +7186,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7186 UUID key; 7186 UUID key;
7187 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); 7187 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
7188 7188
7189 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) 7189 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned, false))
7190 { 7190 {
7191 int expires = 0; 7191 int expires = 0;
7192 if (hours != 0) 7192 if (hours != 0)
@@ -10513,7 +10513,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10513 // according to the docs, this command only works if script owner and land owner are the same 10513 // according to the docs, this command only works if script owner and land owner are the same
10514 // lets add estate owners and gods, too, and use the generic permission check. 10514 // lets add estate owners and gods, too, and use the generic permission check.
10515 ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition); 10515 ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
10516 if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia)) return; 10516 if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia, false)) return;
10517 10517
10518 bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)? 10518 bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)?
10519 byte loop = 0; 10519 byte loop = 0;
@@ -10956,7 +10956,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10956 m_host.AddScriptLPS(1); 10956 m_host.AddScriptLPS(1);
10957 UUID key; 10957 UUID key;
10958 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); 10958 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
10959 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) 10959 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned, false))
10960 { 10960 {
10961 int expires = 0; 10961 int expires = 0;
10962 if (hours != 0) 10962 if (hours != 0)
@@ -10997,7 +10997,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10997 m_host.AddScriptLPS(1); 10997 m_host.AddScriptLPS(1);
10998 UUID key; 10998 UUID key;
10999 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); 10999 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
11000 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed)) 11000 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed, false))
11001 { 11001 {
11002 if (UUID.TryParse(avatar, out key)) 11002 if (UUID.TryParse(avatar, out key))
11003 { 11003 {
@@ -11024,7 +11024,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11024 m_host.AddScriptLPS(1); 11024 m_host.AddScriptLPS(1);
11025 UUID key; 11025 UUID key;
11026 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); 11026 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
11027 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) 11027 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned, false))
11028 { 11028 {
11029 if (UUID.TryParse(avatar, out key)) 11029 if (UUID.TryParse(avatar, out key))
11030 { 11030 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index c474173..7081416 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1434,7 +1434,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1434 return; 1434 return;
1435 } 1435 }
1436 1436
1437 if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions)) 1437 if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions, false))
1438 { 1438 {
1439 OSSLShoutError("You do not have permission to modify the parcel"); 1439 OSSLShoutError("You do not have permission to modify the parcel");
1440 return; 1440 return;
diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs
index 954783c..eed2645 100644
--- a/OpenSim/Server/Base/HttpServerBase.cs
+++ b/OpenSim/Server/Base/HttpServerBase.cs
@@ -40,7 +40,7 @@ namespace OpenSim.Server.Base
40{ 40{
41 public class HttpServerBase : ServicesServerBase 41 public class HttpServerBase : ServicesServerBase
42 { 42 {
43// private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 44
45 private uint m_consolePort; 45 private uint m_consolePort;
46 46
@@ -69,6 +69,7 @@ namespace OpenSim.Server.Base
69 69
70 bool ssl_main = networkConfig.GetBoolean("https_main",false); 70 bool ssl_main = networkConfig.GetBoolean("https_main",false);
71 bool ssl_listener = networkConfig.GetBoolean("https_listener",false); 71 bool ssl_listener = networkConfig.GetBoolean("https_listener",false);
72 bool ssl_external = networkConfig.GetBoolean("https_external",false);
72 73
73 m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0); 74 m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0);
74 75
@@ -113,20 +114,29 @@ namespace OpenSim.Server.Base
113 114
114 uint https_port = (uint)networkConfig.GetInt("https_port", 0); 115 uint https_port = (uint)networkConfig.GetInt("https_port", 0);
115 116
116 string cert_path = networkConfig.GetString("cert_path",String.Empty); 117 m_log.WarnFormat("[SSL]: External flag is {0}", ssl_external);
117 if ( cert_path == String.Empty ) 118 if (!ssl_external)
118 { 119 {
119 System.Console.WriteLine("Path to X509 certificate is missing, server can't start."); 120 string cert_path = networkConfig.GetString("cert_path",String.Empty);
120 Thread.CurrentThread.Abort(); 121 if ( cert_path == String.Empty )
122 {
123 System.Console.WriteLine("Path to X509 certificate is missing, server can't start.");
124 Thread.CurrentThread.Abort();
125 }
126 string cert_pass = networkConfig.GetString("cert_pass",String.Empty);
127 if ( cert_pass == String.Empty )
128 {
129 System.Console.WriteLine("Password for X509 certificate is missing, server can't start.");
130 Thread.CurrentThread.Abort();
131 }
132
133 MainServer.AddHttpServer(new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass));
121 } 134 }
122 string cert_pass = networkConfig.GetString("cert_pass",String.Empty); 135 else
123 if ( cert_pass == String.Empty )
124 { 136 {
125 System.Console.WriteLine("Password for X509 certificate is missing, server can't start."); 137 m_log.WarnFormat("[SSL]: SSL port is active but no SSL is used because external SSL was requested.");
126 Thread.CurrentThread.Abort(); 138 MainServer.AddHttpServer(new BaseHttpServer(https_port));
127 } 139 }
128
129 MainServer.AddHttpServer(new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass));
130 } 140 }
131 } 141 }
132 142
diff --git a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs
new file mode 100644
index 0000000..80e3535
--- /dev/null
+++ b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs
@@ -0,0 +1,249 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using System.Xml;
33
34using Nini.Config;
35using log4net;
36using OpenMetaverse;
37
38using OpenSim.Framework;
39using OpenSim.Server.Base;
40using OpenSim.Services.Interfaces;
41using OpenSim.Framework.Servers.HttpServer;
42using OpenSim.Server.Handlers.Base;
43
44using GridRegion = OpenSim.Services.Interfaces.GridRegion;
45
46namespace OpenSim.Server.Handlers.MapImage
47{
48 public class MapRemoveServiceConnector : ServiceConnector
49 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51
52 private IMapImageService m_MapService;
53 private IGridService m_GridService;
54 private string m_ConfigName = "MapImageService";
55
56 public MapRemoveServiceConnector(IConfigSource config, IHttpServer server, string configName) :
57 base(config, server, configName)
58 {
59 IConfig serverConfig = config.Configs[m_ConfigName];
60 if (serverConfig == null)
61 throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
62
63 string mapService = serverConfig.GetString("LocalServiceModule",
64 String.Empty);
65
66 if (mapService == String.Empty)
67 throw new Exception("No LocalServiceModule in config file");
68
69 Object[] args = new Object[] { config };
70 m_MapService = ServerUtils.LoadPlugin<IMapImageService>(mapService, args);
71
72 string gridService = serverConfig.GetString("GridService", String.Empty);
73 if (gridService != string.Empty)
74 m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
75
76 if (m_GridService != null)
77 m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is ON");
78 else
79 m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF");
80
81 bool proxy = serverConfig.GetBoolean("HasProxy", false);
82 server.AddStreamHandler(new MapServerRemoveHandler(m_MapService, m_GridService, proxy));
83
84 }
85 }
86
87 class MapServerRemoveHandler : BaseStreamHandler
88 {
89 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
90 private IMapImageService m_MapService;
91 private IGridService m_GridService;
92 bool m_Proxy;
93
94 public MapServerRemoveHandler(IMapImageService service, IGridService grid, bool proxy) :
95 base("POST", "/removemap")
96 {
97 m_MapService = service;
98 m_GridService = grid;
99 m_Proxy = proxy;
100 }
101
102 public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
103 {
104// m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path);
105 StreamReader sr = new StreamReader(requestData);
106 string body = sr.ReadToEnd();
107 sr.Close();
108 body = body.Trim();
109
110 try
111 {
112 Dictionary<string, object> request = ServerUtils.ParseQueryString(body);
113
114 if (!request.ContainsKey("X") || !request.ContainsKey("Y"))
115 {
116 httpResponse.StatusCode = (int)OSHttpStatusCode.ClientErrorBadRequest;
117 return FailureResult("Bad request.");
118 }
119 int x = 0, y = 0;
120 Int32.TryParse(request["X"].ToString(), out x);
121 Int32.TryParse(request["Y"].ToString(), out y);
122
123 m_log.DebugFormat("[MAP REMOVE SERVER CONNECTOR]: Received position data for region at {0}-{1}", x, y);
124
125 if (m_GridService != null)
126 {
127 System.Net.IPAddress ipAddr = GetCallerIP(httpRequest);
128 GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, x * (int)Constants.RegionSize, y * (int)Constants.RegionSize);
129 if (r != null)
130 {
131 if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString())
132 {
133 m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be trying to impersonate region in IP {1}", ipAddr, r.ExternalEndPoint.Address);
134 return FailureResult("IP address of caller does not match IP address of registered region");
135 }
136
137 }
138 else
139 {
140 m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be rogue. Region not found at coordinates {1}-{2}",
141 ipAddr, x, y);
142 return FailureResult("Region not found at given coordinates");
143 }
144 }
145
146 string reason = string.Empty;
147 bool result = m_MapService.RemoveMapTile(x, y, out reason);
148
149 if (result)
150 return SuccessResult();
151 else
152 return FailureResult(reason);
153
154 }
155 catch (Exception e)
156 {
157 m_log.ErrorFormat("[MAP SERVICE IMAGE HANDLER]: Exception {0} {1}", e.Message, e.StackTrace);
158 }
159
160 return FailureResult("Unexpected server error");
161 }
162
163 private byte[] SuccessResult()
164 {
165 XmlDocument doc = new XmlDocument();
166
167 XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration,
168 "", "");
169
170 doc.AppendChild(xmlnode);
171
172 XmlElement rootElement = doc.CreateElement("", "ServerResponse",
173 "");
174
175 doc.AppendChild(rootElement);
176
177 XmlElement result = doc.CreateElement("", "Result", "");
178 result.AppendChild(doc.CreateTextNode("Success"));
179
180 rootElement.AppendChild(result);
181
182 return DocToBytes(doc);
183 }
184
185 private byte[] FailureResult(string msg)
186 {
187 XmlDocument doc = new XmlDocument();
188
189 XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration,
190 "", "");
191
192 doc.AppendChild(xmlnode);
193
194 XmlElement rootElement = doc.CreateElement("", "ServerResponse",
195 "");
196
197 doc.AppendChild(rootElement);
198
199 XmlElement result = doc.CreateElement("", "Result", "");
200 result.AppendChild(doc.CreateTextNode("Failure"));
201
202 rootElement.AppendChild(result);
203
204 XmlElement message = doc.CreateElement("", "Message", "");
205 message.AppendChild(doc.CreateTextNode(msg));
206
207 rootElement.AppendChild(message);
208
209 return DocToBytes(doc);
210 }
211
212 private byte[] DocToBytes(XmlDocument doc)
213 {
214 MemoryStream ms = new MemoryStream();
215 XmlTextWriter xw = new XmlTextWriter(ms, null);
216 xw.Formatting = Formatting.Indented;
217 doc.WriteTo(xw);
218 xw.Flush();
219
220 return ms.ToArray();
221 }
222
223 private System.Net.IPAddress GetCallerIP(IOSHttpRequest request)
224 {
225 if (!m_Proxy)
226 return request.RemoteIPEndPoint.Address;
227
228 // We're behind a proxy
229 string xff = "X-Forwarded-For";
230 string xffValue = request.Headers[xff.ToLower()];
231 if (xffValue == null || (xffValue != null && xffValue == string.Empty))
232 xffValue = request.Headers[xff];
233
234 if (xffValue == null || (xffValue != null && xffValue == string.Empty))
235 {
236 m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header");
237 return request.RemoteIPEndPoint.Address;
238 }
239
240 System.Net.IPEndPoint ep = Util.GetClientIPFromXFF(xffValue);
241 if (ep != null)
242 return ep.Address;
243
244 // Oops
245 return request.RemoteIPEndPoint.Address;
246 }
247
248 }
249}
diff --git a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs
index cc485f7..725204d 100644
--- a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs
+++ b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs
@@ -86,6 +86,66 @@ namespace OpenSim.Services.Connectors
86 m_ServerURI = serviceURI.TrimEnd('/'); 86 m_ServerURI = serviceURI.TrimEnd('/');
87 } 87 }
88 88
89 public bool RemoveMapTile(int x, int y, out string reason)
90 {
91 reason = string.Empty;
92 int tickstart = Util.EnvironmentTickCount();
93 Dictionary<string, object> sendData = new Dictionary<string, object>();
94 sendData["X"] = x.ToString();
95 sendData["Y"] = y.ToString();
96
97 string reqString = ServerUtils.BuildQueryString(sendData);
98 string uri = m_ServerURI + "/removemap";
99
100 try
101 {
102 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
103 uri,
104 reqString);
105 if (reply != string.Empty)
106 {
107 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
108
109 if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "success"))
110 {
111 return true;
112 }
113 else if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "failure"))
114 {
115 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Delete failed: {0}", replyData["Message"].ToString());
116 reason = replyData["Message"].ToString();
117 return false;
118 }
119 else if (!replyData.ContainsKey("Result"))
120 {
121 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: reply data does not contain result field");
122 }
123 else
124 {
125 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: unexpected result {0}", replyData["Result"].ToString());
126 reason = "Unexpected result " + replyData["Result"].ToString();
127 }
128
129 }
130 else
131 {
132 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Map post received null reply");
133 }
134 }
135 catch (Exception e)
136 {
137 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Exception when contacting map server at {0}: {1}", uri, e.Message);
138 }
139 finally
140 {
141 // This just dumps a warning for any operation that takes more than 100 ms
142 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
143 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: map tile deleted in {0}ms", tickdiff);
144 }
145
146 return false;
147 }
148
89 public bool AddMapTile(int x, int y, byte[] jpgData, out string reason) 149 public bool AddMapTile(int x, int y, byte[] jpgData, out string reason)
90 { 150 {
91 reason = string.Empty; 151 reason = string.Empty;
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index 137ce04..76415ce 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -284,7 +284,7 @@ namespace OpenSim.Services.GridService
284 284
285 int flags = Convert.ToInt32(region.Data["flags"]); 285 int flags = Convert.ToInt32(region.Data["flags"]);
286 286
287 if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Framework.RegionFlags.Persistent) != 0) 287 if ((!m_DeleteOnUnregister) || ((flags & (int)OpenSim.Framework.RegionFlags.Persistent) != 0))
288 { 288 {
289 flags &= ~(int)OpenSim.Framework.RegionFlags.RegionOnline; 289 flags &= ~(int)OpenSim.Framework.RegionFlags.RegionOnline;
290 region.Data["flags"] = flags.ToString(); 290 region.Data["flags"] = flags.ToString();
@@ -299,7 +299,6 @@ namespace OpenSim.Services.GridService
299 } 299 }
300 300
301 return true; 301 return true;
302
303 } 302 }
304 303
305 return m_Database.Delete(regionID); 304 return m_Database.Delete(regionID);
diff --git a/OpenSim/Services/Interfaces/IMapImageService.cs b/OpenSim/Services/Interfaces/IMapImageService.cs
index a7b2cf1..78daa5f 100644
--- a/OpenSim/Services/Interfaces/IMapImageService.cs
+++ b/OpenSim/Services/Interfaces/IMapImageService.cs
@@ -35,6 +35,7 @@ namespace OpenSim.Services.Interfaces
35 { 35 {
36 //List<MapBlockData> GetMapBlocks(UUID scopeID, int minX, int minY, int maxX, int maxY); 36 //List<MapBlockData> GetMapBlocks(UUID scopeID, int minX, int minY, int maxX, int maxY);
37 bool AddMapTile(int x, int y, byte[] imageData, out string reason); 37 bool AddMapTile(int x, int y, byte[] imageData, out string reason);
38 bool RemoveMapTile(int x, int y, out string reason);
38 byte[] GetMapTile(string fileName, out string format); 39 byte[] GetMapTile(string fileName, out string format);
39 } 40 }
40} 41}
diff --git a/OpenSim/Services/MapImageService/MapImageService.cs b/OpenSim/Services/MapImageService/MapImageService.cs
index 9ba5dab..31e147b 100644
--- a/OpenSim/Services/MapImageService/MapImageService.cs
+++ b/OpenSim/Services/MapImageService/MapImageService.cs
@@ -112,9 +112,38 @@ namespace OpenSim.Services.MapImageService
112 reason = e.Message; 112 reason = e.Message;
113 return false; 113 return false;
114 } 114 }
115 }
116
117 return UpdateMultiResolutionFiles(x, y, out reason);
118 }
119
120 public bool RemoveMapTile(int x, int y, out string reason)
121 {
122 reason = String.Empty;
123 string fileName = GetFileName(1, x, y);
124
125 lock (m_Sync)
126 {
127 try
128 {
129 File.Delete(fileName);
130 }
131 catch (Exception e)
132 {
133 m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to save delete file {0}: {1}", fileName, e);
134 reason = e.Message;
135 return false;
136 }
137 }
115 138
116 // Also save in png format? 139 return UpdateMultiResolutionFiles(x, y, out reason);
140 }
117 141
142 private bool UpdateMultiResolutionFiles(int x, int y, out string reason)
143 {
144 reason = String.Empty;
145 lock (m_Sync)
146 {
118 // Stitch seven more aggregate tiles together 147 // Stitch seven more aggregate tiles together
119 for (uint zoomLevel = 2; zoomLevel <= ZOOM_LEVELS; zoomLevel++) 148 for (uint zoomLevel = 2; zoomLevel <= ZOOM_LEVELS; zoomLevel++)
120 { 149 {
@@ -126,7 +155,7 @@ namespace OpenSim.Services.MapImageService
126 155
127 if (!CreateTile(zoomLevel, x1, y1)) 156 if (!CreateTile(zoomLevel, x1, y1))
128 { 157 {
129 m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to create tile for {0} at zoom level {1}", fileName, zoomLevel); 158 m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to create tile for {0},{1} at zoom level {1}", x, y, zoomLevel);
130 reason = string.Format("Map tile at zoom level {0} failed", zoomLevel); 159 reason = string.Format("Map tile at zoom level {0} failed", zoomLevel);
131 return false; 160 return false;
132 } 161 }