diff options
Diffstat (limited to 'chrome/nacl/nacl_validation_query.cc')
-rw-r--r-- | chrome/nacl/nacl_validation_query.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/chrome/nacl/nacl_validation_query.cc b/chrome/nacl/nacl_validation_query.cc index 37d9b78..0ff831c 100644 --- a/chrome/nacl/nacl_validation_query.cc +++ b/chrome/nacl/nacl_validation_query.cc @@ -7,6 +7,8 @@ #include "base/logging.h" #include "crypto/nss_util.h" #include "chrome/nacl/nacl_validation_db.h" +#include "native_client/src/include/portability.h" +#include "native_client/src/trusted/validator/nacl_file_info.h" #include "native_client/src/trusted/validator/validation_cache.h" NaClValidationQueryContext::NaClValidationQueryContext( @@ -29,6 +31,13 @@ NaClValidationQuery* NaClValidationQueryContext::CreateQuery() { return query; } +bool NaClValidationQueryContext::ResolveFileToken( + struct NaClFileToken* file_token, + 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 +136,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) { + 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)); + 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 +167,6 @@ struct NaClValidationCache* CreateValidationCache( cache->QueryKnownToValidate = QueryKnownToValidate; cache->SetKnownToValidate = SetKnownToValidate; cache->DestroyQuery = DestroyQuery; + cache->ResolveFileToken = ResolveFileToken; return cache; } |