Commit f2f4404f authored by rnk@chromium.org's avatar rnk@chromium.org

Fix clang -Wwritable-strings warnings in the Windows sandbox

R=cpu@chromium.org
BUG=82385

Review URL: https://codereview.chromium.org/294753003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271591 0039d316-1c4b-4281-b951-d872f2087c98
parent f92003d2
...@@ -14,7 +14,8 @@ Job::~Job() { ...@@ -14,7 +14,8 @@ Job::~Job() {
::CloseHandle(job_handle_); ::CloseHandle(job_handle_);
}; };
DWORD Job::Init(JobLevel security_level, wchar_t *job_name, DWORD Job::Init(JobLevel security_level,
const wchar_t* job_name,
DWORD ui_exceptions) { DWORD ui_exceptions) {
if (job_handle_) if (job_handle_)
return ERROR_ALREADY_INITIALIZED; return ERROR_ALREADY_INITIALIZED;
......
...@@ -29,7 +29,9 @@ class Job { ...@@ -29,7 +29,9 @@ class Job {
// If the function succeeds, the return value is ERROR_SUCCESS. If the // If the function succeeds, the return value is ERROR_SUCCESS. If the
// function fails, the return value is the win32 error code corresponding to // function fails, the return value is the win32 error code corresponding to
// the error. // the error.
DWORD Init(JobLevel security_level, wchar_t *job_name, DWORD ui_exceptions); DWORD Init(JobLevel security_level,
const wchar_t* job_name,
DWORD ui_exceptions);
// Assigns the process referenced by process_handle to the job. // Assigns the process referenced by process_handle to the job.
// If the function succeeds, the return value is ERROR_SUCCESS. If the // If the function succeeds, the return value is ERROR_SUCCESS. If the
......
...@@ -109,9 +109,10 @@ TEST(NamedPipePolicyTest, CreatePipeCanonicalization) { ...@@ -109,9 +109,10 @@ TEST(NamedPipePolicyTest, CreatePipeCanonicalization) {
// disable all string parsing and to send the string that follows it straight // disable all string parsing and to send the string that follows it straight
// to the file system." // to the file system."
// http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx // http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx
wchar_t* argv[2] = { L"\\\\?\\pipe\\test\\..\\bleh", const wchar_t* argv[2] = { L"\\\\?\\pipe\\test\\..\\bleh",
L"\\Device\\NamedPipe\\test" }; L"\\Device\\NamedPipe\\test" };
EXPECT_EQ(SBOX_TEST_SUCCEEDED, NamedPipe_Create(2, argv)); EXPECT_EQ(SBOX_TEST_SUCCEEDED,
NamedPipe_Create(2, const_cast<wchar_t**>(argv)));
} }
// The same test as CreatePipe but this time using strict interceptions. // The same test as CreatePipe but this time using strict interceptions.
......
...@@ -60,7 +60,7 @@ TEST(PolicyEngineTest, Rules1) { ...@@ -60,7 +60,7 @@ TEST(PolicyEngineTest, Rules1) {
opcode_maker.MakeOpAction(FAKE_ACCESS_DENIED, kPolNone); opcode_maker.MakeOpAction(FAKE_ACCESS_DENIED, kPolNone);
policy->opcode_count = 7; policy->opcode_count = 7;
wchar_t* filename = L"c:\\Documents and Settings\\Microsoft\\BLAH.txt"; const wchar_t* filename = L"c:\\Documents and Settings\\Microsoft\\BLAH.txt";
unsigned long creation_mode = OPEN_EXISTING; unsigned long creation_mode = OPEN_EXISTING;
unsigned long flags = FILE_ATTRIBUTE_NORMAL; unsigned long flags = FILE_ATTRIBUTE_NORMAL;
void* security_descriptor = NULL; void* security_descriptor = NULL;
......
...@@ -62,7 +62,7 @@ TEST(PolicyEngineTest, SimpleStrMatch) { ...@@ -62,7 +62,7 @@ TEST(PolicyEngineTest, SimpleStrMatch) {
EXPECT_TRUE(policyGen.AddRule(kFakeService, &pr)); EXPECT_TRUE(policyGen.AddRule(kFakeService, &pr));
EXPECT_TRUE(policyGen.Done()); EXPECT_TRUE(policyGen.Done());
wchar_t* filename = L"Z:\\Directory\\domo.txt"; const wchar_t* filename = L"Z:\\Directory\\domo.txt";
POLPARAMS_BEGIN(eval_params) POLPARAMS_BEGIN(eval_params)
POLPARAM(filename) // Argument 0 POLPARAM(filename) // Argument 0
...@@ -95,7 +95,7 @@ TEST(PolicyEngineTest, SimpleIfNotStrMatch) { ...@@ -95,7 +95,7 @@ TEST(PolicyEngineTest, SimpleIfNotStrMatch) {
EXPECT_TRUE(policyGen.AddRule(kFakeService, &pr)); EXPECT_TRUE(policyGen.AddRule(kFakeService, &pr));
EXPECT_TRUE(policyGen.Done()); EXPECT_TRUE(policyGen.Done());
wchar_t* filename = NULL; const wchar_t* filename = NULL;
POLPARAMS_BEGIN(eval_params) POLPARAMS_BEGIN(eval_params)
POLPARAM(filename) // Argument 0 POLPARAM(filename) // Argument 0
POLPARAMS_END; POLPARAMS_END;
...@@ -133,7 +133,7 @@ TEST(PolicyEngineTest, SimpleIfNotStrMatchWild1) { ...@@ -133,7 +133,7 @@ TEST(PolicyEngineTest, SimpleIfNotStrMatchWild1) {
EXPECT_TRUE(policyGen.AddRule(kFakeService, &pr)); EXPECT_TRUE(policyGen.AddRule(kFakeService, &pr));
EXPECT_TRUE(policyGen.Done()); EXPECT_TRUE(policyGen.Done());
wchar_t* filename = NULL; const wchar_t* filename = NULL;
POLPARAMS_BEGIN(eval_params) POLPARAMS_BEGIN(eval_params)
POLPARAM(filename) // Argument 0 POLPARAM(filename) // Argument 0
POLPARAMS_END; POLPARAMS_END;
...@@ -166,7 +166,7 @@ TEST(PolicyEngineTest, SimpleIfNotStrMatchWild2) { ...@@ -166,7 +166,7 @@ TEST(PolicyEngineTest, SimpleIfNotStrMatchWild2) {
EXPECT_TRUE(policyGen.AddRule(kFakeService, &pr)); EXPECT_TRUE(policyGen.AddRule(kFakeService, &pr));
EXPECT_TRUE(policyGen.Done()); EXPECT_TRUE(policyGen.Done());
wchar_t* filename = NULL; const wchar_t* filename = NULL;
POLPARAMS_BEGIN(eval_params) POLPARAMS_BEGIN(eval_params)
POLPARAM(filename) // Argument 0 POLPARAM(filename) // Argument 0
POLPARAMS_END; POLPARAMS_END;
...@@ -205,7 +205,7 @@ TEST(PolicyEngineTest, IfNotStrMatchTwoRulesWild1) { ...@@ -205,7 +205,7 @@ TEST(PolicyEngineTest, IfNotStrMatchTwoRulesWild1) {
EXPECT_TRUE(policyGen.AddRule(kFakeService, &pr)); EXPECT_TRUE(policyGen.AddRule(kFakeService, &pr));
EXPECT_TRUE(policyGen.Done()); EXPECT_TRUE(policyGen.Done());
wchar_t* filename = NULL; const wchar_t* filename = NULL;
unsigned long access = 0; unsigned long access = 0;
POLPARAMS_BEGIN(eval_params) POLPARAMS_BEGIN(eval_params)
POLPARAM(filename) // Argument 0 POLPARAM(filename) // Argument 0
...@@ -254,7 +254,7 @@ TEST(PolicyEngineTest, IfNotStrMatchTwoRulesWild2) { ...@@ -254,7 +254,7 @@ TEST(PolicyEngineTest, IfNotStrMatchTwoRulesWild2) {
EXPECT_TRUE(policyGen.AddRule(kFakeService, &pr)); EXPECT_TRUE(policyGen.AddRule(kFakeService, &pr));
EXPECT_TRUE(policyGen.Done()); EXPECT_TRUE(policyGen.Done());
wchar_t* filename = NULL; const wchar_t* filename = NULL;
unsigned long access = 0; unsigned long access = 0;
unsigned long sharing = 66; unsigned long sharing = 66;
...@@ -328,7 +328,7 @@ TEST(PolicyEngineTest, OneRuleTest) { ...@@ -328,7 +328,7 @@ TEST(PolicyEngineTest, OneRuleTest) {
EXPECT_TRUE(policyGen.AddRule(kNtFakeCreateFile, &pr)); EXPECT_TRUE(policyGen.AddRule(kNtFakeCreateFile, &pr));
EXPECT_TRUE(policyGen.Done()); EXPECT_TRUE(policyGen.Done());
wchar_t* filename = L"c:\\Documents and Settings\\Microsoft\\BLAH.txt"; const wchar_t* filename = L"c:\\Documents and Settings\\Microsoft\\BLAH.txt";
unsigned long creation_mode = OPEN_EXISTING; unsigned long creation_mode = OPEN_EXISTING;
unsigned long flags = FILE_ATTRIBUTE_NORMAL; unsigned long flags = FILE_ATTRIBUTE_NORMAL;
void* security_descriptor = NULL; void* security_descriptor = NULL;
...@@ -484,7 +484,7 @@ TEST(PolicyEngineTest, ThreeRulesTest) { ...@@ -484,7 +484,7 @@ TEST(PolicyEngineTest, ThreeRulesTest) {
// Test the policy evaluation. // Test the policy evaluation.
wchar_t* filename = L""; const wchar_t* filename = L"";
unsigned long creation_mode = OPEN_EXISTING; unsigned long creation_mode = OPEN_EXISTING;
unsigned long flags = FILE_ATTRIBUTE_NORMAL; unsigned long flags = FILE_ATTRIBUTE_NORMAL;
void* security_descriptor = NULL; void* security_descriptor = NULL;
...@@ -588,7 +588,7 @@ TEST(PolicyEngineTest, PolicyRuleCopyConstructorTwoStrings) { ...@@ -588,7 +588,7 @@ TEST(PolicyEngineTest, PolicyRuleCopyConstructorTwoStrings) {
EXPECT_TRUE(policyGen.AddRule(2, &pr_copy)); EXPECT_TRUE(policyGen.AddRule(2, &pr_copy));
EXPECT_TRUE(policyGen.Done()); EXPECT_TRUE(policyGen.Done());
wchar_t* name = NULL; const wchar_t* name = NULL;
POLPARAMS_BEGIN(eval_params) POLPARAMS_BEGIN(eval_params)
POLPARAM(name) POLPARAM(name)
POLPARAMS_END; POLPARAMS_END;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment