aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/HypergridService/GatekeeperService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/HypergridService/GatekeeperService.cs')
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs93
1 files changed, 12 insertions, 81 deletions
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
57 private static IUserAccountService m_UserAccountService; 57 private static IUserAccountService m_UserAccountService;
58 private static IUserAgentService m_UserAgentService; 58 private static IUserAgentService m_UserAgentService;
59 private static ISimulationService m_SimulationService; 59 private static ISimulationService m_SimulationService;
60 private static IGridUserService m_GridUserService;
61 60
62 private static string m_AllowedClients = string.Empty; 61 protected string m_AllowedClients = string.Empty;
63 private static string m_DeniedClients = string.Empty; 62 protected string m_DeniedClients = string.Empty;
64 private static bool m_ForeignAgentsAllowed = true; 63 private static bool m_ForeignAgentsAllowed = true;
65 private static List<string> m_ForeignsAllowedExceptions = new List<string>();
66 private static List<string> m_ForeignsDisallowedExceptions = new List<string>();
67 64
68 private static UUID m_ScopeID; 65 private static UUID m_ScopeID;
69 private static bool m_AllowTeleportsToAnyRegion; 66 private static bool m_AllowTeleportsToAnyRegion;
@@ -85,9 +82,8 @@ namespace OpenSim.Services.HypergridService
85 string gridService = serverConfig.GetString("GridService", String.Empty); 82 string gridService = serverConfig.GetString("GridService", String.Empty);
86 string presenceService = serverConfig.GetString("PresenceService", String.Empty); 83 string presenceService = serverConfig.GetString("PresenceService", String.Empty);
87 string simulationService = serverConfig.GetString("SimulationService", String.Empty); 84 string simulationService = serverConfig.GetString("SimulationService", String.Empty);
88 string gridUserService = serverConfig.GetString("GridUserService", String.Empty);
89 85
90 // These are mandatory, the others aren't 86 // These 3 are mandatory, the others aren't
91 if (gridService == string.Empty || presenceService == string.Empty) 87 if (gridService == string.Empty || presenceService == string.Empty)
92 throw new Exception("Incomplete specifications, Gatekeeper Service cannot function."); 88 throw new Exception("Incomplete specifications, Gatekeeper Service cannot function.");
93 89
@@ -107,8 +103,6 @@ namespace OpenSim.Services.HypergridService
107 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); 103 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
108 if (homeUsersService != string.Empty) 104 if (homeUsersService != string.Empty)
109 m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args); 105 m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args);
110 if (gridUserService != string.Empty)
111 m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
112 106
113 if (simService != null) 107 if (simService != null)
114 m_SimulationService = simService; 108 m_SimulationService = simService;
@@ -119,9 +113,6 @@ namespace OpenSim.Services.HypergridService
119 m_DeniedClients = serverConfig.GetString("DeniedClients", string.Empty); 113 m_DeniedClients = serverConfig.GetString("DeniedClients", string.Empty);
120 m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true); 114 m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true);
121 115
122 LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions);
123 LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_ForeignsDisallowedExceptions);
124
125 if (m_GridService == null || m_PresenceService == null || m_SimulationService == null) 116 if (m_GridService == null || m_PresenceService == null || m_SimulationService == null)
126 throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); 117 throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function.");
127 118
@@ -134,15 +125,6 @@ namespace OpenSim.Services.HypergridService
134 { 125 {
135 } 126 }
136 127
137 protected void LoadDomainExceptionsFromConfig(IConfig config, string variable, List<string> exceptions)
138 {
139 string value = config.GetString(variable, string.Empty);
140 string[] parts = value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
141
142 foreach (string s in parts)
143 exceptions.Add(s.Trim());
144 }
145
146 public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason) 128 public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason)
147 { 129 {
148 regionID = UUID.Zero; 130 regionID = UUID.Zero;
@@ -278,27 +260,18 @@ namespace OpenSim.Services.HypergridService
278 m_log.DebugFormat("[GATEKEEPER SERVICE]: User is ok"); 260 m_log.DebugFormat("[GATEKEEPER SERVICE]: User is ok");
279 261
280 // 262 //
281 // Foreign agents allowed? Exceptions? 263 // Foreign agents allowed
282 // 264 //
283 if (account == null) 265 if (account == null && !m_ForeignAgentsAllowed)
284 { 266 {
285 bool allowed = m_ForeignAgentsAllowed; 267 reason = "Unauthorized";
286 268 m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agents are not permitted {0} {1}. Refusing service.",
287 if (m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsAllowedExceptions)) 269 aCircuit.firstname, aCircuit.lastname);
288 allowed = false; 270 return false;
289
290 if (!m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsDisallowedExceptions))
291 allowed = true;
292
293 if (!allowed)
294 {
295 reason = "Destination does not allow visitors from your world";
296 m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agents are not permitted {0} {1} @ {2}. Refusing service.",
297 aCircuit.firstname, aCircuit.lastname, aCircuit.ServiceURLs["HomeURI"]);
298 return false;
299 }
300 } 271 }
301 272
273 // May want to authorize
274
302 bool isFirstLogin = false; 275 bool isFirstLogin = false;
303 // 276 //
304 // Login the presence, if it's not there yet (by the login service) 277 // Login the presence, if it's not there yet (by the login service)
@@ -307,8 +280,7 @@ namespace OpenSim.Services.HypergridService
307 if (presence != null) // it has been placed there by the login service 280 if (presence != null) // it has been placed there by the login service
308 isFirstLogin = true; 281 isFirstLogin = true;
309 282
310 else 283 else
311 {
312 if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID)) 284 if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID))
313 { 285 {
314 reason = "Unable to login presence"; 286 reason = "Unable to login presence";
@@ -318,26 +290,6 @@ namespace OpenSim.Services.HypergridService
318 } 290 }
319 m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok"); 291 m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok");
320 292
321 // Also login foreigners with GridUser service
322 if (m_GridUserService != null && account == null)
323 {
324 string userId = aCircuit.AgentID.ToString();
325 string first = aCircuit.firstname, last = aCircuit.lastname;
326 if (last.StartsWith("@"))
327 {
328 string[] parts = aCircuit.firstname.Split('.');
329 if (parts.Length >= 2)
330 {
331 first = parts[0];
332 last = parts[1];
333 }
334 }
335
336 userId += ";" + aCircuit.ServiceURLs["HomeURI"] + ";" + first + " " + last;
337 m_GridUserService.LoggedIn(userId);
338 }
339 }
340
341 // 293 //
342 // Get the region 294 // Get the region
343 // 295 //
@@ -441,27 +393,6 @@ namespace OpenSim.Services.HypergridService
441 393
442 #region Misc 394 #region Misc
443 395
444 private bool IsException(AgentCircuitData aCircuit, List<string> exceptions)
445 {
446 bool exception = false;
447 if (exceptions.Count > 0) // we have exceptions
448 {
449 // Retrieve the visitor's origin
450 string userURL = aCircuit.ServiceURLs["HomeURI"].ToString();
451 if (!userURL.EndsWith("/"))
452 userURL += "/";
453
454 if (exceptions.Find(delegate(string s)
455 {
456 if (!s.EndsWith("/"))
457 s += "/";
458 return s == userURL;
459 }) != null)
460 exception = true;
461 }
462
463 return exception;
464 }
465 396
466 #endregion 397 #endregion
467 } 398 }