diff options
author | onefang | 2019-05-19 21:24:15 +1000 |
---|---|---|
committer | onefang | 2019-05-19 21:24:15 +1000 |
commit | 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch) | |
tree | a9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Services/LLLoginService/LLLoginService.cs | |
parent | Add a build script. (diff) | |
download | opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2 opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz |
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/LLLoginService/LLLoginService.cs | 211 |
1 files changed, 153 insertions, 58 deletions
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 0b38738..3ccdc9c 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -40,6 +40,7 @@ using OpenMetaverse; | |||
40 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
41 | using OpenSim.Framework.Console; | 41 | using OpenSim.Framework.Console; |
42 | using OpenSim.Server.Base; | 42 | using OpenSim.Server.Base; |
43 | using OpenSim.Services.Connectors.InstantMessage; | ||
43 | using OpenSim.Services.Interfaces; | 44 | using OpenSim.Services.Interfaces; |
44 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 45 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
45 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; | 46 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; |
@@ -77,16 +78,19 @@ namespace OpenSim.Services.LLLoginService | |||
77 | protected string m_GatekeeperURL; | 78 | protected string m_GatekeeperURL; |
78 | protected bool m_AllowRemoteSetLoginLevel; | 79 | protected bool m_AllowRemoteSetLoginLevel; |
79 | protected string m_MapTileURL; | 80 | protected string m_MapTileURL; |
81 | protected string m_ProfileURL; | ||
82 | protected string m_OpenIDURL; | ||
80 | protected string m_SearchURL; | 83 | protected string m_SearchURL; |
81 | protected string m_Currency; | 84 | protected string m_Currency; |
82 | protected string m_ClassifiedFee; | 85 | protected string m_ClassifiedFee; |
83 | protected int m_MaxAgentGroups; | 86 | protected int m_MaxAgentGroups = 42; |
84 | protected string m_DestinationGuide; | 87 | protected string m_DestinationGuide; |
85 | protected string m_AvatarPicker; | 88 | protected string m_AvatarPicker; |
86 | protected string m_AllowedClients; | 89 | protected string m_AllowedClients; |
87 | protected string m_DeniedClients; | 90 | protected string m_DeniedClients; |
88 | protected string m_MessageUrl; | 91 | protected string m_MessageUrl; |
89 | protected string m_DSTZone; | 92 | protected string m_DSTZone; |
93 | protected bool m_allowDuplicatePresences = false; | ||
90 | 94 | ||
91 | IConfig m_LoginServerConfig; | 95 | IConfig m_LoginServerConfig; |
92 | // IConfig m_ClientsConfig; | 96 | // IConfig m_ClientsConfig; |
@@ -117,6 +121,8 @@ namespace OpenSim.Services.LLLoginService | |||
117 | m_GatekeeperURL = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", | 121 | m_GatekeeperURL = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", |
118 | new string[] { "Startup", "Hypergrid", "LoginService" }, String.Empty); | 122 | new string[] { "Startup", "Hypergrid", "LoginService" }, String.Empty); |
119 | m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); | 123 | m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); |
124 | m_ProfileURL = m_LoginServerConfig.GetString("ProfileServerURL", string.Empty); | ||
125 | m_OpenIDURL = m_LoginServerConfig.GetString("OpenIDServerURL", String.Empty); | ||
120 | m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); | 126 | m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); |
121 | m_Currency = m_LoginServerConfig.GetString("Currency", string.Empty); | 127 | m_Currency = m_LoginServerConfig.GetString("Currency", string.Empty); |
122 | m_ClassifiedFee = m_LoginServerConfig.GetString("ClassifiedFee", string.Empty); | 128 | m_ClassifiedFee = m_LoginServerConfig.GetString("ClassifiedFee", string.Empty); |
@@ -127,7 +133,7 @@ namespace OpenSim.Services.LLLoginService | |||
127 | m_AllowedClients = Util.GetConfigVarFromSections<string>( | 133 | m_AllowedClients = Util.GetConfigVarFromSections<string>( |
128 | config, "AllowedClients", possibleAccessControlConfigSections, string.Empty); | 134 | config, "AllowedClients", possibleAccessControlConfigSections, string.Empty); |
129 | m_DeniedClients = Util.GetConfigVarFromSections<string>( | 135 | m_DeniedClients = Util.GetConfigVarFromSections<string>( |
130 | config, "DeniedClients", possibleAccessControlConfigSections, string.Empty); | 136 | config, "DeniedClients", possibleAccessControlConfigSections, string.Empty); |
131 | 137 | ||
132 | m_MessageUrl = m_LoginServerConfig.GetString("MessageUrl", string.Empty); | 138 | m_MessageUrl = m_LoginServerConfig.GetString("MessageUrl", string.Empty); |
133 | m_DSTZone = m_LoginServerConfig.GetString("DSTZone", "America/Los_Angeles;Pacific Standard Time"); | 139 | m_DSTZone = m_LoginServerConfig.GetString("DSTZone", "America/Los_Angeles;Pacific Standard Time"); |
@@ -136,6 +142,11 @@ namespace OpenSim.Services.LLLoginService | |||
136 | if (groupConfig != null) | 142 | if (groupConfig != null) |
137 | m_MaxAgentGroups = groupConfig.GetInt("MaxAgentGroups", 42); | 143 | m_MaxAgentGroups = groupConfig.GetInt("MaxAgentGroups", 42); |
138 | 144 | ||
145 | IConfig presenceConfig = config.Configs["PresenceService"]; | ||
146 | if (presenceConfig != null) | ||
147 | { | ||
148 | m_allowDuplicatePresences = presenceConfig.GetBoolean("AllowDuplicatePresences", m_allowDuplicatePresences); | ||
149 | } | ||
139 | 150 | ||
140 | // Clean up some of these vars | 151 | // Clean up some of these vars |
141 | if (m_MapTileURL != String.Empty) | 152 | if (m_MapTileURL != String.Empty) |
@@ -155,7 +166,8 @@ namespace OpenSim.Services.LLLoginService | |||
155 | Object[] args = new Object[] { config }; | 166 | Object[] args = new Object[] { config }; |
156 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); | 167 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); |
157 | m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args); | 168 | m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args); |
158 | m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args); | 169 | Object[] authArgs = new Object[] { config, m_UserAccountService }; |
170 | m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, authArgs); | ||
159 | m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args); | 171 | m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args); |
160 | 172 | ||
161 | if (gridService != string.Empty) | 173 | if (gridService != string.Empty) |
@@ -175,9 +187,14 @@ namespace OpenSim.Services.LLLoginService | |||
175 | string hgInvServicePlugin = m_LoginServerConfig.GetString("HGInventoryServicePlugin", String.Empty); | 187 | string hgInvServicePlugin = m_LoginServerConfig.GetString("HGInventoryServicePlugin", String.Empty); |
176 | if (hgInvServicePlugin != string.Empty) | 188 | if (hgInvServicePlugin != string.Empty) |
177 | { | 189 | { |
190 | // TODO: Remove HGInventoryServiceConstructorArg after 0.9 release | ||
178 | string hgInvServiceArg = m_LoginServerConfig.GetString("HGInventoryServiceConstructorArg", String.Empty); | 191 | string hgInvServiceArg = m_LoginServerConfig.GetString("HGInventoryServiceConstructorArg", String.Empty); |
179 | Object[] args2 = new Object[] { config, hgInvServiceArg }; | 192 | if (hgInvServiceArg != String.Empty) |
180 | m_HGInventoryService = ServerUtils.LoadPlugin<IInventoryService>(hgInvServicePlugin, args2); | 193 | { |
194 | m_log.Warn("[LLOGIN SERVICE]: You are using HGInventoryServiceConstructorArg, which is deprecated. See example file for correct syntax."); | ||
195 | hgInvServicePlugin = hgInvServiceArg + "@" + hgInvServicePlugin; | ||
196 | } | ||
197 | m_HGInventoryService = ServerUtils.LoadPlugin<IInventoryService>(hgInvServicePlugin, args); | ||
181 | } | 198 | } |
182 | 199 | ||
183 | // | 200 | // |
@@ -260,16 +277,20 @@ namespace OpenSim.Services.LLLoginService | |||
260 | return response; | 277 | return response; |
261 | } | 278 | } |
262 | 279 | ||
263 | public LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, | 280 | public LoginResponse Login(string firstName, string lastName, string passwd, string startLocation, UUID scopeID, |
264 | string clientVersion, string channel, string mac, string id0, IPEndPoint clientIP) | 281 | string clientVersion, string channel, string mac, string id0, IPEndPoint clientIP, bool LibOMVclient) |
265 | { | 282 | { |
266 | bool success = false; | 283 | bool success = false; |
267 | UUID session = UUID.Random(); | 284 | UUID session = UUID.Random(); |
285 | |||
268 | string processedMessage; | 286 | string processedMessage; |
269 | 287 | ||
270 | m_log.InfoFormat("[LLOGIN SERVICE]: Login request for {0} {1} at {2} using viewer {3}, channel {4}, IP {5}, Mac {6}, Id0 {7}", | 288 | if (clientVersion.Contains("Radegast")) |
271 | firstName, lastName, startLocation, clientVersion, channel, clientIP.Address.ToString(), mac, id0); | 289 | LibOMVclient = false; |
272 | 290 | ||
291 | m_log.InfoFormat("[LLOGIN SERVICE]: Login request for {0} {1} at {2} using viewer {3}, channel {4}, IP {5}, Mac {6}, Id0 {7}, Possible LibOMVGridProxy: {8} ", | ||
292 | firstName, lastName, startLocation, clientVersion, channel, clientIP.Address.ToString(), mac, id0, LibOMVclient.ToString()); | ||
293 | |||
273 | try | 294 | try |
274 | { | 295 | { |
275 | // | 296 | // |
@@ -345,7 +366,8 @@ namespace OpenSim.Services.LLLoginService | |||
345 | if (!passwd.StartsWith("$1$")) | 366 | if (!passwd.StartsWith("$1$")) |
346 | passwd = "$1$" + Util.Md5Hash(passwd); | 367 | passwd = "$1$" + Util.Md5Hash(passwd); |
347 | passwd = passwd.Remove(0, 3); //remove $1$ | 368 | passwd = passwd.Remove(0, 3); //remove $1$ |
348 | string token = m_AuthenticationService.Authenticate(account.PrincipalID, passwd, 30); | 369 | UUID realID; |
370 | string token = m_AuthenticationService.Authenticate(account.PrincipalID, passwd, 30, out realID); | ||
349 | UUID secureSession = UUID.Zero; | 371 | UUID secureSession = UUID.Zero; |
350 | if ((token == string.Empty) || (token != string.Empty && !UUID.TryParse(token, out secureSession))) | 372 | if ((token == string.Empty) || (token != string.Empty && !UUID.TryParse(token, out secureSession))) |
351 | { | 373 | { |
@@ -355,6 +377,29 @@ namespace OpenSim.Services.LLLoginService | |||
355 | return LLFailedLoginResponse.UserProblem; | 377 | return LLFailedLoginResponse.UserProblem; |
356 | } | 378 | } |
357 | 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 | |||
358 | // | 403 | // |
359 | // Get the user's inventory | 404 | // Get the user's inventory |
360 | // | 405 | // |
@@ -391,7 +436,7 @@ namespace OpenSim.Services.LLLoginService | |||
391 | // | 436 | // |
392 | if (m_PresenceService != null) | 437 | if (m_PresenceService != null) |
393 | { | 438 | { |
394 | success = m_PresenceService.LoginAgent(account.PrincipalID.ToString(), session, secureSession); | 439 | success = m_PresenceService.LoginAgent(PrincipalIDstr, session, secureSession); |
395 | 440 | ||
396 | if (!success) | 441 | if (!success) |
397 | { | 442 | { |
@@ -406,7 +451,6 @@ namespace OpenSim.Services.LLLoginService | |||
406 | // Change Online status and get the home region | 451 | // Change Online status and get the home region |
407 | // | 452 | // |
408 | GridRegion home = null; | 453 | GridRegion home = null; |
409 | GridUserInfo guinfo = m_GridUserService.LoggedIn(account.PrincipalID.ToString()); | ||
410 | 454 | ||
411 | // 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 |
412 | // spamming the console. | 456 | // spamming the console. |
@@ -437,7 +481,7 @@ namespace OpenSim.Services.LLLoginService | |||
437 | guinfo = new GridUserInfo(); | 481 | guinfo = new GridUserInfo(); |
438 | guinfo.LastPosition = guinfo.HomePosition = new Vector3(128, 128, 30); | 482 | guinfo.LastPosition = guinfo.HomePosition = new Vector3(128, 128, 30); |
439 | } | 483 | } |
440 | 484 | ||
441 | // | 485 | // |
442 | // Find the destination region/grid | 486 | // Find the destination region/grid |
443 | // | 487 | // |
@@ -479,7 +523,7 @@ namespace OpenSim.Services.LLLoginService | |||
479 | // | 523 | // |
480 | string reason = string.Empty; | 524 | string reason = string.Empty; |
481 | GridRegion dest; | 525 | GridRegion dest; |
482 | AgentCircuitData aCircuit = LaunchAgentAtGrid(gatekeeper, destination, account, avatar, session, secureSession, position, where, | 526 | AgentCircuitData aCircuit = LaunchAgentAtGrid(gatekeeper, destination, account, avatar, session, secureSession, position, where, |
483 | clientVersion, channel, mac, id0, clientIP, flags, out where, out reason, out dest); | 527 | clientVersion, channel, mac, id0, clientIP, flags, out where, out reason, out dest); |
484 | destination = dest; | 528 | destination = dest; |
485 | if (aCircuit == null) | 529 | if (aCircuit == null) |
@@ -489,7 +533,11 @@ namespace OpenSim.Services.LLLoginService | |||
489 | return new LLFailedLoginResponse("key", reason, "false"); | 533 | return new LLFailedLoginResponse("key", reason, "false"); |
490 | 534 | ||
491 | } | 535 | } |
492 | // Get Friends list | 536 | |
537 | // only now we can assume a login | ||
538 | guinfo = m_GridUserService.LoggedIn(PrincipalIDstr); | ||
539 | |||
540 | // Get Friends list | ||
493 | FriendInfo[] friendsList = new FriendInfo[0]; | 541 | FriendInfo[] friendsList = new FriendInfo[0]; |
494 | if (m_FriendsService != null) | 542 | if (m_FriendsService != null) |
495 | { | 543 | { |
@@ -502,8 +550,8 @@ namespace OpenSim.Services.LLLoginService | |||
502 | // | 550 | // |
503 | if (m_MessageUrl != String.Empty) | 551 | if (m_MessageUrl != String.Empty) |
504 | { | 552 | { |
505 | WebClient client = new WebClient(); | 553 | using(WebClient client = new WebClient()) |
506 | processedMessage = client.DownloadString(m_MessageUrl); | 554 | processedMessage = client.DownloadString(m_MessageUrl); |
507 | } | 555 | } |
508 | else | 556 | else |
509 | { | 557 | { |
@@ -512,11 +560,11 @@ namespace OpenSim.Services.LLLoginService | |||
512 | processedMessage = processedMessage.Replace("\\n", "\n").Replace("<USERNAME>", firstName + " " + lastName); | 560 | processedMessage = processedMessage.Replace("\\n", "\n").Replace("<USERNAME>", firstName + " " + lastName); |
513 | 561 | ||
514 | LLLoginResponse response | 562 | LLLoginResponse response |
515 | = new LLLoginResponse( | 563 | = new LLLoginResponse( |
516 | account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, | 564 | account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, |
517 | where, startLocation, position, lookAt, gestures, processedMessage, home, clientIP, | 565 | where, startLocation, position, lookAt, gestures, processedMessage, home, clientIP, |
518 | m_MapTileURL, m_SearchURL, m_Currency, m_DSTZone, | 566 | m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency, m_DSTZone, |
519 | m_DestinationGuide, m_AvatarPicker, m_ClassifiedFee, m_MaxAgentGroups); | 567 | m_DestinationGuide, m_AvatarPicker, realID, m_ClassifiedFee,m_MaxAgentGroups); |
520 | 568 | ||
521 | m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to {0} {1}", firstName, lastName); | 569 | m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to {0} {1}", firstName, lastName); |
522 | 570 | ||
@@ -572,12 +620,13 @@ namespace OpenSim.Services.LLLoginService | |||
572 | lookAt = pinfo.HomeLookAt; | 620 | lookAt = pinfo.HomeLookAt; |
573 | flags |= TeleportFlags.ViaHome; | 621 | flags |= TeleportFlags.ViaHome; |
574 | } | 622 | } |
575 | 623 | ||
576 | if (tryDefaults) | 624 | if (tryDefaults) |
577 | { | 625 | { |
578 | List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID); | 626 | List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID); |
579 | if (defaults != null && defaults.Count > 0) | 627 | if (defaults != null && defaults.Count > 0) |
580 | { | 628 | { |
629 | flags |= TeleportFlags.ViaRegionID; | ||
581 | region = defaults[0]; | 630 | region = defaults[0]; |
582 | where = "safe"; | 631 | where = "safe"; |
583 | } | 632 | } |
@@ -587,7 +636,10 @@ namespace OpenSim.Services.LLLoginService | |||
587 | account.FirstName, account.LastName); | 636 | account.FirstName, account.LastName); |
588 | region = FindAlternativeRegion(scopeID); | 637 | region = FindAlternativeRegion(scopeID); |
589 | if (region != null) | 638 | if (region != null) |
639 | { | ||
640 | flags |= TeleportFlags.ViaRegionID; | ||
590 | where = "safe"; | 641 | where = "safe"; |
642 | } | ||
591 | } | 643 | } |
592 | } | 644 | } |
593 | 645 | ||
@@ -608,6 +660,7 @@ namespace OpenSim.Services.LLLoginService | |||
608 | List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID); | 660 | List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID); |
609 | if (defaults != null && defaults.Count > 0) | 661 | if (defaults != null && defaults.Count > 0) |
610 | { | 662 | { |
663 | flags |= TeleportFlags.ViaRegionID; | ||
611 | region = defaults[0]; | 664 | region = defaults[0]; |
612 | where = "safe"; | 665 | where = "safe"; |
613 | } | 666 | } |
@@ -616,7 +669,10 @@ namespace OpenSim.Services.LLLoginService | |||
616 | m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region"); | 669 | m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region"); |
617 | region = FindAlternativeRegion(scopeID); | 670 | region = FindAlternativeRegion(scopeID); |
618 | if (region != null) | 671 | if (region != null) |
672 | { | ||
673 | flags |= TeleportFlags.ViaRegionID; | ||
619 | where = "safe"; | 674 | where = "safe"; |
675 | } | ||
620 | } | 676 | } |
621 | 677 | ||
622 | } | 678 | } |
@@ -625,7 +681,7 @@ namespace OpenSim.Services.LLLoginService | |||
625 | position = pinfo.LastPosition; | 681 | position = pinfo.LastPosition; |
626 | lookAt = pinfo.LastLookAt; | 682 | lookAt = pinfo.LastLookAt; |
627 | } | 683 | } |
628 | 684 | ||
629 | return region; | 685 | return region; |
630 | } | 686 | } |
631 | else | 687 | else |
@@ -661,7 +717,7 @@ namespace OpenSim.Services.LLLoginService | |||
661 | regions = m_GridService.GetDefaultRegions(scopeID); | 717 | regions = m_GridService.GetDefaultRegions(scopeID); |
662 | if (regions != null && regions.Count > 0) | 718 | if (regions != null && regions.Count > 0) |
663 | { | 719 | { |
664 | where = "safe"; | 720 | where = "safe"; |
665 | return regions[0]; | 721 | return regions[0]; |
666 | } | 722 | } |
667 | else | 723 | else |
@@ -696,7 +752,7 @@ namespace OpenSim.Services.LLLoginService | |||
696 | return null; | 752 | return null; |
697 | } | 753 | } |
698 | // Valid specification of a remote grid | 754 | // Valid specification of a remote grid |
699 | 755 | ||
700 | regionName = parts[0]; | 756 | regionName = parts[0]; |
701 | string domainLocator = parts[1]; | 757 | string domainLocator = parts[1]; |
702 | parts = domainLocator.Split(new char[] {':'}); | 758 | parts = domainLocator.Split(new char[] {':'}); |
@@ -714,7 +770,7 @@ namespace OpenSim.Services.LLLoginService | |||
714 | List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID); | 770 | List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID); |
715 | if (defaults != null && defaults.Count > 0) | 771 | if (defaults != null && defaults.Count > 0) |
716 | { | 772 | { |
717 | where = "safe"; | 773 | where = "safe"; |
718 | return defaults[0]; | 774 | return defaults[0]; |
719 | } | 775 | } |
720 | else | 776 | else |
@@ -767,12 +823,15 @@ namespace OpenSim.Services.LLLoginService | |||
767 | ulong handle; | 823 | ulong handle; |
768 | string imageURL = string.Empty, reason = string.Empty; | 824 | string imageURL = string.Empty, reason = string.Empty; |
769 | string message; | 825 | string message; |
770 | if (m_GatekeeperConnector.LinkRegion(gatekeeper, out regionID, out handle, out domainName, out imageURL, out reason)) | 826 | int sizeX = (int)Constants.RegionSize; |
827 | int sizeY = (int)Constants.RegionSize; | ||
828 | |||
829 | if (m_GatekeeperConnector.LinkRegion(gatekeeper, out regionID, out handle, out domainName, out imageURL, out reason, out sizeX, out sizeY)) | ||
771 | { | 830 | { |
772 | string homeURI = null; | 831 | string homeURI = null; |
773 | if (account.ServiceURLs != null && account.ServiceURLs.ContainsKey("HomeURI")) | 832 | if (account.ServiceURLs != null && account.ServiceURLs.ContainsKey("HomeURI")) |
774 | homeURI = (string)account.ServiceURLs["HomeURI"]; | 833 | homeURI = (string)account.ServiceURLs["HomeURI"]; |
775 | 834 | ||
776 | GridRegion destination = m_GatekeeperConnector.GetHyperlinkRegion(gatekeeper, regionID, account.PrincipalID, homeURI, out message); | 835 | GridRegion destination = m_GatekeeperConnector.GetHyperlinkRegion(gatekeeper, regionID, account.PrincipalID, homeURI, out message); |
777 | return destination; | 836 | return destination; |
778 | } | 837 | } |
@@ -806,6 +865,9 @@ namespace OpenSim.Services.LLLoginService | |||
806 | reason = string.Empty; | 865 | reason = string.Empty; |
807 | uint circuitCode = 0; | 866 | uint circuitCode = 0; |
808 | AgentCircuitData aCircuit = null; | 867 | AgentCircuitData aCircuit = null; |
868 | dest = null; | ||
869 | |||
870 | bool success = false; | ||
809 | 871 | ||
810 | if (m_UserAgentService == null) | 872 | if (m_UserAgentService == null) |
811 | { | 873 | { |
@@ -816,28 +878,14 @@ namespace OpenSim.Services.LLLoginService | |||
816 | simConnector = m_LocalSimulationService; | 878 | simConnector = m_LocalSimulationService; |
817 | else if (m_RemoteSimulationService != null) | 879 | else if (m_RemoteSimulationService != null) |
818 | simConnector = m_RemoteSimulationService; | 880 | simConnector = m_RemoteSimulationService; |
819 | } | ||
820 | else // User Agent Service is on | ||
821 | { | ||
822 | if (gatekeeper == null) // login to local grid | ||
823 | { | ||
824 | if (hostName == string.Empty) | ||
825 | SetHostAndPort(m_GatekeeperURL); | ||
826 | |||
827 | gatekeeper = new GridRegion(destination); | ||
828 | gatekeeper.ExternalHostName = hostName; | ||
829 | gatekeeper.HttpPort = (uint)port; | ||
830 | gatekeeper.ServerURI = m_GatekeeperURL; | ||
831 | } | ||
832 | m_log.Debug("[LLLOGIN SERVICE]: no gatekeeper detected..... using " + m_GatekeeperURL); | ||
833 | } | ||
834 | 881 | ||
835 | bool success = false; | 882 | if(simConnector == null) |
883 | return null; | ||
836 | 884 | ||
837 | if (m_UserAgentService == null && simConnector != null) | ||
838 | { | ||
839 | circuitCode = (uint)Util.RandomClass.Next(); ; | 885 | circuitCode = (uint)Util.RandomClass.Next(); ; |
840 | aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, clientIP.Address.ToString(), viewer, channel, mac, id0); | 886 | aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, |
887 | clientIP.Address.ToString(), viewer, channel, mac, id0); | ||
888 | |||
841 | success = LaunchAgentDirectly(simConnector, destination, aCircuit, flags, out reason); | 889 | success = LaunchAgentDirectly(simConnector, destination, aCircuit, flags, out reason); |
842 | if (!success && m_GridService != null) | 890 | if (!success && m_GridService != null) |
843 | { | 891 | { |
@@ -859,10 +907,22 @@ namespace OpenSim.Services.LLLoginService | |||
859 | } | 907 | } |
860 | } | 908 | } |
861 | 909 | ||
862 | if (m_UserAgentService != null) | 910 | else |
863 | { | 911 | { |
912 | if (gatekeeper == null) // login to local grid | ||
913 | { | ||
914 | if (hostName == string.Empty) | ||
915 | SetHostAndPort(m_GatekeeperURL); | ||
916 | |||
917 | gatekeeper = new GridRegion(destination); | ||
918 | gatekeeper.ExternalHostName = hostName; | ||
919 | gatekeeper.HttpPort = (uint)port; | ||
920 | gatekeeper.ServerURI = m_GatekeeperURL; | ||
921 | } | ||
864 | circuitCode = (uint)Util.RandomClass.Next(); ; | 922 | circuitCode = (uint)Util.RandomClass.Next(); ; |
865 | aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, clientIP.Address.ToString(), viewer, channel, mac, id0); | 923 | aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, |
924 | clientIP.Address.ToString(), viewer, channel, mac, id0); | ||
925 | |||
866 | aCircuit.teleportFlags |= (uint)flags; | 926 | aCircuit.teleportFlags |= (uint)flags; |
867 | success = LaunchAgentIndirectly(gatekeeper, destination, aCircuit, clientIP, out reason); | 927 | success = LaunchAgentIndirectly(gatekeeper, destination, aCircuit, clientIP, out reason); |
868 | if (!success && m_GridService != null) | 928 | if (!success && m_GridService != null) |
@@ -891,8 +951,8 @@ namespace OpenSim.Services.LLLoginService | |||
891 | return null; | 951 | return null; |
892 | } | 952 | } |
893 | 953 | ||
894 | private AgentCircuitData MakeAgent(GridRegion region, UserAccount account, | 954 | private AgentCircuitData MakeAgent(GridRegion region, UserAccount account, |
895 | AvatarAppearance avatar, UUID session, UUID secureSession, uint circuit, Vector3 position, | 955 | AvatarAppearance avatar, UUID session, UUID secureSession, uint circuit, Vector3 position, |
896 | string ipaddress, string viewer, string channel, string mac, string id0) | 956 | string ipaddress, string viewer, string channel, string mac, string id0) |
897 | { | 957 | { |
898 | AgentCircuitData aCircuit = new AgentCircuitData(); | 958 | AgentCircuitData aCircuit = new AgentCircuitData(); |
@@ -930,7 +990,7 @@ namespace OpenSim.Services.LLLoginService | |||
930 | if (account.ServiceURLs == null) | 990 | if (account.ServiceURLs == null) |
931 | return; | 991 | return; |
932 | 992 | ||
933 | // Old style: get the service keys from the DB | 993 | // Old style: get the service keys from the DB |
934 | foreach (KeyValuePair<string, object> kvp in account.ServiceURLs) | 994 | foreach (KeyValuePair<string, object> kvp in account.ServiceURLs) |
935 | { | 995 | { |
936 | if (kvp.Value != null) | 996 | if (kvp.Value != null) |
@@ -989,7 +1049,7 @@ namespace OpenSim.Services.LLLoginService | |||
989 | region, aCircuit.AgentID, null, true, aCircuit.startpos, new List<UUID>(), ctx, out reason)) | 1049 | region, aCircuit.AgentID, null, true, aCircuit.startpos, new List<UUID>(), ctx, out reason)) |
990 | return false; | 1050 | return false; |
991 | 1051 | ||
992 | return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, out reason); | 1052 | return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, ctx, out reason); |
993 | } | 1053 | } |
994 | 1054 | ||
995 | private bool LaunchAgentIndirectly(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, IPEndPoint clientIP, out string reason) | 1055 | private bool LaunchAgentIndirectly(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, IPEndPoint clientIP, out string reason) |
@@ -1027,7 +1087,7 @@ namespace OpenSim.Services.LLLoginService | |||
1027 | switch (subcommand) | 1087 | switch (subcommand) |
1028 | { | 1088 | { |
1029 | case "level": | 1089 | case "level": |
1030 | // Set the minimum level to allow login | 1090 | // Set the minimum level to allow login |
1031 | // Useful to allow grid update without worrying about users. | 1091 | // Useful to allow grid update without worrying about users. |
1032 | // or fixing critical issues | 1092 | // or fixing critical issues |
1033 | // | 1093 | // |
@@ -1040,8 +1100,8 @@ namespace OpenSim.Services.LLLoginService | |||
1040 | } | 1100 | } |
1041 | break; | 1101 | break; |
1042 | 1102 | ||
1043 | case "reset": | 1103 | case "reset": |
1044 | m_MinLoginLevel = 0; | 1104 | m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0); |
1045 | MainConsole.Instance.OutputFormat("Reset min login level to {0}", m_MinLoginLevel); | 1105 | MainConsole.Instance.OutputFormat("Reset min login level to {0}", m_MinLoginLevel); |
1046 | break; | 1106 | break; |
1047 | 1107 | ||
@@ -1054,6 +1114,41 @@ namespace OpenSim.Services.LLLoginService | |||
1054 | break; | 1114 | break; |
1055 | } | 1115 | } |
1056 | } | 1116 | } |
1117 | |||
1118 | private bool SendAgentGodKillToRegion(UUID scopeID, UUID agentID , GridUserInfo guinfo) | ||
1119 | { | ||
1120 | UUID regionID = guinfo.LastRegionID; | ||
1121 | GridRegion regInfo = m_GridService.GetRegionByUUID(scopeID, regionID); | ||
1122 | if(regInfo == null) | ||
1123 | return false; | ||
1124 | |||
1125 | string regURL = regInfo.ServerURI; | ||
1126 | if(String.IsNullOrEmpty(regURL)) | ||
1127 | return false; | ||
1128 | |||
1129 | UUID guuid = new UUID("6571e388-6218-4574-87db-f9379718315e"); | ||
1130 | |||
1131 | GridInstantMessage msg = new GridInstantMessage(); | ||
1132 | msg.imSessionID = UUID.Zero.Guid; | ||
1133 | msg.fromAgentID = guuid.Guid; | ||
1134 | msg.toAgentID = agentID.Guid; | ||
1135 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); | ||
1136 | msg.fromAgentName = "GRID"; | ||
1137 | msg.message = string.Format("New login detected"); | ||
1138 | msg.dialog = 250; // God kick | ||
1139 | msg.fromGroup = false; | ||
1140 | msg.offline = (byte)0; | ||
1141 | msg.ParentEstateID = 0; | ||
1142 | msg.Position = Vector3.Zero; | ||
1143 | msg.RegionID = scopeID.Guid; | ||
1144 | msg.binaryBucket = new byte[1] {0}; | ||
1145 | InstantMessageServiceConnector.SendInstantMessage(regURL,msg); | ||
1146 | |||
1147 | m_GridUserService.LoggedOut(agentID.ToString(), | ||
1148 | UUID.Zero, guinfo.LastRegionID, guinfo.LastPosition, guinfo.LastLookAt); | ||
1149 | |||
1150 | return true; | ||
1151 | } | ||
1057 | } | 1152 | } |
1058 | 1153 | ||
1059 | #endregion | 1154 | #endregion |