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

Side by Side Diff: platform.cc

Issue 6895001: [cryptohome] make guest-mode homedir mount with -rwx------ (Closed) Base URL: http://git.chromium.org/git/cryptohome.git@master
Patch Set: Created 9 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« platform.h ('K') | « platform.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Contains the implementation of class Platform 5 // Contains the implementation of class Platform
6 6
7 #include "platform.h" 7 #include "platform.h"
8 8
9 #include <errno.h> 9 #include <errno.h>
10 #include <grp.h> 10 #include <grp.h>
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 return false; 379 return false;
380 } 380 }
381 381
382 // Set permissions on the directory itself 382 // Set permissions on the directory itself
383 if (!SetOwnership(current_dir, user_id, group_id)) 383 if (!SetOwnership(current_dir, user_id, group_id))
384 return false; 384 return false;
385 } 385 }
386 return true; 386 return true;
387 } 387 }
388 388
389 bool Platform::SetPermissions(const std::string& path, mode_t new_perms) {
390 if (chmod(path.c_str(), new_perms)) {
391 PLOG(ERROR) << "chmod() of " << path.c_str() << " to " << new_perms
392 << " failed.";
393 return false;
394 }
395 return true;
396 }
397
389 int Platform::SetMask(int new_mask) { 398 int Platform::SetMask(int new_mask) {
390 return umask(new_mask); 399 return umask(new_mask);
391 } 400 }
392 401
393 bool Platform::GetUserId(const std::string& user, uid_t* user_id, 402 bool Platform::GetUserId(const std::string& user, uid_t* user_id,
394 gid_t* group_id) { 403 gid_t* group_id) {
395 // Load the passwd entry 404 // Load the passwd entry
396 long user_name_length = sysconf(_SC_GETPW_R_SIZE_MAX); 405 long user_name_length = sysconf(_SC_GETPW_R_SIZE_MAX);
397 if (user_name_length == -1) { 406 if (user_name_length == -1) {
398 user_name_length = kDefaultPwnameLength; 407 user_name_length = kDefaultPwnameLength;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 bool recursive, 575 bool recursive,
567 std::vector<std::string>* file_list) { 576 std::vector<std::string>* file_list) {
568 file_util::FileEnumerator dir_enum(FilePath(path), recursive, 577 file_util::FileEnumerator dir_enum(FilePath(path), recursive,
569 file_util::FileEnumerator::FILES); 578 file_util::FileEnumerator::FILES);
570 for (FilePath path = dir_enum.Next(); !path.empty(); path = dir_enum.Next()) 579 for (FilePath path = dir_enum.Next(); !path.empty(); path = dir_enum.Next())
571 file_list->push_back(path.value()); 580 file_list->push_back(path.value());
572 return true; 581 return true;
573 } 582 }
574 583
575 } // namespace cryptohome 584 } // namespace cryptohome
OLDNEW
« platform.h ('K') | « platform.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698