aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
authorDiva Canto2010-01-17 11:33:47 -0800
committerDiva Canto2010-01-17 11:33:47 -0800
commitf276ba57bf5bd732fbc6a255213c9bb7f5f5f148 (patch)
tree65c49c571c4012b195a309866b8bf6ed2885f9ef /OpenSim/Services
parentCopyright notices. (diff)
downloadopensim-SC-f276ba57bf5bd732fbc6a255213c9bb7f5f5f148.zip
opensim-SC-f276ba57bf5bd732fbc6a255213c9bb7f5f5f148.tar.gz
opensim-SC-f276ba57bf5bd732fbc6a255213c9bb7f5f5f148.tar.bz2
opensim-SC-f276ba57bf5bd732fbc6a255213c9bb7f5f5f148.tar.xz
HG agent transfers are starting to work. Gatekeeper handlers are missing.
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/HypergridServiceConnector.cs7
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs34
-rw-r--r--OpenSim/Services/HypergridService/HypergridService.cs8
-rw-r--r--OpenSim/Services/Interfaces/IHypergridService.cs2
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs49
5 files changed, 80 insertions, 20 deletions
diff --git a/OpenSim/Services/Connectors/Hypergrid/HypergridServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HypergridServiceConnector.cs
index 0bb1c0e..953c7bd 100644
--- a/OpenSim/Services/Connectors/Hypergrid/HypergridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/HypergridServiceConnector.cs
@@ -50,6 +50,8 @@ namespace OpenSim.Services.Connectors.Hypergrid
50 50
51 private IAssetService m_AssetService; 51 private IAssetService m_AssetService;
52 52
53 public HypergridServiceConnector() : this(null) { }
54
53 public HypergridServiceConnector(IAssetService assService) 55 public HypergridServiceConnector(IAssetService assService)
54 { 56 {
55 m_AssetService = assService; 57 m_AssetService = assService;
@@ -197,21 +199,24 @@ namespace OpenSim.Services.Connectors.Hypergrid
197 GridRegion region = new GridRegion(); 199 GridRegion region = new GridRegion();
198 200
199 UUID.TryParse((string)hash["uuid"], out region.RegionID); 201 UUID.TryParse((string)hash["uuid"], out region.RegionID);
200 //m_log.Debug(">> HERE, uuid: " + uuid); 202 //m_log.Debug(">> HERE, uuid: " + region.RegionID);
201 int n = 0; 203 int n = 0;
202 if (hash["x"] != null) 204 if (hash["x"] != null)
203 { 205 {
204 Int32.TryParse((string)hash["x"], out n); 206 Int32.TryParse((string)hash["x"], out n);
205 region.RegionLocX = n; 207 region.RegionLocX = n;
208 //m_log.Debug(">> HERE, x: " + region.RegionLocX);
206 } 209 }
207 if (hash["y"] != null) 210 if (hash["y"] != null)
208 { 211 {
209 Int32.TryParse((string)hash["y"], out n); 212 Int32.TryParse((string)hash["y"], out n);
210 region.RegionLocY = n; 213 region.RegionLocY = n;
214 //m_log.Debug(">> HERE, y: " + region.RegionLocY);
211 } 215 }
212 if (hash["region_name"] != null) 216 if (hash["region_name"] != null)
213 { 217 {
214 region.RegionName = (string)hash["region_name"]; 218 region.RegionName = (string)hash["region_name"];
219 //m_log.Debug(">> HERE, name: " + region.RegionName);
215 } 220 }
216 if (hash["hostname"] != null) 221 if (hash["hostname"] != null)
217 region.ExternalHostName = (string)hash["hostname"]; 222 region.ExternalHostName = (string)hash["hostname"];
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs
index ec7ef1d..a5bd881 100644
--- a/OpenSim/Services/HypergridService/GatekeeperService.cs
+++ b/OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -112,6 +112,10 @@ namespace OpenSim.Services.HypergridService
112 m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to link to {0}", regionName); 112 m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to link to {0}", regionName);
113 if (!m_AllowTeleportsToAnyRegion) 113 if (!m_AllowTeleportsToAnyRegion)
114 { 114 {
115 List<GridRegion> defs = m_GridService.GetDefaultRegions(m_ScopeID);
116 if (defs != null && defs.Count > 0)
117 m_DefaultGatewayRegion = defs[0];
118
115 try 119 try
116 { 120 {
117 regionID = m_DefaultGatewayRegion.RegionID; 121 regionID = m_DefaultGatewayRegion.RegionID;
@@ -150,6 +154,8 @@ namespace OpenSim.Services.HypergridService
150 154
151 public GridRegion GetHyperlinkRegion(UUID regionID) 155 public GridRegion GetHyperlinkRegion(UUID regionID)
152 { 156 {
157 m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to get hyperlink region {0}", regionID);
158
153 if (!m_AllowTeleportsToAnyRegion) 159 if (!m_AllowTeleportsToAnyRegion)
154 // Don't even check the given regionID 160 // Don't even check the given regionID
155 return m_DefaultGatewayRegion; 161 return m_DefaultGatewayRegion;
@@ -160,23 +166,43 @@ namespace OpenSim.Services.HypergridService
160 166
161 public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination) 167 public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination)
162 { 168 {
169 string authURL = string.Empty;
170 if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
171 authURL = aCircuit.ServiceURLs["HomeURI"].ToString();
172
173 m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to login foreign agent {0} {1} @ {2} ({3}) at destination {4}",
174 aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName);
175
163 if (!Authenticate(aCircuit)) 176 if (!Authenticate(aCircuit))
177 {
178 m_log.InfoFormat("[GATEKEEPER SERVICE]: Unable to verify identity of agent {0} {1}. Refusing service.", aCircuit.firstname, aCircuit.lastname);
164 return false; 179 return false;
180 }
165 181
166 // Check to see if we have a local user with that UUID 182 // Check to see if we have a local user with that UUID
167 UserAccount account = m_UserAccountService.GetUserAccount(m_ScopeID, aCircuit.AgentID); 183 UserAccount account = m_UserAccountService.GetUserAccount(m_ScopeID, aCircuit.AgentID);
168 if (account != null) 184 if (account != null)
185 {
169 // No, sorry; go away 186 // No, sorry; go away
187 m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agent {0} {1} has UUID of local user {3}. Refusing service.",
188 aCircuit.firstname, aCircuit.lastname, aCircuit.AgentID);
170 return false; 189 return false;
190 }
171 191
172 // May want to authorize 192 // May want to authorize
173 193
174 // Login the presence 194 // Login the presence
175 if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID)) 195 if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID))
196 {
197 m_log.InfoFormat("[GATEKEEPER SERVICE]: Presence login failed for foreign agent {0} {1}. Refusing service.",
198 aCircuit.firstname, aCircuit.lastname);
176 return false; 199 return false;
200 }
177 201
178 // Finally launch the agent at the destination 202 // Finally launch the agent at the destination
179 string reason = string.Empty; 203 string reason = string.Empty;
204 aCircuit.firstname = aCircuit.firstname + "." + aCircuit.lastname;
205 aCircuit.lastname = "@" + aCircuit.ServiceURLs["HomeURI"].ToString();
180 return m_SimulationService.CreateAgent(destination, aCircuit, 0, out reason); 206 return m_SimulationService.CreateAgent(destination, aCircuit, 0, out reason);
181 } 207 }
182 208
@@ -188,9 +214,15 @@ namespace OpenSim.Services.HypergridService
188 214
189 protected bool Authenticate(AgentCircuitData aCircuit) 215 protected bool Authenticate(AgentCircuitData aCircuit)
190 { 216 {
191 string authURL = string.Empty; // GetAuthURL(aCircuit); 217 string authURL = string.Empty;
218 if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
219 authURL = aCircuit.ServiceURLs["HomeURI"].ToString();
220
192 if (authURL == string.Empty) 221 if (authURL == string.Empty)
222 {
223 m_log.DebugFormat("[GATEKEEPER SERVICE]: Agent did not provide an authentication server URL");
193 return false; 224 return false;
225 }
194 226
195 Object[] args = new Object[] { authURL }; 227 Object[] args = new Object[] { authURL };
196 IAuthenticationService authService = ServerUtils.LoadPlugin<IAuthenticationService>(m_AuthDll, args); 228 IAuthenticationService authService = ServerUtils.LoadPlugin<IAuthenticationService>(m_AuthDll, args);
diff --git a/OpenSim/Services/HypergridService/HypergridService.cs b/OpenSim/Services/HypergridService/HypergridService.cs
index 747b98a..734931d 100644
--- a/OpenSim/Services/HypergridService/HypergridService.cs
+++ b/OpenSim/Services/HypergridService/HypergridService.cs
@@ -347,10 +347,12 @@ namespace OpenSim.Services.HypergridService
347 347
348 #region Get Hyperlinks 348 #region Get Hyperlinks
349 349
350 public GridRegion GetHyperlinkRegion(UUID regionID) 350 public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID)
351 { 351 {
352 //GridRegion region = m_HypergridConnector. 352 if (m_HyperlinkRegions.ContainsKey(regionID))
353 return null; 353 return m_HypergridConnector.GetHyperlinkRegion(gatekeeper, regionID);
354 else
355 return gatekeeper;
354 } 356 }
355 357
356 #endregion 358 #endregion
diff --git a/OpenSim/Services/Interfaces/IHypergridService.cs b/OpenSim/Services/Interfaces/IHypergridService.cs
index b49657a..f2a1983 100644
--- a/OpenSim/Services/Interfaces/IHypergridService.cs
+++ b/OpenSim/Services/Interfaces/IHypergridService.cs
@@ -36,7 +36,7 @@ namespace OpenSim.Services.Interfaces
36 public interface IHypergridService 36 public interface IHypergridService
37 { 37 {
38 bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string imageURL, out string reason); 38 bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string imageURL, out string reason);
39 GridRegion GetHyperlinkRegion(UUID regionID); 39 GridRegion GetHyperlinkRegion(GridRegion gateway, UUID regionID);
40 40
41 GridRegion GetRegionByUUID(UUID regionID); 41 GridRegion GetRegionByUUID(UUID regionID);
42 GridRegion GetRegionByPosition(int x, int y); 42 GridRegion GetRegionByPosition(int x, int y);
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 6f92388..d4f89d9 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -37,24 +37,26 @@ namespace OpenSim.Services.LLLoginService
37 private bool m_RequireInventory; 37 private bool m_RequireInventory;
38 private int m_MinLoginLevel; 38 private int m_MinLoginLevel;
39 39
40 IConfig m_LoginServerConfig;
41
40 public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService) 42 public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService)
41 { 43 {
42 IConfig serverConfig = config.Configs["LoginService"]; 44 m_LoginServerConfig = config.Configs["LoginService"];
43 if (serverConfig == null) 45 if (m_LoginServerConfig == null)
44 throw new Exception(String.Format("No section LoginService in config file")); 46 throw new Exception(String.Format("No section LoginService in config file"));
45 47
46 string accountService = serverConfig.GetString("UserAccountService", String.Empty); 48 string accountService = m_LoginServerConfig.GetString("UserAccountService", String.Empty);
47 string authService = serverConfig.GetString("AuthenticationService", String.Empty); 49 string authService = m_LoginServerConfig.GetString("AuthenticationService", String.Empty);
48 string invService = serverConfig.GetString("InventoryService", String.Empty); 50 string invService = m_LoginServerConfig.GetString("InventoryService", String.Empty);
49 string gridService = serverConfig.GetString("GridService", String.Empty); 51 string gridService = m_LoginServerConfig.GetString("GridService", String.Empty);
50 string presenceService = serverConfig.GetString("PresenceService", String.Empty); 52 string presenceService = m_LoginServerConfig.GetString("PresenceService", String.Empty);
51 string libService = serverConfig.GetString("LibraryService", String.Empty); 53 string libService = m_LoginServerConfig.GetString("LibraryService", String.Empty);
52 string avatarService = serverConfig.GetString("AvatarService", String.Empty); 54 string avatarService = m_LoginServerConfig.GetString("AvatarService", String.Empty);
53 string simulationService = serverConfig.GetString("SimulationService", String.Empty); 55 string simulationService = m_LoginServerConfig.GetString("SimulationService", String.Empty);
54 56
55 m_DefaultRegionName = serverConfig.GetString("DefaultRegion", String.Empty); 57 m_DefaultRegionName = m_LoginServerConfig.GetString("DefaultRegion", String.Empty);
56 m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!"); 58 m_WelcomeMessage = m_LoginServerConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
57 m_RequireInventory = serverConfig.GetBoolean("RequireInventory", true); 59 m_RequireInventory = m_LoginServerConfig.GetBoolean("RequireInventory", true);
58 60
59 // These are required; the others aren't 61 // These are required; the others aren't
60 if (accountService == string.Empty || authService == string.Empty) 62 if (accountService == string.Empty || authService == string.Empty)
@@ -438,7 +440,7 @@ namespace OpenSim.Services.LLLoginService
438 aCircuit.SecureSessionID = secureSession; 440 aCircuit.SecureSessionID = secureSession;
439 aCircuit.SessionID = session; 441 aCircuit.SessionID = session;
440 aCircuit.startpos = position; 442 aCircuit.startpos = position;
441 aCircuit.ServiceURLs = account.ServiceURLs; 443 SetServiceURLs(aCircuit, account);
442 444
443 if (simConnector.CreateAgent(region, aCircuit, 0, out reason)) 445 if (simConnector.CreateAgent(region, aCircuit, 0, out reason))
444 return aCircuit; 446 return aCircuit;
@@ -447,6 +449,25 @@ namespace OpenSim.Services.LLLoginService
447 449
448 } 450 }
449 451
452 private void SetServiceURLs(AgentCircuitData aCircuit, UserAccount account)
453 {
454 aCircuit.ServiceURLs = new Dictionary<string, object>();
455 if (account.ServiceURLs == null)
456 return;
457
458 foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
459 {
460 if (kvp.Value == null || (kvp.Value != null && kvp.Value.ToString() == string.Empty))
461 {
462 aCircuit.ServiceURLs[kvp.Key] = m_LoginServerConfig.GetString(kvp.Key, string.Empty);
463 }
464 else
465 {
466 aCircuit.ServiceURLs[kvp.Key] = kvp.Value;
467 }
468 }
469 }
470
450 #region Console Commands 471 #region Console Commands
451 private void RegisterCommands() 472 private void RegisterCommands()
452 { 473 {