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

Unified Diff: chrome/nacl/nacl_listener.cc

Issue 14750007: NaCl: enable meta-based validation for shared libraries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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: chrome/nacl/nacl_listener.cc
diff --git a/chrome/nacl/nacl_listener.cc b/chrome/nacl/nacl_listener.cc
index b0b27e91a461904f9d9eef84f9cba4eb338d4e08..cd7cbad3e1bf17865795413bee5d3275b16346aa 100644
--- a/chrome/nacl/nacl_listener.cc
+++ b/chrome/nacl/nacl_listener.cc
@@ -130,6 +130,34 @@ class BrowserValidationDBProxy : public NaClValidationDB {
}
}
+ virtual bool ResolveFileNonce(uint64 nonce, int32* fd,
+ std::string* path) OVERRIDE {
+ *fd = -1;
+ *path = "";
+ if (nonce == 0) {
+ return false;
+ }
+ IPC::PlatformFileForTransit ipc_fd;
+ base::FilePath ipc_path;
+ if (!listener_->Send(new NaClProcessMsg_ResolveFileNonce(nonce, &ipc_fd,
+ &ipc_path))) {
+ return false;
+ }
+ if (ipc_fd == IPC::InvalidPlatformFileForTransit()) {
+ return false;
+ }
+ base::PlatformFile handle =
+ IPC::PlatformFileForTransitToPlatformFile(ipc_fd);
+#if defined(OS_WIN)
+ // On Windows, valid handles are 32 bit unsigned integers so this is safe.
+ *fd = reinterpret_cast<uintptr_t>(handle);
+#else
+ *fd = handle;
+#endif
+ *path = ipc_path.AsUTF8Unsafe();
+ return true;
+ }
+
private:
// The listener never dies, otherwise this might be a dangling reference.
NaClListener* listener_;

Powered by Google App Engine
This is Rietveld 408576698