aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs121
-rw-r--r--OpenSim/Services/HypergridService/UserAgentService.cs1
2 files changed, 99 insertions, 23 deletions
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs
index b80700f..9bf3cf8 100644
--- a/OpenSim/Services/HypergridService/GatekeeperService.cs
+++ b/OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -35,8 +35,8 @@ using OpenSim.Framework;
35using OpenSim.Services.Interfaces; 35using OpenSim.Services.Interfaces;
36using GridRegion = OpenSim.Services.Interfaces.GridRegion; 36using GridRegion = OpenSim.Services.Interfaces.GridRegion;
37using OpenSim.Server.Base; 37using OpenSim.Server.Base;
38using OpenSim.Services.Connectors.InstantMessage;
38using OpenSim.Services.Connectors.Hypergrid; 39using OpenSim.Services.Connectors.Hypergrid;
39
40using OpenMetaverse; 40using OpenMetaverse;
41 41
42using Nini.Config; 42using Nini.Config;
@@ -71,6 +71,7 @@ namespace OpenSim.Services.HypergridService
71 private static string m_ExternalName; 71 private static string m_ExternalName;
72 private static Uri m_Uri; 72 private static Uri m_Uri;
73 private static GridRegion m_DefaultGatewayRegion; 73 private static GridRegion m_DefaultGatewayRegion;
74 private bool m_allowDuplicatePresences = false;
74 75
75 public GatekeeperService(IConfigSource config, ISimulationService simService) 76 public GatekeeperService(IConfigSource config, ISimulationService simService)
76 { 77 {
@@ -144,6 +145,12 @@ namespace OpenSim.Services.HypergridService
144 if (m_GridService == null || m_PresenceService == null || m_SimulationService == null) 145 if (m_GridService == null || m_PresenceService == null || m_SimulationService == null)
145 throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); 146 throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function.");
146 147
148 IConfig presenceConfig = config.Configs["PresenceService"];
149 if (presenceConfig != null)
150 {
151 m_allowDuplicatePresences = presenceConfig.GetBoolean("AllowDuplicatePresences", m_allowDuplicatePresences);
152 }
153
147 m_log.Debug("[GATEKEEPER SERVICE]: Starting..."); 154 m_log.Debug("[GATEKEEPER SERVICE]: Starting...");
148 } 155 }
149 } 156 }
@@ -369,6 +376,36 @@ namespace OpenSim.Services.HypergridService
369 return false; 376 return false;
370 } 377 }
371 378
379 if(account.PrincipalID == new UUID("6571e388-6218-4574-87db-f9379718315e"))
380 {
381 // really?
382 reason = "Invalid account ID";
383 return false;
384 }
385
386 if(m_GridUserService != null)
387 {
388 string PrincipalIDstr = account.PrincipalID.ToString();
389 GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(PrincipalIDstr);
390
391 if(!m_allowDuplicatePresences)
392 {
393 if(guinfo != null && guinfo.Online && guinfo.LastRegionID != UUID.Zero)
394 {
395 if(SendAgentGodKillToRegion(UUID.Zero, account.PrincipalID, guinfo))
396 {
397 m_log.InfoFormat(
398 "[GATEKEEPER SERVICE]: Login failed for {0} {1}, reason: already logged in",
399 account.FirstName, account.LastName);
400 reason = "You appear to be already logged in on destiny grid " +
401 "Please wait a a minute or two and retry. " +
402 "If this takes longer than a few minutes please contact the grid owner. ";
403 return false;
404 }
405 }
406 }
407 }
408
372 m_log.DebugFormat("[GATEKEEPER SERVICE]: User {0} is ok", aCircuit.Name); 409 m_log.DebugFormat("[GATEKEEPER SERVICE]: User {0} is ok", aCircuit.Name);
373 410
374 bool isFirstLogin = false; 411 bool isFirstLogin = false;
@@ -389,26 +426,6 @@ namespace OpenSim.Services.HypergridService
389 return false; 426 return false;
390 } 427 }
391 428
392 m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence {0} is ok", aCircuit.Name);
393
394 // Also login foreigners with GridUser service
395 if (m_GridUserService != null && account == null)
396 {
397 string userId = aCircuit.AgentID.ToString();
398 string first = aCircuit.firstname, last = aCircuit.lastname;
399 if (last.StartsWith("@"))
400 {
401 string[] parts = aCircuit.firstname.Split('.');
402 if (parts.Length >= 2)
403 {
404 first = parts[0];
405 last = parts[1];
406 }
407 }
408
409 userId += ";" + aCircuit.ServiceURLs["HomeURI"] + ";" + first + " " + last;
410 m_GridUserService.LoggedIn(userId);
411 }
412 } 429 }
413 430
414 // 431 //
@@ -465,7 +482,33 @@ namespace OpenSim.Services.HypergridService
465 true, aCircuit.startpos, new List<UUID>(), ctx, out reason)) 482 true, aCircuit.startpos, new List<UUID>(), ctx, out reason))
466 return false; 483 return false;
467 484
468 return m_SimulationService.CreateAgent(source, destination, aCircuit, (uint)loginFlag, ctx, out reason); 485 bool didit = m_SimulationService.CreateAgent(source, destination, aCircuit, (uint)loginFlag, ctx, out reason);
486
487 if(didit)
488 {
489 m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence {0} is ok", aCircuit.Name);
490
491 if(!isFirstLogin && m_GridUserService != null && account == null)
492 {
493 // Also login foreigners with GridUser service
494 string userId = aCircuit.AgentID.ToString();
495 string first = aCircuit.firstname, last = aCircuit.lastname;
496 if (last.StartsWith("@"))
497 {
498 string[] parts = aCircuit.firstname.Split('.');
499 if (parts.Length >= 2)
500 {
501 first = parts[0];
502 last = parts[1];
503 }
504 }
505
506 userId += ";" + aCircuit.ServiceURLs["HomeURI"] + ";" + first + " " + last;
507 m_GridUserService.LoggedIn(userId);
508 }
509 }
510
511 return didit;
469 } 512 }
470 513
471 protected bool Authenticate(AgentCircuitData aCircuit) 514 protected bool Authenticate(AgentCircuitData aCircuit)
@@ -563,6 +606,40 @@ namespace OpenSim.Services.HypergridService
563 return exception; 606 return exception;
564 } 607 }
565 608
609 private bool SendAgentGodKillToRegion(UUID scopeID, UUID agentID , GridUserInfo guinfo)
610 {
611 UUID regionID = guinfo.LastRegionID;
612 GridRegion regInfo = m_GridService.GetRegionByUUID(scopeID, regionID);
613 if(regInfo == null)
614 return false;
615
616 string regURL = regInfo.ServerURI;
617 if(String.IsNullOrEmpty(regURL))
618 return false;
619
620 UUID guuid = new UUID("6571e388-6218-4574-87db-f9379718315e");
621
622 GridInstantMessage msg = new GridInstantMessage();
623 msg.imSessionID = UUID.Zero.Guid;
624 msg.fromAgentID = guuid.Guid;
625 msg.toAgentID = agentID.Guid;
626 msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
627 msg.fromAgentName = "GRID";
628 msg.message = string.Format("New login detected");
629 msg.dialog = 250; // God kick
630 msg.fromGroup = false;
631 msg.offline = (byte)0;
632 msg.ParentEstateID = 0;
633 msg.Position = Vector3.Zero;
634 msg.RegionID = scopeID.Guid;
635 msg.binaryBucket = new byte[1] {0};
636 InstantMessageServiceConnector.SendInstantMessage(regURL,msg);
637
638 m_GridUserService.LoggedOut(agentID.ToString(),
639 UUID.Zero, guinfo.LastRegionID, guinfo.LastPosition, guinfo.LastLookAt);
640
641 return true;
642 }
566 #endregion 643 #endregion
567 } 644 }
568} 645}
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index ba3cb2f..6f2cdd5 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -254,7 +254,6 @@ namespace OpenSim.Services.HypergridService
254 } 254 }
255 } 255 }
256 256
257
258 // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination 257 // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination
259 GridRegion region = new GridRegion(gatekeeper); 258 GridRegion region = new GridRegion(gatekeeper);
260 region.ServerURI = gatekeeper.ServerURI; 259 region.ServerURI = gatekeeper.ServerURI;