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

Unified Diff: chrome/nacl/nacl_validation_query.cc

Issue 14750007: NaCl: enable meta-based validation for shared libraries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment 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_validation_query.cc
diff --git a/chrome/nacl/nacl_validation_query.cc b/chrome/nacl/nacl_validation_query.cc
index 37d9b7866e51fa0c356e4a4871b1a7f95f926b2e..c62c3653aa846f5a0dc95827ad46a1c1fc91d91c 100644
--- a/chrome/nacl/nacl_validation_query.cc
+++ b/chrome/nacl/nacl_validation_query.cc
@@ -7,6 +7,7 @@
#include "base/logging.h"
#include "crypto/nss_util.h"
#include "chrome/nacl/nacl_validation_db.h"
+#include "native_client/src/trusted/validator/nacl_file_info.h"
#include "native_client/src/trusted/validator/validation_cache.h"
NaClValidationQueryContext::NaClValidationQueryContext(
@@ -29,6 +30,13 @@ NaClValidationQuery* NaClValidationQueryContext::CreateQuery() {
return query;
}
+bool NaClValidationQueryContext::ResolveFileToken(
+ struct NaClFileToken *file_token,
Mark Seaborn 2013/05/24 20:21:58 Fix "*" spacing style
Nick Bray (chromium) 2013/05/24 21:35:24 Done.
+ int32* fd,
+ std::string* path) {
+ return db_->ResolveFileToken(file_token, fd, path);
+}
+
NaClValidationQuery::NaClValidationQuery(NaClValidationDB* db,
const std::string& profile_key)
: state_(READY),
@@ -127,6 +135,24 @@ static void DestroyQuery(void* query) {
delete static_cast<NaClValidationQuery*>(query);
}
+static int ResolveFileToken(void* handle, struct NaClFileToken* file_token,
+ int32* fd, char** file_path,
+ uint32 *file_path_length) {
Mark Seaborn 2013/05/24 20:21:58 Fix "*" spacing style
Nick Bray (chromium) 2013/05/24 21:35:24 Done.
+ std::string path;
+ *file_path = NULL;
+ *file_path_length = 0;
+ bool ok = static_cast<NaClValidationQueryContext*>(handle)->
+ ResolveFileToken(file_token, fd, &path);
+ if (ok) {
+ *file_path = static_cast<char *>(malloc(path.length() + 1));
Mark Seaborn 2013/05/24 20:21:58 Style is "char*"
Nick Bray (chromium) 2013/05/24 21:35:24 Done.
+ CHECK(*file_path);
+ memcpy(*file_path, path.data(), path.length());
+ (*file_path)[path.length()] = 0;
+ *file_path_length = static_cast<uint32>(path.length());
+ }
+ return ok;
+}
+
struct NaClValidationCache* CreateValidationCache(
NaClValidationDB* db, const std::string& profile_key,
const std::string& nacl_version) {
@@ -140,5 +166,6 @@ struct NaClValidationCache* CreateValidationCache(
cache->QueryKnownToValidate = QueryKnownToValidate;
cache->SetKnownToValidate = SetKnownToValidate;
cache->DestroyQuery = DestroyQuery;
+ cache->ResolveFileToken = ResolveFileToken;
return cache;
}

Powered by Google App Engine
This is Rietveld 408576698