diff options
author | Justin Clark-Casey (justincc) | 2012-09-24 22:52:33 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-09-24 22:52:33 +0100 |
commit | ac02cadbdb817f0a8ab913bfd67f2f8919cdd69f (patch) | |
tree | f0fca1b7c047760a0927441840e7709ff91e7fb5 /OpenSim | |
parent | Documenting LSL script-related events (diff) | |
parent | HG Rez object: warn the user if the item or asset cannot be found. (diff) | |
download | opensim-SC_OLD-ac02cadbdb817f0a8ab913bfd67f2f8919cdd69f.zip opensim-SC_OLD-ac02cadbdb817f0a8ab913bfd67f2f8919cdd69f.tar.gz opensim-SC_OLD-ac02cadbdb817f0a8ab913bfd67f2f8919cdd69f.tar.bz2 opensim-SC_OLD-ac02cadbdb817f0a8ab913bfd67f2f8919cdd69f.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim')
7 files changed, 211 insertions, 25 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 8c29ad4..d139235 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -636,11 +636,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
636 | } | 636 | } |
637 | catch (IOException e) | 637 | catch (IOException e) |
638 | { | 638 | { |
639 | m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.Message), e); | 639 | m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.StackTrace), e); |
640 | } | 640 | } |
641 | catch (Exception e) | 641 | catch (Exception e) |
642 | { | 642 | { |
643 | m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.Message), e); | 643 | m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.StackTrace), e); |
644 | SendHTML500(response); | 644 | SendHTML500(response); |
645 | } | 645 | } |
646 | finally | 646 | finally |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index d6ad07e..c74584c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -859,6 +859,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
859 | 859 | ||
860 | InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID); | 860 | InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID); |
861 | item = m_scene.InventoryService.GetItem(item); | 861 | item = m_scene.InventoryService.GetItem(item); |
862 | if (item == null) | ||
863 | return; | ||
864 | |||
862 | bool changed = sp.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID); | 865 | bool changed = sp.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID); |
863 | if (changed && m_scene.AvatarFactory != null) | 866 | if (changed && m_scene.AvatarFactory != null) |
864 | { | 867 | { |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 0b386d3..a6698e6 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -150,6 +150,34 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
150 | 150 | ||
151 | if (m_Enabled) | 151 | if (m_Enabled) |
152 | scene.RegisterModuleInterface<IUserAgentVerificationModule>(this); | 152 | scene.RegisterModuleInterface<IUserAgentVerificationModule>(this); |
153 | |||
154 | scene.EventManager.OnIncomingSceneObject += OnIncomingSceneObject; | ||
155 | } | ||
156 | |||
157 | void OnIncomingSceneObject(SceneObjectGroup so) | ||
158 | { | ||
159 | if (!so.IsAttachment) | ||
160 | return; | ||
161 | |||
162 | if (so.Scene.UserManagementModule.IsLocalGridUser(so.AttachedAvatar)) | ||
163 | return; | ||
164 | |||
165 | // foreign user | ||
166 | AgentCircuitData aCircuit = so.Scene.AuthenticateHandler.GetAgentCircuitData(so.AttachedAvatar); | ||
167 | if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) | ||
168 | { | ||
169 | if (aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) | ||
170 | { | ||
171 | string url = aCircuit.ServiceURLs["AssetServerURI"].ToString(); | ||
172 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Incoming attachement {0} for HG user {1} with asset server {2}", so.Name, so.AttachedAvatar, url); | ||
173 | Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>(); | ||
174 | HGUuidGatherer uuidGatherer = new HGUuidGatherer(so.Scene.AssetService, url); | ||
175 | uuidGatherer.GatherAssetUuids(so, ids); | ||
176 | |||
177 | foreach (KeyValuePair<UUID, AssetType> kvp in ids) | ||
178 | uuidGatherer.FetchAsset(kvp.Key); | ||
179 | } | ||
180 | } | ||
153 | } | 181 | } |
154 | 182 | ||
155 | protected override void OnNewClient(IClientAPI client) | 183 | protected override void OnNewClient(IClientAPI client) |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index a0cad40..80257bd 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | |||
@@ -263,8 +263,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
263 | //} | 263 | //} |
264 | 264 | ||
265 | // OK, we're done fetching. Pass it up to the default RezObject | 265 | // OK, we're done fetching. Pass it up to the default RezObject |
266 | return base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, | 266 | SceneObjectGroup sog = base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, |
267 | RezSelected, RemoveItem, fromTaskID, attachment); | 267 | RezSelected, RemoveItem, fromTaskID, attachment); |
268 | |||
269 | if (sog == null) | ||
270 | remoteClient.SendAgentAlertMessage("Unable to rez: problem accessing inventory or locating assets", false); | ||
271 | |||
272 | return sog; | ||
268 | 273 | ||
269 | } | 274 | } |
270 | 275 | ||
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 383604d..28cd09f 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs | |||
@@ -377,6 +377,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
377 | : base(assetService) | 377 | : base(assetService) |
378 | { | 378 | { |
379 | m_assetServerURL = assetServerURL; | 379 | m_assetServerURL = assetServerURL; |
380 | if (!m_assetServerURL.EndsWith("/") && !m_assetServerURL.EndsWith("=")) | ||
381 | m_assetServerURL = m_assetServerURL + "/"; | ||
380 | } | 382 | } |
381 | 383 | ||
382 | protected override AssetBase GetAsset(UUID uuid) | 384 | protected override AssetBase GetAsset(UUID uuid) |
@@ -384,22 +386,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
384 | if (string.Empty == m_assetServerURL) | 386 | if (string.Empty == m_assetServerURL) |
385 | return base.GetAsset(uuid); | 387 | return base.GetAsset(uuid); |
386 | else | 388 | else |
387 | return FetchAsset(m_assetServerURL, uuid); | 389 | return FetchAsset(uuid); |
388 | } | 390 | } |
389 | 391 | ||
390 | public AssetBase FetchAsset(string url, UUID assetID) | 392 | public AssetBase FetchAsset(UUID assetID) |
391 | { | 393 | { |
392 | if (!url.EndsWith("/") && !url.EndsWith("=")) | ||
393 | url = url + "/"; | ||
394 | 394 | ||
395 | AssetBase asset = m_assetService.Get(url + assetID.ToString()); | 395 | // Test if it's already here |
396 | 396 | AssetBase asset = m_assetService.Get(assetID.ToString()); | |
397 | if (asset != null) | 397 | if (asset == null) |
398 | { | 398 | { |
399 | m_log.DebugFormat("[HGUUIDGatherer]: Copied asset {0} from {1} to local asset server. ", asset.ID, url); | 399 | // It's not, so fetch it from abroad |
400 | return asset; | 400 | asset = m_assetService.Get(m_assetServerURL + assetID.ToString()); |
401 | if (asset != null) | ||
402 | m_log.DebugFormat("[HGUUIDGatherer]: Copied asset {0} from {1} to local asset server", assetID, m_assetServerURL); | ||
403 | else | ||
404 | m_log.DebugFormat("[HGUUIDGatherer]: Failed to fetch asset {0} from {1}", assetID, m_assetServerURL); | ||
401 | } | 405 | } |
402 | return null; | 406 | //else |
407 | // m_log.DebugFormat("[HGUUIDGatherer]: Asset {0} from {1} was already here", assetID, m_assetServerURL); | ||
408 | |||
409 | return asset; | ||
403 | } | 410 | } |
404 | } | 411 | } |
405 | } | 412 | } |
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 47d22b9..0f7d7c6 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs | |||
@@ -58,9 +58,11 @@ namespace OpenSim.Services.HypergridService | |||
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 | 60 | ||
61 | protected string m_AllowedClients = string.Empty; | 61 | private static string m_AllowedClients = string.Empty; |
62 | protected string m_DeniedClients = string.Empty; | 62 | private static string m_DeniedClients = string.Empty; |
63 | private static bool m_ForeignAgentsAllowed = true; | 63 | private static bool m_ForeignAgentsAllowed = true; |
64 | private static List<string> m_ForeignsAllowedExceptions = new List<string>(); | ||
65 | private static List<string> m_ForeignsDisallowedExceptions = new List<string>(); | ||
64 | 66 | ||
65 | private static UUID m_ScopeID; | 67 | private static UUID m_ScopeID; |
66 | private static bool m_AllowTeleportsToAnyRegion; | 68 | private static bool m_AllowTeleportsToAnyRegion; |
@@ -113,6 +115,9 @@ namespace OpenSim.Services.HypergridService | |||
113 | m_DeniedClients = serverConfig.GetString("DeniedClients", string.Empty); | 115 | m_DeniedClients = serverConfig.GetString("DeniedClients", string.Empty); |
114 | m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true); | 116 | m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true); |
115 | 117 | ||
118 | LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions); | ||
119 | LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_ForeignsDisallowedExceptions); | ||
120 | |||
116 | if (m_GridService == null || m_PresenceService == null || m_SimulationService == null) | 121 | if (m_GridService == null || m_PresenceService == null || m_SimulationService == null) |
117 | throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); | 122 | throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); |
118 | 123 | ||
@@ -125,6 +130,15 @@ namespace OpenSim.Services.HypergridService | |||
125 | { | 130 | { |
126 | } | 131 | } |
127 | 132 | ||
133 | protected void LoadDomainExceptionsFromConfig(IConfig config, string variable, List<string> exceptions) | ||
134 | { | ||
135 | string value = config.GetString(variable, string.Empty); | ||
136 | string[] parts = value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); | ||
137 | |||
138 | foreach (string s in parts) | ||
139 | exceptions.Add(s.Trim()); | ||
140 | } | ||
141 | |||
128 | public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason) | 142 | public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason) |
129 | { | 143 | { |
130 | regionID = UUID.Zero; | 144 | regionID = UUID.Zero; |
@@ -260,14 +274,25 @@ namespace OpenSim.Services.HypergridService | |||
260 | m_log.DebugFormat("[GATEKEEPER SERVICE]: User is ok"); | 274 | m_log.DebugFormat("[GATEKEEPER SERVICE]: User is ok"); |
261 | 275 | ||
262 | // | 276 | // |
263 | // Foreign agents allowed | 277 | // Foreign agents allowed? Exceptions? |
264 | // | 278 | // |
265 | if (account == null && !m_ForeignAgentsAllowed) | 279 | if (account == null) |
266 | { | 280 | { |
267 | reason = "Unauthorized"; | 281 | bool allowed = m_ForeignAgentsAllowed; |
268 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agents are not permitted {0} {1}. Refusing service.", | 282 | |
269 | aCircuit.firstname, aCircuit.lastname); | 283 | if (m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsAllowedExceptions)) |
270 | return false; | 284 | allowed = false; |
285 | |||
286 | if (!m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsDisallowedExceptions)) | ||
287 | allowed = true; | ||
288 | |||
289 | if (!allowed) | ||
290 | { | ||
291 | reason = "Destination does not allow visitors from your world"; | ||
292 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agents are not permitted {0} {1} @ {2}. Refusing service.", | ||
293 | aCircuit.firstname, aCircuit.lastname, aCircuit.ServiceURLs["HomeURI"]); | ||
294 | return false; | ||
295 | } | ||
271 | } | 296 | } |
272 | 297 | ||
273 | // May want to authorize | 298 | // May want to authorize |
@@ -393,6 +418,27 @@ namespace OpenSim.Services.HypergridService | |||
393 | 418 | ||
394 | #region Misc | 419 | #region Misc |
395 | 420 | ||
421 | private bool IsException(AgentCircuitData aCircuit, List<string> exceptions) | ||
422 | { | ||
423 | bool exception = false; | ||
424 | if (exceptions.Count > 0) // we have exceptions | ||
425 | { | ||
426 | // Retrieve the visitor's origin | ||
427 | string userURL = aCircuit.ServiceURLs["HomeURI"].ToString(); | ||
428 | if (!userURL.EndsWith("/")) | ||
429 | userURL += "/"; | ||
430 | |||
431 | if (exceptions.Find(delegate(string s) | ||
432 | { | ||
433 | if (!s.EndsWith("/")) | ||
434 | s += "/"; | ||
435 | return s == userURL; | ||
436 | }) != null) | ||
437 | exception = true; | ||
438 | } | ||
439 | |||
440 | return exception; | ||
441 | } | ||
396 | 442 | ||
397 | #endregion | 443 | #endregion |
398 | } | 444 | } |
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index 49c7f89..a6fc731 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs | |||
@@ -77,6 +77,10 @@ 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 | |||
80 | public UserAgentService(IConfigSource config) : this(config, null) | 84 | public UserAgentService(IConfigSource config) : this(config, null) |
81 | { | 85 | { |
82 | } | 86 | } |
@@ -121,6 +125,12 @@ namespace OpenSim.Services.HypergridService | |||
121 | m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args); | 125 | m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args); |
122 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userAccountService, args); | 126 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userAccountService, args); |
123 | 127 | ||
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 | |||
124 | m_GridName = serverConfig.GetString("ExternalName", string.Empty); | 134 | m_GridName = serverConfig.GetString("ExternalName", string.Empty); |
125 | if (m_GridName == string.Empty) | 135 | if (m_GridName == string.Empty) |
126 | { | 136 | { |
@@ -130,10 +140,43 @@ namespace OpenSim.Services.HypergridService | |||
130 | if (!m_GridName.EndsWith("/")) | 140 | if (!m_GridName.EndsWith("/")) |
131 | m_GridName = m_GridName + "/"; | 141 | m_GridName = m_GridName + "/"; |
132 | 142 | ||
133 | m_LevelOutsideContacts = serverConfig.GetInt("LevelOutsideContacts", 0); | ||
134 | } | 143 | } |
135 | } | 144 | } |
136 | 145 | ||
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 | |||
137 | public GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt) | 180 | public GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt) |
138 | { | 181 | { |
139 | position = new Vector3(128, 128, 0); lookAt = Vector3.UnitY; | 182 | position = new Vector3(128, 128, 0); lookAt = Vector3.UnitY; |
@@ -166,13 +209,39 @@ namespace OpenSim.Services.HypergridService | |||
166 | m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", | 209 | m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", |
167 | agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI); | 210 | agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI); |
168 | 211 | ||
169 | if (m_UserAccountService.GetUserAccount(UUID.Zero, agentCircuit.AgentID) == null) | 212 | string gridName = gatekeeper.ServerURI; |
213 | |||
214 | UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, agentCircuit.AgentID); | ||
215 | if (account == null) | ||
170 | { | 216 | { |
171 | m_log.WarnFormat("[USER AGENT SERVICE]: Someone attempted to lauch a foreign user from here {0} {1}", agentCircuit.firstname, agentCircuit.lastname); | 217 | m_log.WarnFormat("[USER AGENT SERVICE]: Someone attempted to lauch a foreign user from here {0} {1}", agentCircuit.firstname, agentCircuit.lastname); |
172 | reason = "Forbidden to launch your agents from here"; | 218 | reason = "Forbidden to launch your agents from here"; |
173 | return false; | 219 | return false; |
174 | } | 220 | } |
175 | 221 | ||
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 | |||
176 | // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination | 245 | // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination |
177 | GridRegion region = new GridRegion(gatekeeper); | 246 | GridRegion region = new GridRegion(gatekeeper); |
178 | region.ServerURI = gatekeeper.ServerURI; | 247 | region.ServerURI = gatekeeper.ServerURI; |
@@ -189,7 +258,6 @@ namespace OpenSim.Services.HypergridService | |||
189 | 258 | ||
190 | bool success = false; | 259 | bool success = false; |
191 | string myExternalIP = string.Empty; | 260 | string myExternalIP = string.Empty; |
192 | string gridName = gatekeeper.ServerURI; | ||
193 | 261 | ||
194 | m_log.DebugFormat("[USER AGENT SERVICE]: this grid: {0}, desired grid: {1}", m_GridName, gridName); | 262 | m_log.DebugFormat("[USER AGENT SERVICE]: this grid: {0}, desired grid: {1}", m_GridName, gridName); |
195 | 263 | ||
@@ -588,6 +656,35 @@ namespace OpenSim.Services.HypergridService | |||
588 | else | 656 | else |
589 | return UUID.Zero; | 657 | return UUID.Zero; |
590 | } | 658 | } |
659 | |||
660 | #region Misc | ||
661 | |||
662 | private bool IsException(string dest, int level, Dictionary<int, List<string>> exceptions) | ||
663 | { | ||
664 | if (!exceptions.ContainsKey(level)) | ||
665 | return false; | ||
666 | |||
667 | bool exception = false; | ||
668 | if (exceptions[level].Count > 0) // we have exceptions | ||
669 | { | ||
670 | string destination = dest; | ||
671 | if (!destination.EndsWith("/")) | ||
672 | destination += "/"; | ||
673 | |||
674 | if (exceptions[level].Find(delegate(string s) | ||
675 | { | ||
676 | if (!s.EndsWith("/")) | ||
677 | s += "/"; | ||
678 | return s == destination; | ||
679 | }) != null) | ||
680 | exception = true; | ||
681 | } | ||
682 | |||
683 | return exception; | ||
684 | } | ||
685 | |||
686 | #endregion | ||
687 | |||
591 | } | 688 | } |
592 | 689 | ||
593 | class TravelingAgentInfo | 690 | class TravelingAgentInfo |