Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/plugin/PluginClientBase.cpp

Issue 10955040: Fix domain whitelisting and remove unused code (Closed)
Patch Set: Created June 25, 2013, 9:42 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 // Internet / FTP 3 // Internet / FTP
4 #include <wininet.h> 4 #include <wininet.h>
5 5
6 // IP adapter 6 // IP adapter
7 #include <iphlpapi.h> 7 #include <iphlpapi.h>
8 8
9 #include "PluginSettings.h" 9 #include "PluginSettings.h"
10 #include "PluginSystem.h" 10 #include "PluginSystem.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 hasError = true; 149 hasError = true;
150 150
151 s_pluginErrors.erase(it); 151 s_pluginErrors.erase(it);
152 } 152 }
153 } 153 }
154 s_criticalSectionLocal.Unlock(); 154 s_criticalSectionLocal.Unlock();
155 155
156 return hasError; 156 return hasError;
157 } 157 }
158
159 // ============================================================================
160 // Whitelisting
161 // ============================================================================
162
163 #ifdef SUPPORT_WHITELIST
164
165 bool CPluginClientBase::IsUrlWhiteListed(const CString& url)
166 {
167 if (url.IsEmpty())
168 {
169 return false;
170 }
171
172 int pos = 0;
173 CString scheme = url.Find('/',pos) >= 0 ? url.Tokenize(L"/", pos) : L"";
174 CString domain = ExtractDomain(url);
175 if (scheme == L"res:" || scheme == L"file:")
Felix Dahlke 2013/06/25 09:46:58 Do you think excluding some schemes is still neces
Wladimir Palant 2013/06/25 12:00:40 Yes, leaving it to Matches() is more consistent to
Oleksandr 2013/06/25 12:13:58 We should do as little as possible with these. Esp
176 {
177 return true;
178 }
179
180 // TODO: Caching whitelist entries in PluginSettings is redundant and wasteful . We should have an engine call for IsWhitelistedDomain.
181 CPluginSettings* pluginSettings = CPluginSettings::GetInstance();
182 pluginSettings->RefreshWhitelist();
183 return pluginSettings->IsWhiteListedDomain(domain);
184 }
185
186 #endif // SUPPORT_WHITELIST
OLDNEW

Powered by Google App Engine
This is Rietveld