mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 17:55:48 +08:00
fix merge
This commit is contained in:
@@ -212,6 +212,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
if (m_Scene.TryGetScenePresence(remoteClient.AgentId, out presence))
|
||||
{
|
||||
byte[] data = null;
|
||||
uint everyonemask = 0;
|
||||
uint groupmask = 0;
|
||||
|
||||
if (invType == (sbyte)InventoryType.Landmark && presence != null)
|
||||
{
|
||||
@@ -220,6 +222,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
data = Encoding.ASCII.GetBytes(strdata);
|
||||
name = prefix + name;
|
||||
description += suffix;
|
||||
groupmask = (uint)PermissionMask.AllAndExport;
|
||||
everyonemask = (uint)(PermissionMask.AllAndExport & ~PermissionMask.Modify);
|
||||
}
|
||||
|
||||
AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId);
|
||||
@@ -227,9 +231,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
m_Scene.CreateNewInventoryItem(
|
||||
remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
|
||||
name, description, 0, callbackID, asset.FullID, asset.Type, invType,
|
||||
(uint)PermissionMask.All | (uint)PermissionMask.Export, // Base
|
||||
(uint)PermissionMask.All | (uint)PermissionMask.Export, // Current
|
||||
0, nextOwnerMask, 0, creationDate, false); // Data from viewer
|
||||
(uint)PermissionMask.AllAndExport, // Base
|
||||
(uint)PermissionMask.AllAndExport, // Current
|
||||
everyonemask,
|
||||
nextOwnerMask, groupmask, creationDate, false); // Data from viewer
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -573,41 +578,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
InventoryItemBase item, SceneObjectGroup so, List<SceneObjectGroup> objsForEffectivePermissions,
|
||||
IClientAPI remoteClient)
|
||||
{
|
||||
uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export) | 7;
|
||||
uint allObjectsNextOwnerPerms = 0x7fffffff;
|
||||
|
||||
// For the porposes of inventory, an object is modify if the prims
|
||||
// are modify. This allows renaming an object that contains no
|
||||
// mod items.
|
||||
uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export | PermissionMask.FoldedMask);
|
||||
|
||||
foreach (SceneObjectGroup grp in objsForEffectivePermissions)
|
||||
{
|
||||
uint groupPerms = grp.GetEffectivePermissions(true);
|
||||
if ((grp.RootPart.BaseMask & (uint)PermissionMask.Modify) != 0)
|
||||
groupPerms |= (uint)PermissionMask.Modify;
|
||||
|
||||
effectivePerms &= groupPerms;
|
||||
effectivePerms &= grp.CurrentAndFoldedNextPermissions();
|
||||
}
|
||||
effectivePerms |= (uint)PermissionMask.Move;
|
||||
|
||||
|
||||
if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
|
||||
{
|
||||
uint perms = effectivePerms;
|
||||
uint nextPerms = (perms & 7) << 13;
|
||||
if ((nextPerms & (uint)PermissionMask.Copy) == 0)
|
||||
perms &= ~(uint)PermissionMask.Copy;
|
||||
if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
|
||||
perms &= ~(uint)PermissionMask.Transfer;
|
||||
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
|
||||
perms &= ~(uint)PermissionMask.Modify;
|
||||
|
||||
// item.BasePermissions = perms & so.RootPart.NextOwnerMask;
|
||||
|
||||
uint nextp = so.RootPart.NextOwnerMask | (uint)PermissionMask.FoldedMask;
|
||||
item.BasePermissions = perms & nextp;
|
||||
item.CurrentPermissions = item.BasePermissions;
|
||||
item.NextPermissions = perms & so.RootPart.NextOwnerMask;
|
||||
item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask;
|
||||
item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask;
|
||||
// apply parts inventory items next owner
|
||||
PermissionsUtil.ApplyNoModFoldedPermissions(effectivePerms, ref effectivePerms);
|
||||
// change to next owner
|
||||
uint basePerms = effectivePerms & so.RootPart.NextOwnerMask;
|
||||
// fix and update folded
|
||||
basePerms = PermissionsUtil.FixAndFoldPermissions(basePerms);
|
||||
|
||||
item.BasePermissions = basePerms;
|
||||
item.CurrentPermissions = basePerms;
|
||||
item.NextPermissions = basePerms & so.RootPart.NextOwnerMask;
|
||||
item.EveryOnePermissions = basePerms & so.RootPart.EveryoneMask;
|
||||
item.GroupPermissions = basePerms & so.RootPart.GroupMask;
|
||||
|
||||
// apply next owner perms on rez
|
||||
item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
||||
@@ -626,7 +617,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
(uint)PermissionMask.Modify |
|
||||
(uint)PermissionMask.Move |
|
||||
(uint)PermissionMask.Export |
|
||||
7); // Preserve folded permissions
|
||||
(uint)PermissionMask.FoldedMask); // Preserve folded permissions ??
|
||||
}
|
||||
|
||||
return item;
|
||||
@@ -1144,9 +1135,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
if ((item.BasePermissions & (uint)PermissionMask.FoldedMask) != 0)
|
||||
{
|
||||
// We have permissions stored there so use them
|
||||
part.NextOwnerMask = ((item.BasePermissions & 7) << 13);
|
||||
if ((item.BasePermissions & (uint)PermissionMask.FoldedExport) != 0)
|
||||
part.NextOwnerMask |= (uint)PermissionMask.Export;
|
||||
part.NextOwnerMask = ((item.BasePermissions & (uint)PermissionMask.FoldedMask) << (int)PermissionMask.FoldingShift);
|
||||
part.NextOwnerMask |= (uint)PermissionMask.Move;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -223,20 +223,16 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
||||
if (parms.Length - i < 2)
|
||||
break;
|
||||
|
||||
//Have we reached the end of the list of headers?
|
||||
//End is marked by a string with a single digit.
|
||||
//We already know we have at least one parameter
|
||||
//so it is safe to do this check at top of loop.
|
||||
if (Char.IsDigit(parms[i][0]))
|
||||
break;
|
||||
|
||||
if (htc.HttpCustomHeaders == null)
|
||||
htc.HttpCustomHeaders = new List<string>();
|
||||
|
||||
htc.HttpCustomHeaders.Add(parms[i]);
|
||||
htc.HttpCustomHeaders.Add(parms[i+1]);
|
||||
int nexti = i + 2;
|
||||
if (nexti >= parms.Length || Char.IsDigit(parms[nexti][0]))
|
||||
break;
|
||||
|
||||
i += 2;
|
||||
i = nexti;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -26,15 +26,15 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
using System.Reflection;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using log4net;
|
||||
using Mono.Addins;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
@@ -89,6 +89,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||
protected Dictionary<string, UrlData> m_UrlMap =
|
||||
new Dictionary<string, UrlData>();
|
||||
|
||||
protected bool m_enabled = false;
|
||||
protected string m_ErrorStr;
|
||||
protected uint m_HttpsPort = 0;
|
||||
protected IHttpServer m_HttpServer = null;
|
||||
protected IHttpServer m_HttpsServer = null;
|
||||
@@ -118,6 +120,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
IConfig networkConfig = config.Configs["Network"];
|
||||
m_enabled = false;
|
||||
|
||||
if (networkConfig != null)
|
||||
{
|
||||
@@ -128,9 +131,47 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||
if (ssl_enabled)
|
||||
m_HttpsPort = (uint)config.Configs["Network"].GetInt("https_port", (int)m_HttpsPort);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ErrorStr = "[Network] configuration missing, HTTP listener for LSL disabled";
|
||||
m_log.Warn("[URL MODULE]: " + m_ErrorStr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ExternalHostNameForLSL == null)
|
||||
ExternalHostNameForLSL = System.Environment.MachineName;
|
||||
if (String.IsNullOrWhiteSpace(ExternalHostNameForLSL))
|
||||
{
|
||||
m_ErrorStr = "ExternalHostNameForLSL not defined in configuration, HTTP listener for LSL disabled";
|
||||
m_log.Warn("[URL MODULE]: " + m_ErrorStr);
|
||||
return;
|
||||
}
|
||||
|
||||
IPAddress ia = null;
|
||||
try
|
||||
{
|
||||
foreach (IPAddress Adr in Dns.GetHostAddresses(ExternalHostNameForLSL))
|
||||
{
|
||||
if (Adr.AddressFamily == AddressFamily.InterNetwork ||
|
||||
Adr.AddressFamily == AddressFamily.InterNetworkV6) // ipv6 will most likely smoke
|
||||
{
|
||||
ia = Adr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
ia = null;
|
||||
}
|
||||
|
||||
if (ia == null)
|
||||
{
|
||||
m_ErrorStr = "Could not resolve ExternalHostNameForLSL, HTTP listener for LSL disabled";
|
||||
m_log.Warn("[URL MODULE]: " + m_ErrorStr);
|
||||
return;
|
||||
}
|
||||
|
||||
m_enabled = true;
|
||||
m_ErrorStr = String.Empty;
|
||||
|
||||
IConfig llFunctionsConfig = config.Configs["LL-Functions"];
|
||||
|
||||
@@ -146,7 +187,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
if (m_HttpServer == null)
|
||||
if (m_enabled && m_HttpServer == null)
|
||||
{
|
||||
// There can only be one
|
||||
//
|
||||
@@ -197,11 +238,18 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||
{
|
||||
UUID urlcode = UUID.Random();
|
||||
|
||||
if(!m_enabled)
|
||||
{
|
||||
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", m_ErrorStr });
|
||||
return urlcode;
|
||||
}
|
||||
|
||||
lock (m_UrlMap)
|
||||
{
|
||||
if (m_UrlMap.Count >= TotalUrls)
|
||||
{
|
||||
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
|
||||
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED",
|
||||
"Too many URLs already open" });
|
||||
return urlcode;
|
||||
}
|
||||
string url = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/";
|
||||
@@ -243,6 +291,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||
{
|
||||
UUID urlcode = UUID.Random();
|
||||
|
||||
if(!m_enabled)
|
||||
{
|
||||
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", m_ErrorStr });
|
||||
return urlcode;
|
||||
}
|
||||
|
||||
if (m_HttpsServer == null)
|
||||
{
|
||||
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
|
||||
@@ -253,7 +307,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||
{
|
||||
if (m_UrlMap.Count >= TotalUrls)
|
||||
{
|
||||
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
|
||||
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED",
|
||||
"Too many URLs already open" });
|
||||
return urlcode;
|
||||
}
|
||||
string url = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString() + "/";
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
|
||||
// wrap this in a try block so that defaults will work if
|
||||
// the config file doesn't specify otherwise.
|
||||
int maxlisteners = 1000;
|
||||
int maxhandles = 64;
|
||||
int maxhandles = 65;
|
||||
try
|
||||
{
|
||||
m_whisperdistance = config.Configs["Chat"].GetInt(
|
||||
@@ -130,8 +130,15 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
if (maxlisteners < 1) maxlisteners = int.MaxValue;
|
||||
if (maxhandles < 1) maxhandles = int.MaxValue;
|
||||
|
||||
if (maxlisteners < 1)
|
||||
maxlisteners = int.MaxValue;
|
||||
if (maxhandles < 1)
|
||||
maxhandles = int.MaxValue;
|
||||
|
||||
if (maxlisteners < maxhandles)
|
||||
maxlisteners = maxhandles;
|
||||
|
||||
m_listenerManager = new ListenerManager(maxlisteners, maxhandles);
|
||||
m_pendingQ = new Queue();
|
||||
m_pending = Queue.Synchronized(m_pendingQ);
|
||||
@@ -605,11 +612,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
|
||||
li.GetHandle().Equals(handle))
|
||||
{
|
||||
lis.Value.Remove(li);
|
||||
m_curlisteners--;
|
||||
if (lis.Value.Count == 0)
|
||||
{
|
||||
m_listeners.Remove(lis.Key);
|
||||
m_curlisteners--;
|
||||
}
|
||||
m_listeners.Remove(lis.Key); // bailing of loop so this does not smoke
|
||||
// there should be only one, so we bail out early
|
||||
return;
|
||||
}
|
||||
@@ -718,6 +723,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
|
||||
}
|
||||
}
|
||||
|
||||
if(handles.Count >= m_maxhandles)
|
||||
return -1;
|
||||
|
||||
// Note: 0 is NOT a valid handle for llListen() to return
|
||||
for (int i = 1; i <= m_maxhandles; i++)
|
||||
{
|
||||
|
||||
@@ -118,6 +118,11 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
|
||||
return false;
|
||||
|
||||
SceneObjectGroup group = part.ParentGroup;
|
||||
if(group == null || group.IsDeleted || group.inTransit)
|
||||
return false;
|
||||
|
||||
// make sure we are not buying a child part
|
||||
part = group.RootPart;
|
||||
|
||||
switch (saleType)
|
||||
{
|
||||
@@ -157,18 +162,6 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
|
||||
break;
|
||||
|
||||
case 2: // Sell a copy
|
||||
Vector3 inventoryStoredPosition = new Vector3(
|
||||
Math.Min(group.AbsolutePosition.X, m_scene.RegionInfo.RegionSizeX - 6),
|
||||
Math.Min(group.AbsolutePosition.Y, m_scene.RegionInfo.RegionSizeY - 6),
|
||||
group.AbsolutePosition.Z);
|
||||
|
||||
Vector3 originalPosition = group.AbsolutePosition;
|
||||
|
||||
group.AbsolutePosition = inventoryStoredPosition;
|
||||
|
||||
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group);
|
||||
group.AbsolutePosition = originalPosition;
|
||||
|
||||
uint perms = group.EffectiveOwnerPerms;
|
||||
|
||||
if ((perms & (uint)PermissionMask.Transfer) == 0)
|
||||
@@ -185,6 +178,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
|
||||
return false;
|
||||
}
|
||||
|
||||
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group);
|
||||
|
||||
AssetBase asset = m_scene.CreateAsset(
|
||||
group.GetPartName(localID),
|
||||
group.GetPartDescription(localID),
|
||||
@@ -205,22 +200,21 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
|
||||
item.AssetType = asset.Type;
|
||||
item.InvType = (int)InventoryType.Object;
|
||||
item.Folder = categoryID;
|
||||
|
||||
perms = group.CurrentAndFoldedNextPermissions();
|
||||
// apply parts inventory next perms
|
||||
PermissionsUtil.ApplyNoModFoldedPermissions(perms, ref perms);
|
||||
// change to next owner perms
|
||||
perms &= part.NextOwnerMask;
|
||||
// update folded
|
||||
perms = PermissionsUtil.FixAndFoldPermissions(perms);
|
||||
|
||||
uint nextPerms=(perms & 7) << 13;
|
||||
if ((nextPerms & (uint)PermissionMask.Copy) == 0)
|
||||
perms &= ~(uint)PermissionMask.Copy;
|
||||
if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
|
||||
perms &= ~(uint)PermissionMask.Transfer;
|
||||
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
|
||||
perms &= ~(uint)PermissionMask.Modify;
|
||||
item.BasePermissions = perms;
|
||||
item.CurrentPermissions = perms;
|
||||
item.NextPermissions = part.NextOwnerMask & perms;
|
||||
item.EveryOnePermissions = part.EveryoneMask & perms;
|
||||
item.GroupPermissions = part.GroupMask & perms;
|
||||
|
||||
item.BasePermissions = perms & part.NextOwnerMask;
|
||||
item.CurrentPermissions = perms & part.NextOwnerMask;
|
||||
item.NextPermissions = part.NextOwnerMask;
|
||||
item.EveryOnePermissions = part.EveryoneMask &
|
||||
part.NextOwnerMask;
|
||||
item.GroupPermissions = part.GroupMask &
|
||||
part.NextOwnerMask;
|
||||
item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
|
||||
|
||||
@@ -2022,7 +2022,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||
|
||||
uint perms = GetObjectPermissions(sp, sog, true);
|
||||
if((perms & (uint)PermissionMask.Copy) == 0)
|
||||
{
|
||||
sp.ControllingClient.SendAgentAlertMessage("Copying this item has been denied by the permissions system", false);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(sog.OwnerID != sp.UUID && (perms & (uint)PermissionMask.Transfer) == 0)
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user