mirror of
https://github.com/SELinuxProject/selinux
synced 2024-12-25 23:42:05 +00:00
2a1933d830
Email: tliu@redhat.com Subject: policycoreutils: share setfiles restore function with restorecond Date: Wed, 19 Aug 2009 15:51:44 -0400 This is the first of two patches. This patch splits all of the restore functionality in setfiles into another two files, restore.c and restore.h. The reason for this is shown in the next patch, which patches restorecond to share this code. To use it, instantiate a restore_opts struct with the proper options and then pass a pointer to it into restore_init, and call restore_destroy later. Signed-off-by: Thomas Liu <tliu@redhat.com> Signed-off-by: Dan Walsh <dwalsh@redhat.com> I've rebased this so that it will apply to current trunk. Signed-off-by: Chad Sellers <csellers@tresys.com>
51 lines
1.2 KiB
C
51 lines
1.2 KiB
C
#ifndef RESTORE_H
|
|
#define RESTORE_H
|
|
#ifndef _GNU_SOURCE
|
|
#define _GNU_SOURCE
|
|
#endif
|
|
#include <fts.h>
|
|
#include <errno.h>
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
#include <syslog.h>
|
|
#include <sys/stat.h>
|
|
#include <sepol/sepol.h>
|
|
#include <selinux/selinux.h>
|
|
#include <selinux/label.h>
|
|
#include <stdlib.h>
|
|
#include <limits.h>
|
|
|
|
#define STAR_COUNT 1000
|
|
|
|
/* Things that need to be init'd */
|
|
struct restore_opts {
|
|
int add_assoc; /* Track inode associations for conflict detection. */
|
|
int progress;
|
|
unsigned long long count;
|
|
int debug;
|
|
int change;
|
|
int hard_links;
|
|
int verbose;
|
|
int logging;
|
|
char *rootpath;
|
|
int rootpathlen;
|
|
char *progname;
|
|
FILE *outfile;
|
|
int force;
|
|
struct selabel_handle *hnd;
|
|
int expand_realpath; /* Expand paths via realpath. */
|
|
int abort_on_error; /* Abort the file tree walk upon an error. */
|
|
int quiet;
|
|
int fts_flags; /* Flags to fts, e.g. follow links, follow mounts */
|
|
const char *selabel_opt_validate;
|
|
const char *selabel_opt_path;
|
|
};
|
|
|
|
void restore_init(struct restore_opts *opts);
|
|
void restore_finish();
|
|
int add_exclude(const char *directory);
|
|
void remove_exclude(const char *directory);
|
|
int process_one_realpath(char *name, int recurse);
|
|
|
|
#endif
|