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

Delta Between Two Patch Sets: src/plugin/PluginClientBase.cpp

Issue 10948032: Fix domain-based whitelisting (Closed)
Left Patch Set: Created June 14, 2013, 2:44 p.m.
Right Patch Set: Created June 17, 2013, 1:50 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/plugin/PluginClientBase.h ('k') | src/plugin/PluginSettings.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 #ifdef SUPPORT_WHITELIST 167 #ifdef SUPPORT_WHITELIST
168 168
169 bool CPluginClientBase::IsUrlWhiteListed(const CString& url) 169 bool CPluginClientBase::IsUrlWhiteListed(const CString& url)
170 { 170 {
171 if (url.IsEmpty()) 171 if (url.IsEmpty())
172 { 172 {
173 return false; 173 return false;
174 } 174 }
175 175
176 int pos = 0; 176 int pos = 0;
177 CString http = url.Find('/',pos) >= 0 ? url.Tokenize(L"/", pos) : L""; 177 CString scheme = url.Find('/',pos) >= 0 ? url.Tokenize(L"/", pos) : L"";
Wladimir Palant 2013/06/17 09:33:56 I know that this isn't your code but that variable
Felix Dahlke 2013/06/17 11:19:01 Done.
178 CString domain = ExtractDomain(url); 178 CString domain = ExtractDomain(url);
179 if (http == L"res:" || http == L"file:") 179 if (scheme == L"res:" || scheme == L"file:")
180 { 180 {
181 return true; 181 return true;
182 } 182 }
183 183
184 // TODO: Caching whitelist entries in PluginSettings is redundant and wasteful . We should have an engine call for IsWhitelistedDomain.
184 CPluginSettings* pluginSettings = CPluginSettings::GetInstance(); 185 CPluginSettings* pluginSettings = CPluginSettings::GetInstance();
185 pluginSettings->RefreshWhitelist(); 186 pluginSettings->RefreshWhitelist();
186 return pluginSettings->IsWhiteListedDomain(domain); 187 return pluginSettings->IsWhiteListedDomain(domain);
Wladimir Palant 2013/06/17 09:33:56 Retrieving all exception domains from the engine j
Felix Dahlke 2013/06/17 11:19:01 Yes, I agree. I frankly didn't dare to change too
187 } 188 }
188 189
189 #endif // SUPPORT_WHITELIST 190 #endif // SUPPORT_WHITELIST
LEFTRIGHT

Powered by Google App Engine
This is Rietveld