diff options
author | teravus | 2012-11-15 10:05:16 -0500 |
---|---|---|
committer | teravus | 2012-11-15 10:05:16 -0500 |
commit | e9153e1d1aae50024d8cd05fe14a9bce34343a0e (patch) | |
tree | bc111d34f95a26b99c7e34d9e495dc14d1802cc3 /OpenSim/Services/HypergridService | |
parent | Merge master into teravuswork (diff) | |
download | opensim-SC-e9153e1d1aae50024d8cd05fe14a9bce34343a0e.zip opensim-SC-e9153e1d1aae50024d8cd05fe14a9bce34343a0e.tar.gz opensim-SC-e9153e1d1aae50024d8cd05fe14a9bce34343a0e.tar.bz2 opensim-SC-e9153e1d1aae50024d8cd05fe14a9bce34343a0e.tar.xz |
Revert "Merge master into teravuswork", it should have been avination, not master.
This reverts commit dfac269032300872c4d0dc507f4f9062d102b0f4, reversing
changes made to 619c39e5144f15aca129d6d999bcc5c34133ee64.
Diffstat (limited to '')
5 files changed, 27 insertions, 275 deletions
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 004311f..47d22b9 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs | |||
@@ -57,13 +57,10 @@ namespace OpenSim.Services.HypergridService | |||
57 | private static IUserAccountService m_UserAccountService; | 57 | private static IUserAccountService m_UserAccountService; |
58 | private static IUserAgentService m_UserAgentService; | 58 | private static IUserAgentService m_UserAgentService; |
59 | private static ISimulationService m_SimulationService; | 59 | private static ISimulationService m_SimulationService; |
60 | private static IGridUserService m_GridUserService; | ||
61 | 60 | ||
62 | private static string m_AllowedClients = string.Empty; | 61 | protected string m_AllowedClients = string.Empty; |
63 | private static string m_DeniedClients = string.Empty; | 62 | protected string m_DeniedClients = string.Empty; |
64 | private static bool m_ForeignAgentsAllowed = true; | 63 | private static bool m_ForeignAgentsAllowed = true; |
65 | private static List<string> m_ForeignsAllowedExceptions = new List<string>(); | ||
66 | private static List<string> m_ForeignsDisallowedExceptions = new List<string>(); | ||
67 | 64 | ||
68 | private static UUID m_ScopeID; | 65 | private static UUID m_ScopeID; |
69 | private static bool m_AllowTeleportsToAnyRegion; | 66 | private static bool m_AllowTeleportsToAnyRegion; |
@@ -85,9 +82,8 @@ namespace OpenSim.Services.HypergridService | |||
85 | string gridService = serverConfig.GetString("GridService", String.Empty); | 82 | string gridService = serverConfig.GetString("GridService", String.Empty); |
86 | string presenceService = serverConfig.GetString("PresenceService", String.Empty); | 83 | string presenceService = serverConfig.GetString("PresenceService", String.Empty); |
87 | string simulationService = serverConfig.GetString("SimulationService", String.Empty); | 84 | string simulationService = serverConfig.GetString("SimulationService", String.Empty); |
88 | string gridUserService = serverConfig.GetString("GridUserService", String.Empty); | ||
89 | 85 | ||
90 | // These are mandatory, the others aren't | 86 | // These 3 are mandatory, the others aren't |
91 | if (gridService == string.Empty || presenceService == string.Empty) | 87 | if (gridService == string.Empty || presenceService == string.Empty) |
92 | throw new Exception("Incomplete specifications, Gatekeeper Service cannot function."); | 88 | throw new Exception("Incomplete specifications, Gatekeeper Service cannot function."); |
93 | 89 | ||
@@ -107,8 +103,6 @@ namespace OpenSim.Services.HypergridService | |||
107 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); | 103 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); |
108 | if (homeUsersService != string.Empty) | 104 | if (homeUsersService != string.Empty) |
109 | m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args); | 105 | m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args); |
110 | if (gridUserService != string.Empty) | ||
111 | m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args); | ||
112 | 106 | ||
113 | if (simService != null) | 107 | if (simService != null) |
114 | m_SimulationService = simService; | 108 | m_SimulationService = simService; |
@@ -119,9 +113,6 @@ namespace OpenSim.Services.HypergridService | |||
119 | m_DeniedClients = serverConfig.GetString("DeniedClients", string.Empty); | 113 | m_DeniedClients = serverConfig.GetString("DeniedClients", string.Empty); |
120 | m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true); | 114 | m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true); |
121 | 115 | ||
122 | LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions); | ||
123 | LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_ForeignsDisallowedExceptions); | ||
124 | |||
125 | if (m_GridService == null || m_PresenceService == null || m_SimulationService == null) | 116 | if (m_GridService == null || m_PresenceService == null || m_SimulationService == null) |
126 | throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); | 117 | throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); |
127 | 118 | ||
@@ -134,15 +125,6 @@ namespace OpenSim.Services.HypergridService | |||
134 | { | 125 | { |
135 | } | 126 | } |
136 | 127 | ||
137 | protected void LoadDomainExceptionsFromConfig(IConfig config, string variable, List<string> exceptions) | ||
138 | { | ||
139 | string value = config.GetString(variable, string.Empty); | ||
140 | string[] parts = value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); | ||
141 | |||
142 | foreach (string s in parts) | ||
143 | exceptions.Add(s.Trim()); | ||
144 | } | ||
145 | |||
146 | public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason) | 128 | public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason) |
147 | { | 129 | { |
148 | regionID = UUID.Zero; | 130 | regionID = UUID.Zero; |
@@ -278,27 +260,18 @@ namespace OpenSim.Services.HypergridService | |||
278 | m_log.DebugFormat("[GATEKEEPER SERVICE]: User is ok"); | 260 | m_log.DebugFormat("[GATEKEEPER SERVICE]: User is ok"); |
279 | 261 | ||
280 | // | 262 | // |
281 | // Foreign agents allowed? Exceptions? | 263 | // Foreign agents allowed |
282 | // | 264 | // |
283 | if (account == null) | 265 | if (account == null && !m_ForeignAgentsAllowed) |
284 | { | 266 | { |
285 | bool allowed = m_ForeignAgentsAllowed; | 267 | reason = "Unauthorized"; |
286 | 268 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agents are not permitted {0} {1}. Refusing service.", | |
287 | if (m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsAllowedExceptions)) | 269 | aCircuit.firstname, aCircuit.lastname); |
288 | allowed = false; | 270 | return false; |
289 | |||
290 | if (!m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsDisallowedExceptions)) | ||
291 | allowed = true; | ||
292 | |||
293 | if (!allowed) | ||
294 | { | ||
295 | reason = "Destination does not allow visitors from your world"; | ||
296 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agents are not permitted {0} {1} @ {2}. Refusing service.", | ||
297 | aCircuit.firstname, aCircuit.lastname, aCircuit.ServiceURLs["HomeURI"]); | ||
298 | return false; | ||
299 | } | ||
300 | } | 271 | } |
301 | 272 | ||
273 | // May want to authorize | ||
274 | |||
302 | bool isFirstLogin = false; | 275 | bool isFirstLogin = false; |
303 | // | 276 | // |
304 | // Login the presence, if it's not there yet (by the login service) | 277 | // Login the presence, if it's not there yet (by the login service) |
@@ -307,8 +280,7 @@ namespace OpenSim.Services.HypergridService | |||
307 | if (presence != null) // it has been placed there by the login service | 280 | if (presence != null) // it has been placed there by the login service |
308 | isFirstLogin = true; | 281 | isFirstLogin = true; |
309 | 282 | ||
310 | else | 283 | else |
311 | { | ||
312 | if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID)) | 284 | if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID)) |
313 | { | 285 | { |
314 | reason = "Unable to login presence"; | 286 | reason = "Unable to login presence"; |
@@ -318,26 +290,6 @@ namespace OpenSim.Services.HypergridService | |||
318 | } | 290 | } |
319 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok"); | 291 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok"); |
320 | 292 | ||
321 | // Also login foreigners with GridUser service | ||
322 | if (m_GridUserService != null && account == null) | ||
323 | { | ||
324 | string userId = aCircuit.AgentID.ToString(); | ||
325 | string first = aCircuit.firstname, last = aCircuit.lastname; | ||
326 | if (last.StartsWith("@")) | ||
327 | { | ||
328 | string[] parts = aCircuit.firstname.Split('.'); | ||
329 | if (parts.Length >= 2) | ||
330 | { | ||
331 | first = parts[0]; | ||
332 | last = parts[1]; | ||
333 | } | ||
334 | } | ||
335 | |||
336 | userId += ";" + aCircuit.ServiceURLs["HomeURI"] + ";" + first + " " + last; | ||
337 | m_GridUserService.LoggedIn(userId); | ||
338 | } | ||
339 | } | ||
340 | |||
341 | // | 293 | // |
342 | // Get the region | 294 | // Get the region |
343 | // | 295 | // |
@@ -441,27 +393,6 @@ namespace OpenSim.Services.HypergridService | |||
441 | 393 | ||
442 | #region Misc | 394 | #region Misc |
443 | 395 | ||
444 | private bool IsException(AgentCircuitData aCircuit, List<string> exceptions) | ||
445 | { | ||
446 | bool exception = false; | ||
447 | if (exceptions.Count > 0) // we have exceptions | ||
448 | { | ||
449 | // Retrieve the visitor's origin | ||
450 | string userURL = aCircuit.ServiceURLs["HomeURI"].ToString(); | ||
451 | if (!userURL.EndsWith("/")) | ||
452 | userURL += "/"; | ||
453 | |||
454 | if (exceptions.Find(delegate(string s) | ||
455 | { | ||
456 | if (!s.EndsWith("/")) | ||
457 | s += "/"; | ||
458 | return s == userURL; | ||
459 | }) != null) | ||
460 | exception = true; | ||
461 | } | ||
462 | |||
463 | return exception; | ||
464 | } | ||
465 | 396 | ||
466 | #endregion | 397 | #endregion |
467 | } | 398 | } |
diff --git a/OpenSim/Services/HypergridService/HGAssetService.cs b/OpenSim/Services/HypergridService/HGAssetService.cs index 84dec8d..db98166 100644 --- a/OpenSim/Services/HypergridService/HGAssetService.cs +++ b/OpenSim/Services/HypergridService/HGAssetService.cs | |||
@@ -58,8 +58,6 @@ namespace OpenSim.Services.HypergridService | |||
58 | 58 | ||
59 | private UserAccountCache m_Cache; | 59 | private UserAccountCache m_Cache; |
60 | 60 | ||
61 | private AssetPermissions m_AssetPerms; | ||
62 | |||
63 | public HGAssetService(IConfigSource config, string configName) : base(config, configName) | 61 | public HGAssetService(IConfigSource config, string configName) : base(config, configName) |
64 | { | 62 | { |
65 | m_log.Debug("[HGAsset Service]: Starting"); | 63 | m_log.Debug("[HGAsset Service]: Starting"); |
@@ -82,10 +80,6 @@ namespace OpenSim.Services.HypergridService | |||
82 | m_HomeURL = assetConfig.GetString("HomeURI", m_HomeURL); | 80 | m_HomeURL = assetConfig.GetString("HomeURI", m_HomeURL); |
83 | 81 | ||
84 | m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); | 82 | m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); |
85 | |||
86 | // Permissions | ||
87 | m_AssetPerms = new AssetPermissions(assetConfig); | ||
88 | |||
89 | } | 83 | } |
90 | 84 | ||
91 | #region IAssetService overrides | 85 | #region IAssetService overrides |
@@ -96,9 +90,6 @@ namespace OpenSim.Services.HypergridService | |||
96 | if (asset == null) | 90 | if (asset == null) |
97 | return null; | 91 | return null; |
98 | 92 | ||
99 | if (!m_AssetPerms.AllowedExport(asset.Type)) | ||
100 | return null; | ||
101 | |||
102 | if (asset.Metadata.Type == (sbyte)AssetType.Object) | 93 | if (asset.Metadata.Type == (sbyte)AssetType.Object) |
103 | asset.Data = AdjustIdentifiers(asset.Data); ; | 94 | asset.Data = AdjustIdentifiers(asset.Data); ; |
104 | 95 | ||
@@ -121,27 +112,16 @@ namespace OpenSim.Services.HypergridService | |||
121 | 112 | ||
122 | public override byte[] GetData(string id) | 113 | public override byte[] GetData(string id) |
123 | { | 114 | { |
124 | AssetBase asset = Get(id); | 115 | byte[] data = base.GetData(id); |
125 | |||
126 | if (asset == null) | ||
127 | return null; | ||
128 | 116 | ||
129 | if (!m_AssetPerms.AllowedExport(asset.Type)) | 117 | if (data == null) |
130 | return null; | 118 | return null; |
131 | 119 | ||
132 | return asset.Data; | 120 | return AdjustIdentifiers(data); |
133 | } | 121 | } |
134 | 122 | ||
135 | //public virtual bool Get(string id, Object sender, AssetRetrieved handler) | 123 | //public virtual bool Get(string id, Object sender, AssetRetrieved handler) |
136 | 124 | ||
137 | public override string Store(AssetBase asset) | ||
138 | { | ||
139 | if (!m_AssetPerms.AllowedImport(asset.Type)) | ||
140 | return string.Empty; | ||
141 | |||
142 | return base.Store(asset); | ||
143 | } | ||
144 | |||
145 | public override bool Delete(string id) | 125 | public override bool Delete(string id) |
146 | { | 126 | { |
147 | // NOGO | 127 | // NOGO |
diff --git a/OpenSim/Services/HypergridService/HGFriendsService.cs b/OpenSim/Services/HypergridService/HGFriendsService.cs index a8bcfb2..98423d7 100644 --- a/OpenSim/Services/HypergridService/HGFriendsService.cs +++ b/OpenSim/Services/HypergridService/HGFriendsService.cs | |||
@@ -397,7 +397,7 @@ namespace OpenSim.Services.HypergridService | |||
397 | if (region != null) | 397 | if (region != null) |
398 | { | 398 | { |
399 | m_log.DebugFormat("[HGFRIENDS SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, foreignUserID, (online ? "online" : "offline")); | 399 | m_log.DebugFormat("[HGFRIENDS SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, foreignUserID, (online ? "online" : "offline")); |
400 | m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID.ToString(), online); | 400 | m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID, online); |
401 | } | 401 | } |
402 | } | 402 | } |
403 | } | 403 | } |
diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index 784f136..6e4b68c 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs | |||
@@ -56,12 +56,10 @@ namespace OpenSim.Services.HypergridService | |||
56 | 56 | ||
57 | private string m_HomeURL; | 57 | private string m_HomeURL; |
58 | private IUserAccountService m_UserAccountService; | 58 | private IUserAccountService m_UserAccountService; |
59 | private IAvatarService m_AvatarService; | ||
60 | 59 | ||
61 | // private UserAccountCache m_Cache; | 60 | // private UserAccountCache m_Cache; |
62 | 61 | ||
63 | private ExpiringCache<UUID, List<XInventoryFolder>> m_SuitcaseTrees = new ExpiringCache<UUID, List<XInventoryFolder>>(); | 62 | private ExpiringCache<UUID, List<XInventoryFolder>> m_SuitcaseTrees = new ExpiringCache<UUID, List<XInventoryFolder>>(); |
64 | private ExpiringCache<UUID, AvatarAppearance> m_Appearances = new ExpiringCache<UUID, AvatarAppearance>(); | ||
65 | 63 | ||
66 | public HGSuitcaseInventoryService(IConfigSource config, string configName) | 64 | public HGSuitcaseInventoryService(IConfigSource config, string configName) |
67 | : base(config, configName) | 65 | : base(config, configName) |
@@ -71,7 +69,7 @@ namespace OpenSim.Services.HypergridService | |||
71 | m_ConfigName = configName; | 69 | m_ConfigName = configName; |
72 | 70 | ||
73 | if (m_Database == null) | 71 | if (m_Database == null) |
74 | m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: m_Database is null!"); | 72 | m_log.WarnFormat("[XXX]: m_Database is null!"); |
75 | 73 | ||
76 | // | 74 | // |
77 | // Try reading the [InventoryService] section, if it exists | 75 | // Try reading the [InventoryService] section, if it exists |
@@ -79,6 +77,7 @@ namespace OpenSim.Services.HypergridService | |||
79 | IConfig invConfig = config.Configs[m_ConfigName]; | 77 | IConfig invConfig = config.Configs[m_ConfigName]; |
80 | if (invConfig != null) | 78 | if (invConfig != null) |
81 | { | 79 | { |
80 | // realm = authConfig.GetString("Realm", realm); | ||
82 | string userAccountsDll = invConfig.GetString("UserAccountsService", string.Empty); | 81 | string userAccountsDll = invConfig.GetString("UserAccountsService", string.Empty); |
83 | if (userAccountsDll == string.Empty) | 82 | if (userAccountsDll == string.Empty) |
84 | throw new Exception("Please specify UserAccountsService in HGInventoryService configuration"); | 83 | throw new Exception("Please specify UserAccountsService in HGInventoryService configuration"); |
@@ -88,14 +87,8 @@ namespace OpenSim.Services.HypergridService | |||
88 | if (m_UserAccountService == null) | 87 | if (m_UserAccountService == null) |
89 | throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); | 88 | throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); |
90 | 89 | ||
91 | string avatarDll = invConfig.GetString("AvatarService", string.Empty); | 90 | // legacy configuration [obsolete] |
92 | if (avatarDll == string.Empty) | 91 | m_HomeURL = invConfig.GetString("ProfileServerURI", string.Empty); |
93 | throw new Exception("Please specify AvatarService in HGInventoryService configuration"); | ||
94 | |||
95 | m_AvatarService = ServerUtils.LoadPlugin<IAvatarService>(avatarDll, args); | ||
96 | if (m_AvatarService == null) | ||
97 | throw new Exception(String.Format("Unable to create m_AvatarService from {0}", avatarDll)); | ||
98 | |||
99 | // Preferred | 92 | // Preferred |
100 | m_HomeURL = invConfig.GetString("HomeURI", m_HomeURL); | 93 | m_HomeURL = invConfig.GetString("HomeURI", m_HomeURL); |
101 | 94 | ||
@@ -301,7 +294,7 @@ namespace OpenSim.Services.HypergridService | |||
301 | 294 | ||
302 | public override bool AddFolder(InventoryFolderBase folder) | 295 | public override bool AddFolder(InventoryFolderBase folder) |
303 | { | 296 | { |
304 | //m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder {0} {1}", folder.Name, folder.ParentID); | 297 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder {0} {1}", folder.Name, folder.ParentID); |
305 | // Let's do a bit of sanity checking, more than the base service does | 298 | // Let's do a bit of sanity checking, more than the base service does |
306 | // make sure the given folder's parent folder exists under the suitcase tree of this user | 299 | // make sure the given folder's parent folder exists under the suitcase tree of this user |
307 | 300 | ||
@@ -323,7 +316,7 @@ namespace OpenSim.Services.HypergridService | |||
323 | 316 | ||
324 | public override bool UpdateFolder(InventoryFolderBase folder) | 317 | public override bool UpdateFolder(InventoryFolderBase folder) |
325 | { | 318 | { |
326 | //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version); | 319 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version); |
327 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) | 320 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) |
328 | { | 321 | { |
329 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: folder {0} not within Suitcase tree", folder.Name); | 322 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: folder {0} not within Suitcase tree", folder.Name); |
@@ -401,7 +394,7 @@ namespace OpenSim.Services.HypergridService | |||
401 | return null; | 394 | return null; |
402 | } | 395 | } |
403 | 396 | ||
404 | if (!IsWithinSuitcaseTree(it.Owner, it.Folder) && !IsPartOfAppearance(it.Owner, it.ID)) | 397 | if (!IsWithinSuitcaseTree(it.Owner, it.Folder)) |
405 | { | 398 | { |
406 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0} (folder {1}) is not within Suitcase", | 399 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0} (folder {1}) is not within Suitcase", |
407 | it.Name, it.Folder); | 400 | it.Name, it.Folder); |
@@ -460,15 +453,6 @@ namespace OpenSim.Services.HypergridService | |||
460 | 453 | ||
461 | if (folders != null && folders.Length > 0) | 454 | if (folders != null && folders.Length > 0) |
462 | return folders[0]; | 455 | return folders[0]; |
463 | |||
464 | // OK, so the RootFolder type didn't work. Let's look for any type with parent UUID.Zero. | ||
465 | folders = m_Database.GetFolders( | ||
466 | new string[] { "agentID", "folderName", "parentFolderID" }, | ||
467 | new string[] { principalID.ToString(), "My Inventory", UUID.Zero.ToString() }); | ||
468 | |||
469 | if (folders != null && folders.Length > 0) | ||
470 | return folders[0]; | ||
471 | |||
472 | return null; | 456 | return null; |
473 | } | 457 | } |
474 | 458 | ||
@@ -565,52 +549,6 @@ namespace OpenSim.Services.HypergridService | |||
565 | else return true; | 549 | else return true; |
566 | } | 550 | } |
567 | #endregion | 551 | #endregion |
568 | |||
569 | #region Avatar Appearance | ||
570 | |||
571 | private AvatarAppearance GetAppearance(UUID principalID) | ||
572 | { | ||
573 | AvatarAppearance a = null; | ||
574 | if (m_Appearances.TryGetValue(principalID, out a)) | ||
575 | return a; | ||
576 | |||
577 | a = m_AvatarService.GetAppearance(principalID); | ||
578 | m_Appearances.AddOrUpdate(principalID, a, 5 * 60); // 5minutes | ||
579 | return a; | ||
580 | } | ||
581 | |||
582 | private bool IsPartOfAppearance(UUID principalID, UUID itemID) | ||
583 | { | ||
584 | AvatarAppearance a = GetAppearance(principalID); | ||
585 | |||
586 | if (a == null) | ||
587 | return false; | ||
588 | |||
589 | // Check wearables (body parts and clothes) | ||
590 | for (int i = 0; i < a.Wearables.Length; i++) | ||
591 | { | ||
592 | for (int j = 0; j < a.Wearables[i].Count; j++) | ||
593 | { | ||
594 | if (a.Wearables[i][j].ItemID == itemID) | ||
595 | { | ||
596 | //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: item {0} is a wearable", itemID); | ||
597 | return true; | ||
598 | } | ||
599 | } | ||
600 | } | ||
601 | |||
602 | // Check attachments | ||
603 | if (a.GetAttachmentForItem(itemID) != null) | ||
604 | { | ||
605 | //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: item {0} is an attachment", itemID); | ||
606 | return true; | ||
607 | } | ||
608 | |||
609 | return false; | ||
610 | } | ||
611 | |||
612 | #endregion | ||
613 | |||
614 | } | 552 | } |
615 | 553 | ||
616 | } | 554 | } |
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index 416ad16..a49993c 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs | |||
@@ -77,10 +77,6 @@ namespace OpenSim.Services.HypergridService | |||
77 | 77 | ||
78 | protected static bool m_BypassClientVerification; | 78 | protected static bool m_BypassClientVerification; |
79 | 79 | ||
80 | private static Dictionary<int, bool> m_ForeignTripsAllowed = new Dictionary<int, bool>(); | ||
81 | private static Dictionary<int, List<string>> m_TripsAllowedExceptions = new Dictionary<int, List<string>>(); | ||
82 | private static Dictionary<int, List<string>> m_TripsDisallowedExceptions = new Dictionary<int, List<string>>(); | ||
83 | |||
84 | public UserAgentService(IConfigSource config) : this(config, null) | 80 | public UserAgentService(IConfigSource config) : this(config, null) |
85 | { | 81 | { |
86 | } | 82 | } |
@@ -125,12 +121,6 @@ namespace OpenSim.Services.HypergridService | |||
125 | m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args); | 121 | m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args); |
126 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userAccountService, args); | 122 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userAccountService, args); |
127 | 123 | ||
128 | m_LevelOutsideContacts = serverConfig.GetInt("LevelOutsideContacts", 0); | ||
129 | |||
130 | LoadTripPermissionsFromConfig(serverConfig, "ForeignTripsAllowed"); | ||
131 | LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_TripsAllowedExceptions); | ||
132 | LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_TripsDisallowedExceptions); | ||
133 | |||
134 | m_GridName = serverConfig.GetString("ExternalName", string.Empty); | 124 | m_GridName = serverConfig.GetString("ExternalName", string.Empty); |
135 | if (m_GridName == string.Empty) | 125 | if (m_GridName == string.Empty) |
136 | { | 126 | { |
@@ -140,43 +130,10 @@ namespace OpenSim.Services.HypergridService | |||
140 | if (!m_GridName.EndsWith("/")) | 130 | if (!m_GridName.EndsWith("/")) |
141 | m_GridName = m_GridName + "/"; | 131 | m_GridName = m_GridName + "/"; |
142 | 132 | ||
133 | m_LevelOutsideContacts = serverConfig.GetInt("LevelOutsideContacts", 0); | ||
143 | } | 134 | } |
144 | } | 135 | } |
145 | 136 | ||
146 | protected void LoadTripPermissionsFromConfig(IConfig config, string variable) | ||
147 | { | ||
148 | foreach (string keyName in config.GetKeys()) | ||
149 | { | ||
150 | if (keyName.StartsWith(variable + "_Level_")) | ||
151 | { | ||
152 | int level = 0; | ||
153 | if (Int32.TryParse(keyName.Replace(variable + "_Level_", ""), out level)) | ||
154 | m_ForeignTripsAllowed.Add(level, config.GetBoolean(keyName, true)); | ||
155 | } | ||
156 | } | ||
157 | } | ||
158 | |||
159 | protected void LoadDomainExceptionsFromConfig(IConfig config, string variable, Dictionary<int, List<string>> exceptions) | ||
160 | { | ||
161 | foreach (string keyName in config.GetKeys()) | ||
162 | { | ||
163 | if (keyName.StartsWith(variable + "_Level_")) | ||
164 | { | ||
165 | int level = 0; | ||
166 | if (Int32.TryParse(keyName.Replace(variable + "_Level_", ""), out level) && !exceptions.ContainsKey(level)) | ||
167 | { | ||
168 | exceptions.Add(level, new List<string>()); | ||
169 | string value = config.GetString(keyName, string.Empty); | ||
170 | string[] parts = value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); | ||
171 | |||
172 | foreach (string s in parts) | ||
173 | exceptions[level].Add(s.Trim()); | ||
174 | } | ||
175 | } | ||
176 | } | ||
177 | } | ||
178 | |||
179 | |||
180 | public GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt) | 137 | public GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt) |
181 | { | 138 | { |
182 | position = new Vector3(128, 128, 0); lookAt = Vector3.UnitY; | 139 | position = new Vector3(128, 128, 0); lookAt = Vector3.UnitY; |
@@ -209,39 +166,13 @@ namespace OpenSim.Services.HypergridService | |||
209 | m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", | 166 | m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", |
210 | agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI); | 167 | agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI); |
211 | 168 | ||
212 | string gridName = gatekeeper.ServerURI; | 169 | if (m_UserAccountService.GetUserAccount(UUID.Zero, agentCircuit.AgentID) == null) |
213 | |||
214 | UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, agentCircuit.AgentID); | ||
215 | if (account == null) | ||
216 | { | 170 | { |
217 | m_log.WarnFormat("[USER AGENT SERVICE]: Someone attempted to lauch a foreign user from here {0} {1}", agentCircuit.firstname, agentCircuit.lastname); | 171 | m_log.WarnFormat("[USER AGENT SERVICE]: Someone attempted to lauch a foreign user from here {0} {1}", agentCircuit.firstname, agentCircuit.lastname); |
218 | reason = "Forbidden to launch your agents from here"; | 172 | reason = "Forbidden to launch your agents from here"; |
219 | return false; | 173 | return false; |
220 | } | 174 | } |
221 | 175 | ||
222 | // Is this user allowed to go there? | ||
223 | if (m_GridName != gridName) | ||
224 | { | ||
225 | if (m_ForeignTripsAllowed.ContainsKey(account.UserLevel)) | ||
226 | { | ||
227 | bool allowed = m_ForeignTripsAllowed[account.UserLevel]; | ||
228 | |||
229 | if (m_ForeignTripsAllowed[account.UserLevel] && IsException(gridName, account.UserLevel, m_TripsAllowedExceptions)) | ||
230 | allowed = false; | ||
231 | |||
232 | if (!m_ForeignTripsAllowed[account.UserLevel] && IsException(gridName, account.UserLevel, m_TripsDisallowedExceptions)) | ||
233 | allowed = true; | ||
234 | |||
235 | if (!allowed) | ||
236 | { | ||
237 | reason = "Your world does not allow you to visit the destination"; | ||
238 | m_log.InfoFormat("[USER AGENT SERVICE]: Agents not permitted to visit {0}. Refusing service.", gridName); | ||
239 | return false; | ||
240 | } | ||
241 | } | ||
242 | } | ||
243 | |||
244 | |||
245 | // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination | 176 | // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination |
246 | GridRegion region = new GridRegion(gatekeeper); | 177 | GridRegion region = new GridRegion(gatekeeper); |
247 | region.ServerURI = gatekeeper.ServerURI; | 178 | region.ServerURI = gatekeeper.ServerURI; |
@@ -258,6 +189,7 @@ namespace OpenSim.Services.HypergridService | |||
258 | 189 | ||
259 | bool success = false; | 190 | bool success = false; |
260 | string myExternalIP = string.Empty; | 191 | string myExternalIP = string.Empty; |
192 | string gridName = gatekeeper.ServerURI; | ||
261 | 193 | ||
262 | m_log.DebugFormat("[USER AGENT SERVICE]: this grid: {0}, desired grid: {1}", m_GridName, gridName); | 194 | m_log.DebugFormat("[USER AGENT SERVICE]: this grid: {0}, desired grid: {1}", m_GridName, gridName); |
263 | 195 | ||
@@ -502,7 +434,7 @@ namespace OpenSim.Services.HypergridService | |||
502 | if (region != null) | 434 | if (region != null) |
503 | { | 435 | { |
504 | m_log.DebugFormat("[USER AGENT SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, foreignUserID, (online ? "online" : "offline")); | 436 | m_log.DebugFormat("[USER AGENT SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, foreignUserID, (online ? "online" : "offline")); |
505 | m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID.ToString(), online); | 437 | m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID, online); |
506 | } | 438 | } |
507 | } | 439 | } |
508 | } | 440 | } |
@@ -654,35 +586,6 @@ namespace OpenSim.Services.HypergridService | |||
654 | else | 586 | else |
655 | return UUID.Zero; | 587 | return UUID.Zero; |
656 | } | 588 | } |
657 | |||
658 | #region Misc | ||
659 | |||
660 | private bool IsException(string dest, int level, Dictionary<int, List<string>> exceptions) | ||
661 | { | ||
662 | if (!exceptions.ContainsKey(level)) | ||
663 | return false; | ||
664 | |||
665 | bool exception = false; | ||
666 | if (exceptions[level].Count > 0) // we have exceptions | ||
667 | { | ||
668 | string destination = dest; | ||
669 | if (!destination.EndsWith("/")) | ||
670 | destination += "/"; | ||
671 | |||
672 | if (exceptions[level].Find(delegate(string s) | ||
673 | { | ||
674 | if (!s.EndsWith("/")) | ||
675 | s += "/"; | ||
676 | return s == destination; | ||
677 | }) != null) | ||
678 | exception = true; | ||
679 | } | ||
680 | |||
681 | return exception; | ||
682 | } | ||
683 | |||
684 | #endregion | ||
685 | |||
686 | } | 589 | } |
687 | 590 | ||
688 | class TravelingAgentInfo | 591 | class TravelingAgentInfo |