Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(482)

Unified Diff: net/socket/unix_domain_server_socket_posix.h

Issue 382143005: Supports DevTools socket access authentication based on Android permissions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Commented process_id Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/socket/unix_domain_server_socket_posix.h
diff --git a/net/socket/unix_domain_server_socket_posix.h b/net/socket/unix_domain_server_socket_posix.h
index 06fb8d32c47bc4b0e700fa70f51d3f2ab80aa36d..85c743d2b8fcc6613afba713cec729687c13eb42 100644
--- a/net/socket/unix_domain_server_socket_posix.h
+++ b/net/socket/unix_domain_server_socket_posix.h
@@ -25,20 +25,30 @@ class SocketLibevent;
// Linux and Android.
class NET_EXPORT UnixDomainServerSocket : public ServerSocket {
public:
+ // Credentials of a peer process connected to the socket.
+ struct NET_EXPORT Credentials {
+#if defined(OS_LINUX) || defined(OS_ANDROID)
+ // Linux/Android API provides more information about the connected peer
+ // than Windows/OS X. It's useful for permission-based authorization on
+ // Android.
+ pid_t process_id;
+#endif
+ uid_t user_id;
+ gid_t group_id;
+ };
+
// Callback that returns whether the already connected client, identified by
- // its process |user_id| and |group_id|, is allowed to keep the connection
- // open. Note that the socket is closed immediately in case the callback
- // returns false.
- typedef base::Callback<bool (uid_t user_id, gid_t group_id)> AuthCallback;
+ // its credentials, is allowed to keep the connection open. Note that
+ // the socket is closed immediately in case the callback returns false.
+ typedef base::Callback<bool (const Credentials&)> AuthCallback;
UnixDomainServerSocket(const AuthCallback& auth_callack,
bool use_abstract_namespace);
virtual ~UnixDomainServerSocket();
- // Gets UID and GID of peer to check permissions.
- static bool GetPeerIds(SocketDescriptor socket_fd,
- uid_t* user_id,
- gid_t* group_id);
+ // Gets credentials of peer to check permissions.
+ static bool GetPeerCredentials(SocketDescriptor socket_fd,
+ Credentials* credentials);
// ServerSocket implementation.
virtual int Listen(const IPEndPoint& address, int backlog) OVERRIDE;
« no previous file with comments | « net/socket/unix_domain_listen_socket_posix_unittest.cc ('k') | net/socket/unix_domain_server_socket_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698