aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/LLLoginService
diff options
context:
space:
mode:
authorUbitUmarov2017-05-11 17:59:37 +0100
committerUbitUmarov2017-05-11 17:59:37 +0100
commit211a1fe9d413f5571efb2deb1a436ae8639f1c1e (patch)
treefd3c4ca682239e73ac7ef8281c314f177930b67e /OpenSim/Services/LLLoginService
parent let new regions know about grid services god (diff)
downloadopensim-SC_OLD-211a1fe9d413f5571efb2deb1a436ae8639f1c1e.zip
opensim-SC_OLD-211a1fe9d413f5571efb2deb1a436ae8639f1c1e.tar.gz
opensim-SC_OLD-211a1fe9d413f5571efb2deb1a436ae8639f1c1e.tar.bz2
opensim-SC_OLD-211a1fe9d413f5571efb2deb1a436ae8639f1c1e.tar.xz
do not allow multiple logins of same avatar. No HG case, that needs work on some paths. option m_allowDuplicatePresences is checked, but is is a total nonsense.. Presences control will get broken if allowed, No one ever added code to suport it correctly.
Diffstat (limited to 'OpenSim/Services/LLLoginService')
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginResponse.cs5
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs72
2 files changed, 72 insertions, 5 deletions
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
index 32e14a1..823fd36 100644
--- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
@@ -82,9 +82,8 @@ namespace OpenSim.Services.LLLoginService
82 "false"); 82 "false");
83 AlreadyLoggedInProblem = new LLFailedLoginResponse("presence", 83 AlreadyLoggedInProblem = new LLFailedLoginResponse("presence",
84 "You appear to be already logged in. " + 84 "You appear to be already logged in. " +
85 "If this is not the case please wait for your session to timeout. " + 85 "Please wait a a minute or two and retry. " +
86 "If this takes longer than a few minutes please contact the grid owner. " + 86 "If this takes longer than a few minutes please contact the grid owner. ",
87 "Please wait 5 minutes if you are going to connect to a region nearby to the region you were at previously.",
88 "false"); 87 "false");
89 InternalError = new LLFailedLoginResponse("Internal Error", "Error generating Login Response", "false"); 88 InternalError = new LLFailedLoginResponse("Internal Error", "Error generating Login Response", "false");
90 } 89 }
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index fc45f86..6a289d1 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -40,6 +40,7 @@ using OpenMetaverse;
40using OpenSim.Framework; 40using OpenSim.Framework;
41using OpenSim.Framework.Console; 41using OpenSim.Framework.Console;
42using OpenSim.Server.Base; 42using OpenSim.Server.Base;
43using OpenSim.Services.Connectors.InstantMessage;
43using OpenSim.Services.Interfaces; 44using OpenSim.Services.Interfaces;
44using GridRegion = OpenSim.Services.Interfaces.GridRegion; 45using GridRegion = OpenSim.Services.Interfaces.GridRegion;
45using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; 46using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
@@ -89,6 +90,7 @@ namespace OpenSim.Services.LLLoginService
89 protected string m_DeniedClients; 90 protected string m_DeniedClients;
90 protected string m_MessageUrl; 91 protected string m_MessageUrl;
91 protected string m_DSTZone; 92 protected string m_DSTZone;
93 protected bool m_allowDuplicatePresences = false;
92 94
93 IConfig m_LoginServerConfig; 95 IConfig m_LoginServerConfig;
94// IConfig m_ClientsConfig; 96// IConfig m_ClientsConfig;
@@ -140,6 +142,11 @@ namespace OpenSim.Services.LLLoginService
140 if (groupConfig != null) 142 if (groupConfig != null)
141 m_MaxAgentGroups = groupConfig.GetInt("MaxAgentGroups", 42); 143 m_MaxAgentGroups = groupConfig.GetInt("MaxAgentGroups", 42);
142 144
145 IConfig presenceConfig = config.Configs["PresenceService"];
146 if (presenceConfig != null)
147 {
148 m_allowDuplicatePresences = presenceConfig.GetBoolean("AllowDuplicatePresences", m_allowDuplicatePresences);
149 }
143 150
144 // Clean up some of these vars 151 // Clean up some of these vars
145 if (m_MapTileURL != String.Empty) 152 if (m_MapTileURL != String.Empty)
@@ -370,6 +377,29 @@ namespace OpenSim.Services.LLLoginService
370 return LLFailedLoginResponse.UserProblem; 377 return LLFailedLoginResponse.UserProblem;
371 } 378 }
372 379
380 if(account.PrincipalID == new UUID("6571e388-6218-4574-87db-f9379718315e"))
381 {
382 // really?
383 return LLFailedLoginResponse.UserProblem;
384 }
385
386 string PrincipalIDstr = account.PrincipalID.ToString();
387 GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(PrincipalIDstr);
388
389 if(!m_allowDuplicatePresences)
390 {
391 if(guinfo != null && guinfo.Online && guinfo.LastRegionID != UUID.Zero)
392 {
393 if(SendAgentGodKillToRegion(scopeID, account.PrincipalID, guinfo))
394 {
395 m_log.InfoFormat(
396 "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: already logged in",
397 firstName, lastName);
398 return LLFailedLoginResponse.AlreadyLoggedInProblem;
399 }
400 }
401 }
402
373 // 403 //
374 // Get the user's inventory 404 // Get the user's inventory
375 // 405 //
@@ -406,7 +436,7 @@ namespace OpenSim.Services.LLLoginService
406 // 436 //
407 if (m_PresenceService != null) 437 if (m_PresenceService != null)
408 { 438 {
409 success = m_PresenceService.LoginAgent(account.PrincipalID.ToString(), session, secureSession); 439 success = m_PresenceService.LoginAgent(PrincipalIDstr, session, secureSession);
410 440
411 if (!success) 441 if (!success)
412 { 442 {
@@ -421,7 +451,6 @@ namespace OpenSim.Services.LLLoginService
421 // Change Online status and get the home region 451 // Change Online status and get the home region
422 // 452 //
423 GridRegion home = null; 453 GridRegion home = null;
424 GridUserInfo guinfo = m_GridUserService.LoggedIn(account.PrincipalID.ToString());
425 454
426 // We are only going to complain about no home if the user actually tries to login there, to avoid 455 // We are only going to complain about no home if the user actually tries to login there, to avoid
427 // spamming the console. 456 // spamming the console.
@@ -504,6 +533,10 @@ namespace OpenSim.Services.LLLoginService
504 return new LLFailedLoginResponse("key", reason, "false"); 533 return new LLFailedLoginResponse("key", reason, "false");
505 534
506 } 535 }
536
537 // only now we can assume a login
538 guinfo = m_GridUserService.LoggedIn(PrincipalIDstr);
539
507 // Get Friends list 540 // Get Friends list
508 FriendInfo[] friendsList = new FriendInfo[0]; 541 FriendInfo[] friendsList = new FriendInfo[0];
509 if (m_FriendsService != null) 542 if (m_FriendsService != null)
@@ -1080,6 +1113,41 @@ namespace OpenSim.Services.LLLoginService
1080 break; 1113 break;
1081 } 1114 }
1082 } 1115 }
1116
1117 private bool SendAgentGodKillToRegion(UUID scopeID, UUID agentID , GridUserInfo guinfo)
1118 {
1119 UUID regionID = guinfo.LastRegionID;
1120 GridRegion regInfo = m_GridService.GetRegionByUUID(scopeID, regionID);
1121 if(regInfo == null)
1122 return false;
1123
1124 string regURL = regInfo.ServerURI;
1125 if(String.IsNullOrEmpty(regURL))
1126 return false;
1127
1128 UUID guuid = new UUID("6571e388-6218-4574-87db-f9379718315e");
1129
1130 GridInstantMessage msg = new GridInstantMessage();
1131 msg.imSessionID = UUID.Zero.Guid;
1132 msg.fromAgentID = guuid.Guid;
1133 msg.toAgentID = agentID.Guid;
1134 msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
1135 msg.fromAgentName = "GRID";
1136 msg.message = string.Format("New login detected");
1137 msg.dialog = 250; // God kick
1138 msg.fromGroup = false;
1139 msg.offline = (byte)0;
1140 msg.ParentEstateID = 0;
1141 msg.Position = Vector3.Zero;
1142 msg.RegionID = scopeID.Guid;
1143 msg.binaryBucket = new byte[1] {0};
1144 InstantMessageServiceConnector.SendInstantMessage(regURL,msg);
1145
1146 m_GridUserService.LoggedOut(agentID.ToString(),
1147 UUID.Zero, guinfo.LastRegionID, guinfo.LastPosition, guinfo.LastLookAt);
1148
1149 return true;
1150 }
1083 } 1151 }
1084 1152
1085 #endregion 1153 #endregion