diff options
Diffstat (limited to 'OpenSim/Services/HypergridService')
11 files changed, 409 insertions, 69 deletions
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 8e10125..5c6abd2 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs | |||
@@ -35,8 +35,8 @@ using OpenSim.Framework; | |||
35 | using OpenSim.Services.Interfaces; | 35 | using OpenSim.Services.Interfaces; |
36 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 36 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
37 | using OpenSim.Server.Base; | 37 | using OpenSim.Server.Base; |
38 | using OpenSim.Services.Connectors.InstantMessage; | ||
38 | using OpenSim.Services.Connectors.Hypergrid; | 39 | using OpenSim.Services.Connectors.Hypergrid; |
39 | |||
40 | using OpenMetaverse; | 40 | using OpenMetaverse; |
41 | 41 | ||
42 | using Nini.Config; | 42 | using 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 | { |
@@ -93,7 +94,7 @@ namespace OpenSim.Services.HypergridService | |||
93 | // These are mandatory, the others aren't | 94 | // These are mandatory, the others aren't |
94 | if (gridService == string.Empty || presenceService == string.Empty) | 95 | if (gridService == string.Empty || presenceService == string.Empty) |
95 | throw new Exception("Incomplete specifications, Gatekeeper Service cannot function."); | 96 | throw new Exception("Incomplete specifications, Gatekeeper Service cannot function."); |
96 | 97 | ||
97 | string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString()); | 98 | string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString()); |
98 | UUID.TryParse(scope, out m_ScopeID); | 99 | UUID.TryParse(scope, out m_ScopeID); |
99 | //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!"); | 100 | //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!"); |
@@ -135,7 +136,7 @@ namespace OpenSim.Services.HypergridService | |||
135 | m_AllowedClients = Util.GetConfigVarFromSections<string>( | 136 | m_AllowedClients = Util.GetConfigVarFromSections<string>( |
136 | config, "AllowedClients", possibleAccessControlConfigSections, string.Empty); | 137 | config, "AllowedClients", possibleAccessControlConfigSections, string.Empty); |
137 | m_DeniedClients = Util.GetConfigVarFromSections<string>( | 138 | m_DeniedClients = Util.GetConfigVarFromSections<string>( |
138 | config, "DeniedClients", possibleAccessControlConfigSections, string.Empty); | 139 | config, "DeniedClients", possibleAccessControlConfigSections, string.Empty); |
139 | m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true); | 140 | m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true); |
140 | 141 | ||
141 | LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions); | 142 | LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions); |
@@ -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 | } |
@@ -162,10 +169,12 @@ namespace OpenSim.Services.HypergridService | |||
162 | exceptions.Add(s.Trim()); | 169 | exceptions.Add(s.Trim()); |
163 | } | 170 | } |
164 | 171 | ||
165 | public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason) | 172 | public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason, out int sizeX, out int sizeY) |
166 | { | 173 | { |
167 | regionID = UUID.Zero; | 174 | regionID = UUID.Zero; |
168 | regionHandle = 0; | 175 | regionHandle = 0; |
176 | sizeX = (int)Constants.RegionSize; | ||
177 | sizeY = (int)Constants.RegionSize; | ||
169 | externalName = m_ExternalName + ((regionName != string.Empty) ? " " + regionName : ""); | 178 | externalName = m_ExternalName + ((regionName != string.Empty) ? " " + regionName : ""); |
170 | imageURL = string.Empty; | 179 | imageURL = string.Empty; |
171 | reason = string.Empty; | 180 | reason = string.Empty; |
@@ -199,6 +208,8 @@ namespace OpenSim.Services.HypergridService | |||
199 | 208 | ||
200 | regionID = region.RegionID; | 209 | regionID = region.RegionID; |
201 | regionHandle = region.RegionHandle; | 210 | regionHandle = region.RegionHandle; |
211 | sizeX = region.RegionSizeX; | ||
212 | sizeY = region.RegionSizeY; | ||
202 | 213 | ||
203 | string regionimage = "regionImage" + regionID.ToString(); | 214 | string regionimage = "regionImage" + regionID.ToString(); |
204 | regionimage = regionimage.Replace("-", ""); | 215 | regionimage = regionimage.Replace("-", ""); |
@@ -215,11 +226,11 @@ namespace OpenSim.Services.HypergridService | |||
215 | { | 226 | { |
216 | // Don't even check the given regionID | 227 | // Don't even check the given regionID |
217 | m_log.DebugFormat( | 228 | m_log.DebugFormat( |
218 | "[GATEKEEPER SERVICE]: Returning gateway region {0} {1} @ {2} to user {3}{4} as teleporting to arbitrary regions is not allowed.", | 229 | "[GATEKEEPER SERVICE]: Returning gateway region {0} {1} @ {2} to user {3}{4} as teleporting to arbitrary regions is not allowed.", |
219 | m_DefaultGatewayRegion.RegionName, | 230 | m_DefaultGatewayRegion.RegionName, |
220 | m_DefaultGatewayRegion.RegionID, | 231 | m_DefaultGatewayRegion.RegionID, |
221 | m_DefaultGatewayRegion.ServerURI, | 232 | m_DefaultGatewayRegion.ServerURI, |
222 | agentID, | 233 | agentID, |
223 | agentHomeURI == null ? "" : " @ " + agentHomeURI); | 234 | agentHomeURI == null ? "" : " @ " + agentHomeURI); |
224 | 235 | ||
225 | message = "Teleporting to the default region."; | 236 | message = "Teleporting to the default region."; |
@@ -240,10 +251,10 @@ namespace OpenSim.Services.HypergridService | |||
240 | 251 | ||
241 | m_log.DebugFormat( | 252 | m_log.DebugFormat( |
242 | "[GATEKEEPER SERVICE]: Returning region {0} {1} @ {2} to user {3}{4}.", | 253 | "[GATEKEEPER SERVICE]: Returning region {0} {1} @ {2} to user {3}{4}.", |
243 | region.RegionName, | 254 | region.RegionName, |
244 | region.RegionID, | 255 | region.RegionID, |
245 | region.ServerURI, | 256 | region.ServerURI, |
246 | agentID, | 257 | agentID, |
247 | agentHomeURI == null ? "" : " @ " + agentHomeURI); | 258 | agentHomeURI == null ? "" : " @ " + agentHomeURI); |
248 | 259 | ||
249 | return region; | 260 | return region; |
@@ -275,6 +286,7 @@ namespace OpenSim.Services.HypergridService | |||
275 | 286 | ||
276 | if (!am.Success) | 287 | if (!am.Success) |
277 | { | 288 | { |
289 | reason = "Login failed: client " + curViewer + " is not allowed"; | ||
278 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: client {0} is not allowed", curViewer); | 290 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: client {0} is not allowed", curViewer); |
279 | return false; | 291 | return false; |
280 | } | 292 | } |
@@ -287,6 +299,7 @@ namespace OpenSim.Services.HypergridService | |||
287 | 299 | ||
288 | if (dm.Success) | 300 | if (dm.Success) |
289 | { | 301 | { |
302 | reason = "Login failed: client " + curViewer + " is denied"; | ||
290 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: client {0} is denied", curViewer); | 303 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: client {0} is denied", curViewer); |
291 | return false; | 304 | return false; |
292 | } | 305 | } |
@@ -302,7 +315,7 @@ namespace OpenSim.Services.HypergridService | |||
302 | return false; | 315 | return false; |
303 | } | 316 | } |
304 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Identity verified for {0} {1} @ {2}", aCircuit.firstname, aCircuit.lastname, authURL); | 317 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Identity verified for {0} {1} @ {2}", aCircuit.firstname, aCircuit.lastname, authURL); |
305 | 318 | ||
306 | // | 319 | // |
307 | // Check for impersonations | 320 | // Check for impersonations |
308 | // | 321 | // |
@@ -363,6 +376,38 @@ namespace OpenSim.Services.HypergridService | |||
363 | return false; | 376 | return false; |
364 | } | 377 | } |
365 | 378 | ||
379 | UUID agentID = aCircuit.AgentID; | ||
380 | if(agentID == new UUID("6571e388-6218-4574-87db-f9379718315e")) | ||
381 | { | ||
382 | // really? | ||
383 | reason = "Invalid account ID"; | ||
384 | return false; | ||
385 | } | ||
386 | |||
387 | if(m_GridUserService != null) | ||
388 | { | ||
389 | string PrincipalIDstr = agentID.ToString(); | ||
390 | GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(PrincipalIDstr); | ||
391 | |||
392 | if(!m_allowDuplicatePresences) | ||
393 | { | ||
394 | if(guinfo != null && guinfo.Online && guinfo.LastRegionID != UUID.Zero) | ||
395 | { | ||
396 | if(SendAgentGodKillToRegion(UUID.Zero, agentID, guinfo)) | ||
397 | { | ||
398 | if(account != null) | ||
399 | m_log.InfoFormat( | ||
400 | "[GATEKEEPER SERVICE]: Login failed for {0} {1}, reason: already logged in", | ||
401 | account.FirstName, account.LastName); | ||
402 | reason = "You appear to be already logged in on the destination grid " + | ||
403 | "Please wait a a minute or two and retry. " + | ||
404 | "If this takes longer than a few minutes please contact the grid owner."; | ||
405 | return false; | ||
406 | } | ||
407 | } | ||
408 | } | ||
409 | } | ||
410 | |||
366 | m_log.DebugFormat("[GATEKEEPER SERVICE]: User {0} is ok", aCircuit.Name); | 411 | m_log.DebugFormat("[GATEKEEPER SERVICE]: User {0} is ok", aCircuit.Name); |
367 | 412 | ||
368 | bool isFirstLogin = false; | 413 | bool isFirstLogin = false; |
@@ -383,26 +428,6 @@ namespace OpenSim.Services.HypergridService | |||
383 | return false; | 428 | return false; |
384 | } | 429 | } |
385 | 430 | ||
386 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence {0} is ok", aCircuit.Name); | ||
387 | |||
388 | // Also login foreigners with GridUser service | ||
389 | if (m_GridUserService != null && account == null) | ||
390 | { | ||
391 | string userId = aCircuit.AgentID.ToString(); | ||
392 | string first = aCircuit.firstname, last = aCircuit.lastname; | ||
393 | if (last.StartsWith("@")) | ||
394 | { | ||
395 | string[] parts = aCircuit.firstname.Split('.'); | ||
396 | if (parts.Length >= 2) | ||
397 | { | ||
398 | first = parts[0]; | ||
399 | last = parts[1]; | ||
400 | } | ||
401 | } | ||
402 | |||
403 | userId += ";" + aCircuit.ServiceURLs["HomeURI"] + ";" + first + " " + last; | ||
404 | m_GridUserService.LoggedIn(userId); | ||
405 | } | ||
406 | } | 431 | } |
407 | 432 | ||
408 | // | 433 | // |
@@ -455,11 +480,37 @@ namespace OpenSim.Services.HypergridService | |||
455 | EntityTransferContext ctx = new EntityTransferContext(); | 480 | EntityTransferContext ctx = new EntityTransferContext(); |
456 | 481 | ||
457 | if (!m_SimulationService.QueryAccess( | 482 | if (!m_SimulationService.QueryAccess( |
458 | destination, aCircuit.AgentID, aCircuit.ServiceURLs["HomeURI"].ToString(), | 483 | destination, aCircuit.AgentID, aCircuit.ServiceURLs["HomeURI"].ToString(), |
459 | true, aCircuit.startpos, new List<UUID>(), ctx, out reason)) | 484 | true, aCircuit.startpos, new List<UUID>(), ctx, out reason)) |
460 | return false; | 485 | return false; |
461 | 486 | ||
462 | return m_SimulationService.CreateAgent(source, destination, aCircuit, (uint)loginFlag, out reason); | 487 | bool didit = m_SimulationService.CreateAgent(source, destination, aCircuit, (uint)loginFlag, ctx, out reason); |
488 | |||
489 | if(didit) | ||
490 | { | ||
491 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence {0} is ok", aCircuit.Name); | ||
492 | |||
493 | if(!isFirstLogin && m_GridUserService != null && account == null) | ||
494 | { | ||
495 | // Also login foreigners with GridUser service | ||
496 | string userId = aCircuit.AgentID.ToString(); | ||
497 | string first = aCircuit.firstname, last = aCircuit.lastname; | ||
498 | if (last.StartsWith("@")) | ||
499 | { | ||
500 | string[] parts = aCircuit.firstname.Split('.'); | ||
501 | if (parts.Length >= 2) | ||
502 | { | ||
503 | first = parts[0]; | ||
504 | last = parts[1]; | ||
505 | } | ||
506 | } | ||
507 | |||
508 | userId += ";" + aCircuit.ServiceURLs["HomeURI"] + ";" + first + " " + last; | ||
509 | m_GridUserService.LoggedIn(userId); | ||
510 | } | ||
511 | } | ||
512 | |||
513 | return didit; | ||
463 | } | 514 | } |
464 | 515 | ||
465 | protected bool Authenticate(AgentCircuitData aCircuit) | 516 | protected bool Authenticate(AgentCircuitData aCircuit) |
@@ -489,7 +540,7 @@ namespace OpenSim.Services.HypergridService | |||
489 | } | 540 | } |
490 | else | 541 | else |
491 | { | 542 | { |
492 | IUserAgentService userAgentService = new UserAgentServiceConnector(userURL); | 543 | IUserAgentService userAgentService = new UserAgentServiceConnector(userURL); |
493 | 544 | ||
494 | try | 545 | try |
495 | { | 546 | { |
@@ -557,6 +608,40 @@ namespace OpenSim.Services.HypergridService | |||
557 | return exception; | 608 | return exception; |
558 | } | 609 | } |
559 | 610 | ||
611 | private bool SendAgentGodKillToRegion(UUID scopeID, UUID agentID , GridUserInfo guinfo) | ||
612 | { | ||
613 | UUID regionID = guinfo.LastRegionID; | ||
614 | GridRegion regInfo = m_GridService.GetRegionByUUID(scopeID, regionID); | ||
615 | if(regInfo == null) | ||
616 | return false; | ||
617 | |||
618 | string regURL = regInfo.ServerURI; | ||
619 | if(String.IsNullOrEmpty(regURL)) | ||
620 | return false; | ||
621 | |||
622 | UUID guuid = new UUID("6571e388-6218-4574-87db-f9379718315e"); | ||
623 | |||
624 | GridInstantMessage msg = new GridInstantMessage(); | ||
625 | msg.imSessionID = UUID.Zero.Guid; | ||
626 | msg.fromAgentID = guuid.Guid; | ||
627 | msg.toAgentID = agentID.Guid; | ||
628 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); | ||
629 | msg.fromAgentName = "GRID"; | ||
630 | msg.message = string.Format("New login detected"); | ||
631 | msg.dialog = 250; // God kick | ||
632 | msg.fromGroup = false; | ||
633 | msg.offline = (byte)0; | ||
634 | msg.ParentEstateID = 0; | ||
635 | msg.Position = Vector3.Zero; | ||
636 | msg.RegionID = scopeID.Guid; | ||
637 | msg.binaryBucket = new byte[1] {0}; | ||
638 | InstantMessageServiceConnector.SendInstantMessage(regURL,msg); | ||
639 | |||
640 | m_GridUserService.LoggedOut(agentID.ToString(), | ||
641 | UUID.Zero, guinfo.LastRegionID, guinfo.LastPosition, guinfo.LastLookAt); | ||
642 | |||
643 | return true; | ||
644 | } | ||
560 | #endregion | 645 | #endregion |
561 | } | 646 | } |
562 | } | 647 | } |
diff --git a/OpenSim/Services/HypergridService/HGAssetService.cs b/OpenSim/Services/HypergridService/HGAssetService.cs index b83fb1e..a66478e 100644 --- a/OpenSim/Services/HypergridService/HGAssetService.cs +++ b/OpenSim/Services/HypergridService/HGAssetService.cs | |||
@@ -164,7 +164,7 @@ namespace OpenSim.Services.HypergridService | |||
164 | return false; | 164 | return false; |
165 | } | 165 | } |
166 | 166 | ||
167 | #endregion | 167 | #endregion |
168 | 168 | ||
169 | protected void AdjustIdentifiers(AssetMetadata meta) | 169 | protected void AdjustIdentifiers(AssetMetadata meta) |
170 | { | 170 | { |
diff --git a/OpenSim/Services/HypergridService/HGFSAssetService.cs b/OpenSim/Services/HypergridService/HGFSAssetService.cs index 54e8ccb..2b30b3a 100644 --- a/OpenSim/Services/HypergridService/HGFSAssetService.cs +++ b/OpenSim/Services/HypergridService/HGFSAssetService.cs | |||
@@ -160,7 +160,7 @@ namespace OpenSim.Services.HypergridService | |||
160 | return false; | 160 | return false; |
161 | } | 161 | } |
162 | 162 | ||
163 | #endregion | 163 | #endregion |
164 | 164 | ||
165 | protected void AdjustIdentifiers(AssetMetadata meta) | 165 | protected void AdjustIdentifiers(AssetMetadata meta) |
166 | { | 166 | { |
diff --git a/OpenSim/Services/HypergridService/HGFriendsService.cs b/OpenSim/Services/HypergridService/HGFriendsService.cs index 6e35a88..d3b4f18 100644 --- a/OpenSim/Services/HypergridService/HGFriendsService.cs +++ b/OpenSim/Services/HypergridService/HGFriendsService.cs | |||
@@ -227,7 +227,7 @@ namespace OpenSim.Services.HypergridService | |||
227 | 227 | ||
228 | List<UUID> localFriendsOnline = new List<UUID>(); | 228 | List<UUID> localFriendsOnline = new List<UUID>(); |
229 | 229 | ||
230 | m_log.DebugFormat("[HGFRIENDS SERVICE]: Status notification: foreign user {0} wants to notify {1} local friends of {2} status", | 230 | m_log.DebugFormat("[HGFRIENDS SERVICE]: Status notification: foreign user {0} wants to notify {1} local friends of {2} status", |
231 | foreignUserID, friends.Count, (online ? "online" : "offline")); | 231 | foreignUserID, friends.Count, (online ? "online" : "offline")); |
232 | 232 | ||
233 | // First, let's double check that the reported friends are, indeed, friends of that user | 233 | // First, let's double check that the reported friends are, indeed, friends of that user |
diff --git a/OpenSim/Services/HypergridService/HGInstantMessageService.cs b/OpenSim/Services/HypergridService/HGInstantMessageService.cs index 32ca09a..d1739cf 100644 --- a/OpenSim/Services/HypergridService/HGInstantMessageService.cs +++ b/OpenSim/Services/HypergridService/HGInstantMessageService.cs | |||
@@ -184,7 +184,7 @@ namespace OpenSim.Services.HypergridService | |||
184 | else if (o is string) | 184 | else if (o is string) |
185 | url = (string)o; | 185 | url = (string)o; |
186 | 186 | ||
187 | // We need to compare the current location with the previous | 187 | // We need to compare the current location with the previous |
188 | // or the recursive loop will never end because it will never try to lookup the agent again | 188 | // or the recursive loop will never end because it will never try to lookup the agent again |
189 | if (!firstTime) | 189 | if (!firstTime) |
190 | { | 190 | { |
diff --git a/OpenSim/Services/HypergridService/HGInventoryService.cs b/OpenSim/Services/HypergridService/HGInventoryService.cs index 9158b41..f14593e 100644 --- a/OpenSim/Services/HypergridService/HGInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGInventoryService.cs | |||
@@ -70,7 +70,7 @@ namespace OpenSim.Services.HypergridService | |||
70 | // | 70 | // |
71 | IConfig invConfig = config.Configs[m_ConfigName]; | 71 | IConfig invConfig = config.Configs[m_ConfigName]; |
72 | if (invConfig != null) | 72 | if (invConfig != null) |
73 | { | 73 | { |
74 | // realm = authConfig.GetString("Realm", realm); | 74 | // realm = authConfig.GetString("Realm", realm); |
75 | string userAccountsDll = invConfig.GetString("UserAccountsService", string.Empty); | 75 | string userAccountsDll = invConfig.GetString("UserAccountsService", string.Empty); |
76 | if (userAccountsDll == string.Empty) | 76 | if (userAccountsDll == string.Empty) |
@@ -82,7 +82,7 @@ namespace OpenSim.Services.HypergridService | |||
82 | throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); | 82 | throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); |
83 | 83 | ||
84 | m_HomeURL = Util.GetConfigVarFromSections<string>(config, "HomeURI", | 84 | m_HomeURL = Util.GetConfigVarFromSections<string>(config, "HomeURI", |
85 | new string[] { "Startup", "Hypergrid", m_ConfigName }, String.Empty); | 85 | new string[] { "Startup", "Hypergrid", m_ConfigName }, String.Empty); |
86 | 86 | ||
87 | m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); | 87 | m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); |
88 | } | 88 | } |
@@ -113,7 +113,7 @@ namespace OpenSim.Services.HypergridService | |||
113 | 113 | ||
114 | if (folders.Length > 0) | 114 | if (folders.Length > 0) |
115 | return ConvertToOpenSim(folders[0]); | 115 | return ConvertToOpenSim(folders[0]); |
116 | 116 | ||
117 | // make one | 117 | // make one |
118 | XInventoryFolder suitcase = CreateFolder(principalID, UUID.Zero, (int)FolderType.Suitcase, "My Suitcase"); | 118 | XInventoryFolder suitcase = CreateFolder(principalID, UUID.Zero, (int)FolderType.Suitcase, "My Suitcase"); |
119 | return ConvertToOpenSim(suitcase); | 119 | return ConvertToOpenSim(suitcase); |
@@ -160,7 +160,7 @@ namespace OpenSim.Services.HypergridService | |||
160 | { | 160 | { |
161 | return new InventoryCollection[0]; | 161 | return new InventoryCollection[0]; |
162 | } | 162 | } |
163 | 163 | ||
164 | //public List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID) | 164 | //public List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID) |
165 | //{ | 165 | //{ |
166 | //} | 166 | //} |
@@ -291,9 +291,9 @@ namespace OpenSim.Services.HypergridService | |||
291 | //{ | 291 | //{ |
292 | //} | 292 | //} |
293 | 293 | ||
294 | public override InventoryItemBase GetItem(InventoryItemBase item) | 294 | public override InventoryItemBase GetItem(UUID principalID, UUID itemID) |
295 | { | 295 | { |
296 | InventoryItemBase it = base.GetItem(item); | 296 | InventoryItemBase it = base.GetItem(principalID, itemID); |
297 | if (it != null) | 297 | if (it != null) |
298 | { | 298 | { |
299 | UserAccount user = m_Cache.GetUser(it.CreatorId); | 299 | UserAccount user = m_Cache.GetUser(it.CreatorId); |
diff --git a/OpenSim/Services/HypergridService/HGRemoteAssetService.cs b/OpenSim/Services/HypergridService/HGRemoteAssetService.cs new file mode 100644 index 0000000..5e98af9 --- /dev/null +++ b/OpenSim/Services/HypergridService/HGRemoteAssetService.cs | |||
@@ -0,0 +1,240 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using System.IO; | ||
30 | using System.Reflection; | ||
31 | using System.Xml; | ||
32 | |||
33 | using Nini.Config; | ||
34 | using log4net; | ||
35 | using OpenMetaverse; | ||
36 | |||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Serialization.External; | ||
39 | using OpenSim.Server.Base; | ||
40 | using OpenSim.Services.Interfaces; | ||
41 | using OpenSim.Services.AssetService; | ||
42 | |||
43 | namespace OpenSim.Services.HypergridService | ||
44 | { | ||
45 | /// <summary> | ||
46 | /// Hypergrid asset service. It serves the IAssetService interface, | ||
47 | /// but implements it in ways that are appropriate for inter-grid | ||
48 | /// asset exchanges. | ||
49 | /// </summary> | ||
50 | public class HGRemoteAssetService : IAssetService | ||
51 | { | ||
52 | private static readonly ILog m_log = | ||
53 | LogManager.GetLogger( | ||
54 | MethodBase.GetCurrentMethod().DeclaringType); | ||
55 | |||
56 | private string m_HomeURL; | ||
57 | private IUserAccountService m_UserAccountService; | ||
58 | private IAssetService m_assetConnector; | ||
59 | |||
60 | private UserAccountCache m_Cache; | ||
61 | |||
62 | private AssetPermissions m_AssetPerms; | ||
63 | |||
64 | public HGRemoteAssetService(IConfigSource config, string configName) | ||
65 | { | ||
66 | m_log.Debug("[HGRemoteAsset Service]: Starting"); | ||
67 | IConfig assetConfig = config.Configs[configName]; | ||
68 | if (assetConfig == null) | ||
69 | throw new Exception("No HGAssetService configuration"); | ||
70 | |||
71 | Object[] args = new Object[] { config }; | ||
72 | |||
73 | string assetConnectorDll = assetConfig.GetString("AssetConnector", String.Empty); | ||
74 | if (assetConnectorDll == String.Empty) | ||
75 | throw new Exception("Please specify AssetConnector in HGAssetService configuration"); | ||
76 | |||
77 | m_assetConnector = ServerUtils.LoadPlugin<IAssetService>(assetConnectorDll, args); | ||
78 | if (m_assetConnector == null) | ||
79 | throw new Exception(String.Format("Unable to create AssetConnector from {0}", assetConnectorDll)); | ||
80 | |||
81 | string userAccountsDll = assetConfig.GetString("UserAccountsService", string.Empty); | ||
82 | if (userAccountsDll == string.Empty) | ||
83 | throw new Exception("Please specify UserAccountsService in HGAssetService configuration"); | ||
84 | |||
85 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userAccountsDll, args); | ||
86 | if (m_UserAccountService == null) | ||
87 | throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); | ||
88 | |||
89 | m_HomeURL = Util.GetConfigVarFromSections<string>(config, "HomeURI", | ||
90 | new string[] { "Startup", "Hypergrid", configName }, string.Empty); | ||
91 | if (m_HomeURL == string.Empty) | ||
92 | throw new Exception("[HGAssetService] No HomeURI specified"); | ||
93 | |||
94 | m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); | ||
95 | |||
96 | // Permissions | ||
97 | m_AssetPerms = new AssetPermissions(assetConfig); | ||
98 | |||
99 | } | ||
100 | |||
101 | #region IAssetService overrides | ||
102 | public AssetBase Get(string id) | ||
103 | { | ||
104 | AssetBase asset = m_assetConnector.Get(id); | ||
105 | |||
106 | if (asset == null) | ||
107 | return null; | ||
108 | |||
109 | if (!m_AssetPerms.AllowedExport(asset.Type)) | ||
110 | return null; | ||
111 | |||
112 | if (asset.Metadata.Type == (sbyte)AssetType.Object) | ||
113 | asset.Data = AdjustIdentifiers(asset.Data); | ||
114 | |||
115 | AdjustIdentifiers(asset.Metadata); | ||
116 | |||
117 | return asset; | ||
118 | } | ||
119 | |||
120 | public AssetMetadata GetMetadata(string id) | ||
121 | { | ||
122 | AssetMetadata meta = m_assetConnector.GetMetadata(id); | ||
123 | |||
124 | if (meta == null) | ||
125 | return null; | ||
126 | |||
127 | AdjustIdentifiers(meta); | ||
128 | |||
129 | return meta; | ||
130 | } | ||
131 | |||
132 | public byte[] GetData(string id) | ||
133 | { | ||
134 | AssetBase asset = Get(id); | ||
135 | |||
136 | if (asset == null) | ||
137 | return null; | ||
138 | |||
139 | if (!m_AssetPerms.AllowedExport(asset.Type)) | ||
140 | return null; | ||
141 | |||
142 | // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) | ||
143 | // Fix bad assets before sending them elsewhere | ||
144 | if (asset.Type == (int)AssetType.Object && asset.Data != null) | ||
145 | { | ||
146 | string xml = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(asset.Data)); | ||
147 | asset.Data = Utils.StringToBytes(xml); | ||
148 | } | ||
149 | |||
150 | return asset.Data; | ||
151 | } | ||
152 | |||
153 | // public delegate void AssetRetrieved(string id, Object sender, AssetBase asset); | ||
154 | public virtual bool Get(string id, Object sender, AssetRetrieved handler) | ||
155 | { | ||
156 | return m_assetConnector.Get(id, sender, (i, s, asset) => | ||
157 | { | ||
158 | if (asset != null) | ||
159 | { | ||
160 | if (!m_AssetPerms.AllowedExport(asset.Type)) | ||
161 | { | ||
162 | asset = null; | ||
163 | } | ||
164 | else | ||
165 | { | ||
166 | if (asset.Metadata.Type == (sbyte)AssetType.Object) | ||
167 | asset.Data = AdjustIdentifiers(asset.Data); | ||
168 | |||
169 | AdjustIdentifiers(asset.Metadata); | ||
170 | } | ||
171 | } | ||
172 | |||
173 | handler(i, s, asset); | ||
174 | }); | ||
175 | } | ||
176 | |||
177 | public string Store(AssetBase asset) | ||
178 | { | ||
179 | if (!m_AssetPerms.AllowedImport(asset.Type)) | ||
180 | return string.Empty; | ||
181 | |||
182 | // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) | ||
183 | // Fix bad assets before storing on this server | ||
184 | if (asset.Type == (int)AssetType.Object && asset.Data != null) | ||
185 | { | ||
186 | string xml = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(asset.Data)); | ||
187 | asset.Data = Utils.StringToBytes(xml); | ||
188 | } | ||
189 | |||
190 | return m_assetConnector.Store(asset); | ||
191 | } | ||
192 | |||
193 | public bool Delete(string id) | ||
194 | { | ||
195 | // NOGO | ||
196 | return false; | ||
197 | } | ||
198 | |||
199 | #endregion | ||
200 | |||
201 | protected void AdjustIdentifiers(AssetMetadata meta) | ||
202 | { | ||
203 | if (meta == null || m_Cache == null) | ||
204 | return; | ||
205 | |||
206 | UserAccount creator = m_Cache.GetUser(meta.CreatorID); | ||
207 | if (creator != null) | ||
208 | meta.CreatorID = meta.CreatorID + ";" + m_HomeURL + "/" + creator.FirstName + " " + creator.LastName; | ||
209 | } | ||
210 | |||
211 | // Only for Object | ||
212 | protected byte[] AdjustIdentifiers(byte[] data) | ||
213 | { | ||
214 | string xml = Utils.BytesToString(data); | ||
215 | |||
216 | // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) | ||
217 | // Fix bad assets before sending them elsewhere | ||
218 | xml = ExternalRepresentationUtils.SanitizeXml(xml); | ||
219 | |||
220 | return Utils.StringToBytes(ExternalRepresentationUtils.RewriteSOP(xml, "HGAssetService", m_HomeURL, m_Cache, UUID.Zero)); | ||
221 | } | ||
222 | |||
223 | public AssetBase GetCached(string id) | ||
224 | { | ||
225 | return Get(id); | ||
226 | } | ||
227 | |||
228 | public bool[] AssetsExist(string[] ids) | ||
229 | { | ||
230 | return m_assetConnector.AssetsExist(ids); | ||
231 | } | ||
232 | |||
233 | public bool UpdateContent(string id, byte[] data) | ||
234 | { | ||
235 | // SO not happening!! | ||
236 | return false; | ||
237 | } | ||
238 | } | ||
239 | |||
240 | } | ||
diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index 40eb6d4..d1f2e70 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs | |||
@@ -97,7 +97,7 @@ namespace OpenSim.Services.HypergridService | |||
97 | throw new Exception(String.Format("Unable to create m_AvatarService from {0}", avatarDll)); | 97 | throw new Exception(String.Format("Unable to create m_AvatarService from {0}", avatarDll)); |
98 | 98 | ||
99 | // m_HomeURL = Util.GetConfigVarFromSections<string>(config, "HomeURI", | 99 | // m_HomeURL = Util.GetConfigVarFromSections<string>(config, "HomeURI", |
100 | // new string[] { "Startup", "Hypergrid", m_ConfigName }, String.Empty); | 100 | // new string[] { "Startup", "Hypergrid", m_ConfigName }, String.Empty); |
101 | 101 | ||
102 | // m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); | 102 | // m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); |
103 | } | 103 | } |
@@ -318,7 +318,7 @@ namespace OpenSim.Services.HypergridService | |||
318 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} (user {1}) is not within Suitcase tree", folder.ID, folder.Owner); | 318 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} (user {1}) is not within Suitcase tree", folder.ID, folder.Owner); |
319 | return false; | 319 | return false; |
320 | } | 320 | } |
321 | 321 | ||
322 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) | 322 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) |
323 | { | 323 | { |
324 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} (user {1}) is not within Suitcase tree", folder.ParentID, folder.Owner); | 324 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} (user {1}) is not within Suitcase tree", folder.ParentID, folder.Owner); |
@@ -383,7 +383,7 @@ namespace OpenSim.Services.HypergridService | |||
383 | // Check the items' current folders | 383 | // Check the items' current folders |
384 | foreach (InventoryItemBase item in items) | 384 | foreach (InventoryItemBase item in items) |
385 | { | 385 | { |
386 | InventoryItemBase originalItem = base.GetItem(item); | 386 | InventoryItemBase originalItem = base.GetItem(item.Owner, item.ID); |
387 | if (!IsWithinSuitcaseTree(originalItem.Owner, originalItem.Folder)) | 387 | if (!IsWithinSuitcaseTree(originalItem.Owner, originalItem.Folder)) |
388 | { | 388 | { |
389 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner); | 389 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner); |
@@ -401,7 +401,7 @@ namespace OpenSim.Services.HypergridService | |||
401 | 401 | ||
402 | public new InventoryItemBase GetItem(InventoryItemBase item) | 402 | public new InventoryItemBase GetItem(InventoryItemBase item) |
403 | { | 403 | { |
404 | InventoryItemBase it = base.GetItem(item); | 404 | InventoryItemBase it = base.GetItem(item.Owner, item.ID); |
405 | if (it == null) | 405 | if (it == null) |
406 | { | 406 | { |
407 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to retrieve item {0} ({1}) in folder {2}", | 407 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to retrieve item {0} ({1}) in folder {2}", |
@@ -426,9 +426,9 @@ namespace OpenSim.Services.HypergridService | |||
426 | return it; | 426 | return it; |
427 | } | 427 | } |
428 | 428 | ||
429 | public new InventoryFolderBase GetFolder(InventoryFolderBase folder) | 429 | public new InventoryFolderBase GetFolder(UUID principalID, UUID folderID) |
430 | { | 430 | { |
431 | InventoryFolderBase f = base.GetFolder(folder); | 431 | InventoryFolderBase f = base.GetFolder(principalID, folderID); |
432 | 432 | ||
433 | if (f != null) | 433 | if (f != null) |
434 | { | 434 | { |
@@ -505,11 +505,11 @@ namespace OpenSim.Services.HypergridService | |||
505 | // Warp! Root folder for travelers | 505 | // Warp! Root folder for travelers |
506 | XInventoryFolder[] folders = m_Database.GetFolders( | 506 | XInventoryFolder[] folders = m_Database.GetFolders( |
507 | new string[] { "agentID", "type" }, | 507 | new string[] { "agentID", "type" }, |
508 | new string[] { principalID.ToString(), ((int)FolderType.Suitcase).ToString() }); | 508 | new string[] { principalID.ToString(), ((int)FolderType.Suitcase).ToString() }); |
509 | 509 | ||
510 | if (folders != null && folders.Length > 0) | 510 | if (folders != null && folders.Length > 0) |
511 | return folders[0]; | 511 | return folders[0]; |
512 | 512 | ||
513 | // check to see if we have the old Suitcase folder | 513 | // check to see if we have the old Suitcase folder |
514 | folders = m_Database.GetFolders( | 514 | folders = m_Database.GetFolders( |
515 | new string[] { "agentID", "folderName", "parentFolderID" }, | 515 | new string[] { "agentID", "folderName", "parentFolderID" }, |
@@ -629,7 +629,7 @@ namespace OpenSim.Services.HypergridService | |||
629 | { | 629 | { |
630 | if (a.Wearables[i][j].ItemID == itemID) | 630 | if (a.Wearables[i][j].ItemID == itemID) |
631 | { | 631 | { |
632 | //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: item {0} is a wearable", itemID); | 632 | //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: item {0} is a wearable", itemID); |
633 | return true; | 633 | return true; |
634 | } | 634 | } |
635 | } | 635 | } |
@@ -638,7 +638,7 @@ namespace OpenSim.Services.HypergridService | |||
638 | // Check attachments | 638 | // Check attachments |
639 | if (a.GetAttachmentForItem(itemID) != null) | 639 | if (a.GetAttachmentForItem(itemID) != null) |
640 | { | 640 | { |
641 | //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: item {0} is an attachment", itemID); | 641 | //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: item {0} is an attachment", itemID); |
642 | return true; | 642 | return true; |
643 | } | 643 | } |
644 | 644 | ||
diff --git a/OpenSim/Services/HypergridService/Properties/AssemblyInfo.cs b/OpenSim/Services/HypergridService/Properties/AssemblyInfo.cs index 9999237..31b9f4e 100644 --- a/OpenSim/Services/HypergridService/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/HypergridService/Properties/AssemblyInfo.cs | |||
@@ -2,7 +2,7 @@ | |||
2 | using System.Runtime.CompilerServices; | 2 | using System.Runtime.CompilerServices; |
3 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
4 | 4 | ||
5 | // General Information about an assembly is controlled through the following | 5 | // General Information about an assembly is controlled through the following |
6 | // set of attributes. Change these attribute values to modify the information | 6 | // set of attributes. Change these attribute values to modify the information |
7 | // associated with an assembly. | 7 | // associated with an assembly. |
8 | [assembly: AssemblyTitle("OpenSim.Services.HypergridService")] | 8 | [assembly: AssemblyTitle("OpenSim.Services.HypergridService")] |
@@ -14,8 +14,8 @@ using System.Runtime.InteropServices; | |||
14 | [assembly: AssemblyTrademark("")] | 14 | [assembly: AssemblyTrademark("")] |
15 | [assembly: AssemblyCulture("")] | 15 | [assembly: AssemblyCulture("")] |
16 | 16 | ||
17 | // Setting ComVisible to false makes the types in this assembly not visible | 17 | // Setting ComVisible to false makes the types in this assembly not visible |
18 | // to COM components. If you need to access a type in this assembly from | 18 | // to COM components. If you need to access a type in this assembly from |
19 | // COM, set the ComVisible attribute to true on that type. | 19 | // COM, set the ComVisible attribute to true on that type. |
20 | [assembly: ComVisible(false)] | 20 | [assembly: ComVisible(false)] |
21 | 21 | ||
@@ -25,9 +25,9 @@ using System.Runtime.InteropServices; | |||
25 | // Version information for an assembly consists of the following four values: | 25 | // Version information for an assembly consists of the following four values: |
26 | // | 26 | // |
27 | // Major Version | 27 | // Major Version |
28 | // Minor Version | 28 | // Minor Version |
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.8.3.*")] | 32 | [assembly: AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)] |
33 | 33 | ||
diff --git a/OpenSim/Services/HypergridService/UserAccountCache.cs b/OpenSim/Services/HypergridService/UserAccountCache.cs index fa7dd0b..ae0f7ce 100644 --- a/OpenSim/Services/HypergridService/UserAccountCache.cs +++ b/OpenSim/Services/HypergridService/UserAccountCache.cs | |||
@@ -16,7 +16,7 @@ namespace OpenSim.Services.HypergridService | |||
16 | // private static readonly ILog m_log = | 16 | // private static readonly ILog m_log = |
17 | // LogManager.GetLogger( | 17 | // LogManager.GetLogger( |
18 | // MethodBase.GetCurrentMethod().DeclaringType); | 18 | // MethodBase.GetCurrentMethod().DeclaringType); |
19 | 19 | ||
20 | private ExpiringCache<UUID, UserAccount> m_UUIDCache; | 20 | private ExpiringCache<UUID, UserAccount> m_UUIDCache; |
21 | 21 | ||
22 | private IUserAccountService m_UserAccountService; | 22 | private IUserAccountService m_UserAccountService; |
@@ -90,11 +90,21 @@ namespace OpenSim.Services.HypergridService | |||
90 | return null; | 90 | return null; |
91 | } | 91 | } |
92 | 92 | ||
93 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query) | ||
94 | { | ||
95 | return null; | ||
96 | } | ||
97 | |||
93 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) | 98 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) |
94 | { | 99 | { |
95 | return null; | 100 | return null; |
96 | } | 101 | } |
97 | 102 | ||
103 | public List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs) | ||
104 | { | ||
105 | return null; | ||
106 | } | ||
107 | |||
98 | public void InvalidateCache(UUID userID) | 108 | public void InvalidateCache(UUID userID) |
99 | { | 109 | { |
100 | m_UUIDCache.Remove(userID); | 110 | m_UUIDCache.Remove(userID); |
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index c65122a..6f2cdd5 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs | |||
@@ -219,7 +219,7 @@ namespace OpenSim.Services.HypergridService | |||
219 | 219 | ||
220 | public bool LoginAgentToGrid(GridRegion source, AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, bool fromLogin, out string reason) | 220 | public bool LoginAgentToGrid(GridRegion source, AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, bool fromLogin, out string reason) |
221 | { | 221 | { |
222 | m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", | 222 | m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", |
223 | agentCircuit.firstname, agentCircuit.lastname, (fromLogin ? agentCircuit.IPAddress : "stored IP"), gatekeeper.ServerURI); | 223 | agentCircuit.firstname, agentCircuit.lastname, (fromLogin ? agentCircuit.IPAddress : "stored IP"), gatekeeper.ServerURI); |
224 | 224 | ||
225 | string gridName = gatekeeper.ServerURI; | 225 | string gridName = gatekeeper.ServerURI; |
@@ -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; |
@@ -269,7 +268,7 @@ namespace OpenSim.Services.HypergridService | |||
269 | agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random(); | 268 | agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random(); |
270 | TravelingAgentInfo old = null; | 269 | TravelingAgentInfo old = null; |
271 | TravelingAgentInfo travel = CreateTravelInfo(agentCircuit, region, fromLogin, out old); | 270 | TravelingAgentInfo travel = CreateTravelInfo(agentCircuit, region, fromLogin, out old); |
272 | 271 | ||
273 | bool success = false; | 272 | bool success = false; |
274 | string myExternalIP = string.Empty; | 273 | string myExternalIP = string.Empty; |
275 | 274 | ||
@@ -281,12 +280,14 @@ namespace OpenSim.Services.HypergridService | |||
281 | } | 280 | } |
282 | else | 281 | else |
283 | { | 282 | { |
284 | success = m_GatekeeperConnector.CreateAgent(source, region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out myExternalIP, out reason); | 283 | //TODO: Should there not be a call to QueryAccess here? |
284 | EntityTransferContext ctx = new EntityTransferContext(); | ||
285 | success = m_GatekeeperConnector.CreateAgent(source, region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, ctx, out myExternalIP, out reason); | ||
285 | } | 286 | } |
286 | 287 | ||
287 | if (!success) | 288 | if (!success) |
288 | { | 289 | { |
289 | m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}", | 290 | m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}", |
290 | agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason); | 291 | agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason); |
291 | 292 | ||
292 | if (old != null) | 293 | if (old != null) |
@@ -299,8 +300,12 @@ namespace OpenSim.Services.HypergridService | |||
299 | 300 | ||
300 | // Everything is ok | 301 | // Everything is ok |
301 | 302 | ||
302 | // Update the perceived IP Address of our grid | 303 | if (!fromLogin) |
303 | m_log.DebugFormat("[USER AGENT SERVICE]: Gatekeeper sees me as {0}", myExternalIP); | 304 | { |
305 | // Update the perceived IP Address of our grid | ||
306 | m_log.DebugFormat("[USER AGENT SERVICE]: Gatekeeper sees me as {0}", myExternalIP); | ||
307 | } | ||
308 | |||
304 | travel.MyIpAddress = myExternalIP; | 309 | travel.MyIpAddress = myExternalIP; |
305 | 310 | ||
306 | StoreTravelInfo(travel); | 311 | StoreTravelInfo(travel); |
@@ -370,7 +375,7 @@ namespace OpenSim.Services.HypergridService | |||
370 | if (m_BypassClientVerification) | 375 | if (m_BypassClientVerification) |
371 | return true; | 376 | return true; |
372 | 377 | ||
373 | m_log.DebugFormat("[USER AGENT SERVICE]: Verifying Client session {0} with reported IP {1}.", | 378 | m_log.DebugFormat("[USER AGENT SERVICE]: Verifying Client session {0} with reported IP {1}.", |
374 | sessionID, reportedIP); | 379 | sessionID, reportedIP); |
375 | 380 | ||
376 | HGTravelingData hgt = m_Database.Get(sessionID); | 381 | HGTravelingData hgt = m_Database.Get(sessionID); |
@@ -529,7 +534,7 @@ namespace OpenSim.Services.HypergridService | |||
529 | FriendInfo[] friendInfos = m_FriendsService.GetFriends(localUserID); | 534 | FriendInfo[] friendInfos = m_FriendsService.GetFriends(localUserID); |
530 | foreach (FriendInfo finfo in friendInfos) | 535 | foreach (FriendInfo finfo in friendInfos) |
531 | { | 536 | { |
532 | if (finfo.Friend.StartsWith(foreignUserID.ToString()) && finfo.Friend.EndsWith(secret) && | 537 | if (finfo.Friend.StartsWith(foreignUserID.ToString()) && finfo.Friend.EndsWith(secret) && |
533 | (finfo.TheirFlags & (int)FriendRights.CanSeeOnline) != 0 && (finfo.TheirFlags != -1)) | 538 | (finfo.TheirFlags & (int)FriendRights.CanSeeOnline) != 0 && (finfo.TheirFlags != -1)) |
534 | { | 539 | { |
535 | // great! | 540 | // great! |
@@ -635,7 +640,7 @@ namespace OpenSim.Services.HypergridService | |||
635 | foreach (FriendInfo f in friends) | 640 | foreach (FriendInfo f in friends) |
636 | if (f.Friend.StartsWith(targetUserID.ToString())) | 641 | if (f.Friend.StartsWith(targetUserID.ToString())) |
637 | { | 642 | { |
638 | // Let's remove the secret | 643 | // Let's remove the secret |
639 | UUID id; string tmp = string.Empty, secret = string.Empty; | 644 | UUID id; string tmp = string.Empty, secret = string.Empty; |
640 | if (Util.ParseUniversalUserIdentifier(f.Friend, out id, out tmp, out tmp, out tmp, out secret)) | 645 | if (Util.ParseUniversalUserIdentifier(f.Friend, out id, out tmp, out tmp, out tmp, out secret)) |
641 | return f.Friend.Replace(secret, "0"); | 646 | return f.Friend.Replace(secret, "0"); |