diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2016-04-19 09:17:52 -0400 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2016-05-11 11:34:05 +0200 |
commit | 760a62e4aea13e3d1a428be35c4ae1547ae63afc (patch) | |
tree | ea196b87a46278620c55dcdd83cb7a2fd35da66d /src/tools/tools_util.h | |
parent | e8474ac0be7e81c0ca54eb09e2fef42595602945 (diff) | |
download | sssd-760a62e4aea13e3d1a428be35c4ae1547ae63afc.tar.gz sssd-760a62e4aea13e3d1a428be35c4ae1547ae63afc.tar.xz sssd-760a62e4aea13e3d1a428be35c4ae1547ae63afc.zip |
UTIL: Add secure copy function
This is a precursor to supporting a static default configuration file.
We need to be able to copy the default into the mutable location if the
infopipe is asked to modify it.
This patch opens both the source and destination files together in order
to avoid time-of-check/time-of-use bugs.
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Diffstat (limited to 'src/tools/tools_util.h')
-rw-r--r-- | src/tools/tools_util.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/tools/tools_util.h b/src/tools/tools_util.h index c5990b012..f914e9a73 100644 --- a/src/tools/tools_util.h +++ b/src/tools/tools_util.h @@ -119,6 +119,12 @@ int remove_tree(const char *root); int copy_tree(const char *src_root, const char *dst_root, mode_t mode_root, uid_t uid, gid_t gid); +int +copy_file_secure(const char *src, + const char *dest, + mode_t mode, + uid_t uid, gid_t gid, + bool force); /* from selinux.c */ int selinux_file_context(const char *dst_name); |