From 7118774ec94bb1a2e8ef7a5f8cbcb6b781ccfdd8 Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Fri, 13 Jan 2017 13:30:10 -0600 Subject: libtar: backup and restore posix capabilities This patch also allows libtar to combine data from multiple extended tar headers into a single header. Change-Id: I82d13e89a3622ea665b60062b1904ddbedfa41b3 --- libtar/libtar.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'libtar/libtar.h') diff --git a/libtar/libtar.h b/libtar/libtar.h index ab5a3bede..8c4202817 100644 --- a/libtar/libtar.h +++ b/libtar/libtar.h @@ -15,6 +15,7 @@ #include #include +#include #include "tar.h" #include "libtar_listhash.h" @@ -43,7 +44,7 @@ extern "C" /* extended metadata for next file - used to store selinux_context */ #define TH_EXT_TYPE 'x' -#define TH_POL_TYPE 'p' +#define TH_POL_TYPE_DO_NOT_USE 'p' /* our version of the tar header structure */ struct tar_header @@ -73,6 +74,8 @@ struct tar_header #ifdef HAVE_EXT4_CRYPT char *e4crypt_policy; #endif + int has_cap_data; + struct vfs_cap_data cap_data; }; @@ -118,6 +121,7 @@ TAR; #define TAR_STORE_SELINUX 128 /* store selinux context */ #define TAR_USE_NUMERIC_ID 256 /* favor numeric owner over names */ #define TAR_STORE_EXT4_POL 512 /* store ext4 crypto policy */ +#define TAR_STORE_POSIX_CAP 1024 /* store posix file capabilities */ /* this is obsolete - it's here for backwards-compatibility only */ #define TAR_IGNORE_MAGIC 0 @@ -214,7 +218,7 @@ int th_write(TAR *t); #define TH_ISLONGNAME(t) ((t)->th_buf.typeflag == GNU_LONGNAME_TYPE) #define TH_ISLONGLINK(t) ((t)->th_buf.typeflag == GNU_LONGLINK_TYPE) #define TH_ISEXTHEADER(t) ((t)->th_buf.typeflag == TH_EXT_TYPE) -#define TH_ISPOLHEADER(t) ((t)->th_buf.typeflag == TH_POL_TYPE) +#define TH_ISPOLHEADER(t) ((t)->th_buf.typeflag == TH_POL_TYPE_DO_NOT_USE) /* decode tar header info */ #define th_get_crc(t) oct_to_int((t)->th_buf.chksum, sizeof((t)->th_buf.chksum)) @@ -323,6 +327,9 @@ void int_to_oct(int64_t num, char *oct, size_t octlen); /* integer to string-octal conversion, or binary as necessary */ void int_to_oct_ex(int64_t num, char *oct, size_t octlen); +/* prints posix file capabilities */ +void print_caps(struct vfs_cap_data *cap_data); + /***** wrapper.c **********************************************************/ -- cgit v1.2.3