aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/LLLoginService/LLLoginService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/LLLoginService/LLLoginService.cs')
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs48
1 files changed, 35 insertions, 13 deletions
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index ffed15e..6683caf 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -523,6 +523,7 @@ namespace OpenSim.Services.LLLoginService
523 // free uri form 523 // free uri form
524 // e.g. New Moon&135&46 New Moon@osgrid.org:8002&153&34 524 // e.g. New Moon&135&46 New Moon@osgrid.org:8002&153&34
525 where = "url"; 525 where = "url";
526 GridRegion region = null;
526 Regex reURI = new Regex(@"^uri:(?<region>[^&]+)&(?<x>\d+)&(?<y>\d+)&(?<z>\d+)$"); 527 Regex reURI = new Regex(@"^uri:(?<region>[^&]+)&(?<x>\d+)&(?<y>\d+)&(?<z>\d+)$");
527 Match uriMatch = reURI.Match(startLocation); 528 Match uriMatch = reURI.Match(startLocation);
528 if (uriMatch == null) 529 if (uriMatch == null)
@@ -553,8 +554,18 @@ namespace OpenSim.Services.LLLoginService
553 } 554 }
554 else 555 else
555 { 556 {
556 m_log.InfoFormat("[LLLOGIN SERVICE]: Got Custom Login URI {0}, Grid does not provide default regions.", startLocation); 557 m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region");
557 return null; 558 region = FindAlternativeRegion(scopeID);
559 if (region != null)
560 {
561 where = "safe";
562 return region;
563 }
564 else
565 {
566 m_log.InfoFormat("[LLLOGIN SERVICE]: Got Custom Login URI {0}, Grid does not provide default regions and no alternative found.", startLocation);
567 return null;
568 }
558 } 569 }
559 } 570 }
560 return regions[0]; 571 return regions[0];
@@ -582,7 +593,8 @@ namespace OpenSim.Services.LLLoginService
582 if (parts.Length > 1) 593 if (parts.Length > 1)
583 UInt32.TryParse(parts[1], out port); 594 UInt32.TryParse(parts[1], out port);
584 595
585 GridRegion region = FindForeignRegion(domainName, port, regionName, out gatekeeper); 596// GridRegion region = FindForeignRegion(domainName, port, regionName, out gatekeeper);
597 region = FindForeignRegion(domainName, port, regionName, out gatekeeper);
586 return region; 598 return region;
587 } 599 }
588 } 600 }
@@ -811,16 +823,13 @@ namespace OpenSim.Services.LLLoginService
811 // Old style: get the service keys from the DB 823 // Old style: get the service keys from the DB
812 foreach (KeyValuePair<string, object> kvp in account.ServiceURLs) 824 foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
813 { 825 {
814 if (kvp.Value == null || (kvp.Value != null && kvp.Value.ToString() == string.Empty)) 826 if (kvp.Value != null)
815 {
816 aCircuit.ServiceURLs[kvp.Key] = m_LoginServerConfig.GetString(kvp.Key, string.Empty);
817 }
818 else
819 { 827 {
820 aCircuit.ServiceURLs[kvp.Key] = kvp.Value; 828 aCircuit.ServiceURLs[kvp.Key] = kvp.Value;
829
830 if (!aCircuit.ServiceURLs[kvp.Key].ToString().EndsWith("/"))
831 aCircuit.ServiceURLs[kvp.Key] = aCircuit.ServiceURLs[kvp.Key] + "/";
821 } 832 }
822 if (!aCircuit.ServiceURLs[kvp.Key].ToString().EndsWith("/"))
823 aCircuit.ServiceURLs[kvp.Key] = aCircuit.ServiceURLs[kvp.Key] + "/";
824 } 833 }
825 834
826 // New style: service keys start with SRV_; override the previous 835 // New style: service keys start with SRV_; override the previous
@@ -828,16 +837,29 @@ namespace OpenSim.Services.LLLoginService
828 837
829 if (keys.Length > 0) 838 if (keys.Length > 0)
830 { 839 {
840 bool newUrls = false;
831 IEnumerable<string> serviceKeys = keys.Where(value => value.StartsWith("SRV_")); 841 IEnumerable<string> serviceKeys = keys.Where(value => value.StartsWith("SRV_"));
832 foreach (string serviceKey in serviceKeys) 842 foreach (string serviceKey in serviceKeys)
833 { 843 {
834 string keyName = serviceKey.Replace("SRV_", ""); 844 string keyName = serviceKey.Replace("SRV_", "");
835 aCircuit.ServiceURLs[keyName] = m_LoginServerConfig.GetString(serviceKey, string.Empty); 845 string keyValue = m_LoginServerConfig.GetString(serviceKey, string.Empty);
836 if (!aCircuit.ServiceURLs[keyName].ToString().EndsWith("/")) 846 if (!keyValue.EndsWith("/"))
837 aCircuit.ServiceURLs[keyName] = aCircuit.ServiceURLs[keyName] + "/"; 847 keyValue = keyValue + "/";
848
849 if (!account.ServiceURLs.ContainsKey(keyName) || (account.ServiceURLs.ContainsKey(keyName) && account.ServiceURLs[keyName] != keyValue))
850 {
851 account.ServiceURLs[keyName] = keyValue;
852 newUrls = true;
853 }
854 aCircuit.ServiceURLs[keyName] = keyValue;
838 855
839 m_log.DebugFormat("[LLLOGIN SERVICE]: found new key {0} {1}", keyName, aCircuit.ServiceURLs[keyName]); 856 m_log.DebugFormat("[LLLOGIN SERVICE]: found new key {0} {1}", keyName, aCircuit.ServiceURLs[keyName]);
840 } 857 }
858
859 // The grid operator decided to override the defaults in the
860 // [LoginService] configuration. Let's store the correct ones.
861 if (newUrls)
862 m_UserAccountService.StoreUserAccount(account);
841 } 863 }
842 864
843 } 865 }