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

Side by Side Diff: user_collector.h

Issue 4603001: crash-reporter: Avoid writing through symlinks. (Closed) Base URL: http://git.chromium.org/git/crash-reporter.git@master
Patch Set: Respond to review Created 10 years, 1 month 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
« no previous file with comments | « kernel_collector.cc ('k') | user_collector.cc » ('j') | 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) 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 #ifndef _CRASH_REPORTER_USER_COLLECTOR_H_ 5 #ifndef _CRASH_REPORTER_USER_COLLECTOR_H_
6 #define _CRASH_REPORTER_USER_COLLECTOR_H_ 6 #define _CRASH_REPORTER_USER_COLLECTOR_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // Set (override the default) core file pattern. 45 // Set (override the default) core file pattern.
46 void set_core_pattern_file(const std::string &pattern) { 46 void set_core_pattern_file(const std::string &pattern) {
47 core_pattern_file_ = pattern; 47 core_pattern_file_ = pattern;
48 } 48 }
49 49
50 private: 50 private:
51 friend class UserCollectorTest; 51 friend class UserCollectorTest;
52 FRIEND_TEST(UserCollectorTest, CopyOffProcFilesBadPath); 52 FRIEND_TEST(UserCollectorTest, CopyOffProcFilesBadPath);
53 FRIEND_TEST(UserCollectorTest, CopyOffProcFilesBadPid); 53 FRIEND_TEST(UserCollectorTest, CopyOffProcFilesBadPid);
54 FRIEND_TEST(UserCollectorTest, CopyOffProcFilesOK); 54 FRIEND_TEST(UserCollectorTest, CopyOffProcFilesOK);
55 FRIEND_TEST(UserCollectorTest, ForkExecAndPipe);
56 FRIEND_TEST(UserCollectorTest, GetIdFromStatus); 55 FRIEND_TEST(UserCollectorTest, GetIdFromStatus);
57 FRIEND_TEST(UserCollectorTest, GetProcessPath); 56 FRIEND_TEST(UserCollectorTest, GetProcessPath);
58 FRIEND_TEST(UserCollectorTest, GetSymlinkTarget); 57 FRIEND_TEST(UserCollectorTest, GetSymlinkTarget);
59 FRIEND_TEST(UserCollectorTest, GetUserInfoFromName); 58 FRIEND_TEST(UserCollectorTest, GetUserInfoFromName);
60 59
61 // Enumeration to pass to GetIdFromStatus. Must match the order 60 // Enumeration to pass to GetIdFromStatus. Must match the order
62 // that the kernel lists IDs in the status file. 61 // that the kernel lists IDs in the status file.
63 enum IdKind { 62 enum IdKind {
64 kIdReal = 0, // uid and gid 63 kIdReal = 0, // uid and gid
65 kIdEffective = 1, // euid and egid 64 kIdEffective = 1, // euid and egid
(...skipping 22 matching lines...) Expand all
88 87
89 bool CopyOffProcFiles(pid_t pid, const FilePath &process_map); 88 bool CopyOffProcFiles(pid_t pid, const FilePath &process_map);
90 // Determines the crash directory for given pid based on pid's owner, 89 // Determines the crash directory for given pid based on pid's owner,
91 // and creates the directory if necessary with appropriate permissions. 90 // and creates the directory if necessary with appropriate permissions.
92 // Returns true whether or not directory needed to be created, false on 91 // Returns true whether or not directory needed to be created, false on
93 // any failure. 92 // any failure.
94 bool GetCreatedCrashDirectory(pid_t pid, 93 bool GetCreatedCrashDirectory(pid_t pid,
95 FilePath *crash_file_path, 94 FilePath *crash_file_path,
96 bool *out_of_capacity); 95 bool *out_of_capacity);
97 bool CopyStdinToCoreFile(const FilePath &core_path); 96 bool CopyStdinToCoreFile(const FilePath &core_path);
98 int ForkExecAndPipe(std::vector<const char *> &arguments,
99 const char *output_file);
100 bool RunCoreToMinidump(const FilePath &core_path, 97 bool RunCoreToMinidump(const FilePath &core_path,
101 const FilePath &procfs_directory, 98 const FilePath &procfs_directory,
102 const FilePath &minidump_path, 99 const FilePath &minidump_path,
103 const FilePath &temp_directory); 100 const FilePath &temp_directory);
104 bool ConvertCoreToMinidump(pid_t pid, 101 bool ConvertCoreToMinidump(pid_t pid,
105 const FilePath &container_dir, 102 const FilePath &container_dir,
106 const FilePath &core_path, 103 const FilePath &core_path,
107 const FilePath &minidump_path); 104 const FilePath &minidump_path);
108 bool ConvertAndEnqueueCrash(int pid, const std::string &exec_name, 105 bool ConvertAndEnqueueCrash(int pid, const std::string &exec_name,
109 bool *out_of_capacity); 106 bool *out_of_capacity);
110 107
111 bool generate_diagnostics_; 108 bool generate_diagnostics_;
112 std::string core_pattern_file_; 109 std::string core_pattern_file_;
113 std::string our_path_; 110 std::string our_path_;
114 bool initialized_; 111 bool initialized_;
115 112
116 // String containing the current log of crash handling errors. 113 // String containing the current log of crash handling errors.
117 std::string error_log_; 114 std::string error_log_;
118 115
119 static const char *kUserId; 116 static const char *kUserId;
120 static const char *kGroupId; 117 static const char *kGroupId;
121 }; 118 };
122 119
123 #endif // _CRASH_REPORTER_USER_COLLECTOR_H_ 120 #endif // _CRASH_REPORTER_USER_COLLECTOR_H_
OLDNEW
« no previous file with comments | « kernel_collector.cc ('k') | user_collector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698