OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include <stdio.h> |
| 6 #include <stdlib.h> |
5 #include <string.h> | 7 #include <string.h> |
6 #include <sys/capability.h> | 8 #include <sys/capability.h> |
7 | 9 |
8 #include "base/command_line.h" | 10 #include "base/command_line.h" |
9 | 11 |
10 // Checks that the capabilities mask of the current process is as expected. | 12 // Checks that the capabilities mask of the current process is as expected. |
11 // It mirrors the minijail code in considering CAP_SETPCAP acceptable | 13 // It mirrors the minijail code in considering CAP_SETPCAP acceptable |
12 // regardless of the mask passed into the function. | 14 // regardless of the mask passed into the function. |
13 void CheckRootCaps(uint64_t effective_capmask) { | 15 void CheckRootCaps(uint64_t effective_capmask) { |
14 cap_t caps = cap_get_proc(); | 16 cap_t caps = cap_get_proc(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 57 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
56 | 58 |
57 if(cmd_line->HasSwitch("checkRootCaps")) { | 59 if(cmd_line->HasSwitch("checkRootCaps")) { |
58 uint64_t caps = | 60 uint64_t caps = |
59 atol(cmd_line->GetSwitchValueASCII("checkRootCaps").c_str()); | 61 atol(cmd_line->GetSwitchValueASCII("checkRootCaps").c_str()); |
60 CheckRootCaps(caps); | 62 CheckRootCaps(caps); |
61 } | 63 } |
62 | 64 |
63 return 0; | 65 return 0; |
64 } | 66 } |
OLD | NEW |