fix merge

httptests
UbitUmarov 2017-01-05 19:32:57 +00:00
commit 254b26a7d5
960 changed files with 23754 additions and 23741 deletions

View File

@ -227,10 +227,10 @@ namespace OpenSim.Framework
byte RayEndIsIntersection);
public delegate void RequestGodlikePowers(
UUID AgentID, UUID SessionID, UUID token, bool GodLike, IClientAPI remote_client);
UUID AgentID, UUID SessionID, UUID token, bool GodLike);
public delegate void GodKickUser(
UUID GodAgentID, UUID GodSessionID, UUID AgentID, uint kickflags, byte[] reason);
UUID GodAgentID, UUID AgentID, uint kickflags, byte[] reason);
public delegate void CreateInventoryFolder(
IClientAPI remoteClient, UUID folderID, ushort folderType, string folderName, UUID parentID);

View File

@ -10455,6 +10455,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private bool HandleRequestGodlikePowers(IClientAPI sender, Packet Pack)
{
RequestGodlikePowersPacket rglpPack = (RequestGodlikePowersPacket)Pack;
if (rglpPack.AgentData.SessionID != SessionId ||
rglpPack.AgentData.AgentID != AgentId)
return true;
RequestGodlikePowersPacket.RequestBlockBlock rblock = rglpPack.RequestBlock;
UUID token = rblock.Token;
@ -10464,7 +10469,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (handlerReqGodlikePowers != null)
{
handlerReqGodlikePowers(ablock.AgentID, ablock.SessionID, token, rblock.Godlike, this);
handlerReqGodlikePowers(ablock.AgentID, ablock.SessionID, token, rblock.Godlike);
}
return true;
@ -10475,6 +10480,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
GodUpdateRegionInfoPacket GodUpdateRegionInfo =
(GodUpdateRegionInfoPacket)Packet;
if (GodUpdateRegionInfo.AgentData.SessionID != SessionId ||
GodUpdateRegionInfo.AgentData.AgentID != AgentId)
return true;
GodUpdateRegionInfoUpdate handlerGodUpdateRegionInfo = OnGodUpdateRegionInfoUpdate;
if (handlerGodUpdateRegionInfo != null)
{
@ -10508,6 +10517,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
GodlikeMessagePacket GodlikeMessage =
(GodlikeMessagePacket)Packet;
if (GodlikeMessage.AgentData.SessionID != SessionId ||
GodlikeMessage.AgentData.AgentID != AgentId)
return true;
GodlikeMessage handlerGodlikeMessage = onGodlikeMessage;
if (handlerGodlikeMessage != null)
{
@ -10524,6 +10537,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
StateSavePacket SaveStateMessage =
(StateSavePacket)Packet;
if (SaveStateMessage.AgentData.SessionID != SessionId ||
SaveStateMessage.AgentData.AgentID != AgentId)
return true;
SaveStateHandler handlerSaveStatePacket = OnSaveState;
if (handlerSaveStatePacket != null)
{
@ -10537,30 +10555,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
GodKickUserPacket gkupack = (GodKickUserPacket)Pack;
if (gkupack.UserInfo.GodSessionID == SessionId && AgentId == gkupack.UserInfo.GodID)
{
if (gkupack.UserInfo.GodSessionID != SessionId ||
gkupack.UserInfo.GodID != AgentId)
return true;
GodKickUser handlerGodKickUser = OnGodKickUser;
if (handlerGodKickUser != null)
{
handlerGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID,
gkupack.UserInfo.AgentID, gkupack.UserInfo.KickFlags, gkupack.UserInfo.Reason);
handlerGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.AgentID, gkupack.UserInfo.KickFlags, gkupack.UserInfo.Reason);
}
}
else
{
SendAgentAlertMessage("Kick request denied", false);
}
//KickUserPacket kupack = new KickUserPacket();
//KickUserPacket.UserInfoBlock kupackib = kupack.UserInfo;
//kupack.UserInfo.AgentID = gkupack.UserInfo.AgentID;
//kupack.UserInfo.SessionID = gkupack.UserInfo.GodSessionID;
//kupack.TargetBlock.TargetIP = (uint)0;
//kupack.TargetBlock.TargetPort = (ushort)0;
//kupack.UserInfo.Reason = gkupack.UserInfo.Reason;
//OutPacket(kupack, ThrottleOutPacketType.Task);
return true;
}
#endregion GodPackets

View File

@ -53,6 +53,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
private UTF8Encoding enc = new UTF8Encoding();
private string m_URL = String.Empty;
private static XmlSerializer m_serializer = new XmlSerializer(typeof(AssetBase));
private static bool m_enabled = false;
private static IServiceAuth m_Auth;
@ -63,11 +64,19 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
return;
m_URL = config.GetString("URL", String.Empty);
if (m_URL == String.Empty)
return;
m_enabled = true;
m_Auth = ServiceAuth.Create(configSource, "XBakes");
}
public void AddRegion(Scene scene)
{
if (!m_enabled)
return;
// m_log.InfoFormat("[XBakes]: Enabled for region {0}", scene.RegionInfo.RegionName);
m_Scene = scene;

View File

@ -152,7 +152,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
if (god == null || god.ControllingClient.SessionId != godSessionID)
return String.Empty;
KickUser(godID, godSessionID, agentID, kickFlags, Util.StringToBytes1024(reason));
KickUser(godID, agentID, kickFlags, Util.StringToBytes1024(reason));
}
else
{
@ -162,59 +162,53 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
}
public void RequestGodlikePowers(
UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient)
UUID agentID, UUID sessionID, UUID token, bool godLike)
{
ScenePresence sp = m_scene.GetScenePresence(agentID);
if (sp != null)
{
if (godLike == false)
{
sp.GrantGodlikePowers(agentID, sessionID, token, godLike);
if(sp == null || sp.IsDeleted || sp.isNPC)
return;
}
// First check that this is the sim owner
if (m_scene.Permissions.IsGod(agentID))
{
// Next we check for spoofing.....
UUID testSessionID = sp.ControllingClient.SessionId;
if (sessionID == testSessionID)
{
if (sessionID == controllingClient.SessionId)
{
//m_log.Info("godlike: " + godLike.ToString());
sp.GrantGodlikePowers(agentID, testSessionID, token, godLike);
}
}
}
else
{
if (DialogModule != null)
if (sessionID != sp.ControllingClient.SessionId)
return;
sp.GrantGodlikePowers(token, godLike);
if (godLike && sp.GodLevel < 200 && DialogModule != null)
DialogModule.SendAlertToUser(agentID, "Request for god powers denied");
}
}
}
/// <summary>
/// Kicks User specified from the simulator. This logs them off of the grid
/// If the client gets the UUID: 44e87126e7944ded05b37c42da3d5cdb it assumes
/// that you're kicking it even if the avatar's UUID isn't the UUID that the
/// agent is assigned
/// Kicks or freezes User specified from the simulator. This logs them off of the grid
/// </summary>
/// <param name="godID">The person doing the kicking</param>
/// <param name="sessionID">The session of the person doing the kicking</param>
/// <param name="agentID">the person that is being kicked</param>
/// <param name="kickflags">Tells what to do to the user</param>
/// <param name="reason">The message to send to the user after it's been turned into a field</param>
public void KickUser(UUID godID, UUID sessionID, UUID agentID, uint kickflags, byte[] reason)
public void KickUser(UUID godID, UUID agentID, uint kickflags, byte[] reason)
{
if (!m_scene.Permissions.IsGod(godID))
// assuming automatic god rights on this for fast griefing reaction
// this is also needed for kick via message
if(!m_scene.Permissions.IsGod(godID))
return;
ScenePresence sp = m_scene.GetScenePresence(agentID);
int godlevel = 200;
// update level so higher gods can kick lower ones
ScenePresence god = m_scene.GetScenePresence(godID);
if(god != null && god.GodLevel > godlevel)
godlevel = god.GodLevel;
if (sp == null && agentID != ALL_AGENTS)
if(agentID == ALL_AGENTS)
{
m_scene.ForEachRootScenePresence(delegate(ScenePresence p)
{
if (p.UUID != godID && godlevel > p.GodLevel)
doKickmodes(godID, p, kickflags, reason);
});
return;
}
ScenePresence sp = m_scene.GetScenePresence(agentID);
if (sp == null || sp.IsChildAgent)
{
IMessageTransferModule transferModule =
m_scene.RequestModuleInterface<IMessageTransferModule>();
@ -230,48 +224,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
return;
}
if (godlevel <= sp.GodLevel) // no god wars
return;
if(sp.UUID == godID)
return;
doKickmodes(godID, sp, kickflags, reason);
}
private void doKickmodes(UUID godID, ScenePresence sp, uint kickflags, byte[] reason)
{
switch (kickflags)
{
case 0:
if (sp != null)
{
KickPresence(sp, Utils.BytesToString(reason));
}
else if (agentID == ALL_AGENTS)
{
m_scene.ForEachRootScenePresence(
delegate(ScenePresence p)
{
if (p.UUID != godID && (!m_scene.Permissions.IsGod(p.UUID)))
KickPresence(p, Utils.BytesToString(reason));
}
);
}
break;
case 1:
if (sp != null)
{
sp.AllowMovement = false;
m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason));
m_dialogModule.SendAlertToUser(sp.UUID, Utils.BytesToString(reason));
m_dialogModule.SendAlertToUser(godID, "User Frozen");
}
break;
case 2:
if (sp != null)
{
sp.AllowMovement = true;
m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason));
m_dialogModule.SendAlertToUser(sp.UUID, Utils.BytesToString(reason));
m_dialogModule.SendAlertToUser(godID, "User Unfrozen");
}
break;
default:
break;
}
}
private void KickPresence(ScenePresence sp, string reason)
{
if (sp.IsChildAgent)
if(sp.IsDeleted || sp.IsChildAgent)
return;
sp.ControllingClient.Kick(reason);
sp.Scene.CloseAgent(sp.UUID, true);
@ -286,7 +273,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
UUID godID = new UUID(msg.fromAgentID);
uint kickMode = (uint)msg.binaryBucket[0];
KickUser(godID, UUID.Zero, agentID, kickMode, Util.StringToBytes1024(reason));
KickUser(godID, agentID, kickMode, Util.StringToBytes1024(reason));
}
}
}

