21 #ifndef LIBREPORT_DUMP_DIR_H_
22 #define LIBREPORT_DUMP_DIR_H_
25 #include "libreport_types.h"
28 #include <sys/types.h>
39 int create_symlink_lockfile(
const char *filename,
const char *pid_str);
40 int create_symlink_lockfile_at(
int dir_fd,
const char *filename,
const char *pid_str);
45 int secure_openat_read(
int dir_fd,
const char *filename);
48 DD_FAIL_QUIETLY_ENOENT = (1 << 0),
49 DD_FAIL_QUIETLY_EACCES = (1 << 1),
51 DD_OPEN_FOLLOW = (1 << 2),
52 DD_OPEN_READONLY = (1 << 3),
53 DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE = (1 << 4),
54 DD_DONT_WAIT_FOR_LOCK = (1 << 5),
56 DD_CREATE_PARENTS = (1 << 6),
76 int dd_openfd(
const char *dir);
77 struct dump_dir *dd_opendir(
const char *dir,
int flags);
80 struct dump_dir *dd_fdopendir(
int dir_fd,
const char *dir,
int flags);
81 struct dump_dir *dd_create_skeleton(
const char *dir, uid_t uid, mode_t mode,
int flags);
82 int dd_reset_ownership(
struct dump_dir *dd);
86 struct dump_dir *dd_create(
const char *dir, uid_t uid, mode_t mode);
88 void dd_create_basic_files(
struct dump_dir *dd, uid_t uid,
const char *chroot_dir);
89 int dd_exist(
const struct dump_dir *dd,
const char *path);
90 void dd_sanitize_mode_and_owner(
struct dump_dir *dd);
92 DIR *dd_init_next_file(
struct dump_dir *dd);
93 int dd_get_next_file(
struct dump_dir *dd,
char **short_name,
char **full_name);
95 char* dd_load_text_ext(
const struct dump_dir *dd,
const char *name,
unsigned flags);
96 char* dd_load_text(
const struct dump_dir *dd,
const char *name);
97 void dd_save_text(
struct dump_dir *dd,
const char *name,
const char *data);
98 void dd_save_binary(
struct dump_dir *dd,
const char *name,
const char *data,
unsigned size);
99 int dd_copy_file(
struct dump_dir *dd,
const char *name,
const char *source_path);
104 long dd_get_item_size(
struct dump_dir *dd,
const char *name);
109 int dd_delete_item(
struct dump_dir *dd,
const char *name);
112 int dd_rename(
struct dump_dir *dd,
const char *new_path);
121 int dd_chown(
struct dump_dir *dd, uid_t new_uid);
144 #define add_reported_to_data libreport_add_reported_to_data
145 int add_reported_to_data(
char **reported_to,
const char *line);
159 #define add_reported_to_entry_data libreport_add_reported_to_entry_data
160 int add_reported_to_entry_data(
char **reported_to,
struct report_result *result);
166 #define add_reported_to libreport_add_reported_to
167 void add_reported_to(
struct dump_dir *dd,
const char *line);
173 #define add_reported_to_entry libreport_add_reported_to_entry
176 #define free_report_result libreport_free_report_result
178 #define find_in_reported_to_data libreport_find_in_reported_to_data
179 report_result_t *find_in_reported_to_data(
const char *reported_to,
const char *report_label);
180 #define find_in_reported_to libreport_find_in_reported_to
182 #define read_entire_reported_to_data libreport_read_entire_reported_to_data
183 GList *read_entire_reported_to_data(
const char* reported_to);
184 #define read_entire_reported_to libreport_read_entire_reported_to
185 GList *read_entire_reported_to(
struct dump_dir *dd);
188 void delete_dump_dir(
const char *dirname);
196 int dump_dir_accessible_by_uid(
const char *dirname, uid_t uid);
197 int fdump_dir_accessible_by_uid(
int dir_fd, uid_t uid);
200 DD_STAT_ACCESSIBLE_BY_UID = 1,
201 DD_STAT_OWNED_BY_UID = DD_STAT_ACCESSIBLE_BY_UID << 1,
211 int dump_dir_stat_for_uid(
const char *dirname, uid_t uid);
212 int fdump_dir_stat_for_uid(
int dir_fd, uid_t uid);
220 int dd_mark_as_notreportable(
struct dump_dir *dd,
const char *reason);
242 int dd_create_archive(
struct dump_dir *dd,
const char *archive_name,
243 const_string_vector_const_ptr_t exclude_elements,
int flags);