.\"
.\" $FreeBSD$
.\"
-.Dd August 14, 2014
+.Dd September 16, 2014
.Dt CPIO 1
.Os
.Sh NAME
Compress the resulting archive with
.Xr lzop 1 .
In input mode, this option is ignored.
+.It Fl Fl passphrase Ar passphrase
+The
+.Pa passphrase
+is used to extract or create an encrypted archive.
+Currently, zip is only a format that
+.Nm
+can handle encrypted archives.
+You shouldn't use this option unless you realize how insecure
+use of this option is.
.It Fl m , Fl Fl preserve-modification-time
(i and p modes)
Set file modification time on created files to match
{ "null", 0, '0' },
{ "numeric-uid-gid", 0, 'n' },
{ "owner", 1, 'R' },
+ { "passphrase", 1, OPTION_PASSPHRASE },
{ "pass-through", 0, 'p' },
{ "preserve-modification-time", 0, 'm' },
{ "preserve-owner", 0, OPTION_PRESERVE_OWNER },
cpio->mode = opt;
cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NODOTDOT;
break;
+ case OPTION_PASSPHRASE:
+ cpio->passphrase = cpio->argument;
+ break;
case OPTION_PRESERVE_OWNER:
cpio->extract_flags |= ARCHIVE_EXTRACT_OWNER;
break;
cpio->linkresolver = archive_entry_linkresolver_new();
archive_entry_linkresolver_set_strategy(cpio->linkresolver,
archive_format(cpio->archive));
+ if (cpio->passphrase != NULL) {
+ if (archive_write_set_passphrase(cpio->archive,
+ cpio->passphrase) != ARCHIVE_OK)
+ lafe_errc(1, 0, "%s",
+ archive_error_string(cpio->archive));
+ }
/*
* The main loop: Copy each file into the output archive.
lafe_errc(1, 0, "Couldn't allocate archive object");
archive_read_support_filter_all(a);
archive_read_support_format_all(a);
+ if (cpio->passphrase != NULL) {
+ if (archive_read_add_passphrase(a,
+ cpio->passphrase) != ARCHIVE_OK)
+ lafe_errc(1, 0, "%s", archive_error_string(a));
+ }
if (archive_read_open_filename(a, cpio->filename,
cpio->bytes_per_block))
lafe_errc(1, 0, "Couldn't allocate archive object");
archive_read_support_filter_all(a);
archive_read_support_format_all(a);
+ if (cpio->passphrase != NULL) {
+ if (archive_read_add_passphrase(a,
+ cpio->passphrase) != ARCHIVE_OK)
+ lafe_errc(1, 0, "%s", archive_error_string(a));
+ }
if (archive_read_open_filename(a, cpio->filename,
cpio->bytes_per_block))
int gid_override;
char *gname_override;
int day_first; /* true if locale prefers day/mon */
+ const char *passphrase;
/* If >= 0, then close this when done. */
int fd;
OPTION_LZ4,
OPTION_LZMA,
OPTION_LZOP,
+ OPTION_PASSPHRASE,
OPTION_NO_PRESERVE_OWNER,
OPTION_PRESERVE_OWNER,
OPTION_QUIET,
.\"
.\" $FreeBSD$
.\"
-.Dd September 10, 2014
+.Dd September 16, 2014
.Dt TAR 1
.Os
.Sh NAME
.Fl Fl no-same-owner
and
.Fl Fl no-same-permissions .
+.It Fl Fl passphrase Ar passphrase
+The
+.Pa passphrase
+is used to extract or create an encrypted archive.
+Currently, zip is only a format that
+.Nm
+can handle encrypted archives.
+You shouldn't use this option unless you realize how insecure
+use of this option is.
.It Fl Fl posix
(c, r, u mode only)
Synonym for
bsdtar->extract_flags |= ARCHIVE_EXTRACT_FFLAGS;
bsdtar->extract_flags |= ARCHIVE_EXTRACT_MAC_METADATA;
break;
+ case OPTION_PASSPHRASE:
+ bsdtar->passphrase = bsdtar->argument;
+ break;
case OPTION_POSIX: /* GNU tar */
cset_set_format(bsdtar->cset, "pax");
break;
const char *gname; /* --gname */
int uid; /* --uid */
const char *uname; /* --uname */
+ const char *passphrase; /* --passphrase */
char mode; /* Program mode: 'c', 't', 'r', 'u', 'x' */
char symlink_mode; /* H or L, per BSD conventions */
char option_absolute_paths; /* -P */
OPTION_OLDER_MTIME_THAN,
OPTION_ONE_FILE_SYSTEM,
OPTION_OPTIONS,
+ OPTION_PASSPHRASE,
OPTION_POSIX,
OPTION_SAME_OWNER,
OPTION_STRIP_COMPONENTS,
{ "older-than", 1, OPTION_OLDER_CTIME_THAN },
{ "one-file-system", 0, OPTION_ONE_FILE_SYSTEM },
{ "options", 1, OPTION_OPTIONS },
+ { "passphrase", 1, OPTION_PASSPHRASE },
{ "posix", 0, OPTION_POSIX },
{ "preserve-permissions", 0, 'p' },
{ "read-full-blocks", 0, 'B' },
if (archive_read_set_options(a,
"read_concatenated_archives") != ARCHIVE_OK)
lafe_errc(1, 0, "%s", archive_error_string(a));
+ if (bsdtar->passphrase != NULL) {
+ if (archive_read_add_passphrase(a,
+ bsdtar->passphrase) != ARCHIVE_OK)
+ lafe_errc(1, 0, "%s", archive_error_string(a));
+ }
if (archive_read_open_filename(a, bsdtar->filename,
bsdtar->bytes_per_block))
lafe_errc(1, 0, "Error opening archive: %s",
}
set_writer_options(bsdtar, a);
+ if (bsdtar->passphrase != NULL) {
+ if (archive_write_set_passphrase(a,
+ bsdtar->passphrase) != ARCHIVE_OK)
+ lafe_errc(1, 0, "%s", archive_error_string(a));
+ }
if (ARCHIVE_OK != archive_write_open_filename(a, bsdtar->filename))
lafe_errc(1, 0, "%s", archive_error_string(a));
write_archive(a, bsdtar);
archive_read_support_filter_all(ina);
set_reader_options(bsdtar, a);
archive_read_set_options(ina, "mtree:checkfs");
+ if (bsdtar->passphrase != NULL) {
+ if (archive_read_add_passphrase(a,
+ bsdtar->passphrase) != ARCHIVE_OK)
+ lafe_errc(1, 0, "%s", archive_error_string(a));
+ }
if (archive_read_open_filename(ina, filename,
bsdtar->bytes_per_block)) {
lafe_warnc(0, "%s", archive_error_string(ina));