Index: content/browser/debugger/devtools_http_handler_impl.cc |
diff --git a/content/browser/debugger/devtools_http_handler_impl.cc b/content/browser/debugger/devtools_http_handler_impl.cc |
index 3982a45b11b466efb888cb2486d62ecf5b537fca..8b34692d4a05b3aa9ffca967ecf47d9d4c4be3be 100644 |
--- a/content/browser/debugger/devtools_http_handler_impl.cc |
+++ b/content/browser/debugger/devtools_http_handler_impl.cc |
@@ -118,6 +118,25 @@ class DevToolsClientHostImpl : public DevToolsClientHost { |
} // namespace |
+#if defined(OS_ANDROID) |
+// static |
+bool DevToolsHttpHandler::IsUserAllowedToConnect(uid_t uid, gid_t gid) { |
pfeldman
2012/08/02 17:05:50
I don't think this code belongs here. It looks lik
Satish
2012/08/02 17:17:53
This function is specific to the devtools feature,
pfeldman
2012/08/02 17:37:53
The code below does not seem to be related to devt
Satish
2012/08/06 10:21:41
Done.
|
+ struct passwd* creds = getpwuid(uid); |
+ if (!creds || !creds->pw_name) { |
+ LOG(WARNING) << "DevToolsHttpHandler: can't obtain creds for uid " << uid; |
+ return false; |
+ } |
+ if (gid == uid && |
+ (strcmp("root", creds->pw_name) == 0 || |
+ strcmp("shell", creds->pw_name) == 0)) { |
+ return true; |
+ } |
+ LOG(WARNING) << "DevToolsHttpHandler: connection attempt from " |
+ << creds->pw_name; |
+ return false; |
+} |
+#endif |
+ |
// static |
int DevToolsHttpHandler::GetFrontendResourceId(const std::string& name) { |
for (size_t i = 0; i < kDevtoolsResourcesSize; ++i) { |