From e9153e1d1aae50024d8cd05fe14a9bce34343a0e Mon Sep 17 00:00:00 2001 From: teravus Date: Thu, 15 Nov 2012 10:05:16 -0500 Subject: Revert "Merge master into teravuswork", it should have been avination, not master. This reverts commit dfac269032300872c4d0dc507f4f9062d102b0f4, reversing changes made to 619c39e5144f15aca129d6d999bcc5c34133ee64. --- .../Services/HypergridService/GatekeeperService.cs | 93 +++------------------- 1 file changed, 12 insertions(+), 81 deletions(-) (limited to 'OpenSim/Services/HypergridService/GatekeeperService.cs') diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 004311f..47d22b9 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -57,13 +57,10 @@ namespace OpenSim.Services.HypergridService private static IUserAccountService m_UserAccountService; private static IUserAgentService m_UserAgentService; private static ISimulationService m_SimulationService; - private static IGridUserService m_GridUserService; - private static string m_AllowedClients = string.Empty; - private static string m_DeniedClients = string.Empty; + protected string m_AllowedClients = string.Empty; + protected string m_DeniedClients = string.Empty; private static bool m_ForeignAgentsAllowed = true; - private static List m_ForeignsAllowedExceptions = new List(); - private static List m_ForeignsDisallowedExceptions = new List(); private static UUID m_ScopeID; private static bool m_AllowTeleportsToAnyRegion; @@ -85,9 +82,8 @@ namespace OpenSim.Services.HypergridService string gridService = serverConfig.GetString("GridService", String.Empty); string presenceService = serverConfig.GetString("PresenceService", String.Empty); string simulationService = serverConfig.GetString("SimulationService", String.Empty); - string gridUserService = serverConfig.GetString("GridUserService", String.Empty); - // These are mandatory, the others aren't + // These 3 are mandatory, the others aren't if (gridService == string.Empty || presenceService == string.Empty) throw new Exception("Incomplete specifications, Gatekeeper Service cannot function."); @@ -107,8 +103,6 @@ namespace OpenSim.Services.HypergridService m_UserAccountService = ServerUtils.LoadPlugin(accountService, args); if (homeUsersService != string.Empty) m_UserAgentService = ServerUtils.LoadPlugin(homeUsersService, args); - if (gridUserService != string.Empty) - m_GridUserService = ServerUtils.LoadPlugin(gridUserService, args); if (simService != null) m_SimulationService = simService; @@ -119,9 +113,6 @@ namespace OpenSim.Services.HypergridService m_DeniedClients = serverConfig.GetString("DeniedClients", string.Empty); m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true); - LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions); - LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_ForeignsDisallowedExceptions); - if (m_GridService == null || m_PresenceService == null || m_SimulationService == null) throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); @@ -134,15 +125,6 @@ namespace OpenSim.Services.HypergridService { } - protected void LoadDomainExceptionsFromConfig(IConfig config, string variable, List exceptions) - { - string value = config.GetString(variable, string.Empty); - string[] parts = value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); - - foreach (string s in parts) - exceptions.Add(s.Trim()); - } - public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason) { regionID = UUID.Zero; @@ -278,27 +260,18 @@ namespace OpenSim.Services.HypergridService m_log.DebugFormat("[GATEKEEPER SERVICE]: User is ok"); // - // Foreign agents allowed? Exceptions? + // Foreign agents allowed // - if (account == null) + if (account == null && !m_ForeignAgentsAllowed) { - bool allowed = m_ForeignAgentsAllowed; - - if (m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsAllowedExceptions)) - allowed = false; - - if (!m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsDisallowedExceptions)) - allowed = true; - - if (!allowed) - { - reason = "Destination does not allow visitors from your world"; - m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agents are not permitted {0} {1} @ {2}. Refusing service.", - aCircuit.firstname, aCircuit.lastname, aCircuit.ServiceURLs["HomeURI"]); - return false; - } + reason = "Unauthorized"; + m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agents are not permitted {0} {1}. Refusing service.", + aCircuit.firstname, aCircuit.lastname); + return false; } + // May want to authorize + bool isFirstLogin = false; // // Login the presence, if it's not there yet (by the login service) @@ -307,8 +280,7 @@ namespace OpenSim.Services.HypergridService if (presence != null) // it has been placed there by the login service isFirstLogin = true; - else - { + else if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID)) { reason = "Unable to login presence"; @@ -318,26 +290,6 @@ namespace OpenSim.Services.HypergridService } m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok"); - // 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); - } - } - // // Get the region // @@ -441,27 +393,6 @@ namespace OpenSim.Services.HypergridService #region Misc - private bool IsException(AgentCircuitData aCircuit, List exceptions) - { - bool exception = false; - if (exceptions.Count > 0) // we have exceptions - { - // Retrieve the visitor's origin - string userURL = aCircuit.ServiceURLs["HomeURI"].ToString(); - if (!userURL.EndsWith("/")) - userURL += "/"; - - if (exceptions.Find(delegate(string s) - { - if (!s.EndsWith("/")) - s += "/"; - return s == userURL; - }) != null) - exception = true; - } - - return exception; - } #endregion } -- cgit v1.1