diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
6 files changed, 131 insertions, 86 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 67c847b..f1885da 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -212,6 +212,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
212 | if (m_Scene.TryGetScenePresence(remoteClient.AgentId, out presence)) | 212 | if (m_Scene.TryGetScenePresence(remoteClient.AgentId, out presence)) |
213 | { | 213 | { |
214 | byte[] data = null; | 214 | byte[] data = null; |
215 | uint everyonemask = 0; | ||
216 | uint groupmask = 0; | ||
215 | 217 | ||
216 | if (invType == (sbyte)InventoryType.Landmark && presence != null) | 218 | if (invType == (sbyte)InventoryType.Landmark && presence != null) |
217 | { | 219 | { |
@@ -220,6 +222,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
220 | data = Encoding.ASCII.GetBytes(strdata); | 222 | data = Encoding.ASCII.GetBytes(strdata); |
221 | name = prefix + name; | 223 | name = prefix + name; |
222 | description += suffix; | 224 | description += suffix; |
225 | groupmask = (uint)PermissionMask.AllAndExport; | ||
226 | everyonemask = (uint)(PermissionMask.AllAndExport & ~PermissionMask.Modify); | ||
223 | } | 227 | } |
224 | 228 | ||
225 | AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId); | 229 | AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId); |
@@ -227,9 +231,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
227 | m_Scene.CreateNewInventoryItem( | 231 | m_Scene.CreateNewInventoryItem( |
228 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, | 232 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, |
229 | name, description, 0, callbackID, asset.FullID, asset.Type, invType, | 233 | name, description, 0, callbackID, asset.FullID, asset.Type, invType, |
230 | (uint)PermissionMask.All | (uint)PermissionMask.Export, // Base | 234 | (uint)PermissionMask.AllAndExport, // Base |
231 | (uint)PermissionMask.All | (uint)PermissionMask.Export, // Current | 235 | (uint)PermissionMask.AllAndExport, // Current |
232 | 0, nextOwnerMask, 0, creationDate, false); // Data from viewer | 236 | everyonemask, |
237 | nextOwnerMask, groupmask, creationDate, false); // Data from viewer | ||
233 | } | 238 | } |
234 | else | 239 | else |
235 | { | 240 | { |
@@ -573,41 +578,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
573 | InventoryItemBase item, SceneObjectGroup so, List<SceneObjectGroup> objsForEffectivePermissions, | 578 | InventoryItemBase item, SceneObjectGroup so, List<SceneObjectGroup> objsForEffectivePermissions, |
574 | IClientAPI remoteClient) | 579 | IClientAPI remoteClient) |
575 | { | 580 | { |
576 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export) | 7; | 581 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export | PermissionMask.FoldedMask); |
577 | uint allObjectsNextOwnerPerms = 0x7fffffff; | 582 | |
578 | |||
579 | // For the porposes of inventory, an object is modify if the prims | ||
580 | // are modify. This allows renaming an object that contains no | ||
581 | // mod items. | ||
582 | foreach (SceneObjectGroup grp in objsForEffectivePermissions) | 583 | foreach (SceneObjectGroup grp in objsForEffectivePermissions) |
583 | { | 584 | { |
584 | uint groupPerms = grp.GetEffectivePermissions(true); | 585 | effectivePerms &= grp.CurrentAndFoldedNextPermissions(); |
585 | if ((grp.RootPart.BaseMask & (uint)PermissionMask.Modify) != 0) | ||
586 | groupPerms |= (uint)PermissionMask.Modify; | ||
587 | |||
588 | effectivePerms &= groupPerms; | ||
589 | } | 586 | } |
590 | effectivePerms |= (uint)PermissionMask.Move; | 587 | |
591 | |||
592 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | 588 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) |
593 | { | 589 | { |
594 | uint perms = effectivePerms; | 590 | // apply parts inventory items next owner |
595 | uint nextPerms = (perms & 7) << 13; | 591 | PermissionsUtil.ApplyNoModFoldedPermissions(effectivePerms, ref effectivePerms); |
596 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | 592 | // change to next owner |
597 | perms &= ~(uint)PermissionMask.Copy; | 593 | uint basePerms = effectivePerms & so.RootPart.NextOwnerMask; |
598 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | 594 | // fix and update folded |
599 | perms &= ~(uint)PermissionMask.Transfer; | 595 | basePerms = PermissionsUtil.FixAndFoldPermissions(basePerms); |
600 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | 596 | |
601 | perms &= ~(uint)PermissionMask.Modify; | 597 | item.BasePermissions = basePerms; |
602 | 598 | item.CurrentPermissions = basePerms; | |
603 | // item.BasePermissions = perms & so.RootPart.NextOwnerMask; | 599 | item.NextPermissions = basePerms & so.RootPart.NextOwnerMask; |
604 | 600 | item.EveryOnePermissions = basePerms & so.RootPart.EveryoneMask; | |
605 | uint nextp = so.RootPart.NextOwnerMask | (uint)PermissionMask.FoldedMask; | 601 | item.GroupPermissions = basePerms & so.RootPart.GroupMask; |
606 | item.BasePermissions = perms & nextp; | ||
607 | item.CurrentPermissions = item.BasePermissions; | ||
608 | item.NextPermissions = perms & so.RootPart.NextOwnerMask; | ||
609 | item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask; | ||
610 | item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask; | ||
611 | 602 | ||
612 | // apply next owner perms on rez | 603 | // apply next owner perms on rez |
613 | item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; | 604 | item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; |
@@ -626,7 +617,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
626 | (uint)PermissionMask.Modify | | 617 | (uint)PermissionMask.Modify | |
627 | (uint)PermissionMask.Move | | 618 | (uint)PermissionMask.Move | |
628 | (uint)PermissionMask.Export | | 619 | (uint)PermissionMask.Export | |
629 | 7); // Preserve folded permissions | 620 | (uint)PermissionMask.FoldedMask); // Preserve folded permissions ?? |
630 | } | 621 | } |
631 | 622 | ||
632 | return item; | 623 | return item; |
@@ -1144,9 +1135,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
1144 | if ((item.BasePermissions & (uint)PermissionMask.FoldedMask) != 0) | 1135 | if ((item.BasePermissions & (uint)PermissionMask.FoldedMask) != 0) |
1145 | { | 1136 | { |
1146 | // We have permissions stored there so use them | 1137 | // We have permissions stored there so use them |
1147 | part.NextOwnerMask = ((item.BasePermissions & 7) << 13); | 1138 | part.NextOwnerMask = ((item.BasePermissions & (uint)PermissionMask.FoldedMask) << (int)PermissionMask.FoldingShift); |
1148 | if ((item.BasePermissions & (uint)PermissionMask.FoldedExport) != 0) | ||
1149 | part.NextOwnerMask |= (uint)PermissionMask.Export; | ||
1150 | part.NextOwnerMask |= (uint)PermissionMask.Move; | 1139 | part.NextOwnerMask |= (uint)PermissionMask.Move; |
1151 | } | 1140 | } |
1152 | else | 1141 | else |
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index 09891f7..035097f 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | |||
@@ -223,20 +223,16 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
223 | if (parms.Length - i < 2) | 223 | if (parms.Length - i < 2) |
224 | break; | 224 | break; |
225 | 225 | ||
226 | //Have we reached the end of the list of headers? | ||
227 | //End is marked by a string with a single digit. | ||
228 | //We already know we have at least one parameter | ||
229 | //so it is safe to do this check at top of loop. | ||
230 | if (Char.IsDigit(parms[i][0])) | ||
231 | break; | ||
232 | |||
233 | if (htc.HttpCustomHeaders == null) | 226 | if (htc.HttpCustomHeaders == null) |
234 | htc.HttpCustomHeaders = new List<string>(); | 227 | htc.HttpCustomHeaders = new List<string>(); |
235 | 228 | ||
236 | htc.HttpCustomHeaders.Add(parms[i]); | 229 | htc.HttpCustomHeaders.Add(parms[i]); |
237 | htc.HttpCustomHeaders.Add(parms[i+1]); | 230 | htc.HttpCustomHeaders.Add(parms[i+1]); |
231 | int nexti = i + 2; | ||
232 | if (nexti >= parms.Length || Char.IsDigit(parms[nexti][0])) | ||
233 | break; | ||
238 | 234 | ||
239 | i += 2; | 235 | i = nexti; |
240 | } | 236 | } |
241 | break; | 237 | break; |
242 | 238 | ||
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index 290daa9..66ebdbe 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |||
@@ -26,15 +26,15 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Threading; | ||
30 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
31 | using System.Collections; | 30 | using System.Collections; |
32 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Net; | ||
33 | using System.Net.Sockets; | ||
33 | using log4net; | 34 | using log4net; |
34 | using Mono.Addins; | 35 | using Mono.Addins; |
35 | using Nini.Config; | 36 | using Nini.Config; |
36 | using OpenMetaverse; | 37 | using OpenMetaverse; |
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Servers; | 38 | using OpenSim.Framework.Servers; |
39 | using OpenSim.Framework.Servers.HttpServer; | 39 | using OpenSim.Framework.Servers.HttpServer; |
40 | using OpenSim.Region.Framework.Interfaces; | 40 | using OpenSim.Region.Framework.Interfaces; |
@@ -89,6 +89,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
89 | protected Dictionary<string, UrlData> m_UrlMap = | 89 | protected Dictionary<string, UrlData> m_UrlMap = |
90 | new Dictionary<string, UrlData>(); | 90 | new Dictionary<string, UrlData>(); |
91 | 91 | ||
92 | protected bool m_enabled = false; | ||
93 | protected string m_ErrorStr; | ||
92 | protected uint m_HttpsPort = 0; | 94 | protected uint m_HttpsPort = 0; |
93 | protected IHttpServer m_HttpServer = null; | 95 | protected IHttpServer m_HttpServer = null; |
94 | protected IHttpServer m_HttpsServer = null; | 96 | protected IHttpServer m_HttpsServer = null; |
@@ -118,6 +120,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
118 | public void Initialise(IConfigSource config) | 120 | public void Initialise(IConfigSource config) |
119 | { | 121 | { |
120 | IConfig networkConfig = config.Configs["Network"]; | 122 | IConfig networkConfig = config.Configs["Network"]; |
123 | m_enabled = false; | ||
121 | 124 | ||
122 | if (networkConfig != null) | 125 | if (networkConfig != null) |
123 | { | 126 | { |
@@ -128,9 +131,47 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
128 | if (ssl_enabled) | 131 | if (ssl_enabled) |
129 | m_HttpsPort = (uint)config.Configs["Network"].GetInt("https_port", (int)m_HttpsPort); | 132 | m_HttpsPort = (uint)config.Configs["Network"].GetInt("https_port", (int)m_HttpsPort); |
130 | } | 133 | } |
134 | else | ||
135 | { | ||
136 | m_ErrorStr = "[Network] configuration missing, HTTP listener for LSL disabled"; | ||
137 | m_log.Warn("[URL MODULE]: " + m_ErrorStr); | ||
138 | return; | ||
139 | } | ||
140 | |||
141 | if (String.IsNullOrWhiteSpace(ExternalHostNameForLSL)) | ||
142 | { | ||
143 | m_ErrorStr = "ExternalHostNameForLSL not defined in configuration, HTTP listener for LSL disabled"; | ||
144 | m_log.Warn("[URL MODULE]: " + m_ErrorStr); | ||
145 | return; | ||
146 | } | ||
147 | |||
148 | IPAddress ia = null; | ||
149 | try | ||
150 | { | ||
151 | foreach (IPAddress Adr in Dns.GetHostAddresses(ExternalHostNameForLSL)) | ||
152 | { | ||
153 | if (Adr.AddressFamily == AddressFamily.InterNetwork || | ||
154 | Adr.AddressFamily == AddressFamily.InterNetworkV6) // ipv6 will most likely smoke | ||
155 | { | ||
156 | ia = Adr; | ||
157 | break; | ||
158 | } | ||
159 | } | ||
160 | } | ||
161 | catch | ||
162 | { | ||
163 | ia = null; | ||
164 | } | ||
131 | 165 | ||
132 | if (ExternalHostNameForLSL == null) | 166 | if (ia == null) |
133 | ExternalHostNameForLSL = System.Environment.MachineName; | 167 | { |
168 | m_ErrorStr = "Could not resolve ExternalHostNameForLSL, HTTP listener for LSL disabled"; | ||
169 | m_log.Warn("[URL MODULE]: " + m_ErrorStr); | ||
170 | return; | ||
171 | } | ||
172 | |||
173 | m_enabled = true; | ||
174 | m_ErrorStr = String.Empty; | ||
134 | 175 | ||
135 | IConfig llFunctionsConfig = config.Configs["LL-Functions"]; | 176 | IConfig llFunctionsConfig = config.Configs["LL-Functions"]; |
136 | 177 | ||
@@ -146,7 +187,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
146 | 187 | ||
147 | public void AddRegion(Scene scene) | 188 | public void AddRegion(Scene scene) |
148 | { | 189 | { |
149 | if (m_HttpServer == null) | 190 | if (m_enabled && m_HttpServer == null) |
150 | { | 191 | { |
151 | // There can only be one | 192 | // There can only be one |
152 | // | 193 | // |
@@ -197,11 +238,18 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
197 | { | 238 | { |
198 | UUID urlcode = UUID.Random(); | 239 | UUID urlcode = UUID.Random(); |
199 | 240 | ||
241 | if(!m_enabled) | ||
242 | { | ||
243 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", m_ErrorStr }); | ||
244 | return urlcode; | ||
245 | } | ||
246 | |||
200 | lock (m_UrlMap) | 247 | lock (m_UrlMap) |
201 | { | 248 | { |
202 | if (m_UrlMap.Count >= TotalUrls) | 249 | if (m_UrlMap.Count >= TotalUrls) |
203 | { | 250 | { |
204 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); | 251 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", |
252 | "Too many URLs already open" }); | ||
205 | return urlcode; | 253 | return urlcode; |
206 | } | 254 | } |
207 | string url = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/"; | 255 | string url = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/"; |
@@ -243,6 +291,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
243 | { | 291 | { |
244 | UUID urlcode = UUID.Random(); | 292 | UUID urlcode = UUID.Random(); |
245 | 293 | ||
294 | if(!m_enabled) | ||
295 | { | ||
296 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", m_ErrorStr }); | ||
297 | return urlcode; | ||
298 | } | ||
299 | |||
246 | if (m_HttpsServer == null) | 300 | if (m_HttpsServer == null) |
247 | { | 301 | { |
248 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); | 302 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); |
@@ -253,7 +307,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
253 | { | 307 | { |
254 | if (m_UrlMap.Count >= TotalUrls) | 308 | if (m_UrlMap.Count >= TotalUrls) |
255 | { | 309 | { |
256 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); | 310 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", |
311 | "Too many URLs already open" }); | ||
257 | return urlcode; | 312 | return urlcode; |
258 | } | 313 | } |
259 | string url = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString() + "/"; | 314 | string url = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString() + "/"; |
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index 660e03f..a5203ea 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs | |||
@@ -113,7 +113,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
113 | // wrap this in a try block so that defaults will work if | 113 | // wrap this in a try block so that defaults will work if |
114 | // the config file doesn't specify otherwise. | 114 | // the config file doesn't specify otherwise. |
115 | int maxlisteners = 1000; | 115 | int maxlisteners = 1000; |
116 | int maxhandles = 64; | 116 | int maxhandles = 65; |
117 | try | 117 | try |
118 | { | 118 | { |
119 | m_whisperdistance = config.Configs["Chat"].GetInt( | 119 | m_whisperdistance = config.Configs["Chat"].GetInt( |
@@ -130,8 +130,15 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
130 | catch (Exception) | 130 | catch (Exception) |
131 | { | 131 | { |
132 | } | 132 | } |
133 | if (maxlisteners < 1) maxlisteners = int.MaxValue; | 133 | |
134 | if (maxhandles < 1) maxhandles = int.MaxValue; | 134 | if (maxlisteners < 1) |
135 | maxlisteners = int.MaxValue; | ||
136 | if (maxhandles < 1) | ||
137 | maxhandles = int.MaxValue; | ||
138 | |||
139 | if (maxlisteners < maxhandles) | ||
140 | maxlisteners = maxhandles; | ||
141 | |||
135 | m_listenerManager = new ListenerManager(maxlisteners, maxhandles); | 142 | m_listenerManager = new ListenerManager(maxlisteners, maxhandles); |
136 | m_pendingQ = new Queue(); | 143 | m_pendingQ = new Queue(); |
137 | m_pending = Queue.Synchronized(m_pendingQ); | 144 | m_pending = Queue.Synchronized(m_pendingQ); |
@@ -605,11 +612,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
605 | li.GetHandle().Equals(handle)) | 612 | li.GetHandle().Equals(handle)) |
606 | { | 613 | { |
607 | lis.Value.Remove(li); | 614 | lis.Value.Remove(li); |
615 | m_curlisteners--; | ||
608 | if (lis.Value.Count == 0) | 616 | if (lis.Value.Count == 0) |
609 | { | 617 | m_listeners.Remove(lis.Key); // bailing of loop so this does not smoke |
610 | m_listeners.Remove(lis.Key); | ||
611 | m_curlisteners--; | ||
612 | } | ||
613 | // there should be only one, so we bail out early | 618 | // there should be only one, so we bail out early |
614 | return; | 619 | return; |
615 | } | 620 | } |
@@ -718,6 +723,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
718 | } | 723 | } |
719 | } | 724 | } |
720 | 725 | ||
726 | if(handles.Count >= m_maxhandles) | ||
727 | return -1; | ||
728 | |||
721 | // Note: 0 is NOT a valid handle for llListen() to return | 729 | // Note: 0 is NOT a valid handle for llListen() to return |
722 | for (int i = 1; i <= m_maxhandles; i++) | 730 | for (int i = 1; i <= m_maxhandles; i++) |
723 | { | 731 | { |
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 90d65c7..a7a9d1d 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs | |||
@@ -118,6 +118,11 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
118 | return false; | 118 | return false; |
119 | 119 | ||
120 | SceneObjectGroup group = part.ParentGroup; | 120 | SceneObjectGroup group = part.ParentGroup; |
121 | if(group == null || group.IsDeleted || group.inTransit) | ||
122 | return false; | ||
123 | |||
124 | // make sure we are not buying a child part | ||
125 | part = group.RootPart; | ||
121 | 126 | ||
122 | switch (saleType) | 127 | switch (saleType) |
123 | { | 128 | { |
@@ -157,18 +162,6 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
157 | break; | 162 | break; |
158 | 163 | ||
159 | case 2: // Sell a copy | 164 | case 2: // Sell a copy |
160 | Vector3 inventoryStoredPosition = new Vector3( | ||
161 | Math.Min(group.AbsolutePosition.X, m_scene.RegionInfo.RegionSizeX - 6), | ||
162 | Math.Min(group.AbsolutePosition.Y, m_scene.RegionInfo.RegionSizeY - 6), | ||
163 | group.AbsolutePosition.Z); | ||
164 | |||
165 | Vector3 originalPosition = group.AbsolutePosition; | ||
166 | |||
167 | group.AbsolutePosition = inventoryStoredPosition; | ||
168 | |||
169 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group); | ||
170 | group.AbsolutePosition = originalPosition; | ||
171 | |||
172 | uint perms = group.EffectiveOwnerPerms; | 165 | uint perms = group.EffectiveOwnerPerms; |
173 | 166 | ||
174 | if ((perms & (uint)PermissionMask.Transfer) == 0) | 167 | if ((perms & (uint)PermissionMask.Transfer) == 0) |
@@ -185,6 +178,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
185 | return false; | 178 | return false; |
186 | } | 179 | } |
187 | 180 | ||
181 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group); | ||
182 | |||
188 | AssetBase asset = m_scene.CreateAsset( | 183 | AssetBase asset = m_scene.CreateAsset( |
189 | group.GetPartName(localID), | 184 | group.GetPartName(localID), |
190 | group.GetPartDescription(localID), | 185 | group.GetPartDescription(localID), |
@@ -205,22 +200,21 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
205 | item.AssetType = asset.Type; | 200 | item.AssetType = asset.Type; |
206 | item.InvType = (int)InventoryType.Object; | 201 | item.InvType = (int)InventoryType.Object; |
207 | item.Folder = categoryID; | 202 | item.Folder = categoryID; |
203 | |||
204 | perms = group.CurrentAndFoldedNextPermissions(); | ||
205 | // apply parts inventory next perms | ||
206 | PermissionsUtil.ApplyNoModFoldedPermissions(perms, ref perms); | ||
207 | // change to next owner perms | ||
208 | perms &= part.NextOwnerMask; | ||
209 | // update folded | ||
210 | perms = PermissionsUtil.FixAndFoldPermissions(perms); | ||
211 | |||
212 | item.BasePermissions = perms; | ||
213 | item.CurrentPermissions = perms; | ||
214 | item.NextPermissions = part.NextOwnerMask & perms; | ||
215 | item.EveryOnePermissions = part.EveryoneMask & perms; | ||
216 | item.GroupPermissions = part.GroupMask & perms; | ||
208 | 217 | ||
209 | uint nextPerms=(perms & 7) << 13; | ||
210 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
211 | perms &= ~(uint)PermissionMask.Copy; | ||
212 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
213 | perms &= ~(uint)PermissionMask.Transfer; | ||
214 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
215 | perms &= ~(uint)PermissionMask.Modify; | ||
216 | |||
217 | item.BasePermissions = perms & part.NextOwnerMask; | ||
218 | item.CurrentPermissions = perms & part.NextOwnerMask; | ||
219 | item.NextPermissions = part.NextOwnerMask; | ||
220 | item.EveryOnePermissions = part.EveryoneMask & | ||
221 | part.NextOwnerMask; | ||
222 | item.GroupPermissions = part.GroupMask & | ||
223 | part.NextOwnerMask; | ||
224 | item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; | 218 | item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; |
225 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 219 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
226 | 220 | ||
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 8eee864..18d164f 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -2022,7 +2022,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
2022 | 2022 | ||
2023 | uint perms = GetObjectPermissions(sp, sog, true); | 2023 | uint perms = GetObjectPermissions(sp, sog, true); |
2024 | if((perms & (uint)PermissionMask.Copy) == 0) | 2024 | if((perms & (uint)PermissionMask.Copy) == 0) |
2025 | { | ||
2026 | sp.ControllingClient.SendAgentAlertMessage("Copying this item has been denied by the permissions system", false); | ||
2025 | return false; | 2027 | return false; |
2028 | } | ||
2026 | 2029 | ||
2027 | if(sog.OwnerID != sp.UUID && (perms & (uint)PermissionMask.Transfer) == 0) | 2030 | if(sog.OwnerID != sp.UUID && (perms & (uint)PermissionMask.Transfer) == 0) |
2028 | return false; | 2031 | return false; |