diff options
author | onefang | 2019-09-11 16:36:50 +1000 |
---|---|---|
committer | onefang | 2019-09-11 16:36:50 +1000 |
commit | 50cd1ffd32f69228e566f2b0b89f86ea0d9fe489 (patch) | |
tree | 52f2ab0c04f1a5d7d6ac5dc872981b4b156447e7 /OpenSim/Framework/OutboundUrlFilter.cs | |
parent | Renamed branch to SledjChisl. (diff) | |
parent | Bump to release flavour, build 0. (diff) | |
download | opensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.zip opensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.gz opensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.bz2 opensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.xz |
Merge branch 'SledjChisl'
Diffstat (limited to 'OpenSim/Framework/OutboundUrlFilter.cs')
-rw-r--r-- | OpenSim/Framework/OutboundUrlFilter.cs | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/OpenSim/Framework/OutboundUrlFilter.cs b/OpenSim/Framework/OutboundUrlFilter.cs index baa3647..63ae361 100644 --- a/OpenSim/Framework/OutboundUrlFilter.cs +++ b/OpenSim/Framework/OutboundUrlFilter.cs | |||
@@ -49,8 +49,8 @@ namespace OpenSim.Framework | |||
49 | private List<IPEndPoint> m_blacklistExceptionEndPoints; | 49 | private List<IPEndPoint> m_blacklistExceptionEndPoints; |
50 | 50 | ||
51 | public OutboundUrlFilter( | 51 | public OutboundUrlFilter( |
52 | string name, | 52 | string name, |
53 | List<IPNetwork> blacklistNetworks, List<IPEndPoint> blacklistEndPoints, | 53 | List<IPNetwork> blacklistNetworks, List<IPEndPoint> blacklistEndPoints, |
54 | List<IPNetwork> blacklistExceptionNetworks, List<IPEndPoint> blacklistExceptionEndPoints) | 54 | List<IPNetwork> blacklistExceptionNetworks, List<IPEndPoint> blacklistExceptionEndPoints) |
55 | { | 55 | { |
56 | Name = name; | 56 | Name = name; |
@@ -79,7 +79,7 @@ namespace OpenSim.Framework | |||
79 | if (networkConfig != null) | 79 | if (networkConfig != null) |
80 | { | 80 | { |
81 | configBlacklist = networkConfig.GetString("OutboundDisallowForUserScripts", configBlacklist); | 81 | configBlacklist = networkConfig.GetString("OutboundDisallowForUserScripts", configBlacklist); |
82 | configBlacklistExceptions | 82 | configBlacklistExceptions |
83 | = networkConfig.GetString("OutboundDisallowForUserScriptsExcept", configBlacklistExceptions); | 83 | = networkConfig.GetString("OutboundDisallowForUserScriptsExcept", configBlacklistExceptions); |
84 | } | 84 | } |
85 | 85 | ||
@@ -98,7 +98,7 @@ namespace OpenSim.Framework | |||
98 | string fullConfigEntry, string filterName, out List<IPNetwork> networks, out List<IPEndPoint> endPoints) | 98 | string fullConfigEntry, string filterName, out List<IPNetwork> networks, out List<IPEndPoint> endPoints) |
99 | { | 99 | { |
100 | // Parse blacklist | 100 | // Parse blacklist |
101 | string[] configBlacklistEntries | 101 | string[] configBlacklistEntries |
102 | = fullConfigEntry.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); | 102 | = fullConfigEntry.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); |
103 | 103 | ||
104 | configBlacklistEntries = configBlacklistEntries.Select(e => e.Trim()).ToArray(); | 104 | configBlacklistEntries = configBlacklistEntries.Select(e => e.Trim()).ToArray(); |
@@ -129,7 +129,7 @@ namespace OpenSim.Framework | |||
129 | if (!Uri.TryCreate("http://" + configEntry, UriKind.Absolute, out configEntryUri)) | 129 | if (!Uri.TryCreate("http://" + configEntry, UriKind.Absolute, out configEntryUri)) |
130 | { | 130 | { |
131 | m_log.ErrorFormat( | 131 | m_log.ErrorFormat( |
132 | "[OUTBOUND URL FILTER]: EndPoint entry [{0}] is invalid endpoint for {1}", | 132 | "[OUTBOUND URL FILTER]: EndPoint entry [{0}] is invalid endpoint for {1}", |
133 | configEntry, filterName); | 133 | configEntry, filterName); |
134 | 134 | ||
135 | continue; | 135 | continue; |
@@ -184,14 +184,14 @@ namespace OpenSim.Framework | |||
184 | foreach (IPEndPoint ep in endPoints) | 184 | foreach (IPEndPoint ep in endPoints) |
185 | { | 185 | { |
186 | // m_log.DebugFormat( | 186 | // m_log.DebugFormat( |
187 | // "[OUTBOUND URL FILTER]: Checking [{0}:{1}] against endpoint [{2}]", | 187 | // "[OUTBOUND URL FILTER]: Checking [{0}:{1}] against endpoint [{2}]", |
188 | // addr, port, ep); | 188 | // addr, port, ep); |
189 | 189 | ||
190 | if (addr.Equals(ep.Address) && port == ep.Port) | 190 | if (addr.Equals(ep.Address) && port == ep.Port) |
191 | { | 191 | { |
192 | // m_log.DebugFormat( | 192 | // m_log.DebugFormat( |
193 | // "[OUTBOUND URL FILTER]: Found [{0}:{1}] in endpoint [{2}]", addr, port, ep); | 193 | // "[OUTBOUND URL FILTER]: Found [{0}:{1}] in endpoint [{2}]", addr, port, ep); |
194 | 194 | ||
195 | return true; | 195 | return true; |
196 | } | 196 | } |
197 | } | 197 | } |
@@ -212,7 +212,17 @@ namespace OpenSim.Framework | |||
212 | // Check that we are permitted to make calls to this endpoint. | 212 | // Check that we are permitted to make calls to this endpoint. |
213 | bool foundIpv4Address = false; | 213 | bool foundIpv4Address = false; |
214 | 214 | ||
215 | IPAddress[] addresses = Dns.GetHostAddresses(url.Host); | 215 | IPAddress[] addresses = null; |
216 | |||
217 | try | ||
218 | { | ||
219 | addresses = Dns.GetHostAddresses(url.Host); | ||
220 | } | ||
221 | catch | ||
222 | { | ||
223 | // If there is a DNS error, we can't stop the script! | ||
224 | return true; | ||
225 | } | ||
216 | 226 | ||
217 | foreach (IPAddress addr in addresses) | 227 | foreach (IPAddress addr in addresses) |
218 | { | 228 | { |
@@ -228,7 +238,7 @@ namespace OpenSim.Framework | |||
228 | // m_log.DebugFormat("[OUTBOUND URL FILTER]: Found [{0}] in blacklist for {1}", url, Name); | 238 | // m_log.DebugFormat("[OUTBOUND URL FILTER]: Found [{0}] in blacklist for {1}", url, Name); |
229 | 239 | ||
230 | // Check blacklist exceptions | 240 | // Check blacklist exceptions |
231 | allowed | 241 | allowed |
232 | = OutboundUrlFilter.IsInNetwork( | 242 | = OutboundUrlFilter.IsInNetwork( |
233 | addr, url.Port, m_blacklistExceptionNetworks, m_blacklistExceptionEndPoints, Name); | 243 | addr, url.Port, m_blacklistExceptionNetworks, m_blacklistExceptionEndPoints, Name); |
234 | 244 | ||
@@ -253,4 +263,4 @@ namespace OpenSim.Framework | |||
253 | return allowed; | 263 | return allowed; |
254 | } | 264 | } |
255 | } | 265 | } |
256 | } \ No newline at end of file | 266 | } |