diff options
31 files changed, 1086 insertions, 248 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 1ee2468..510905f 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -3087,15 +3087,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
3087 | /// </summary> | 3087 | /// </summary> |
3088 | private void ApplyNextOwnerPermissions(InventoryItemBase item) | 3088 | private void ApplyNextOwnerPermissions(InventoryItemBase item) |
3089 | { | 3089 | { |
3090 | if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) | 3090 | if (item.InvType == (int)InventoryType.Object) |
3091 | { | 3091 | { |
3092 | if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) | 3092 | uint perms = item.CurrentPermissions; |
3093 | item.CurrentPermissions &= ~(uint)PermissionMask.Copy; | 3093 | PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref perms); |
3094 | if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) | 3094 | item.CurrentPermissions = perms; |
3095 | item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; | ||
3096 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) | ||
3097 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; | ||
3098 | } | 3095 | } |
3096 | |||
3099 | item.CurrentPermissions &= item.NextPermissions; | 3097 | item.CurrentPermissions &= item.NextPermissions; |
3100 | item.BasePermissions &= item.NextPermissions; | 3098 | item.BasePermissions &= item.NextPermissions; |
3101 | item.EveryOnePermissions &= item.NextPermissions; | 3099 | item.EveryOnePermissions &= item.NextPermissions; |
diff --git a/OpenSim/Framework/PermissionsUtil.cs b/OpenSim/Framework/PermissionsUtil.cs index 3dce04d..e50d4df 100644 --- a/OpenSim/Framework/PermissionsUtil.cs +++ b/OpenSim/Framework/PermissionsUtil.cs | |||
@@ -60,9 +60,57 @@ namespace OpenSim.Framework | |||
60 | str += "C"; | 60 | str += "C"; |
61 | if ((perms & (int)PermissionMask.Transfer) != 0) | 61 | if ((perms & (int)PermissionMask.Transfer) != 0) |
62 | str += "T"; | 62 | str += "T"; |
63 | if ((perms & (int)PermissionMask.Export) != 0) | ||
64 | str += "X"; | ||
63 | if (str == "") | 65 | if (str == "") |
64 | str = "."; | 66 | str = "."; |
65 | return str; | 67 | return str; |
66 | } | 68 | } |
69 | |||
70 | public static void ApplyFoldedPermissions(uint foldedSourcePerms, ref uint targetPerms) | ||
71 | { | ||
72 | uint folded = foldedSourcePerms & (uint)PermissionMask.FoldedMask; | ||
73 | if(folded == 0 || folded == (uint)PermissionMask.FoldedMask) // invalid we need to ignore, or nothing to do | ||
74 | return; | ||
75 | |||
76 | folded <<= (int)PermissionMask.FoldingShift; | ||
77 | folded |= ~(uint)PermissionMask.UnfoldedMask; | ||
78 | |||
79 | uint tmp = targetPerms; | ||
80 | tmp &= folded; | ||
81 | targetPerms = tmp; | ||
82 | } | ||
83 | |||
84 | // do not touch MOD | ||
85 | public static void ApplyNoModFoldedPermissions(uint foldedSourcePerms, ref uint target) | ||
86 | { | ||
87 | uint folded = foldedSourcePerms & (uint)PermissionMask.FoldedMask; | ||
88 | if(folded == 0 || folded == (uint)PermissionMask.FoldedMask) // invalid we need to ignore, or nothing to do | ||
89 | return; | ||
90 | |||
91 | folded <<= (int)PermissionMask.FoldingShift; | ||
92 | folded |= (~(uint)PermissionMask.UnfoldedMask | (uint)PermissionMask.Modify); | ||
93 | |||
94 | uint tmp = target; | ||
95 | tmp &= folded; | ||
96 | target = tmp; | ||
97 | } | ||
98 | |||
99 | public static uint FixAndFoldPermissions(uint perms) | ||
100 | { | ||
101 | uint tmp = perms; | ||
102 | |||
103 | // C & T rule | ||
104 | if((tmp & (uint)(PermissionMask.Copy | PermissionMask.Transfer)) == 0) | ||
105 | tmp |= (uint)PermissionMask.Transfer; | ||
106 | |||
107 | // unlock | ||
108 | tmp |= (uint)PermissionMask.Move; | ||
109 | |||
110 | tmp &= ~(uint)PermissionMask.FoldedMask; | ||
111 | tmp |= ((tmp >> (int)PermissionMask.FoldingShift) & (uint)PermissionMask.FoldedMask); | ||
112 | |||
113 | return tmp; | ||
114 | } | ||
67 | } | 115 | } |
68 | } | 116 | } |
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 5111673..c7f0136 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -191,8 +191,7 @@ namespace OpenSim.Framework.Servers | |||
191 | } | 191 | } |
192 | catch(Exception e) | 192 | catch(Exception e) |
193 | { | 193 | { |
194 | m_log.FatalFormat("Fatal error: {0}", | 194 | m_log.Fatal("Fatal error: " + e.ToString()); |
195 | (e.Message == null || e.Message == String.Empty) ? "Unknown reason":e.Message ); | ||
196 | Environment.Exit(1); | 195 | Environment.Exit(1); |
197 | } | 196 | } |
198 | 197 | ||
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 0ec24e6..f6ded04 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -79,7 +79,9 @@ namespace OpenSim.Framework | |||
79 | 79 | ||
80 | FoldedMask = 0x0f, | 80 | FoldedMask = 0x0f, |
81 | 81 | ||
82 | // | 82 | FoldingShift = 13 , // number of bit shifts from normal perm to folded or back (same as Transfer shift below) |
83 | // when doing as a block | ||
84 | |||
83 | Transfer = 1 << 13, // 0x02000 | 85 | Transfer = 1 << 13, // 0x02000 |
84 | Modify = 1 << 14, // 0x04000 | 86 | Modify = 1 << 14, // 0x04000 |
85 | Copy = 1 << 15, // 0x08000 | 87 | Copy = 1 << 15, // 0x08000 |
@@ -90,7 +92,8 @@ namespace OpenSim.Framework | |||
90 | // explicitly given | 92 | // explicitly given |
91 | All = 0x8e000, | 93 | All = 0x8e000, |
92 | AllAndExport = 0x9e000, | 94 | AllAndExport = 0x9e000, |
93 | AllEffective = 0x9e000 | 95 | AllEffective = 0x9e000, |
96 | UnfoldedMask = 0x1e000 | ||
94 | } | 97 | } |
95 | 98 | ||
96 | /// <summary> | 99 | /// <summary> |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 079d733..757e255 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -237,7 +237,7 @@ namespace OpenSim | |||
237 | string permissionModules = Util.GetConfigVarFromSections<string>(Config, "permissionmodules", | 237 | string permissionModules = Util.GetConfigVarFromSections<string>(Config, "permissionmodules", |
238 | new string[] { "Startup", "Permissions" }, "DefaultPermissionsModule"); | 238 | new string[] { "Startup", "Permissions" }, "DefaultPermissionsModule"); |
239 | 239 | ||
240 | m_permsModules = new List<string>(permissionModules.Split(',')); | 240 | m_permsModules = new List<string>(permissionModules.Split(',').Select(m => m.Trim())); |
241 | 241 | ||
242 | managedStatsURI = startupConfig.GetString("ManagedStatsRemoteFetchURI", String.Empty); | 242 | managedStatsURI = startupConfig.GetString("ManagedStatsRemoteFetchURI", String.Empty); |
243 | managedStatsPassword = startupConfig.GetString("ManagedStatsRemoteFetchPassword", String.Empty); | 243 | managedStatsPassword = startupConfig.GetString("ManagedStatsRemoteFetchPassword", String.Empty); |
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; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 2f016fa..afdd99e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -682,30 +682,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
682 | // These will be applied to the root prim at next rez. | 682 | // These will be applied to the root prim at next rez. |
683 | // The legacy slam bit (bit 3) and folded permission (bits 0-2) | 683 | // The legacy slam bit (bit 3) and folded permission (bits 0-2) |
684 | // are preserved due to the above mangling | 684 | // are preserved due to the above mangling |
685 | ownerPerms &= nextPerms; | 685 | // ownerPerms &= nextPerms; |
686 | 686 | ||
687 | // Mask the base permissions. This is a conservative | 687 | // Mask the base permissions. This is a conservative |
688 | // approach altering only the three main perms | 688 | // approach altering only the three main perms |
689 | basePerms &= nextPerms; | 689 | // basePerms &= nextPerms; |
690 | 690 | ||
691 | // Mask out the folded portion of the base mask. | 691 | // Mask out the folded portion of the base mask. |
692 | // While the owner mask carries the actual folded | 692 | // While the owner mask carries the actual folded |
693 | // permissions, the base mask carries the original | 693 | // permissions, the base mask carries the original |
694 | // base mask, before masking with the folded perms. | 694 | // base mask, before masking with the folded perms. |
695 | // We need this later for rezzing. | 695 | // We need this later for rezzing. |
696 | basePerms &= ~(uint)PermissionMask.FoldedMask; | 696 | // basePerms &= ~(uint)PermissionMask.FoldedMask; |
697 | basePerms |= ((basePerms >> 13) & 7) | (((basePerms & (uint)PermissionMask.Export) != 0) ? (uint)PermissionMask.FoldedExport : 0); | 697 | // basePerms |= ((basePerms >> 13) & 7) | (((basePerms & (uint)PermissionMask.Export) != 0) ? (uint)PermissionMask.FoldedExport : 0); |
698 | 698 | ||
699 | // If this is an object, root prim perms may be more | 699 | // If this is an object, root prim perms may be more |
700 | // permissive than folded perms. Use folded perms as | 700 | // permissive than folded perms. Use folded perms as |
701 | // a mask | 701 | // a mask |
702 | if (item.InvType == (int)InventoryType.Object) | 702 | uint foldedPerms = (item.CurrentPermissions & (uint)PermissionMask.FoldedMask) << (int)PermissionMask.FoldingShift; |
703 | if (foldedPerms != 0 && item.InvType == (int)InventoryType.Object) | ||
703 | { | 704 | { |
704 | // Create a safe mask for the current perms | ||
705 | uint foldedPerms = (item.CurrentPermissions & 7) << 13; | ||
706 | if ((item.CurrentPermissions & (uint)PermissionMask.FoldedExport) != 0) | ||
707 | foldedPerms |= (uint)PermissionMask.Export; | ||
708 | |||
709 | foldedPerms |= permsMask; | 705 | foldedPerms |= permsMask; |
710 | 706 | ||
711 | bool isRootMod = (item.CurrentPermissions & | 707 | bool isRootMod = (item.CurrentPermissions & |
@@ -729,6 +725,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
729 | } | 725 | } |
730 | } | 726 | } |
731 | 727 | ||
728 | // move here so nextperms are mandatory | ||
729 | ownerPerms &= nextPerms; | ||
730 | basePerms &= nextPerms; | ||
731 | basePerms &= ~(uint)PermissionMask.FoldedMask; | ||
732 | basePerms |= ((basePerms >> 13) & 7) | (((basePerms & (uint)PermissionMask.Export) != 0) ? (uint)PermissionMask.FoldedExport : 0); | ||
732 | // Assign to the actual item. Make sure the slam bit is | 733 | // Assign to the actual item. Make sure the slam bit is |
733 | // set, if it wasn't set before. | 734 | // set, if it wasn't set before. |
734 | itemCopy.BasePermissions = basePerms; | 735 | itemCopy.BasePermissions = basePerms; |
@@ -1266,20 +1267,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
1266 | // TODO: Fix this after the inventory fixer exists and has beenr run | 1267 | // TODO: Fix this after the inventory fixer exists and has beenr run |
1267 | if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions()) | 1268 | if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions()) |
1268 | { | 1269 | { |
1269 | agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); | 1270 | uint perms = taskItem.BasePermissions & taskItem.NextPermissions; |
1270 | if (taskItem.InvType == (int)InventoryType.Object) | 1271 | if (taskItem.InvType == (int)InventoryType.Object) |
1271 | agentItem.CurrentPermissions = agentItem.BasePermissions & (((taskItem.CurrentPermissions & 7) << 13) | (taskItem.CurrentPermissions & (uint)PermissionMask.Move)); | 1272 | { |
1273 | PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms ); | ||
1274 | perms = PermissionsUtil.FixAndFoldPermissions(perms); | ||
1275 | } | ||
1272 | else | 1276 | else |
1273 | agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; | 1277 | perms &= taskItem.CurrentPermissions; |
1274 | 1278 | ||
1275 | agentItem.BasePermissions = agentItem.CurrentPermissions; | 1279 | // always unlock |
1276 | 1280 | perms |= (uint)PermissionMask.Move; | |
1281 | |||
1282 | agentItem.BasePermissions = perms; | ||
1283 | agentItem.CurrentPermissions = perms; | ||
1284 | agentItem.NextPermissions = perms & taskItem.NextPermissions; | ||
1285 | agentItem.EveryOnePermissions = perms & taskItem.EveryonePermissions; | ||
1286 | agentItem.GroupPermissions = perms & taskItem.GroupPermissions; | ||
1287 | |||
1277 | agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; | 1288 | agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; |
1278 | agentItem.Flags &= ~(uint)(InventoryItemFlags.ObjectOverwriteBase | InventoryItemFlags.ObjectOverwriteOwner | InventoryItemFlags.ObjectOverwriteGroup | InventoryItemFlags.ObjectOverwriteEveryone | InventoryItemFlags.ObjectOverwriteNextOwner); | 1289 | agentItem.Flags &= ~(uint)(InventoryItemFlags.ObjectOverwriteBase | InventoryItemFlags.ObjectOverwriteOwner | InventoryItemFlags.ObjectOverwriteGroup | InventoryItemFlags.ObjectOverwriteEveryone | InventoryItemFlags.ObjectOverwriteNextOwner); |
1279 | agentItem.NextPermissions = taskItem.NextPermissions; | ||
1280 | agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); | ||
1281 | // Group permissions make no sense here | ||
1282 | agentItem.GroupPermissions = 0; | ||
1283 | } | 1290 | } |
1284 | else | 1291 | else |
1285 | { | 1292 | { |
@@ -1287,7 +1294,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1287 | agentItem.CurrentPermissions = taskItem.CurrentPermissions; | 1294 | agentItem.CurrentPermissions = taskItem.CurrentPermissions; |
1288 | agentItem.NextPermissions = taskItem.NextPermissions; | 1295 | agentItem.NextPermissions = taskItem.NextPermissions; |
1289 | agentItem.EveryOnePermissions = taskItem.EveryonePermissions; | 1296 | agentItem.EveryOnePermissions = taskItem.EveryonePermissions; |
1290 | agentItem.GroupPermissions = 0; | 1297 | agentItem.GroupPermissions = taskItem.GroupPermissions; |
1291 | } | 1298 | } |
1292 | 1299 | ||
1293 | message = null; | 1300 | message = null; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 12e53a8..36844a9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -252,18 +252,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
252 | } | 252 | } |
253 | 253 | ||
254 | // new test code, to place in better place later | 254 | // new test code, to place in better place later |
255 | private object PermissionsLock = new object(); | 255 | private object m_PermissionsLock = new object(); |
256 | private bool m_EffectivePermsInvalid = true; | ||
257 | |||
258 | public void InvalidateEffectivePerms() | ||
259 | { | ||
260 | lock(m_PermissionsLock) | ||
261 | m_EffectivePermsInvalid = true; | ||
262 | } | ||
256 | 263 | ||
257 | private uint m_EffectiveEveryOnePerms; | 264 | private uint m_EffectiveEveryOnePerms; |
258 | public uint EffectiveEveryOnePerms | 265 | public uint EffectiveEveryOnePerms |
259 | { | 266 | { |
260 | get | 267 | get |
261 | { | 268 | { |
262 | // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) | 269 | lock(m_PermissionsLock) |
263 | // bc this is on heavy duty code paths | 270 | { |
264 | // but for now we need to test the concept | 271 | if(m_EffectivePermsInvalid) |
265 | // AggregateDeepPerms(); | 272 | AggregatePerms(); |
266 | return m_EffectiveEveryOnePerms; | 273 | return m_EffectiveEveryOnePerms; |
274 | } | ||
267 | } | 275 | } |
268 | } | 276 | } |
269 | 277 | ||
@@ -272,11 +280,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
272 | { | 280 | { |
273 | get | 281 | get |
274 | { | 282 | { |
275 | // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) | 283 | lock(m_PermissionsLock) |
276 | // bc this is on heavy duty code paths | 284 | { |
277 | // but for now we need to test the concept | 285 | if(m_EffectivePermsInvalid) |
278 | // AggregateDeepPerms(); | 286 | AggregatePerms(); |
279 | return m_EffectiveGroupPerms; | 287 | return m_EffectiveGroupPerms; |
288 | } | ||
280 | } | 289 | } |
281 | } | 290 | } |
282 | 291 | ||
@@ -285,11 +294,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
285 | { | 294 | { |
286 | get | 295 | get |
287 | { | 296 | { |
288 | // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) | 297 | lock(m_PermissionsLock) |
289 | // bc this is on heavy duty code paths | 298 | { |
290 | // but for now we need to test the concept | 299 | if(m_EffectivePermsInvalid) |
291 | // AggregateDeepPerms(); | 300 | AggregatePerms(); |
292 | return m_EffectiveGroupOrEveryOnePerms; | 301 | return m_EffectiveGroupOrEveryOnePerms; |
302 | } | ||
293 | } | 303 | } |
294 | } | 304 | } |
295 | 305 | ||
@@ -298,11 +308,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
298 | { | 308 | { |
299 | get | 309 | get |
300 | { | 310 | { |
301 | // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) | 311 | lock(m_PermissionsLock) |
302 | // bc this is on heavy duty code paths | 312 | { |
303 | // but for now we need to test the concept | 313 | if(m_EffectivePermsInvalid) |
304 | // AggregateDeepPerms(); | 314 | AggregatePerms(); |
305 | return m_EffectiveOwnerPerms; | 315 | return m_EffectiveOwnerPerms; |
316 | } | ||
306 | } | 317 | } |
307 | } | 318 | } |
308 | 319 | ||
@@ -310,12 +321,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
310 | // AggregatePerms does same using cached parts content perms | 321 | // AggregatePerms does same using cached parts content perms |
311 | public void AggregateDeepPerms() | 322 | public void AggregateDeepPerms() |
312 | { | 323 | { |
313 | lock(PermissionsLock) | 324 | lock(m_PermissionsLock) |
314 | { | 325 | { |
315 | // aux | 326 | // aux |
316 | const uint allmask = (uint)PermissionMask.AllEffective; | 327 | const uint allmask = (uint)PermissionMask.AllEffective; |
317 | const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify); | 328 | const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify); |
318 | const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer); | 329 | const uint copytransfermask = (uint)(PermissionMask.Copy | PermissionMask.Transfer); |
319 | 330 | ||
320 | uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move; | 331 | uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move; |
321 | bool noBaseTransfer = (basePerms & (uint)PermissionMask.Transfer) == 0; | 332 | bool noBaseTransfer = (basePerms & (uint)PermissionMask.Transfer) == 0; |
@@ -327,6 +338,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
327 | uint rootEveryonePerms = RootPart.EveryoneMask; | 338 | uint rootEveryonePerms = RootPart.EveryoneMask; |
328 | uint everyone = rootEveryonePerms; | 339 | uint everyone = rootEveryonePerms; |
329 | 340 | ||
341 | // date is time of writing april 30th 2017 | ||
342 | bool newObject = (RootPart.CreationDate == 0 || RootPart.CreationDate > 1493574994); | ||
330 | SceneObjectPart[] parts = m_parts.GetArray(); | 343 | SceneObjectPart[] parts = m_parts.GetArray(); |
331 | for (int i = 0; i < parts.Length; i++) | 344 | for (int i = 0; i < parts.Length; i++) |
332 | { | 345 | { |
@@ -334,12 +347,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
334 | part.AggregateInnerPerms(); | 347 | part.AggregateInnerPerms(); |
335 | owner &= part.AggregatedInnerOwnerPerms; | 348 | owner &= part.AggregatedInnerOwnerPerms; |
336 | group &= part.AggregatedInnerGroupPerms; | 349 | group &= part.AggregatedInnerGroupPerms; |
337 | everyone &= part.AggregatedInnerEveryonePerms; | 350 | if(newObject) |
351 | everyone &= part.AggregatedInnerEveryonePerms; | ||
338 | } | 352 | } |
339 | // recover modify and move | 353 | // recover modify and move |
340 | rootOwnerPerms &= movemodmask; | 354 | rootOwnerPerms &= movemodmask; |
341 | owner |= rootOwnerPerms; | 355 | owner |= rootOwnerPerms; |
342 | if((owner & copytransfermast) == 0) | 356 | if((owner & copytransfermask) == 0) |
343 | owner |= (uint)PermissionMask.Transfer; | 357 | owner |= (uint)PermissionMask.Transfer; |
344 | 358 | ||
345 | owner &= basePerms; | 359 | owner &= basePerms; |
@@ -370,6 +384,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
370 | 384 | ||
371 | m_EffectiveEveryOnePerms = everyone & owner; | 385 | m_EffectiveEveryOnePerms = everyone & owner; |
372 | m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner; | 386 | m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner; |
387 | m_EffectivePermsInvalid = false; | ||
373 | } | 388 | } |
374 | } | 389 | } |
375 | 390 | ||
@@ -377,7 +392,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
377 | // ie is AggregateDeepPerms without the part.AggregateInnerPerms() call on parts loop | 392 | // ie is AggregateDeepPerms without the part.AggregateInnerPerms() call on parts loop |
378 | public void AggregatePerms() | 393 | public void AggregatePerms() |
379 | { | 394 | { |
380 | lock(PermissionsLock) | 395 | lock(m_PermissionsLock) |
381 | { | 396 | { |
382 | // aux | 397 | // aux |
383 | const uint allmask = (uint)PermissionMask.AllEffective; | 398 | const uint allmask = (uint)PermissionMask.AllEffective; |
@@ -394,13 +409,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
394 | uint rootEveryonePerms = RootPart.EveryoneMask; | 409 | uint rootEveryonePerms = RootPart.EveryoneMask; |
395 | uint everyone = rootEveryonePerms; | 410 | uint everyone = rootEveryonePerms; |
396 | 411 | ||
412 | bool needUpdate = false; | ||
413 | // date is time of writing april 30th 2017 | ||
414 | bool newObject = (RootPart.CreationDate == 0 || RootPart.CreationDate > 1493574994); | ||
397 | SceneObjectPart[] parts = m_parts.GetArray(); | 415 | SceneObjectPart[] parts = m_parts.GetArray(); |
398 | for (int i = 0; i < parts.Length; i++) | 416 | for (int i = 0; i < parts.Length; i++) |
399 | { | 417 | { |
400 | SceneObjectPart part = parts[i]; | 418 | SceneObjectPart part = parts[i]; |
401 | owner &= part.AggregatedInnerOwnerPerms; | 419 | owner &= part.AggregatedInnerOwnerPerms; |
402 | group &= part.AggregatedInnerGroupPerms; | 420 | group &= part.AggregatedInnerGroupPerms; |
403 | everyone &= part.AggregatedInnerEveryonePerms; | 421 | if(newObject) |
422 | everyone &= part.AggregatedInnerEveryonePerms; | ||
404 | } | 423 | } |
405 | // recover modify and move | 424 | // recover modify and move |
406 | rootOwnerPerms &= movemodmask; | 425 | rootOwnerPerms &= movemodmask; |
@@ -409,7 +428,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
409 | owner |= (uint)PermissionMask.Transfer; | 428 | owner |= (uint)PermissionMask.Transfer; |
410 | 429 | ||
411 | owner &= basePerms; | 430 | owner &= basePerms; |
412 | m_EffectiveOwnerPerms = owner; | 431 | if(owner != m_EffectiveOwnerPerms) |
432 | { | ||
433 | needUpdate = true; | ||
434 | m_EffectiveOwnerPerms = owner; | ||
435 | } | ||
436 | |||
413 | uint ownertransfermask = owner & (uint)PermissionMask.Transfer; | 437 | uint ownertransfermask = owner & (uint)PermissionMask.Transfer; |
414 | 438 | ||
415 | // recover modify and move | 439 | // recover modify and move |
@@ -421,7 +445,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
421 | group |= ownertransfermask; | 445 | group |= ownertransfermask; |
422 | 446 | ||
423 | uint groupOrEveryone = group; | 447 | uint groupOrEveryone = group; |
424 | m_EffectiveGroupPerms = group & owner; | 448 | uint tmpPerms = group & owner; |
449 | if(tmpPerms != m_EffectiveGroupPerms) | ||
450 | { | ||
451 | needUpdate = true; | ||
452 | m_EffectiveGroupPerms = tmpPerms; | ||
453 | } | ||
425 | 454 | ||
426 | // recover move | 455 | // recover move |
427 | rootEveryonePerms &= (uint)PermissionMask.Move; | 456 | rootEveryonePerms &= (uint)PermissionMask.Move; |
@@ -434,35 +463,42 @@ namespace OpenSim.Region.Framework.Scenes | |||
434 | 463 | ||
435 | groupOrEveryone |= everyone; | 464 | groupOrEveryone |= everyone; |
436 | 465 | ||
437 | m_EffectiveEveryOnePerms = everyone & owner; | 466 | tmpPerms = everyone & owner; |
438 | m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner; | 467 | if(tmpPerms != m_EffectiveEveryOnePerms) |
439 | } | 468 | { |
440 | } | 469 | needUpdate = true; |
470 | m_EffectiveEveryOnePerms = tmpPerms; | ||
471 | } | ||
441 | 472 | ||
442 | public uint GetEffectivePermissions() | 473 | tmpPerms = groupOrEveryone & owner; |
443 | { | 474 | if(tmpPerms != m_EffectiveGroupOrEveryOnePerms) |
444 | return GetEffectivePermissions(false); | 475 | { |
476 | needUpdate = true; | ||
477 | m_EffectiveGroupOrEveryOnePerms = tmpPerms; | ||
478 | } | ||
479 | |||
480 | m_EffectivePermsInvalid = false; | ||
481 | |||
482 | if(needUpdate) | ||
483 | RootPart.ScheduleFullUpdate(); | ||
484 | } | ||
445 | } | 485 | } |
446 | 486 | ||
447 | public uint GetEffectivePermissions(bool useBase) | 487 | public uint CurrentAndFoldedNextPermissions() |
448 | { | 488 | { |
449 | uint perms=(uint)(PermissionMask.Modify | | 489 | uint perms=(uint)(PermissionMask.Modify | |
450 | PermissionMask.Copy | | 490 | PermissionMask.Copy | |
451 | PermissionMask.Move | | 491 | PermissionMask.Move | |
452 | PermissionMask.Transfer) | 7; | 492 | PermissionMask.Transfer | |
493 | PermissionMask.FoldedMask); | ||
453 | 494 | ||
454 | uint ownerMask = 0x7fffffff; | 495 | uint ownerMask = RootPart.OwnerMask; |
455 | 496 | ||
456 | SceneObjectPart[] parts = m_parts.GetArray(); | 497 | SceneObjectPart[] parts = m_parts.GetArray(); |
457 | for (int i = 0; i < parts.Length; i++) | 498 | for (int i = 0; i < parts.Length; i++) |
458 | { | 499 | { |
459 | SceneObjectPart part = parts[i]; | 500 | SceneObjectPart part = parts[i]; |
460 | 501 | ownerMask &= part.BaseMask; | |
461 | if (useBase) | ||
462 | ownerMask &= part.BaseMask; | ||
463 | else | ||
464 | ownerMask &= part.OwnerMask; | ||
465 | |||
466 | perms &= part.Inventory.MaskEffectivePermissions(); | 502 | perms &= part.Inventory.MaskEffectivePermissions(); |
467 | } | 503 | } |
468 | 504 | ||
@@ -472,17 +508,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
472 | perms &= ~(uint)PermissionMask.Copy; | 508 | perms &= ~(uint)PermissionMask.Copy; |
473 | if ((ownerMask & (uint)PermissionMask.Transfer) == 0) | 509 | if ((ownerMask & (uint)PermissionMask.Transfer) == 0) |
474 | perms &= ~(uint)PermissionMask.Transfer; | 510 | perms &= ~(uint)PermissionMask.Transfer; |
475 | 511 | if ((ownerMask & (uint)PermissionMask.Export) == 0) | |
476 | // If root prim permissions are applied here, this would screw | 512 | perms &= ~(uint)PermissionMask.Export; |
477 | // with in-inventory manipulation of the next owner perms | ||
478 | // in a major way. So, let's move this to the give itself. | ||
479 | // Yes. I know. Evil. | ||
480 | // if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Modify) == 0) | ||
481 | // perms &= ~((uint)PermissionMask.Modify >> 13); | ||
482 | // if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Copy) == 0) | ||
483 | // perms &= ~((uint)PermissionMask.Copy >> 13); | ||
484 | // if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Transfer) == 0) | ||
485 | // perms &= ~((uint)PermissionMask.Transfer >> 13); | ||
486 | 513 | ||
487 | return perms; | 514 | return perms; |
488 | } | 515 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 19bf53f..f948336 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2579,6 +2579,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2579 | AggregatedInnerOwnerPerms = owner & mask; | 2579 | AggregatedInnerOwnerPerms = owner & mask; |
2580 | AggregatedInnerGroupPerms = group & mask; | 2580 | AggregatedInnerGroupPerms = group & mask; |
2581 | AggregatedInnerEveryonePerms = everyone & mask; | 2581 | AggregatedInnerEveryonePerms = everyone & mask; |
2582 | if(ParentGroup != null) | ||
2583 | ParentGroup.InvalidateEffectivePerms(); | ||
2582 | } | 2584 | } |
2583 | } | 2585 | } |
2584 | 2586 | ||
@@ -5286,9 +5288,9 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
5286 | // Export needs to be preserved in the base and everyone | 5288 | // Export needs to be preserved in the base and everyone |
5287 | // mask, but removed in the owner mask as a next owner | 5289 | // mask, but removed in the owner mask as a next owner |
5288 | // can never change the export status | 5290 | // can never change the export status |
5289 | BaseMask &= NextOwnerMask | (uint)PermissionMask.Export; | 5291 | BaseMask &= (NextOwnerMask | (uint)PermissionMask.Export); |
5290 | OwnerMask &= NextOwnerMask; | 5292 | OwnerMask &= NextOwnerMask; |
5291 | EveryoneMask &= NextOwnerMask | (uint)PermissionMask.Export; | 5293 | EveryoneMask &= (NextOwnerMask | (uint)PermissionMask.Export); |
5292 | GroupMask = 0; // Giving an object zaps group permissions | 5294 | GroupMask = 0; // Giving an object zaps group permissions |
5293 | 5295 | ||
5294 | Inventory.ApplyNextOwnerPermissions(); | 5296 | Inventory.ApplyNextOwnerPermissions(); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index b53c355..8c9d0bb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -1332,6 +1332,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1332 | { | 1332 | { |
1333 | foreach (TaskInventoryItem item in m_items.Values) | 1333 | foreach (TaskInventoryItem item in m_items.Values) |
1334 | { | 1334 | { |
1335 | if(item.InvType == (sbyte)InventoryType.Landmark) | ||
1336 | continue; | ||
1335 | owner &= item.CurrentPermissions; | 1337 | owner &= item.CurrentPermissions; |
1336 | group &= item.GroupPermissions; | 1338 | group &= item.GroupPermissions; |
1337 | everyone &= item.EveryonePermissions; | 1339 | everyone &= item.EveryonePermissions; |
@@ -1340,33 +1342,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
1340 | 1342 | ||
1341 | public uint MaskEffectivePermissions() | 1343 | public uint MaskEffectivePermissions() |
1342 | { | 1344 | { |
1345 | // used to propagate permissions restrictions outwards | ||
1346 | // Modify does not propagate outwards. | ||
1343 | uint mask=0x7fffffff; | 1347 | uint mask=0x7fffffff; |
1344 | 1348 | ||
1345 | foreach (TaskInventoryItem item in m_items.Values) | 1349 | foreach (TaskInventoryItem item in m_items.Values) |
1346 | { | 1350 | { |
1347 | if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0) | 1351 | if(item.InvType == (sbyte)InventoryType.Landmark) |
1348 | mask &= ~((uint)PermissionMask.Copy >> 13); | 1352 | continue; |
1349 | if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0) | 1353 | |
1350 | mask &= ~((uint)PermissionMask.Transfer >> 13); | 1354 | // apply current to normal permission bits |
1351 | if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0) | 1355 | uint newperms = item.CurrentPermissions; |
1352 | mask &= ~((uint)PermissionMask.Modify >> 13); | ||
1353 | |||
1354 | if (item.InvType == (int)InventoryType.Object) | ||
1355 | { | ||
1356 | if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) | ||
1357 | mask &= ~((uint)PermissionMask.Copy >> 13); | ||
1358 | if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) | ||
1359 | mask &= ~((uint)PermissionMask.Transfer >> 13); | ||
1360 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) | ||
1361 | mask &= ~((uint)PermissionMask.Modify >> 13); | ||
1362 | } | ||
1363 | 1356 | ||
1364 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | 1357 | if ((newperms & (uint)PermissionMask.Copy) == 0) |
1365 | mask &= ~(uint)PermissionMask.Copy; | 1358 | mask &= ~(uint)PermissionMask.Copy; |
1366 | if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | 1359 | if ((newperms & (uint)PermissionMask.Transfer) == 0) |
1367 | mask &= ~(uint)PermissionMask.Transfer; | 1360 | mask &= ~(uint)PermissionMask.Transfer; |
1368 | if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0) | 1361 | if ((newperms & (uint)PermissionMask.Export) == 0) |
1369 | mask &= ~(uint)PermissionMask.Modify; | 1362 | mask &= ~((uint)PermissionMask.Export); |
1363 | |||
1364 | // apply next owner restricted by current to folded bits | ||
1365 | newperms &= item.NextPermissions; | ||
1366 | |||
1367 | if ((newperms & (uint)PermissionMask.Copy) == 0) | ||
1368 | mask &= ~((uint)PermissionMask.FoldedCopy); | ||
1369 | if ((newperms & (uint)PermissionMask.Transfer) == 0) | ||
1370 | mask &= ~((uint)PermissionMask.FoldedTransfer); | ||
1371 | if ((newperms & (uint)PermissionMask.Export) == 0) | ||
1372 | mask &= ~((uint)PermissionMask.FoldedExport); | ||
1373 | |||
1370 | } | 1374 | } |
1371 | return mask; | 1375 | return mask; |
1372 | } | 1376 | } |
@@ -1375,19 +1379,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1375 | { | 1379 | { |
1376 | foreach (TaskInventoryItem item in m_items.Values) | 1380 | foreach (TaskInventoryItem item in m_items.Values) |
1377 | { | 1381 | { |
1378 | if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) | ||
1379 | { | ||
1380 | // m_log.DebugFormat ( | ||
1381 | // "[SCENE OBJECT PART INVENTORY]: Applying next permissions {0} to {1} in {2} with current {3}, base {4}, everyone {5}", | ||
1382 | // item.NextPermissions, item.Name, m_part.Name, item.CurrentPermissions, item.BasePermissions, item.EveryonePermissions); | ||
1383 | |||
1384 | if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) | ||
1385 | item.CurrentPermissions &= ~(uint)PermissionMask.Copy; | ||
1386 | if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) | ||
1387 | item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; | ||
1388 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) | ||
1389 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; | ||
1390 | } | ||
1391 | item.CurrentPermissions &= item.NextPermissions; | 1382 | item.CurrentPermissions &= item.NextPermissions; |
1392 | item.BasePermissions &= item.NextPermissions; | 1383 | item.BasePermissions &= item.NextPermissions; |
1393 | item.EveryonePermissions &= item.NextPermissions; | 1384 | item.EveryonePermissions &= item.NextPermissions; |
diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/PrimMesher.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/PrimMesher.cs index 10facf2..e93175f 100644 --- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/PrimMesher.cs +++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/PrimMesher.cs | |||
@@ -755,8 +755,8 @@ namespace PrimMesher | |||
755 | if (hollowAngles.angles[0].angle - angles.angles[i].angle < angles.angles[i].angle - hollowAngles.angles[maxJ].angle + 0.000001f) | 755 | if (hollowAngles.angles[0].angle - angles.angles[i].angle < angles.angles[i].angle - hollowAngles.angles[maxJ].angle + 0.000001f) |
756 | { | 756 | { |
757 | newFace.v1 = 0; | 757 | newFace.v1 = 0; |
758 | newFace.v2 = numTotalVerts - maxJ - 1; | 758 | newFace.v2 = numTotalVerts - 1; |
759 | newFace.v3 = numTotalVerts - 1; | 759 | newFace.v3 = numTotalVerts - maxJ - 1; |
760 | 760 | ||
761 | faces.Add(newFace); | 761 | faces.Add(newFace); |
762 | } | 762 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 47c3cb8..2000c44 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -13405,6 +13405,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
13405 | List<string> param = new List<string>(); | 13405 | List<string> param = new List<string>(); |
13406 | bool ok; | 13406 | bool ok; |
13407 | Int32 flag; | 13407 | Int32 flag; |
13408 | int nCustomHeaders = 0; | ||
13408 | 13409 | ||
13409 | for (int i = 0; i < parameters.Data.Length; i += 2) | 13410 | for (int i = 0; i < parameters.Data.Length; i += 2) |
13410 | { | 13411 | { |
@@ -13431,6 +13432,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
13431 | //Second Life documentation for llHTTPRequest. | 13432 | //Second Life documentation for llHTTPRequest. |
13432 | for (int count = 1; count <= 8; ++count) | 13433 | for (int count = 1; count <= 8; ++count) |
13433 | { | 13434 | { |
13435 | if(nCustomHeaders >= 8) | ||
13436 | { | ||
13437 | Error("llHTTPRequest", "Max number of custom headers is 8, excess ignored"); | ||
13438 | break; | ||
13439 | } | ||
13440 | |||
13434 | //Enough parameters remaining for (another) header? | 13441 | //Enough parameters remaining for (another) header? |
13435 | if (parameters.Data.Length - i < 2) | 13442 | if (parameters.Data.Length - i < 2) |
13436 | { | 13443 | { |
@@ -13445,15 +13452,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
13445 | 13452 | ||
13446 | param.Add(parameters.Data[i].ToString()); | 13453 | param.Add(parameters.Data[i].ToString()); |
13447 | param.Add(parameters.Data[i+1].ToString()); | 13454 | param.Add(parameters.Data[i+1].ToString()); |
13455 | nCustomHeaders++; | ||
13448 | 13456 | ||
13449 | //Have we reached the end of the list of headers? | 13457 | //Have we reached the end of the list of headers? |
13450 | //End is marked by a string with a single digit. | 13458 | //End is marked by a string with a single digit. |
13451 | if (i+2 >= parameters.Data.Length || | 13459 | if (i + 2 >= parameters.Data.Length || |
13452 | Char.IsDigit(parameters.Data[i].ToString()[0])) | 13460 | Char.IsDigit(parameters.Data[i + 2].ToString()[0])) |
13453 | { | 13461 | { |
13454 | break; | 13462 | break; |
13455 | } | 13463 | } |
13456 | |||
13457 | i += 2; | 13464 | i += 2; |
13458 | } | 13465 | } |
13459 | } | 13466 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs index 8cac50e..241a24d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs | |||
@@ -87,17 +87,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
87 | uint port = 9999; | 87 | uint port = 9999; |
88 | MainServer.RemoveHttpServer(port); | 88 | MainServer.RemoveHttpServer(port); |
89 | 89 | ||
90 | BaseHttpServer server = new BaseHttpServer(port, false, "", "", ""); | 90 | m_engine = new MockScriptEngine(); |
91 | m_urlModule = new UrlModule(); | ||
92 | |||
93 | IConfigSource config = new IniConfigSource(); | ||
94 | config.AddConfig("Network"); | ||
95 | config.Configs["Network"].Set("ExternalHostNameForLSL", "127.0.0.1"); | ||
96 | m_scene = new SceneHelpers().SetupScene(); | ||
97 | |||
98 | BaseHttpServer server = new BaseHttpServer(port, false, 0, ""); | ||
91 | MainServer.AddHttpServer(server); | 99 | MainServer.AddHttpServer(server); |
92 | MainServer.Instance = server; | 100 | MainServer.Instance = server; |
93 | 101 | ||
94 | server.Start(); | 102 | server.Start(); |
95 | 103 | ||
96 | m_engine = new MockScriptEngine(); | 104 | SceneHelpers.SetupSceneModules(m_scene, config, m_engine, m_urlModule); |
97 | m_urlModule = new UrlModule(); | ||
98 | |||
99 | m_scene = new SceneHelpers().SetupScene(); | ||
100 | SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine, m_urlModule); | ||
101 | 105 | ||
102 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); | 106 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); |
103 | m_scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, so.RootPart); | 107 | m_scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, so.RootPart); |
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 6153f5e..a5c7d34 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs | |||
@@ -909,9 +909,9 @@ namespace OpenSim.Services.GridService | |||
909 | private void OutputRegionsToConsoleSummary(List<RegionData> regions) | 909 | private void OutputRegionsToConsoleSummary(List<RegionData> regions) |
910 | { | 910 | { |
911 | ConsoleDisplayTable dispTable = new ConsoleDisplayTable(); | 911 | ConsoleDisplayTable dispTable = new ConsoleDisplayTable(); |
912 | dispTable.AddColumn("Name", 44); | 912 | dispTable.AddColumn("Name", ConsoleDisplayUtil.RegionNameSize); |
913 | dispTable.AddColumn("ID", 36); | 913 | dispTable.AddColumn("ID", ConsoleDisplayUtil.UuidSize); |
914 | dispTable.AddColumn("Position", 11); | 914 | dispTable.AddColumn("Position", ConsoleDisplayUtil.CoordTupleSize); |
915 | dispTable.AddColumn("Size", 11); | 915 | dispTable.AddColumn("Size", 11); |
916 | dispTable.AddColumn("Flags", 60); | 916 | dispTable.AddColumn("Flags", 60); |
917 | 917 | ||
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index f6b003a..a22754f 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs | |||
@@ -640,9 +640,11 @@ namespace OpenSim.Services.UserAccountService | |||
640 | m_log.DebugFormat("[USER ACCOUNT SERVICE]: Creating default appearance items for {0}", principalID); | 640 | m_log.DebugFormat("[USER ACCOUNT SERVICE]: Creating default appearance items for {0}", principalID); |
641 | 641 | ||
642 | InventoryFolderBase bodyPartsFolder = m_InventoryService.GetFolderForType(principalID, FolderType.BodyPart); | 642 | InventoryFolderBase bodyPartsFolder = m_InventoryService.GetFolderForType(principalID, FolderType.BodyPart); |
643 | // Get Current Outfit folder | ||
644 | InventoryFolderBase currentOutfitFolder = m_InventoryService.GetFolderForType(principalID, FolderType.CurrentOutfit); | ||
643 | 645 | ||
644 | InventoryItemBase eyes = new InventoryItemBase(UUID.Random(), principalID); | 646 | InventoryItemBase eyes = new InventoryItemBase(UUID.Random(), principalID); |
645 | eyes.AssetID = new UUID("4bb6fa4d-1cd2-498a-a84c-95c1a0e745a7"); | 647 | eyes.AssetID = AvatarWearable.DEFAULT_EYES_ASSET; |
646 | eyes.Name = "Default Eyes"; | 648 | eyes.Name = "Default Eyes"; |
647 | eyes.CreatorId = principalID.ToString(); | 649 | eyes.CreatorId = principalID.ToString(); |
648 | eyes.AssetType = (int)AssetType.Bodypart; | 650 | eyes.AssetType = (int)AssetType.Bodypart; |
@@ -655,6 +657,7 @@ namespace OpenSim.Services.UserAccountService | |||
655 | eyes.NextPermissions = (uint)PermissionMask.All; | 657 | eyes.NextPermissions = (uint)PermissionMask.All; |
656 | eyes.Flags = (uint)WearableType.Eyes; | 658 | eyes.Flags = (uint)WearableType.Eyes; |
657 | m_InventoryService.AddItem(eyes); | 659 | m_InventoryService.AddItem(eyes); |
660 | CreateCurrentOutfitLink((int)InventoryType.Wearable, (uint)WearableType.Eyes, eyes.Name, eyes.ID, principalID, currentOutfitFolder.ID); | ||
658 | 661 | ||
659 | InventoryItemBase shape = new InventoryItemBase(UUID.Random(), principalID); | 662 | InventoryItemBase shape = new InventoryItemBase(UUID.Random(), principalID); |
660 | shape.AssetID = AvatarWearable.DEFAULT_BODY_ASSET; | 663 | shape.AssetID = AvatarWearable.DEFAULT_BODY_ASSET; |
@@ -670,6 +673,7 @@ namespace OpenSim.Services.UserAccountService | |||
670 | shape.NextPermissions = (uint)PermissionMask.All; | 673 | shape.NextPermissions = (uint)PermissionMask.All; |
671 | shape.Flags = (uint)WearableType.Shape; | 674 | shape.Flags = (uint)WearableType.Shape; |
672 | m_InventoryService.AddItem(shape); | 675 | m_InventoryService.AddItem(shape); |
676 | CreateCurrentOutfitLink((int)InventoryType.Wearable, (uint)WearableType.Shape, shape.Name, shape.ID, principalID, currentOutfitFolder.ID); | ||
673 | 677 | ||
674 | InventoryItemBase skin = new InventoryItemBase(UUID.Random(), principalID); | 678 | InventoryItemBase skin = new InventoryItemBase(UUID.Random(), principalID); |
675 | skin.AssetID = AvatarWearable.DEFAULT_SKIN_ASSET; | 679 | skin.AssetID = AvatarWearable.DEFAULT_SKIN_ASSET; |
@@ -685,6 +689,7 @@ namespace OpenSim.Services.UserAccountService | |||
685 | skin.NextPermissions = (uint)PermissionMask.All; | 689 | skin.NextPermissions = (uint)PermissionMask.All; |
686 | skin.Flags = (uint)WearableType.Skin; | 690 | skin.Flags = (uint)WearableType.Skin; |
687 | m_InventoryService.AddItem(skin); | 691 | m_InventoryService.AddItem(skin); |
692 | CreateCurrentOutfitLink((int)InventoryType.Wearable, (uint)WearableType.Skin, skin.Name, skin.ID, principalID, currentOutfitFolder.ID); | ||
688 | 693 | ||
689 | InventoryItemBase hair = new InventoryItemBase(UUID.Random(), principalID); | 694 | InventoryItemBase hair = new InventoryItemBase(UUID.Random(), principalID); |
690 | hair.AssetID = AvatarWearable.DEFAULT_HAIR_ASSET; | 695 | hair.AssetID = AvatarWearable.DEFAULT_HAIR_ASSET; |
@@ -700,6 +705,7 @@ namespace OpenSim.Services.UserAccountService | |||
700 | hair.NextPermissions = (uint)PermissionMask.All; | 705 | hair.NextPermissions = (uint)PermissionMask.All; |
701 | hair.Flags = (uint)WearableType.Hair; | 706 | hair.Flags = (uint)WearableType.Hair; |
702 | m_InventoryService.AddItem(hair); | 707 | m_InventoryService.AddItem(hair); |
708 | CreateCurrentOutfitLink((int)InventoryType.Wearable, (uint)WearableType.Hair, hair.Name, hair.ID, principalID, currentOutfitFolder.ID); | ||
703 | 709 | ||
704 | InventoryFolderBase clothingFolder = m_InventoryService.GetFolderForType(principalID, FolderType.Clothing); | 710 | InventoryFolderBase clothingFolder = m_InventoryService.GetFolderForType(principalID, FolderType.Clothing); |
705 | 711 | ||
@@ -717,6 +723,7 @@ namespace OpenSim.Services.UserAccountService | |||
717 | shirt.NextPermissions = (uint)PermissionMask.All; | 723 | shirt.NextPermissions = (uint)PermissionMask.All; |
718 | shirt.Flags = (uint)WearableType.Shirt; | 724 | shirt.Flags = (uint)WearableType.Shirt; |
719 | m_InventoryService.AddItem(shirt); | 725 | m_InventoryService.AddItem(shirt); |
726 | CreateCurrentOutfitLink((int)InventoryType.Wearable, (uint)WearableType.Shirt, shirt.Name, shirt.ID, principalID, currentOutfitFolder.ID); | ||
720 | 727 | ||
721 | InventoryItemBase pants = new InventoryItemBase(UUID.Random(), principalID); | 728 | InventoryItemBase pants = new InventoryItemBase(UUID.Random(), principalID); |
722 | pants.AssetID = AvatarWearable.DEFAULT_PANTS_ASSET; | 729 | pants.AssetID = AvatarWearable.DEFAULT_PANTS_ASSET; |
@@ -732,6 +739,7 @@ namespace OpenSim.Services.UserAccountService | |||
732 | pants.NextPermissions = (uint)PermissionMask.All; | 739 | pants.NextPermissions = (uint)PermissionMask.All; |
733 | pants.Flags = (uint)WearableType.Pants; | 740 | pants.Flags = (uint)WearableType.Pants; |
734 | m_InventoryService.AddItem(pants); | 741 | m_InventoryService.AddItem(pants); |
742 | CreateCurrentOutfitLink((int)InventoryType.Wearable, (uint)WearableType.Pants, pants.Name, pants.ID, principalID, currentOutfitFolder.ID); | ||
735 | 743 | ||
736 | if (m_AvatarService != null) | 744 | if (m_AvatarService != null) |
737 | { | 745 | { |
@@ -815,6 +823,8 @@ namespace OpenSim.Services.UserAccountService | |||
815 | { | 823 | { |
816 | // Get Clothing folder of receiver | 824 | // Get Clothing folder of receiver |
817 | InventoryFolderBase destinationFolder = m_InventoryService.GetFolderForType(destination, FolderType.Clothing); | 825 | InventoryFolderBase destinationFolder = m_InventoryService.GetFolderForType(destination, FolderType.Clothing); |
826 | // Get Current Outfit folder | ||
827 | InventoryFolderBase currentOutfitFolder = m_InventoryService.GetFolderForType(destination, FolderType.CurrentOutfit); | ||
818 | 828 | ||
819 | if (destinationFolder == null) | 829 | if (destinationFolder == null) |
820 | throw new Exception("Cannot locate folder(s)"); | 830 | throw new Exception("Cannot locate folder(s)"); |
@@ -841,6 +851,7 @@ namespace OpenSim.Services.UserAccountService | |||
841 | for (int i = 0; i < wearables.Length; i++) | 851 | for (int i = 0; i < wearables.Length; i++) |
842 | { | 852 | { |
843 | wearable = wearables[i]; | 853 | wearable = wearables[i]; |
854 | m_log.DebugFormat("[XXX]: Getting item {0} from avie {1}", wearable[0].ItemID, source); | ||
844 | if (wearable[0].ItemID != UUID.Zero) | 855 | if (wearable[0].ItemID != UUID.Zero) |
845 | { | 856 | { |
846 | // Get inventory item and copy it | 857 | // Get inventory item and copy it |
@@ -878,6 +889,9 @@ namespace OpenSim.Services.UserAccountService | |||
878 | AvatarWearable newWearable = new AvatarWearable(); | 889 | AvatarWearable newWearable = new AvatarWearable(); |
879 | newWearable.Wear(destinationItem.ID, wearable[0].AssetID); | 890 | newWearable.Wear(destinationItem.ID, wearable[0].AssetID); |
880 | avatarAppearance.SetWearable(i, newWearable); | 891 | avatarAppearance.SetWearable(i, newWearable); |
892 | |||
893 | // Add to Current Outfit | ||
894 | CreateCurrentOutfitLink((int)InventoryType.Wearable, item.Flags, item.Name, destinationItem.ID, destination, currentOutfitFolder.ID); | ||
881 | } | 895 | } |
882 | else | 896 | else |
883 | { | 897 | { |
@@ -930,6 +944,9 @@ namespace OpenSim.Services.UserAccountService | |||
930 | // Attach item | 944 | // Attach item |
931 | avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID); | 945 | avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID); |
932 | m_log.DebugFormat("[USER ACCOUNT SERVICE]: Attached {0}", destinationItem.ID); | 946 | m_log.DebugFormat("[USER ACCOUNT SERVICE]: Attached {0}", destinationItem.ID); |
947 | |||
948 | // Add to Current Outfit | ||
949 | CreateCurrentOutfitLink(destinationItem.InvType, item.Flags, item.Name, destinationItem.ID, destination, currentOutfitFolder.ID); | ||
933 | } | 950 | } |
934 | else | 951 | else |
935 | { | 952 | { |
@@ -939,6 +956,30 @@ namespace OpenSim.Services.UserAccountService | |||
939 | } | 956 | } |
940 | } | 957 | } |
941 | 958 | ||
959 | protected void CreateCurrentOutfitLink(int invType, uint itemType, string name, UUID itemID, UUID userID, UUID currentOutfitFolderUUID) | ||
960 | { | ||
961 | UUID LinkInvItem = UUID.Random(); | ||
962 | InventoryItemBase itembase = new InventoryItemBase(LinkInvItem, userID) | ||
963 | { | ||
964 | AssetID = itemID, | ||
965 | AssetType = (int)AssetType.Link, | ||
966 | CreatorId = userID.ToString(), | ||
967 | InvType = invType, | ||
968 | Description = "", | ||
969 | //Folder = m_InventoryService.GetFolderForType(userID, FolderType.CurrentOutfit).ID, | ||
970 | Folder = currentOutfitFolderUUID, | ||
971 | Flags = itemType, | ||
972 | Name = name, | ||
973 | BasePermissions = (uint)PermissionMask.Copy, | ||
974 | CurrentPermissions = (uint)PermissionMask.Copy, | ||
975 | EveryOnePermissions = (uint)PermissionMask.Copy, | ||
976 | GroupPermissions = (uint)PermissionMask.Copy, | ||
977 | NextPermissions = (uint)PermissionMask.Copy | ||
978 | }; | ||
979 | |||
980 | m_InventoryService.AddItem(itembase); | ||
981 | } | ||
982 | |||
942 | /// <summary> | 983 | /// <summary> |
943 | /// Apply next owner permissions. | 984 | /// Apply next owner permissions. |
944 | /// </summary> | 985 | /// </summary> |
diff --git a/OpenSim/Tests/Permissions/Common.cs b/OpenSim/Tests/Permissions/Common.cs new file mode 100644 index 0000000..f93c120 --- /dev/null +++ b/OpenSim/Tests/Permissions/Common.cs | |||
@@ -0,0 +1,365 @@ | |||
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 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using System.Threading; | ||
30 | using Nini.Config; | ||
31 | using NUnit.Framework; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Region.Framework.Scenes; | ||
35 | using OpenSim.Region.CoreModules.World.Permissions; | ||
36 | using OpenSim.Region.CoreModules.Avatar.Inventory.Transfer; | ||
37 | using OpenSim.Region.CoreModules.Framework.InventoryAccess; | ||
38 | using OpenSim.Services.Interfaces; | ||
39 | using OpenSim.Tests.Common; | ||
40 | using PermissionMask = OpenSim.Framework.PermissionMask; | ||
41 | |||
42 | namespace OpenSim.Tests.Permissions | ||
43 | { | ||
44 | [SetUpFixture] | ||
45 | public class Common : OpenSimTestCase | ||
46 | { | ||
47 | public static Common TheInstance; | ||
48 | |||
49 | public static TestScene TheScene | ||
50 | { | ||
51 | get { return TheInstance.m_Scene; } | ||
52 | } | ||
53 | |||
54 | public static ScenePresence[] TheAvatars | ||
55 | { | ||
56 | get { return TheInstance.m_Avatars; } | ||
57 | } | ||
58 | |||
59 | private static string Perms = "Owner: {0}; Group: {1}; Everyone: {2}; Next: {3}"; | ||
60 | private TestScene m_Scene; | ||
61 | private ScenePresence[] m_Avatars = new ScenePresence[3]; | ||
62 | |||
63 | [SetUp] | ||
64 | public override void SetUp() | ||
65 | { | ||
66 | if (TheInstance == null) | ||
67 | TheInstance = this; | ||
68 | |||
69 | base.SetUp(); | ||
70 | TestHelpers.EnableLogging(); | ||
71 | |||
72 | IConfigSource config = new IniConfigSource(); | ||
73 | config.AddConfig("Messaging"); | ||
74 | config.Configs["Messaging"].Set("InventoryTransferModule", "InventoryTransferModule"); | ||
75 | config.AddConfig("Modules"); | ||
76 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); | ||
77 | config.AddConfig("InventoryService"); | ||
78 | config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:XInventoryService"); | ||
79 | config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll:TestXInventoryDataPlugin"); | ||
80 | |||
81 | m_Scene = new SceneHelpers().SetupScene("Test", UUID.Random(), 1000, 1000, config); | ||
82 | // Add modules | ||
83 | SceneHelpers.SetupSceneModules(m_Scene, config, new DefaultPermissionsModule(), new InventoryTransferModule(), new BasicInventoryAccessModule()); | ||
84 | |||
85 | SetUpBasicEnvironment(); | ||
86 | } | ||
87 | |||
88 | /// <summary> | ||
89 | /// The basic environment consists of: | ||
90 | /// - 3 avatars: A1, A2, A3 | ||
91 | /// - 6 simple boxes inworld belonging to A0 and with Next Owner perms: | ||
92 | /// C, CT, MC, MCT, MT, T | ||
93 | /// - Copies of all of these boxes in A0's inventory in the Objects folder | ||
94 | /// - One additional box inworld and in A0's inventory which is a copy of MCT, but | ||
95 | /// with C removed in inventory. This one is called MCT-C | ||
96 | /// </summary> | ||
97 | private void SetUpBasicEnvironment() | ||
98 | { | ||
99 | Console.WriteLine("===> SetUpBasicEnvironment <==="); | ||
100 | |||
101 | // Add 3 avatars | ||
102 | for (int i = 0; i < 3; i++) | ||
103 | { | ||
104 | UUID id = TestHelpers.ParseTail(i + 1); | ||
105 | |||
106 | m_Avatars[i] = AddScenePresence("Bot", "Bot_" + (i+1), id); | ||
107 | Assert.That(m_Avatars[i], Is.Not.Null); | ||
108 | Assert.That(m_Avatars[i].IsChildAgent, Is.False); | ||
109 | Assert.That(m_Avatars[i].UUID, Is.EqualTo(id)); | ||
110 | Assert.That(m_Scene.GetScenePresences().Count, Is.EqualTo(i + 1)); | ||
111 | } | ||
112 | |||
113 | AddA1Object("Box C", 10, PermissionMask.Copy); | ||
114 | AddA1Object("Box CT", 11, PermissionMask.Copy | PermissionMask.Transfer); | ||
115 | AddA1Object("Box MC", 12, PermissionMask.Modify | PermissionMask.Copy); | ||
116 | AddA1Object("Box MCT", 13, PermissionMask.Modify | PermissionMask.Copy | PermissionMask.Transfer); | ||
117 | AddA1Object("Box MT", 14, PermissionMask.Modify | PermissionMask.Transfer); | ||
118 | AddA1Object("Box T", 15, PermissionMask.Transfer); | ||
119 | |||
120 | // MCT-C | ||
121 | AddA1Object("Box MCT-C", 16, PermissionMask.Modify | PermissionMask.Copy | PermissionMask.Transfer); | ||
122 | |||
123 | Thread.Sleep(5000); | ||
124 | |||
125 | InventoryFolderBase objsFolder = UserInventoryHelpers.GetInventoryFolder(m_Scene.InventoryService, m_Avatars[0].UUID, "Objects"); | ||
126 | List<InventoryItemBase> items = m_Scene.InventoryService.GetFolderItems(m_Avatars[0].UUID, objsFolder.ID); | ||
127 | Assert.That(items.Count, Is.EqualTo(7)); | ||
128 | |||
129 | RevokePermission(0, "Box MCT-C", PermissionMask.Copy); | ||
130 | } | ||
131 | |||
132 | private ScenePresence AddScenePresence(string first, string last, UUID id) | ||
133 | { | ||
134 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_Scene, first, last, id, "pw"); | ||
135 | ScenePresence sp = SceneHelpers.AddScenePresence(m_Scene, id); | ||
136 | Assert.That(m_Scene.AuthenticateHandler.GetAgentCircuitData(id), Is.Not.Null); | ||
137 | |||
138 | return sp; | ||
139 | } | ||
140 | |||
141 | private void AddA1Object(string name, int suffix, PermissionMask nextOwnerPerms) | ||
142 | { | ||
143 | // Create a Box. Default permissions are just T | ||
144 | SceneObjectGroup box = AddSceneObject(name, suffix, 1, m_Avatars[0].UUID); | ||
145 | Assert.True((box.RootPart.NextOwnerMask & (int)PermissionMask.Copy) == 0); | ||
146 | Assert.True((box.RootPart.NextOwnerMask & (int)PermissionMask.Modify) == 0); | ||
147 | Assert.True((box.RootPart.NextOwnerMask & (int)PermissionMask.Transfer) != 0); | ||
148 | |||
149 | // field = 16 is NextOwner | ||
150 | // set = 1 means add the permission; set = 0 means remove permission | ||
151 | |||
152 | if ((nextOwnerPerms & PermissionMask.Copy) != 0) | ||
153 | m_Scene.HandleObjectPermissionsUpdate((IClientAPI)m_Avatars[0].ClientView, m_Avatars[0].UUID, | ||
154 | ((IClientAPI)(m_Avatars[0].ClientView)).SessionId, 16, box.LocalId, (uint)PermissionMask.Copy, 1); | ||
155 | |||
156 | if ((nextOwnerPerms & PermissionMask.Modify) != 0) | ||
157 | m_Scene.HandleObjectPermissionsUpdate((IClientAPI)m_Avatars[0].ClientView, m_Avatars[0].UUID, | ||
158 | ((IClientAPI)(m_Avatars[0].ClientView)).SessionId, 16, box.LocalId, (uint)PermissionMask.Modify, 1); | ||
159 | |||
160 | if ((nextOwnerPerms & PermissionMask.Transfer) == 0) | ||
161 | m_Scene.HandleObjectPermissionsUpdate((IClientAPI)m_Avatars[0].ClientView, m_Avatars[0].UUID, | ||
162 | ((IClientAPI)(m_Avatars[0].ClientView)).SessionId, 16, box.LocalId, (uint)PermissionMask.Transfer, 0); | ||
163 | |||
164 | PrintPerms(box); | ||
165 | AssertPermissions(nextOwnerPerms, (PermissionMask)box.RootPart.NextOwnerMask, box.OwnerID.ToString().Substring(34) + " : " + box.Name); | ||
166 | |||
167 | TakeCopyToInventory(0, box); | ||
168 | |||
169 | } | ||
170 | |||
171 | public void RevokePermission(int ownerIndex, string name, PermissionMask perm) | ||
172 | { | ||
173 | InventoryItemBase item = Common.TheInstance.GetItemFromInventory(m_Avatars[ownerIndex].UUID, "Objects", name); | ||
174 | Assert.That(item, Is.Not.Null); | ||
175 | |||
176 | // Clone it, so to avoid aliasing -- just like the viewer does. | ||
177 | InventoryItemBase clone = Common.TheInstance.CloneInventoryItem(item); | ||
178 | // Revoke the permission in this copy | ||
179 | clone.NextPermissions &= ~(uint)perm; | ||
180 | Common.TheInstance.AssertPermissions((PermissionMask)clone.NextPermissions & ~perm, | ||
181 | (PermissionMask)clone.NextPermissions, Common.TheInstance.IdStr(clone)); | ||
182 | Assert.That(clone.ID == item.ID); | ||
183 | |||
184 | // Update properties of the item in inventory. This should affect the original item above. | ||
185 | Common.TheScene.UpdateInventoryItemAsset(m_Avatars[ownerIndex].ControllingClient, UUID.Zero, clone.ID, clone); | ||
186 | |||
187 | item = Common.TheInstance.GetItemFromInventory(m_Avatars[ownerIndex].UUID, "Objects", name); | ||
188 | Assert.That(item, Is.Not.Null); | ||
189 | Common.TheInstance.PrintPerms(item); | ||
190 | Common.TheInstance.AssertPermissions((PermissionMask)item.NextPermissions & ~perm, | ||
191 | (PermissionMask)item.NextPermissions, Common.TheInstance.IdStr(item)); | ||
192 | |||
193 | } | ||
194 | |||
195 | public void PrintPerms(SceneObjectGroup sog) | ||
196 | { | ||
197 | Console.WriteLine("SOG " + sog.Name + " (" + sog.OwnerID.ToString().Substring(34) + "): " + | ||
198 | String.Format(Perms, (PermissionMask)sog.EffectiveOwnerPerms, | ||
199 | (PermissionMask)sog.EffectiveGroupPerms, (PermissionMask)sog.EffectiveEveryOnePerms, (PermissionMask)sog.RootPart.NextOwnerMask)); | ||
200 | |||
201 | } | ||
202 | |||
203 | public void PrintPerms(InventoryItemBase item) | ||
204 | { | ||
205 | Console.WriteLine("Inv " + item.Name + " (" + item.Owner.ToString().Substring(34) + "): " + | ||
206 | String.Format(Perms, (PermissionMask)item.BasePermissions, | ||
207 | (PermissionMask)item.GroupPermissions, (PermissionMask)item.EveryOnePermissions, (PermissionMask)item.NextPermissions)); | ||
208 | |||
209 | } | ||
210 | |||
211 | public void AssertPermissions(PermissionMask desired, PermissionMask actual, string message) | ||
212 | { | ||
213 | if ((desired & PermissionMask.Copy) != 0) | ||
214 | Assert.True((actual & PermissionMask.Copy) != 0, message); | ||
215 | else | ||
216 | Assert.True((actual & PermissionMask.Copy) == 0, message); | ||
217 | |||
218 | if ((desired & PermissionMask.Modify) != 0) | ||
219 | Assert.True((actual & PermissionMask.Modify) != 0, message); | ||
220 | else | ||
221 | Assert.True((actual & PermissionMask.Modify) == 0, message); | ||
222 | |||
223 | if ((desired & PermissionMask.Transfer) != 0) | ||
224 | Assert.True((actual & PermissionMask.Transfer) != 0, message); | ||
225 | else | ||
226 | Assert.True((actual & PermissionMask.Transfer) == 0, message); | ||
227 | |||
228 | } | ||
229 | |||
230 | public SceneObjectGroup AddSceneObject(string name, int suffix, int partsToTestCount, UUID ownerID) | ||
231 | { | ||
232 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(partsToTestCount, ownerID, name, suffix); | ||
233 | so.Name = name; | ||
234 | so.Description = name; | ||
235 | |||
236 | Assert.That(m_Scene.AddNewSceneObject(so, false), Is.True); | ||
237 | SceneObjectGroup retrievedSo = m_Scene.GetSceneObjectGroup(so.UUID); | ||
238 | |||
239 | // If the parts have the same UUID then we will consider them as one and the same | ||
240 | Assert.That(retrievedSo.PrimCount, Is.EqualTo(partsToTestCount)); | ||
241 | |||
242 | return so; | ||
243 | } | ||
244 | |||
245 | public void TakeCopyToInventory(int userIndex, SceneObjectGroup sog) | ||
246 | { | ||
247 | InventoryFolderBase objsFolder = UserInventoryHelpers.GetInventoryFolder(m_Scene.InventoryService, m_Avatars[userIndex].UUID, "Objects"); | ||
248 | Assert.That(objsFolder, Is.Not.Null); | ||
249 | |||
250 | List<uint> localIds = new List<uint>(); localIds.Add(sog.LocalId); | ||
251 | // This is an async operation | ||
252 | m_Scene.DeRezObjects((IClientAPI)m_Avatars[userIndex].ClientView, localIds, m_Avatars[userIndex].UUID, DeRezAction.TakeCopy, objsFolder.ID); | ||
253 | } | ||
254 | |||
255 | public InventoryItemBase GetItemFromInventory(UUID userID, string folderName, string itemName) | ||
256 | { | ||
257 | InventoryFolderBase objsFolder = UserInventoryHelpers.GetInventoryFolder(m_Scene.InventoryService, userID, folderName); | ||
258 | Assert.That(objsFolder, Is.Not.Null); | ||
259 | List<InventoryItemBase> items = m_Scene.InventoryService.GetFolderItems(userID, objsFolder.ID); | ||
260 | InventoryItemBase item = items.Find(i => i.Name == itemName); | ||
261 | Assert.That(item, Is.Not.Null); | ||
262 | |||
263 | return item; | ||
264 | } | ||
265 | |||
266 | public InventoryItemBase CloneInventoryItem(InventoryItemBase item) | ||
267 | { | ||
268 | InventoryItemBase clone = new InventoryItemBase(item.ID); | ||
269 | clone.Name = item.Name; | ||
270 | clone.Description = item.Description; | ||
271 | clone.AssetID = item.AssetID; | ||
272 | clone.AssetType = item.AssetType; | ||
273 | clone.BasePermissions = item.BasePermissions; | ||
274 | clone.CreatorId = item.CreatorId; | ||
275 | clone.CurrentPermissions = item.CurrentPermissions; | ||
276 | clone.EveryOnePermissions = item.EveryOnePermissions; | ||
277 | clone.Flags = item.Flags; | ||
278 | clone.Folder = item.Folder; | ||
279 | clone.GroupID = item.GroupID; | ||
280 | clone.GroupOwned = item.GroupOwned; | ||
281 | clone.GroupPermissions = item.GroupPermissions; | ||
282 | clone.InvType = item.InvType; | ||
283 | clone.NextPermissions = item.NextPermissions; | ||
284 | clone.Owner = item.Owner; | ||
285 | |||
286 | return clone; | ||
287 | } | ||
288 | |||
289 | public void DeleteObjectsFolders() | ||
290 | { | ||
291 | // Delete everything in A2 and A3's Objects folders, so we can restart | ||
292 | for (int i = 1; i < 3; i++) | ||
293 | { | ||
294 | InventoryFolderBase objsFolder = UserInventoryHelpers.GetInventoryFolder(Common.TheScene.InventoryService, Common.TheAvatars[i].UUID, "Objects"); | ||
295 | Assert.That(objsFolder, Is.Not.Null); | ||
296 | |||
297 | List<InventoryItemBase> items = Common.TheScene.InventoryService.GetFolderItems(Common.TheAvatars[i].UUID, objsFolder.ID); | ||
298 | List<UUID> ids = new List<UUID>(); | ||
299 | foreach (InventoryItemBase it in items) | ||
300 | ids.Add(it.ID); | ||
301 | |||
302 | Common.TheScene.InventoryService.DeleteItems(Common.TheAvatars[i].UUID, ids); | ||
303 | items = Common.TheScene.InventoryService.GetFolderItems(Common.TheAvatars[i].UUID, objsFolder.ID); | ||
304 | Assert.That(items.Count, Is.EqualTo(0), "A" + (i + 1)); | ||
305 | } | ||
306 | |||
307 | } | ||
308 | |||
309 | public string IdStr(InventoryItemBase item) | ||
310 | { | ||
311 | return item.Owner.ToString().Substring(34) + " : " + item.Name; | ||
312 | } | ||
313 | |||
314 | public string IdStr(SceneObjectGroup sog) | ||
315 | { | ||
316 | return sog.OwnerID.ToString().Substring(34) + " : " + sog.Name; | ||
317 | } | ||
318 | |||
319 | public void GiveInventoryItem(UUID itemId, ScenePresence giverSp, ScenePresence receiverSp) | ||
320 | { | ||
321 | TestClient giverClient = (TestClient)giverSp.ControllingClient; | ||
322 | TestClient receiverClient = (TestClient)receiverSp.ControllingClient; | ||
323 | |||
324 | UUID initialSessionId = TestHelpers.ParseTail(0x10); | ||
325 | byte[] giveImBinaryBucket = new byte[17]; | ||
326 | byte[] itemIdBytes = itemId.GetBytes(); | ||
327 | Array.Copy(itemIdBytes, 0, giveImBinaryBucket, 1, itemIdBytes.Length); | ||
328 | |||
329 | GridInstantMessage giveIm | ||
330 | = new GridInstantMessage( | ||
331 | m_Scene, | ||
332 | giverSp.UUID, | ||
333 | giverSp.Name, | ||
334 | receiverSp.UUID, | ||
335 | (byte)InstantMessageDialog.InventoryOffered, | ||
336 | false, | ||
337 | "inventory offered msg", | ||
338 | initialSessionId, | ||
339 | false, | ||
340 | Vector3.Zero, | ||
341 | giveImBinaryBucket, | ||
342 | true); | ||
343 | |||
344 | giverClient.HandleImprovedInstantMessage(giveIm); | ||
345 | |||
346 | // These details might not all be correct. | ||
347 | GridInstantMessage acceptIm | ||
348 | = new GridInstantMessage( | ||
349 | m_Scene, | ||
350 | receiverSp.UUID, | ||
351 | receiverSp.Name, | ||
352 | giverSp.UUID, | ||
353 | (byte)InstantMessageDialog.InventoryAccepted, | ||
354 | false, | ||
355 | "inventory accepted msg", | ||
356 | initialSessionId, | ||
357 | false, | ||
358 | Vector3.Zero, | ||
359 | null, | ||
360 | true); | ||
361 | |||
362 | receiverClient.HandleImprovedInstantMessage(acceptIm); | ||
363 | } | ||
364 | } | ||
365 | } | ||
diff --git a/OpenSim/Tests/Permissions/DirectTransferTests.cs b/OpenSim/Tests/Permissions/DirectTransferTests.cs new file mode 100644 index 0000000..c68bbdf --- /dev/null +++ b/OpenSim/Tests/Permissions/DirectTransferTests.cs | |||
@@ -0,0 +1,146 @@ | |||
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 | |||
28 | using NUnit.Framework; | ||
29 | using OpenMetaverse; | ||
30 | using OpenSim.Framework; | ||
31 | using OpenSim.Region.Framework.Scenes; | ||
32 | using OpenSim.Tests.Common; | ||
33 | using PermissionMask = OpenSim.Framework.PermissionMask; | ||
34 | |||
35 | namespace OpenSim.Tests.Permissions | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// Basic scene object tests (create, read and delete but not update). | ||
39 | /// </summary> | ||
40 | [TestFixture] | ||
41 | public class DirectTransferTests | ||
42 | { | ||
43 | |||
44 | [SetUp] | ||
45 | public void SetUp() | ||
46 | { | ||
47 | Common.TheInstance.DeleteObjectsFolders(); | ||
48 | } | ||
49 | |||
50 | /// <summary> | ||
51 | /// Test giving simple objecta with various combinations of next owner perms. | ||
52 | /// </summary> | ||
53 | [Test] | ||
54 | public void TestGiveBox() | ||
55 | { | ||
56 | TestHelpers.InMethod(); | ||
57 | |||
58 | // C, CT, MC, MCT, MT, T | ||
59 | string[] names = new string[6] { "Box C", "Box CT", "Box MC", "Box MCT", "Box MT", "Box T" }; | ||
60 | PermissionMask[] perms = new PermissionMask[6] { | ||
61 | PermissionMask.Copy, | ||
62 | PermissionMask.Copy | PermissionMask.Transfer, | ||
63 | PermissionMask.Modify | PermissionMask.Copy, | ||
64 | PermissionMask.Modify | PermissionMask.Copy | PermissionMask.Transfer, | ||
65 | PermissionMask.Modify | PermissionMask.Transfer, | ||
66 | PermissionMask.Transfer | ||
67 | }; | ||
68 | |||
69 | for (int i = 0; i < 6; i++) | ||
70 | TestOneBox(names[i], perms[i]); | ||
71 | } | ||
72 | |||
73 | private void TestOneBox(string name, PermissionMask mask) | ||
74 | { | ||
75 | InventoryItemBase item = Common.TheInstance.GetItemFromInventory(Common.TheAvatars[0].UUID, "Objects", name); | ||
76 | |||
77 | Common.TheInstance.GiveInventoryItem(item.ID, Common.TheAvatars[0], Common.TheAvatars[1]); | ||
78 | |||
79 | item = Common.TheInstance.GetItemFromInventory(Common.TheAvatars[1].UUID, "Objects", name); | ||
80 | |||
81 | // Check the receiver | ||
82 | Common.TheInstance.PrintPerms(item); | ||
83 | Common.TheInstance.AssertPermissions(mask, (PermissionMask)item.BasePermissions, item.Owner.ToString().Substring(34) + " : " + item.Name); | ||
84 | |||
85 | int nObjects = Common.TheScene.GetSceneObjectGroups().Count; | ||
86 | // Rez it and check perms in scene too | ||
87 | Common.TheScene.RezObject(Common.TheAvatars[1].ControllingClient, item.ID, UUID.Zero, Vector3.One, Vector3.Zero, UUID.Zero, 0, false, false, false, UUID.Zero); | ||
88 | Assert.That(Common.TheScene.GetSceneObjectGroups().Count, Is.EqualTo(nObjects + 1)); | ||
89 | |||
90 | SceneObjectGroup box = Common.TheScene.GetSceneObjectGroups().Find(sog => sog.OwnerID == Common.TheAvatars[1].UUID && sog.Name == name); | ||
91 | Common.TheInstance.PrintPerms(box); | ||
92 | Assert.That(box, Is.Not.Null); | ||
93 | |||
94 | // Check Owner permissions | ||
95 | Common.TheInstance.AssertPermissions(mask, (PermissionMask)box.EffectiveOwnerPerms, box.OwnerID.ToString().Substring(34) + " : " + box.Name); | ||
96 | |||
97 | // Check Next Owner permissions | ||
98 | Common.TheInstance.AssertPermissions(mask, (PermissionMask)box.RootPart.NextOwnerMask, box.OwnerID.ToString().Substring(34) + " : " + box.Name); | ||
99 | |||
100 | } | ||
101 | |||
102 | /// <summary> | ||
103 | /// Test giving simple objecta with variour combinations of next owner perms. | ||
104 | /// </summary> | ||
105 | [Test] | ||
106 | public void TestDoubleGiveWithChange() | ||
107 | { | ||
108 | TestHelpers.InMethod(); | ||
109 | |||
110 | string name = "Box MCT-C"; | ||
111 | InventoryItemBase item = Common.TheInstance.GetItemFromInventory(Common.TheAvatars[0].UUID, "Objects", name); | ||
112 | |||
113 | // Now give the item to A2. We give the original item, not a clone. | ||
114 | // The giving methods are supposed to duplicate it. | ||
115 | Common.TheInstance.GiveInventoryItem(item.ID, Common.TheAvatars[0], Common.TheAvatars[1]); | ||
116 | |||
117 | item = Common.TheInstance.GetItemFromInventory(Common.TheAvatars[1].UUID, "Objects", name); | ||
118 | |||
119 | // Check the receiver | ||
120 | Common.TheInstance.PrintPerms(item); | ||
121 | Common.TheInstance.AssertPermissions(PermissionMask.Modify | PermissionMask.Transfer, | ||
122 | (PermissionMask)item.BasePermissions, Common.TheInstance.IdStr(item)); | ||
123 | |||
124 | // --------------------------- | ||
125 | // Second transfer | ||
126 | //---------------------------- | ||
127 | |||
128 | // A2 revokes M | ||
129 | Common.TheInstance.RevokePermission(1, name, PermissionMask.Modify); | ||
130 | |||
131 | item = Common.TheInstance.GetItemFromInventory(Common.TheAvatars[1].UUID, "Objects", name); | ||
132 | |||
133 | // Now give the item to A3. We give the original item, not a clone. | ||
134 | // The giving methods are supposed to duplicate it. | ||
135 | Common.TheInstance.GiveInventoryItem(item.ID, Common.TheAvatars[1], Common.TheAvatars[2]); | ||
136 | |||
137 | item = Common.TheInstance.GetItemFromInventory(Common.TheAvatars[2].UUID, "Objects", name); | ||
138 | |||
139 | // Check the receiver | ||
140 | Common.TheInstance.PrintPerms(item); | ||
141 | Common.TheInstance.AssertPermissions(PermissionMask.Transfer, | ||
142 | (PermissionMask)item.BasePermissions, Common.TheInstance.IdStr(item)); | ||
143 | |||
144 | } | ||
145 | } | ||
146 | } \ No newline at end of file | ||
diff --git a/OpenSim/Tests/Permissions/IndirectTransferTests.cs b/OpenSim/Tests/Permissions/IndirectTransferTests.cs new file mode 100644 index 0000000..7d8027f --- /dev/null +++ b/OpenSim/Tests/Permissions/IndirectTransferTests.cs | |||
@@ -0,0 +1,123 @@ | |||
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 | |||
28 | using System.Collections.Generic; | ||
29 | using System.Threading; | ||
30 | using NUnit.Framework; | ||
31 | using OpenMetaverse; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Region.Framework.Scenes; | ||
34 | using OpenSim.Tests.Common; | ||
35 | using PermissionMask = OpenSim.Framework.PermissionMask; | ||
36 | |||
37 | namespace OpenSim.Tests.Permissions | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// Basic scene object tests (create, read and delete but not update). | ||
41 | /// </summary> | ||
42 | [TestFixture] | ||
43 | public class IndirectTransferTests | ||
44 | { | ||
45 | |||
46 | [SetUp] | ||
47 | public void SetUp() | ||
48 | { | ||
49 | Common.TheInstance.DeleteObjectsFolders(); | ||
50 | } | ||
51 | |||
52 | /// <summary> | ||
53 | /// Test giving simple objecta with various combinations of next owner perms. | ||
54 | /// </summary> | ||
55 | [Test] | ||
56 | public void SimpleTakeCopy() | ||
57 | { | ||
58 | TestHelpers.InMethod(); | ||
59 | |||
60 | // The Objects folder of A2 | ||
61 | InventoryFolderBase objsFolder = UserInventoryHelpers.GetInventoryFolder(Common.TheScene.InventoryService, Common.TheAvatars[1].UUID, "Objects"); | ||
62 | |||
63 | // C, CT, MC, MCT, MT, T | ||
64 | string[] names = new string[6] { "Box C", "Box CT", "Box MC", "Box MCT", "Box MT", "Box T" }; | ||
65 | PermissionMask[] perms = new PermissionMask[6] { | ||
66 | PermissionMask.Copy, | ||
67 | PermissionMask.Copy | PermissionMask.Transfer, | ||
68 | PermissionMask.Modify | PermissionMask.Copy, | ||
69 | PermissionMask.Modify | PermissionMask.Copy | PermissionMask.Transfer, | ||
70 | PermissionMask.Modify | PermissionMask.Transfer, | ||
71 | PermissionMask.Transfer | ||
72 | }; | ||
73 | |||
74 | // Try A2 takes copies of objects that cannot be copied. | ||
75 | for (int i = 0; i < 6; i++) | ||
76 | TakeOneBox(Common.TheScene.GetSceneObjectGroups(), names[i], perms[i]); | ||
77 | Thread.Sleep(5000); | ||
78 | |||
79 | List<InventoryItemBase> items = Common.TheScene.InventoryService.GetFolderItems(Common.TheAvatars[1].UUID, objsFolder.ID); | ||
80 | Assert.That(items.Count, Is.EqualTo(0)); | ||
81 | |||
82 | // A1 makes the objects copyable | ||
83 | for (int i = 0; i < 6; i++) | ||
84 | MakeCopyable(Common.TheScene.GetSceneObjectGroups(), names[i]); | ||
85 | |||
86 | // Try A2 takes copies of objects that can be copied. | ||
87 | for (int i = 0; i < 6; i++) | ||
88 | TakeOneBox(Common.TheScene.GetSceneObjectGroups(), names[i], perms[i]); | ||
89 | Thread.Sleep(5000); | ||
90 | |||
91 | items = Common.TheScene.InventoryService.GetFolderItems(Common.TheAvatars[1].UUID, objsFolder.ID); | ||
92 | Assert.That(items.Count, Is.EqualTo(6)); | ||
93 | |||
94 | for (int i = 0; i < 6; i++) | ||
95 | { | ||
96 | InventoryItemBase item = Common.TheInstance.GetItemFromInventory(Common.TheAvatars[1].UUID, "Objects", names[i]); | ||
97 | Assert.That(item, Is.Not.Null); | ||
98 | Common.TheInstance.AssertPermissions(perms[i], (PermissionMask)item.BasePermissions, Common.TheInstance.IdStr(item)); | ||
99 | } | ||
100 | } | ||
101 | |||
102 | private void TakeOneBox(List<SceneObjectGroup> objs, string name, PermissionMask mask) | ||
103 | { | ||
104 | SceneObjectGroup box = objs.Find(sog => sog.Name == name && sog.OwnerID == Common.TheAvatars[0].UUID); | ||
105 | Assert.That(box, Is.Not.Null, name); | ||
106 | |||
107 | // A2's inventory (index 1) | ||
108 | Common.TheInstance.TakeCopyToInventory(1, box); | ||
109 | } | ||
110 | |||
111 | private void MakeCopyable(List<SceneObjectGroup> objs, string name) | ||
112 | { | ||
113 | SceneObjectGroup box = objs.Find(sog => sog.Name == name && sog.OwnerID == Common.TheAvatars[0].UUID); | ||
114 | Assert.That(box, Is.Not.Null, name); | ||
115 | |||
116 | // field = 8 is Everyone | ||
117 | // set = 1 means add the permission; set = 0 means remove permission | ||
118 | Common.TheScene.HandleObjectPermissionsUpdate((IClientAPI)Common.TheAvatars[0].ClientView, Common.TheAvatars[0].UUID, | ||
119 | Common.TheAvatars[0].ControllingClient.SessionId, 8, box.LocalId, (uint)PermissionMask.Copy, 1); | ||
120 | Common.TheInstance.PrintPerms(box); | ||
121 | } | ||
122 | } | ||
123 | } \ No newline at end of file | ||
diff --git a/bin/CSJ2K.dll b/bin/CSJ2K.dll index 238291f..e882e4c 100755 --- a/bin/CSJ2K.dll +++ b/bin/CSJ2K.dll | |||
Binary files differ | |||
diff --git a/bin/OpenMetaverse.Rendering.Meshmerizer.dll b/bin/OpenMetaverse.Rendering.Meshmerizer.dll index 1a12a1e..7087584 100755 --- a/bin/OpenMetaverse.Rendering.Meshmerizer.dll +++ b/bin/OpenMetaverse.Rendering.Meshmerizer.dll | |||
Binary files differ | |||
diff --git a/bin/OpenMetaverse.StructuredData.dll b/bin/OpenMetaverse.StructuredData.dll index 7aeb089..dd3113d 100755 --- a/bin/OpenMetaverse.StructuredData.dll +++ b/bin/OpenMetaverse.StructuredData.dll | |||
Binary files differ | |||
diff --git a/bin/OpenMetaverse.dll b/bin/OpenMetaverse.dll index 5c576a7..1a63a9f 100755 --- a/bin/OpenMetaverse.dll +++ b/bin/OpenMetaverse.dll | |||
Binary files differ | |||
diff --git a/bin/OpenMetaverseTypes.dll b/bin/OpenMetaverseTypes.dll index a07cc1d..cf5080d 100755 --- a/bin/OpenMetaverseTypes.dll +++ b/bin/OpenMetaverseTypes.dll | |||
Binary files differ | |||
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index a9e368a..74888b3 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example | |||
@@ -49,19 +49,13 @@ | |||
49 | ; this section defines constants for grid services | 49 | ; this section defines constants for grid services |
50 | ; to simplify other configuration files default settings | 50 | ; to simplify other configuration files default settings |
51 | 51 | ||
52 | ; BaseURL | 52 | ;# {BaseHostname} {} {BaseHostname} {"example.com" "127.0.0.1"} "127.0.0.1" |
53 | ; should be the externally accessible IP/DNS name of grid or standalone | 53 | BaseHostname = "127.0.0.1" |
54 | ; http://externalHostName or https://externalHostName if using ssl | ||
55 | ; examples: http://mymachine.example.com, https://mymachine.example.com, https://127.0.0.1 | ||
56 | ; default: http://127.0.0.1 | ||
57 | ;# {BaseURL} {} {BaseURL} {"http://example.com" "http://127.0.0.1"} "" | ||
58 | BaseURL = http://127.0.0.1 | ||
59 | 54 | ||
60 | ; default public port | 55 | ;# {BaseURL} {} {BaseURL} {"http://${Const|BaseHostname}} "http://${Const|BaseHostname}" |
61 | ; usually 8002 for grids. | 56 | BaseURL = http://${Const|BaseHostname} |
62 | ; on standalones it needs to match http_listener_port or http_listener_sslport if using ssl | 57 | |
63 | ; in [Network] section below (defaults 9000 or 9001 if using ssl) | 58 | ;# {PublicPort} {} {PublicPort} {8002 9000} "8002" |
64 | ;# {PublicPort} {} {PublicPort} {8002 9000 9001} "8002" | ||
65 | PublicPort = "8002" | 59 | PublicPort = "8002" |
66 | 60 | ||
67 | ;grid default private port 8003, not used in standalone | 61 | ;grid default private port 8003, not used in standalone |
@@ -569,10 +563,9 @@ | |||
569 | 563 | ||
570 | ;# {ExternalHostNameForLSL} {} {Hostname to use for HTTP-IN URLs. This should be reachable from the internet.} {} | 564 | ;# {ExternalHostNameForLSL} {} {Hostname to use for HTTP-IN URLs. This should be reachable from the internet.} {} |
571 | ;; Hostname to use in llRequestURL/llRequestSecureURL | 565 | ;; Hostname to use in llRequestURL/llRequestSecureURL |
572 | ;; if not defined - default machine name is being used | 566 | ;; if not defined - llRequestURL/llRequestSecureURL are disabled |
573 | ;; (on Windows this mean NETBIOS name - useably only inside local network) | 567 | ExternalHostNameForLSL = ${Const|BaseHostname} |
574 | ; ExternalHostNameForLSL = "127.0.0.1" | 568 | |
575 | |||
576 | ;# {shard} {} {Name to use for X-Secondlife-Shard header? (press enter if unsure)} {} OpenSim | 569 | ;# {shard} {} {Name to use for X-Secondlife-Shard header? (press enter if unsure)} {} OpenSim |
577 | ;; What is reported as the "X-Secondlife-Shard" | 570 | ;; What is reported as the "X-Secondlife-Shard" |
578 | ;; Defaults to the user server url if not set | 571 | ;; Defaults to the user server url if not set |
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 0170a27..7bfb32a 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini | |||
@@ -614,8 +614,7 @@ | |||
614 | 614 | ||
615 | ; Hostname to use in llRequestURL/llRequestSecureURL | 615 | ; Hostname to use in llRequestURL/llRequestSecureURL |
616 | ; must be a valid hostname for the ssl cert. | 616 | ; must be a valid hostname for the ssl cert. |
617 | ; if not defined - default machine name is being used | 617 | ; if not defined - llRequestURL/llRequestSecureURL are disabled |
618 | ; (on Windows this mean NETBIOS name - useably only inside local network) | ||
619 | ; ExternalHostNameForLSL=127.0.0.1 | 618 | ; ExternalHostNameForLSL=127.0.0.1 |
620 | 619 | ||
621 | ; Disallow the following address ranges for user scripting calls (e.g. llHttpRequest()) | 620 | ; Disallow the following address ranges for user scripting calls (e.g. llHttpRequest()) |
@@ -1913,7 +1912,8 @@ | |||
1913 | 1912 | ||
1914 | ; regex specifying for which regions concierge service is desired; if | 1913 | ; regex specifying for which regions concierge service is desired; if |
1915 | ; empty, then for all | 1914 | ; empty, then for all |
1916 | regions = "^MeetingSpace-" | 1915 | ;regions = "^MeetingSpace-" |
1916 | regions = "" | ||
1917 | 1917 | ||
1918 | ; for each region that matches the regions regexp you can provide | 1918 | ; for each region that matches the regions regexp you can provide |
1919 | ; (optionally) a welcome template using format substitution: | 1919 | ; (optionally) a welcome template using format substitution: |
@@ -1921,14 +1921,14 @@ | |||
1921 | ; {1} is replaced with the name of the region | 1921 | ; {1} is replaced with the name of the region |
1922 | ; {2} is replaced with the name of the concierge (whoami variable above) | 1922 | ; {2} is replaced with the name of the concierge (whoami variable above) |
1923 | 1923 | ||
1924 | welcomes = /path/to/welcome/template/directory | 1924 | ;welcomes = /path/to/welcome/template/directory |
1925 | 1925 | ||
1926 | ; Concierge can send attendee lists to an event broker whenever an | 1926 | ; Concierge can send attendee lists to an event broker whenever an |
1927 | ; avatar enters or leaves a concierged region. the URL is subject | 1927 | ; avatar enters or leaves a concierged region. the URL is subject |
1928 | ; to format substitution: | 1928 | ; to format substitution: |
1929 | ; {0} is replaced with the region's name | 1929 | ; {0} is replaced with the region's name |
1930 | ; {1} is replaced with the region's UUID | 1930 | ; {1} is replaced with the region's UUID |
1931 | broker = "http://broker.place.com/{1}" | 1931 | ;broker = "http://broker.place.com/{1}" |
1932 | 1932 | ||
1933 | 1933 | ||
1934 | [MRM] | 1934 | [MRM] |
diff --git a/prebuild.xml b/prebuild.xml index c087def..52fb74a 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -3300,7 +3300,46 @@ | |||
3300 | </Files> | 3300 | </Files> |
3301 | </Project> | 3301 | </Project> |
3302 | 3302 | ||
3303 | <?include file="addon-modules/*/prebuild*.xml" ?> | 3303 | <Project frameworkVersion="v4_0" name="OpenSim.Tests.Permissions" path="OpenSim/Tests/Permissions" type="Library"> |
3304 | <Configuration name="Debug"> | ||
3305 | <Options> | ||
3306 | <OutputPath>../../../bin/</OutputPath> | ||
3307 | </Options> | ||
3308 | </Configuration> | ||
3309 | <Configuration name="Release"> | ||
3310 | <Options> | ||
3311 | <OutputPath>../../../bin/</OutputPath> | ||
3312 | </Options> | ||
3313 | </Configuration> | ||
3314 | |||
3315 | <ReferencePath>../../../bin/</ReferencePath> | ||
3316 | <Reference name="System"/> | ||
3317 | <Reference name="System.Core"/> | ||
3318 | <Reference name="System.Xml"/> | ||
3319 | <Reference name="Mono.Addins" path="../../../bin/"/> | ||
3320 | <Reference name="OpenMetaverseTypes" path="../../../bin/"/> | ||
3321 | <Reference name="OpenMetaverse" path="../../../bin/"/> | ||
3322 | <Reference name="OpenSim"/> | ||
3323 | <Reference name="OpenSim.ApplicationPlugins.RegionModulesController"/> | ||
3324 | <Reference name="OpenSim.Framework"/> | ||
3325 | <Reference name="OpenSim.Region.Framework"/> | ||
3326 | <Reference name="OpenSim.Region.CoreModules"/> | ||
3327 | <Reference name="OpenSim.Services.Interfaces"/> | ||
3328 | |||
3329 | <!-- Unit tests --> | ||
3330 | <!-- <Reference name="OpenSim.Tests.Common"/> --> | ||
3331 | <Reference name="OpenSim.Tests.Common"/> | ||
3332 | <Reference name="Nini" path="../../../bin/"/> | ||
3333 | <Reference name="nunit.framework" path="../../../bin/"/> | ||
3334 | |||
3335 | <Reference name="log4net" path="../../../bin/"/> | ||
3336 | |||
3337 | <Files> | ||
3338 | <Match pattern="*.cs" recurse="false"/> | ||
3339 | </Files> | ||
3340 | </Project> | ||
3341 | |||
3342 | <?include file="addon-modules/*/prebuild*.xml" ?> | ||
3304 | 3343 | ||
3305 | </Solution> | 3344 | </Solution> |
3306 | 3345 | ||