View File

@ -45,13 +45,15 @@ namespace OpenSim.Region.CoreModules.World.Estate
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected XEstateModule m_EstateModule;
protected EstateModule m_EstateModule;
private string token;
uint port = 0;
public EstateConnector(XEstateModule module, string _token)
public EstateConnector(EstateModule module, string _token, uint _port)
{
m_EstateModule = module;
token = _token;
port = _port;
}
public void SendTeleportHomeOneUser(uint EstateID, UUID PreyID)
@ -189,8 +191,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
try
{
string url = "";
if(string.IsNullOrEmpty(region.ServerURI))
url = "http://" + region.ExternalHostName + ":" + region.HttpPort;
if(port != 0)
url = "http://" + region.ExternalHostName + ":" + port;
else
url = region.ServerURI;

View File

@ -45,13 +45,14 @@ using Mono.Addins;
namespace OpenSim.Region.CoreModules.World.Estate
{
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XEstate")]
public class XEstateModule : ISharedRegionModule
public class EstateModule : ISharedRegionModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected List<Scene> m_Scenes = new List<Scene>();
protected bool m_InInfoUpdate = false;
private string token = "7db8eh2gvgg45jj";
protected bool m_enabled = false;
public bool InInfoUpdate
{
@ -68,20 +69,32 @@ namespace OpenSim.Region.CoreModules.World.Estate
public void Initialise(IConfigSource config)
{
int port = 0;
uint port = MainServer.Instance.Port;
IConfig estateConfig = config.Configs["Estates"];
if (estateConfig != null)
{
port = estateConfig.GetInt("Port", 0);
if (estateConfig.GetString("EstateCommunicationsHandler", Name) == Name)
m_enabled = true;
else
return;
port = (uint)estateConfig.GetInt("Port", 0);
// this will need to came from somewhere else
token = estateConfig.GetString("Token", token);
}
else
{
m_enabled = true;
}
m_EstateConnector = new EstateConnector(this, token);
m_EstateConnector = new EstateConnector(this, token, port);
if(port == 0)
port = MainServer.Instance.Port;
// Instantiate the request handler
IHttpServer server = MainServer.GetHttpServer((uint)port);
IHttpServer server = MainServer.GetHttpServer(port);
server.AddStreamHandler(new EstateRequestHandler(this, token));
}
@ -95,12 +108,18 @@ namespace OpenSim.Region.CoreModules.World.Estate
public void AddRegion(Scene scene)
{
if (!m_enabled)
return;
lock (m_Scenes)
m_Scenes.Add(scene);
}
public void RegionLoaded(Scene scene)
{
if (!m_enabled)
return;
IEstateModule em = scene.RequestModuleInterface<IEstateModule>();
em.OnRegionInfoChange += OnRegionInfoChange;
@ -112,6 +131,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
public void RemoveRegion(Scene scene)
{
if (!m_enabled)
return;
lock (m_Scenes)
m_Scenes.Remove(scene);
}

View File

@ -46,11 +46,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected XEstateModule m_EstateModule;
protected EstateModule m_EstateModule;
protected Object m_RequestLock = new Object();
private string token;
public EstateRequestHandler(XEstateModule fmodule, string _token)
public EstateRequestHandler(EstateModule fmodule, string _token)
: base("POST", "/estate")
{
m_EstateModule = fmodule;

View File

@ -43,16 +43,15 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="token"></param>
/// <param name="godLike"></param>
/// <param name="controllingClient"></param>
void RequestGodlikePowers(UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient);
void RequestGodlikePowers(UUID agentID, UUID sessionID, UUID token, bool godLike);
/// <summary>
/// Kicks User specified from the simulator. This logs them off of the grid.
/// </summary>
/// <param name="godID">The person doing the kicking</param>
/// <param name="sessionID">The session of the person doing the kicking</param>
/// <param name="agentID">the person that is being kicked</param>
/// <param name="kickflags">This isn't used apparently</param>
/// <param name="reason">The message to send to the user after it's been turned into a field</param>
void KickUser(UUID godID, UUID sessionID, UUID agentID, uint kickflags, byte[] reason);
void KickUser(UUID godID, UUID agentID, uint kickflags, byte[] reason);
}
}

View File

@ -4506,34 +4506,22 @@ namespace OpenSim.Region.Framework.Scenes
#endregion
/// <summary>
/// This allows the Sim owner the abiility to kick users from their sim currently.
/// It tells the client that the agent has permission to do so.
/// handle god level requests.
/// </summary>
public void GrantGodlikePowers(UUID agentID, UUID sessionID, UUID token, bool godStatus)
public void GrantGodlikePowers(UUID token, bool godStatus)
{
int oldgodlevel = GodLevel;
if (godStatus)
if (godStatus && !isNPC && m_scene.Permissions.IsGod(UUID))
{
// For now, assign god level 200 to anyone
// who is granted god powers, but has no god level set.
//
UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, agentID);
if (account != null)
{
if (account.UserLevel > 0)
GodLevel = account.UserLevel;
else
GodLevel = 200;
}
if(GodLevel < UserLevel)
GodLevel = UserLevel;
}
else
{
GodLevel = 0;
}
ControllingClient.SendAdminResponse(token, (uint)GodLevel);
if(oldgodlevel != GodLevel)
parcelGodCheck(m_currentParcelUUID, GodLevel >= 200);
}
@ -4640,7 +4628,7 @@ namespace OpenSim.Region.Framework.Scenes
cAgent.BodyRotation = Rotation;
cAgent.ControlFlags = (uint)m_AgentControlFlags;
if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID)))
if (GodLevel > 200 && m_scene.Permissions.IsGod(cAgent.AgentID))
cAgent.GodLevel = (byte)GodLevel;
else
cAgent.GodLevel = (byte) 0;
@ -4741,10 +4729,12 @@ namespace OpenSim.Region.Framework.Scenes
Rotation = cAgent.BodyRotation;
m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags;
if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID)))
if (cAgent.GodLevel >200 && m_scene.Permissions.IsGod(cAgent.AgentID))
GodLevel = cAgent.GodLevel;
SetAlwaysRun = cAgent.AlwaysRun;
else
GodLevel = 0;
SetAlwaysRun = cAgent.AlwaysRun;
Appearance = new AvatarAppearance(cAgent.Appearance);
/*