aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-07-15 21:51:57 +0100
committerJustin Clark-Casey (justincc)2010-07-15 21:51:57 +0100
commit0bec4f5ea5b2586bcc3899ad084e30d42218cb44 (patch)
treef27dc6b8c848f0c635663042bbd5fe8d55da6be6 /OpenSim
parentrefactor: simplify current whitelist url checking by using System.Uri (diff)
downloadopensim-SC-0bec4f5ea5b2586bcc3899ad084e30d42218cb44.zip
opensim-SC-0bec4f5ea5b2586bcc3899ad084e30d42218cb44.tar.gz
opensim-SC-0bec4f5ea5b2586bcc3899ad084e30d42218cb44.tar.bz2
opensim-SC-0bec4f5ea5b2586bcc3899ad084e30d42218cb44.tar.xz
Handle checking of line starting "*" wildcard for whitelist patterns
A line starting * can only be applied to the domain, not the path
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs30
1 files changed, 22 insertions, 8 deletions
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
index c8e72ca..cbe9af2 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
@@ -458,22 +458,36 @@ namespace OpenSim.Region.CoreModules.Media.Moap
458 { 458 {
459 Uri url = new Uri(rawUrl); 459 Uri url = new Uri(rawUrl);
460 460
461 foreach (string rawWlUrl in whitelist) 461 foreach (string origWlUrl in whitelist)
462 { 462 {
463 string wlUrl = rawWlUrl; 463 string wlUrl = origWlUrl;
464 464
465 // Deal with a line-ending wildcard 465 // Deal with a line-ending wildcard
466 if (wlUrl.EndsWith("*")) 466 if (wlUrl.EndsWith("*"))
467 wlUrl = wlUrl.Remove(wlUrl.Length - 1); 467 wlUrl = wlUrl.Remove(wlUrl.Length - 1);
468 468
469 m_log.DebugFormat("[MOAP]: Checking whitelist URL {0}", wlUrl); 469 m_log.DebugFormat("[MOAP]: Checking whitelist URL pattern {0}", origWlUrl);
470 470
471 string urlToMatch = url.Authority + url.AbsolutePath; 471 // Handle a line starting wildcard slightly differently since this can only match the domain, not the path
472 472 if (wlUrl.StartsWith("*"))
473 if (urlToMatch.StartsWith(wlUrl)) 473 {
474 wlUrl = wlUrl.Substring(1);
475
476 if (url.Host.Contains(wlUrl))
477 {
478 m_log.DebugFormat("[MOAP]: Whitelist URL {0} matches {1}", origWlUrl, rawUrl);
479 return true;
480 }
481 }
482 else
474 { 483 {
475 m_log.DebugFormat("[MOAP]: Whitelist URL {0} matches {1}", wlUrl, urlToMatch); 484 string urlToMatch = url.Authority + url.AbsolutePath;
476 return true; 485
486 if (urlToMatch.StartsWith(wlUrl))
487 {
488 m_log.DebugFormat("[MOAP]: Whitelist URL {0} matches {1}", origWlUrl, rawUrl);
489 return true;
490 }
477 } 491 }
478 } 492 }
479 493