From 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb Mon Sep 17 00:00:00 2001 From: onefang Date: Sun, 19 May 2019 21:24:15 +1000 Subject: Dump OpenSim 0.9.0.1 into it's own branch. --- .../Services/HypergridService/GatekeeperService.cs | 151 ++++++++++--- .../Services/HypergridService/HGAssetService.cs | 2 +- .../Services/HypergridService/HGFSAssetService.cs | 2 +- .../Services/HypergridService/HGFriendsService.cs | 2 +- .../HypergridService/HGInstantMessageService.cs | 2 +- .../HypergridService/HGInventoryService.cs | 12 +- .../HypergridService/HGRemoteAssetService.cs | 240 +++++++++++++++++++++ .../HypergridService/HGSuitcaseInventoryService.cs | 20 +- .../HypergridService/Properties/AssemblyInfo.cs | 10 +- .../Services/HypergridService/UserAccountCache.cs | 12 +- .../Services/HypergridService/UserAgentService.cs | 25 ++- 11 files changed, 409 insertions(+), 69 deletions(-) create mode 100644 OpenSim/Services/HypergridService/HGRemoteAssetService.cs (limited to 'OpenSim/Services/HypergridService') diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 8e10125..5c6abd2 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -35,8 +35,8 @@ using OpenSim.Framework; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; using OpenSim.Server.Base; +using OpenSim.Services.Connectors.InstantMessage; using OpenSim.Services.Connectors.Hypergrid; - using OpenMetaverse; using Nini.Config; @@ -71,6 +71,7 @@ namespace OpenSim.Services.HypergridService private static string m_ExternalName; private static Uri m_Uri; private static GridRegion m_DefaultGatewayRegion; + private bool m_allowDuplicatePresences = false; public GatekeeperService(IConfigSource config, ISimulationService simService) { @@ -93,7 +94,7 @@ namespace OpenSim.Services.HypergridService // These are mandatory, the others aren't if (gridService == string.Empty || presenceService == string.Empty) throw new Exception("Incomplete specifications, Gatekeeper Service cannot function."); - + string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString()); UUID.TryParse(scope, out m_ScopeID); //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!"); @@ -135,7 +136,7 @@ namespace OpenSim.Services.HypergridService m_AllowedClients = Util.GetConfigVarFromSections( config, "AllowedClients", possibleAccessControlConfigSections, string.Empty); m_DeniedClients = Util.GetConfigVarFromSections( - config, "DeniedClients", possibleAccessControlConfigSections, string.Empty); + config, "DeniedClients", possibleAccessControlConfigSections, string.Empty); m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true); LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions); @@ -144,6 +145,12 @@ namespace OpenSim.Services.HypergridService if (m_GridService == null || m_PresenceService == null || m_SimulationService == null) throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); + IConfig presenceConfig = config.Configs["PresenceService"]; + if (presenceConfig != null) + { + m_allowDuplicatePresences = presenceConfig.GetBoolean("AllowDuplicatePresences", m_allowDuplicatePresences); + } + m_log.Debug("[GATEKEEPER SERVICE]: Starting..."); } } @@ -162,10 +169,12 @@ namespace OpenSim.Services.HypergridService exceptions.Add(s.Trim()); } - public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason) + public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason, out int sizeX, out int sizeY) { regionID = UUID.Zero; regionHandle = 0; + sizeX = (int)Constants.RegionSize; + sizeY = (int)Constants.RegionSize; externalName = m_ExternalName + ((regionName != string.Empty) ? " " + regionName : ""); imageURL = string.Empty; reason = string.Empty; @@ -199,6 +208,8 @@ namespace OpenSim.Services.HypergridService regionID = region.RegionID; regionHandle = region.RegionHandle; + sizeX = region.RegionSizeX; + sizeY = region.RegionSizeY; string regionimage = "regionImage" + regionID.ToString(); regionimage = regionimage.Replace("-", ""); @@ -215,11 +226,11 @@ namespace OpenSim.Services.HypergridService { // Don't even check the given regionID m_log.DebugFormat( - "[GATEKEEPER SERVICE]: Returning gateway region {0} {1} @ {2} to user {3}{4} as teleporting to arbitrary regions is not allowed.", - m_DefaultGatewayRegion.RegionName, + "[GATEKEEPER SERVICE]: Returning gateway region {0} {1} @ {2} to user {3}{4} as teleporting to arbitrary regions is not allowed.", + m_DefaultGatewayRegion.RegionName, m_DefaultGatewayRegion.RegionID, m_DefaultGatewayRegion.ServerURI, - agentID, + agentID, agentHomeURI == null ? "" : " @ " + agentHomeURI); message = "Teleporting to the default region."; @@ -240,10 +251,10 @@ namespace OpenSim.Services.HypergridService m_log.DebugFormat( "[GATEKEEPER SERVICE]: Returning region {0} {1} @ {2} to user {3}{4}.", - region.RegionName, + region.RegionName, region.RegionID, region.ServerURI, - agentID, + agentID, agentHomeURI == null ? "" : " @ " + agentHomeURI); return region; @@ -275,6 +286,7 @@ namespace OpenSim.Services.HypergridService if (!am.Success) { + reason = "Login failed: client " + curViewer + " is not allowed"; m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: client {0} is not allowed", curViewer); return false; } @@ -287,6 +299,7 @@ namespace OpenSim.Services.HypergridService if (dm.Success) { + reason = "Login failed: client " + curViewer + " is denied"; m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: client {0} is denied", curViewer); return false; } @@ -302,7 +315,7 @@ namespace OpenSim.Services.HypergridService return false; } m_log.DebugFormat("[GATEKEEPER SERVICE]: Identity verified for {0} {1} @ {2}", aCircuit.firstname, aCircuit.lastname, authURL); - + // // Check for impersonations // @@ -363,6 +376,38 @@ namespace OpenSim.Services.HypergridService return false; } + UUID agentID = aCircuit.AgentID; + if(agentID == new UUID("6571e388-6218-4574-87db-f9379718315e")) + { + // really? + reason = "Invalid account ID"; + return false; + } + + if(m_GridUserService != null) + { + string PrincipalIDstr = agentID.ToString(); + GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(PrincipalIDstr); + + if(!m_allowDuplicatePresences) + { + if(guinfo != null && guinfo.Online && guinfo.LastRegionID != UUID.Zero) + { + if(SendAgentGodKillToRegion(UUID.Zero, agentID, guinfo)) + { + if(account != null) + m_log.InfoFormat( + "[GATEKEEPER SERVICE]: Login failed for {0} {1}, reason: already logged in", + account.FirstName, account.LastName); + reason = "You appear to be already logged in on the destination grid " + + "Please wait a a minute or two and retry. " + + "If this takes longer than a few minutes please contact the grid owner."; + return false; + } + } + } + } + m_log.DebugFormat("[GATEKEEPER SERVICE]: User {0} is ok", aCircuit.Name); bool isFirstLogin = false; @@ -383,26 +428,6 @@ namespace OpenSim.Services.HypergridService return false; } - m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence {0} is ok", aCircuit.Name); - - // Also login foreigners with GridUser service - if (m_GridUserService != null && account == null) - { - string userId = aCircuit.AgentID.ToString(); - string first = aCircuit.firstname, last = aCircuit.lastname; - if (last.StartsWith("@")) - { - string[] parts = aCircuit.firstname.Split('.'); - if (parts.Length >= 2) - { - first = parts[0]; - last = parts[1]; - } - } - - userId += ";" + aCircuit.ServiceURLs["HomeURI"] + ";" + first + " " + last; - m_GridUserService.LoggedIn(userId); - } } // @@ -455,11 +480,37 @@ namespace OpenSim.Services.HypergridService EntityTransferContext ctx = new EntityTransferContext(); if (!m_SimulationService.QueryAccess( - destination, aCircuit.AgentID, aCircuit.ServiceURLs["HomeURI"].ToString(), + destination, aCircuit.AgentID, aCircuit.ServiceURLs["HomeURI"].ToString(), true, aCircuit.startpos, new List(), ctx, out reason)) return false; - return m_SimulationService.CreateAgent(source, destination, aCircuit, (uint)loginFlag, out reason); + bool didit = m_SimulationService.CreateAgent(source, destination, aCircuit, (uint)loginFlag, ctx, out reason); + + if(didit) + { + m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence {0} is ok", aCircuit.Name); + + if(!isFirstLogin && m_GridUserService != null && account == null) + { + // Also login foreigners with GridUser service + string userId = aCircuit.AgentID.ToString(); + string first = aCircuit.firstname, last = aCircuit.lastname; + if (last.StartsWith("@")) + { + string[] parts = aCircuit.firstname.Split('.'); + if (parts.Length >= 2) + { + first = parts[0]; + last = parts[1]; + } + } + + userId += ";" + aCircuit.ServiceURLs["HomeURI"] + ";" + first + " " + last; + m_GridUserService.LoggedIn(userId); + } + } + + return didit; } protected bool Authenticate(AgentCircuitData aCircuit) @@ -489,7 +540,7 @@ namespace OpenSim.Services.HypergridService } else { - IUserAgentService userAgentService = new UserAgentServiceConnector(userURL); + IUserAgentService userAgentService = new UserAgentServiceConnector(userURL); try { @@ -557,6 +608,40 @@ namespace OpenSim.Services.HypergridService return exception; } + private bool SendAgentGodKillToRegion(UUID scopeID, UUID agentID , GridUserInfo guinfo) + { + UUID regionID = guinfo.LastRegionID; + GridRegion regInfo = m_GridService.GetRegionByUUID(scopeID, regionID); + if(regInfo == null) + return false; + + string regURL = regInfo.ServerURI; + if(String.IsNullOrEmpty(regURL)) + return false; + + UUID guuid = new UUID("6571e388-6218-4574-87db-f9379718315e"); + + GridInstantMessage msg = new GridInstantMessage(); + msg.imSessionID = UUID.Zero.Guid; + msg.fromAgentID = guuid.Guid; + msg.toAgentID = agentID.Guid; + msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); + msg.fromAgentName = "GRID"; + msg.message = string.Format("New login detected"); + msg.dialog = 250; // God kick + msg.fromGroup = false; + msg.offline = (byte)0; + msg.ParentEstateID = 0; + msg.Position = Vector3.Zero; + msg.RegionID = scopeID.Guid; + msg.binaryBucket = new byte[1] {0}; + InstantMessageServiceConnector.SendInstantMessage(regURL,msg); + + m_GridUserService.LoggedOut(agentID.ToString(), + UUID.Zero, guinfo.LastRegionID, guinfo.LastPosition, guinfo.LastLookAt); + + return true; + } #endregion } } diff --git a/OpenSim/Services/HypergridService/HGAssetService.cs b/OpenSim/Services/HypergridService/HGAssetService.cs index b83fb1e..a66478e 100644 --- a/OpenSim/Services/HypergridService/HGAssetService.cs +++ b/OpenSim/Services/HypergridService/HGAssetService.cs @@ -164,7 +164,7 @@ namespace OpenSim.Services.HypergridService return false; } - #endregion + #endregion protected void AdjustIdentifiers(AssetMetadata meta) { diff --git a/OpenSim/Services/HypergridService/HGFSAssetService.cs b/OpenSim/Services/HypergridService/HGFSAssetService.cs index 54e8ccb..2b30b3a 100644 --- a/OpenSim/Services/HypergridService/HGFSAssetService.cs +++ b/OpenSim/Services/HypergridService/HGFSAssetService.cs @@ -160,7 +160,7 @@ namespace OpenSim.Services.HypergridService return false; } - #endregion + #endregion protected void AdjustIdentifiers(AssetMetadata meta) { diff --git a/OpenSim/Services/HypergridService/HGFriendsService.cs b/OpenSim/Services/HypergridService/HGFriendsService.cs index 6e35a88..d3b4f18 100644 --- a/OpenSim/Services/HypergridService/HGFriendsService.cs +++ b/OpenSim/Services/HypergridService/HGFriendsService.cs @@ -227,7 +227,7 @@ namespace OpenSim.Services.HypergridService List localFriendsOnline = new List(); - m_log.DebugFormat("[HGFRIENDS SERVICE]: Status notification: foreign user {0} wants to notify {1} local friends of {2} status", + m_log.DebugFormat("[HGFRIENDS SERVICE]: Status notification: foreign user {0} wants to notify {1} local friends of {2} status", foreignUserID, friends.Count, (online ? "online" : "offline")); // First, let's double check that the reported friends are, indeed, friends of that user diff --git a/OpenSim/Services/HypergridService/HGInstantMessageService.cs b/OpenSim/Services/HypergridService/HGInstantMessageService.cs index 32ca09a..d1739cf 100644 --- a/OpenSim/Services/HypergridService/HGInstantMessageService.cs +++ b/OpenSim/Services/HypergridService/HGInstantMessageService.cs @@ -184,7 +184,7 @@ namespace OpenSim.Services.HypergridService else if (o is string) url = (string)o; - // We need to compare the current location with the previous + // We need to compare the current location with the previous // or the recursive loop will never end because it will never try to lookup the agent again if (!firstTime) { diff --git a/OpenSim/Services/HypergridService/HGInventoryService.cs b/OpenSim/Services/HypergridService/HGInventoryService.cs index 9158b41..f14593e 100644 --- a/OpenSim/Services/HypergridService/HGInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGInventoryService.cs @@ -70,7 +70,7 @@ namespace OpenSim.Services.HypergridService // IConfig invConfig = config.Configs[m_ConfigName]; if (invConfig != null) - { + { // realm = authConfig.GetString("Realm", realm); string userAccountsDll = invConfig.GetString("UserAccountsService", string.Empty); if (userAccountsDll == string.Empty) @@ -82,7 +82,7 @@ namespace OpenSim.Services.HypergridService throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); m_HomeURL = Util.GetConfigVarFromSections(config, "HomeURI", - new string[] { "Startup", "Hypergrid", m_ConfigName }, String.Empty); + new string[] { "Startup", "Hypergrid", m_ConfigName }, String.Empty); m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); } @@ -113,7 +113,7 @@ namespace OpenSim.Services.HypergridService if (folders.Length > 0) return ConvertToOpenSim(folders[0]); - + // make one XInventoryFolder suitcase = CreateFolder(principalID, UUID.Zero, (int)FolderType.Suitcase, "My Suitcase"); return ConvertToOpenSim(suitcase); @@ -160,7 +160,7 @@ namespace OpenSim.Services.HypergridService { return new InventoryCollection[0]; } - + //public List GetFolderItems(UUID principalID, UUID folderID) //{ //} @@ -291,9 +291,9 @@ namespace OpenSim.Services.HypergridService //{ //} - public override InventoryItemBase GetItem(InventoryItemBase item) + public override InventoryItemBase GetItem(UUID principalID, UUID itemID) { - InventoryItemBase it = base.GetItem(item); + InventoryItemBase it = base.GetItem(principalID, itemID); if (it != null) { UserAccount user = m_Cache.GetUser(it.CreatorId); diff --git a/OpenSim/Services/HypergridService/HGRemoteAssetService.cs b/OpenSim/Services/HypergridService/HGRemoteAssetService.cs new file mode 100644 index 0000000..5e98af9 --- /dev/null +++ b/OpenSim/Services/HypergridService/HGRemoteAssetService.cs @@ -0,0 +1,240 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Xml; + +using Nini.Config; +using log4net; +using OpenMetaverse; + +using OpenSim.Framework; +using OpenSim.Framework.Serialization.External; +using OpenSim.Server.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Services.AssetService; + +namespace OpenSim.Services.HypergridService +{ + /// + /// Hypergrid asset service. It serves the IAssetService interface, + /// but implements it in ways that are appropriate for inter-grid + /// asset exchanges. + /// + public class HGRemoteAssetService : IAssetService + { + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + private string m_HomeURL; + private IUserAccountService m_UserAccountService; + private IAssetService m_assetConnector; + + private UserAccountCache m_Cache; + + private AssetPermissions m_AssetPerms; + + public HGRemoteAssetService(IConfigSource config, string configName) + { + m_log.Debug("[HGRemoteAsset Service]: Starting"); + IConfig assetConfig = config.Configs[configName]; + if (assetConfig == null) + throw new Exception("No HGAssetService configuration"); + + Object[] args = new Object[] { config }; + + string assetConnectorDll = assetConfig.GetString("AssetConnector", String.Empty); + if (assetConnectorDll == String.Empty) + throw new Exception("Please specify AssetConnector in HGAssetService configuration"); + + m_assetConnector = ServerUtils.LoadPlugin(assetConnectorDll, args); + if (m_assetConnector == null) + throw new Exception(String.Format("Unable to create AssetConnector from {0}", assetConnectorDll)); + + string userAccountsDll = assetConfig.GetString("UserAccountsService", string.Empty); + if (userAccountsDll == string.Empty) + throw new Exception("Please specify UserAccountsService in HGAssetService configuration"); + + m_UserAccountService = ServerUtils.LoadPlugin(userAccountsDll, args); + if (m_UserAccountService == null) + throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); + + m_HomeURL = Util.GetConfigVarFromSections(config, "HomeURI", + new string[] { "Startup", "Hypergrid", configName }, string.Empty); + if (m_HomeURL == string.Empty) + throw new Exception("[HGAssetService] No HomeURI specified"); + + m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); + + // Permissions + m_AssetPerms = new AssetPermissions(assetConfig); + + } + + #region IAssetService overrides + public AssetBase Get(string id) + { + AssetBase asset = m_assetConnector.Get(id); + + if (asset == null) + return null; + + if (!m_AssetPerms.AllowedExport(asset.Type)) + return null; + + if (asset.Metadata.Type == (sbyte)AssetType.Object) + asset.Data = AdjustIdentifiers(asset.Data); + + AdjustIdentifiers(asset.Metadata); + + return asset; + } + + public AssetMetadata GetMetadata(string id) + { + AssetMetadata meta = m_assetConnector.GetMetadata(id); + + if (meta == null) + return null; + + AdjustIdentifiers(meta); + + return meta; + } + + public byte[] GetData(string id) + { + AssetBase asset = Get(id); + + if (asset == null) + return null; + + if (!m_AssetPerms.AllowedExport(asset.Type)) + return null; + + // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) + // Fix bad assets before sending them elsewhere + if (asset.Type == (int)AssetType.Object && asset.Data != null) + { + string xml = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(asset.Data)); + asset.Data = Utils.StringToBytes(xml); + } + + return asset.Data; + } + + // public delegate void AssetRetrieved(string id, Object sender, AssetBase asset); + public virtual bool Get(string id, Object sender, AssetRetrieved handler) + { + return m_assetConnector.Get(id, sender, (i, s, asset) => + { + if (asset != null) + { + if (!m_AssetPerms.AllowedExport(asset.Type)) + { + asset = null; + } + else + { + if (asset.Metadata.Type == (sbyte)AssetType.Object) + asset.Data = AdjustIdentifiers(asset.Data); + + AdjustIdentifiers(asset.Metadata); + } + } + + handler(i, s, asset); + }); + } + + public string Store(AssetBase asset) + { + if (!m_AssetPerms.AllowedImport(asset.Type)) + return string.Empty; + + // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) + // Fix bad assets before storing on this server + if (asset.Type == (int)AssetType.Object && asset.Data != null) + { + string xml = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(asset.Data)); + asset.Data = Utils.StringToBytes(xml); + } + + return m_assetConnector.Store(asset); + } + + public bool Delete(string id) + { + // NOGO + return false; + } + + #endregion + + protected void AdjustIdentifiers(AssetMetadata meta) + { + if (meta == null || m_Cache == null) + return; + + UserAccount creator = m_Cache.GetUser(meta.CreatorID); + if (creator != null) + meta.CreatorID = meta.CreatorID + ";" + m_HomeURL + "/" + creator.FirstName + " " + creator.LastName; + } + + // Only for Object + protected byte[] AdjustIdentifiers(byte[] data) + { + string xml = Utils.BytesToString(data); + + // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) + // Fix bad assets before sending them elsewhere + xml = ExternalRepresentationUtils.SanitizeXml(xml); + + return Utils.StringToBytes(ExternalRepresentationUtils.RewriteSOP(xml, "HGAssetService", m_HomeURL, m_Cache, UUID.Zero)); + } + + public AssetBase GetCached(string id) + { + return Get(id); + } + + public bool[] AssetsExist(string[] ids) + { + return m_assetConnector.AssetsExist(ids); + } + + public bool UpdateContent(string id, byte[] data) + { + // SO not happening!! + return false; + } + } + +} diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index 40eb6d4..d1f2e70 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs @@ -97,7 +97,7 @@ namespace OpenSim.Services.HypergridService throw new Exception(String.Format("Unable to create m_AvatarService from {0}", avatarDll)); // m_HomeURL = Util.GetConfigVarFromSections(config, "HomeURI", -// new string[] { "Startup", "Hypergrid", m_ConfigName }, String.Empty); +// new string[] { "Startup", "Hypergrid", m_ConfigName }, String.Empty); // m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); } @@ -318,7 +318,7 @@ namespace OpenSim.Services.HypergridService m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} (user {1}) is not within Suitcase tree", folder.ID, folder.Owner); return false; } - + if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) { m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} (user {1}) is not within Suitcase tree", folder.ParentID, folder.Owner); @@ -383,7 +383,7 @@ namespace OpenSim.Services.HypergridService // Check the items' current folders foreach (InventoryItemBase item in items) { - InventoryItemBase originalItem = base.GetItem(item); + InventoryItemBase originalItem = base.GetItem(item.Owner, item.ID); if (!IsWithinSuitcaseTree(originalItem.Owner, originalItem.Folder)) { m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner); @@ -401,7 +401,7 @@ namespace OpenSim.Services.HypergridService public new InventoryItemBase GetItem(InventoryItemBase item) { - InventoryItemBase it = base.GetItem(item); + InventoryItemBase it = base.GetItem(item.Owner, item.ID); if (it == null) { m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to retrieve item {0} ({1}) in folder {2}", @@ -426,9 +426,9 @@ namespace OpenSim.Services.HypergridService return it; } - public new InventoryFolderBase GetFolder(InventoryFolderBase folder) + public new InventoryFolderBase GetFolder(UUID principalID, UUID folderID) { - InventoryFolderBase f = base.GetFolder(folder); + InventoryFolderBase f = base.GetFolder(principalID, folderID); if (f != null) { @@ -505,11 +505,11 @@ namespace OpenSim.Services.HypergridService // Warp! Root folder for travelers XInventoryFolder[] folders = m_Database.GetFolders( new string[] { "agentID", "type" }, - new string[] { principalID.ToString(), ((int)FolderType.Suitcase).ToString() }); + new string[] { principalID.ToString(), ((int)FolderType.Suitcase).ToString() }); if (folders != null && folders.Length > 0) return folders[0]; - + // check to see if we have the old Suitcase folder folders = m_Database.GetFolders( new string[] { "agentID", "folderName", "parentFolderID" }, @@ -629,7 +629,7 @@ namespace OpenSim.Services.HypergridService { if (a.Wearables[i][j].ItemID == itemID) { - //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: item {0} is a wearable", itemID); + //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: item {0} is a wearable", itemID); return true; } } @@ -638,7 +638,7 @@ namespace OpenSim.Services.HypergridService // Check attachments if (a.GetAttachmentForItem(itemID) != null) { - //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: item {0} is an attachment", itemID); + //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: item {0} is an attachment", itemID); return true; } diff --git a/OpenSim/Services/HypergridService/Properties/AssemblyInfo.cs b/OpenSim/Services/HypergridService/Properties/AssemblyInfo.cs index 9999237..31b9f4e 100644 --- a/OpenSim/Services/HypergridService/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/HypergridService/Properties/AssemblyInfo.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("OpenSim.Services.HypergridService")] @@ -14,8 +14,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -25,9 +25,9 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -[assembly: AssemblyVersion("0.8.3.*")] +[assembly: AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)] diff --git a/OpenSim/Services/HypergridService/UserAccountCache.cs b/OpenSim/Services/HypergridService/UserAccountCache.cs index fa7dd0b..ae0f7ce 100644 --- a/OpenSim/Services/HypergridService/UserAccountCache.cs +++ b/OpenSim/Services/HypergridService/UserAccountCache.cs @@ -16,7 +16,7 @@ namespace OpenSim.Services.HypergridService // private static readonly ILog m_log = // LogManager.GetLogger( // MethodBase.GetCurrentMethod().DeclaringType); - + private ExpiringCache m_UUIDCache; private IUserAccountService m_UserAccountService; @@ -90,11 +90,21 @@ namespace OpenSim.Services.HypergridService return null; } + public List GetUserAccountsWhere(UUID scopeID, string query) + { + return null; + } + public List GetUserAccounts(UUID scopeID, string query) { return null; } + public List GetUserAccounts(UUID scopeID, List IDs) + { + return null; + } + public void InvalidateCache(UUID userID) { m_UUIDCache.Remove(userID); diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index c65122a..6f2cdd5 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -219,7 +219,7 @@ namespace OpenSim.Services.HypergridService public bool LoginAgentToGrid(GridRegion source, AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, bool fromLogin, out string reason) { - m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", + m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", agentCircuit.firstname, agentCircuit.lastname, (fromLogin ? agentCircuit.IPAddress : "stored IP"), gatekeeper.ServerURI); string gridName = gatekeeper.ServerURI; @@ -254,7 +254,6 @@ namespace OpenSim.Services.HypergridService } } - // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination GridRegion region = new GridRegion(gatekeeper); region.ServerURI = gatekeeper.ServerURI; @@ -269,7 +268,7 @@ namespace OpenSim.Services.HypergridService agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random(); TravelingAgentInfo old = null; TravelingAgentInfo travel = CreateTravelInfo(agentCircuit, region, fromLogin, out old); - + bool success = false; string myExternalIP = string.Empty; @@ -281,12 +280,14 @@ namespace OpenSim.Services.HypergridService } else { - success = m_GatekeeperConnector.CreateAgent(source, region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out myExternalIP, out reason); + //TODO: Should there not be a call to QueryAccess here? + EntityTransferContext ctx = new EntityTransferContext(); + success = m_GatekeeperConnector.CreateAgent(source, region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, ctx, out myExternalIP, out reason); } if (!success) { - m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}", + m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}", agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason); if (old != null) @@ -299,8 +300,12 @@ namespace OpenSim.Services.HypergridService // Everything is ok - // Update the perceived IP Address of our grid - m_log.DebugFormat("[USER AGENT SERVICE]: Gatekeeper sees me as {0}", myExternalIP); + if (!fromLogin) + { + // Update the perceived IP Address of our grid + m_log.DebugFormat("[USER AGENT SERVICE]: Gatekeeper sees me as {0}", myExternalIP); + } + travel.MyIpAddress = myExternalIP; StoreTravelInfo(travel); @@ -370,7 +375,7 @@ namespace OpenSim.Services.HypergridService if (m_BypassClientVerification) return true; - m_log.DebugFormat("[USER AGENT SERVICE]: Verifying Client session {0} with reported IP {1}.", + m_log.DebugFormat("[USER AGENT SERVICE]: Verifying Client session {0} with reported IP {1}.", sessionID, reportedIP); HGTravelingData hgt = m_Database.Get(sessionID); @@ -529,7 +534,7 @@ namespace OpenSim.Services.HypergridService FriendInfo[] friendInfos = m_FriendsService.GetFriends(localUserID); foreach (FriendInfo finfo in friendInfos) { - if (finfo.Friend.StartsWith(foreignUserID.ToString()) && finfo.Friend.EndsWith(secret) && + if (finfo.Friend.StartsWith(foreignUserID.ToString()) && finfo.Friend.EndsWith(secret) && (finfo.TheirFlags & (int)FriendRights.CanSeeOnline) != 0 && (finfo.TheirFlags != -1)) { // great! @@ -635,7 +640,7 @@ namespace OpenSim.Services.HypergridService foreach (FriendInfo f in friends) if (f.Friend.StartsWith(targetUserID.ToString())) { - // Let's remove the secret + // Let's remove the secret UUID id; string tmp = string.Empty, secret = string.Empty; if (Util.ParseUniversalUserIdentifier(f.Friend, out id, out tmp, out tmp, out tmp, out secret)) return f.Friend.Replace(secret, "0"); -- cgit v1.1