2010-06-07 15:33:02 +02:00
|
|
|
/* gpgtar.h - Global definitions for gpgtar
|
|
|
|
* Copyright (C) 2010 Free Software Foundation, Inc.
|
|
|
|
*
|
|
|
|
* This file is part of GnuPG.
|
|
|
|
*
|
|
|
|
* GnuPG is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* GnuPG is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2016-11-05 12:02:19 +01:00
|
|
|
* along with this program; if not, see <https://www.gnu.org/licenses/>.
|
2010-06-07 15:33:02 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GPGTAR_H
|
|
|
|
#define GPGTAR_H
|
|
|
|
|
|
|
|
#include "../common/util.h"
|
2015-11-24 18:39:30 +01:00
|
|
|
#include "../common/strlist.h"
|
2010-06-07 15:33:02 +02:00
|
|
|
|
2020-02-10 16:37:34 +01:00
|
|
|
|
2010-06-07 15:33:02 +02:00
|
|
|
/* We keep all global options in the structure OPT. */
|
2020-02-10 16:37:34 +01:00
|
|
|
EXTERN_UNLESS_MAIN_MODULE
|
2010-06-07 15:33:02 +02:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
int verbose;
|
2015-11-24 18:39:30 +01:00
|
|
|
unsigned int debug_level;
|
2010-06-07 15:33:02 +02:00
|
|
|
int quiet;
|
2015-11-26 17:05:12 +01:00
|
|
|
int dry_run;
|
2020-08-21 21:28:28 +02:00
|
|
|
int utf8strings;
|
2023-06-15 13:52:18 +02:00
|
|
|
int no_compress;
|
2015-11-25 14:57:14 +01:00
|
|
|
const char *gpg_program;
|
2015-11-26 15:36:52 +01:00
|
|
|
strlist_t gpg_arguments;
|
2010-07-16 15:19:45 +02:00
|
|
|
const char *outfile;
|
2015-11-24 18:39:30 +01:00
|
|
|
strlist_t recipients;
|
|
|
|
const char *user;
|
2010-06-07 15:33:02 +02:00
|
|
|
int symmetric;
|
2010-07-16 15:19:45 +02:00
|
|
|
const char *filename;
|
2015-11-25 18:29:22 +01:00
|
|
|
const char *directory;
|
2022-03-21 13:06:00 +01:00
|
|
|
int batch;
|
|
|
|
int answer_yes;
|
|
|
|
int answer_no;
|
gpg,sm,tools: Use string for option --*-fd.
* g10/gpg.c (opts): Use string for oLoggerFD, oOverrideSessionKeyFD,
oStatusFD, oAttributeFD, oCommandFD, and oPassphraseFD.
(main): Use translate_sys2libc_fdstr.
* g10/gpgv.c (opts): Use string for oLoggerFD, and oStatusFD.
(main): Use translate_sys2libc_fdstr.
* sm/gpgsm.c (opts): Use string for oLoggerFD, oStatusFD, and
oPassphraseFD.
(main): Use translate_sys2libc_fdstr.
* tools/gpg-auth.c (opts): Use string for oStatusFD.
(main): Use translate_sys2libc_fdstr.
tools/gpg-card.c (opts): Use string for oStatusFD.
(main): Use translate_sys2libc_fdstr.
* tools/gpg-pair-tool.c (opts): Use string for oStatusFD.
(main): Use translate_sys2libc_fdstr.
* tools/gpg-wks-client.c (opts): Use string for oStatusFD.
(main): Use translate_sys2libc_fdstr.
* tools/gpgconf.c (opts): Use string for oStatusFD.
(main): Use translate_sys2libc_fdstr.
* tools/gpgtar-create.c (gpgtar_create): Fix for opt.status_fd.
* tools/gpgtar-extract.c (gpgtar_extract): Fix for opt.status_fd.
* tools/gpgtar-list.c (gpgtar_list): Fix for opt.status_fd.
* tools/gpgtar.c (opts): Use string for oStatusFD.
(main): Use translate_sys2libc_fdstr.
* tools/gpgtar.h (opts): Use string for oStatusFD.
--
GnuPG-bug-id: 6551
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2023-06-23 06:10:19 +02:00
|
|
|
const char *status_fd;
|
2023-01-30 15:23:38 +01:00
|
|
|
estream_t status_stream;
|
2022-03-21 13:06:00 +01:00
|
|
|
int require_compliance;
|
2022-03-22 10:19:55 +01:00
|
|
|
int with_log;
|
2010-06-07 15:33:02 +02:00
|
|
|
} opt;
|
|
|
|
|
|
|
|
|
2019-03-06 17:46:40 +01:00
|
|
|
/* An info structure to avoid global variables. */
|
|
|
|
struct tarinfo_s
|
|
|
|
{
|
2023-03-15 11:18:29 +01:00
|
|
|
unsigned long long nblocks; /* Count of processed blocks. */
|
2019-03-06 17:46:40 +01:00
|
|
|
unsigned long long headerblock; /* Number of current header block. */
|
2023-03-15 11:18:29 +01:00
|
|
|
unsigned long long nextracted; /* Number of extracted files. */
|
|
|
|
unsigned long skipped_badname;
|
|
|
|
unsigned long skipped_suspicious;
|
|
|
|
unsigned long skipped_symlinks;
|
|
|
|
unsigned long skipped_hardlinks;
|
|
|
|
unsigned long skipped_other;
|
2019-03-06 17:46:40 +01:00
|
|
|
};
|
|
|
|
typedef struct tarinfo_s *tarinfo_t;
|
|
|
|
|
|
|
|
|
2010-06-07 15:33:02 +02:00
|
|
|
/* The size of a tar record. All IO is done in chunks of this size.
|
|
|
|
Note that we don't care about blocking because this version of tar
|
|
|
|
is not expected to be used directly on a tape drive in fact it is
|
|
|
|
used in a pipeline with GPG and thus any blocking would be
|
|
|
|
useless. */
|
2019-03-06 17:46:40 +01:00
|
|
|
#define RECORDSIZE 512
|
2010-06-07 15:33:02 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* Description of the USTAR header format. */
|
|
|
|
struct ustar_raw_header
|
|
|
|
{
|
|
|
|
char name[100];
|
|
|
|
char mode[8];
|
|
|
|
char uid[8];
|
|
|
|
char gid[8];
|
|
|
|
char size[12];
|
|
|
|
char mtime[12];
|
|
|
|
char checksum[8];
|
|
|
|
char typeflag[1];
|
|
|
|
char linkname[100];
|
|
|
|
char magic[6];
|
|
|
|
char version[2];
|
|
|
|
char uname[32];
|
2019-03-06 17:46:40 +01:00
|
|
|
char gname[32];
|
|
|
|
char devmajor[8];
|
2010-06-07 15:33:02 +02:00
|
|
|
char devminor[8];
|
2019-03-06 17:46:40 +01:00
|
|
|
char prefix[155];
|
2010-06-07 15:33:02 +02:00
|
|
|
char pad[12];
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Filetypes as defined by USTAR. */
|
2019-03-06 17:46:40 +01:00
|
|
|
typedef enum
|
2010-06-07 15:33:02 +02:00
|
|
|
{
|
|
|
|
TF_REGULAR,
|
|
|
|
TF_HARDLINK,
|
|
|
|
TF_SYMLINK,
|
|
|
|
TF_CHARDEV,
|
|
|
|
TF_BLOCKDEV,
|
|
|
|
TF_DIRECTORY,
|
|
|
|
TF_FIFO,
|
|
|
|
TF_RESERVED,
|
2022-01-09 18:34:04 +01:00
|
|
|
TF_GEXTHDR, /* Global extended header. */
|
|
|
|
TF_EXTHDR, /* Extended header. */
|
2010-06-07 15:33:02 +02:00
|
|
|
TF_UNKNOWN, /* Needs to be treated as regular file. */
|
|
|
|
TF_NOTSUP /* Not supported (used with --create). */
|
|
|
|
} typeflag_t;
|
|
|
|
|
|
|
|
|
2018-10-25 15:46:23 +02:00
|
|
|
/* The internal representation of a TAR header. */
|
2010-06-07 15:33:02 +02:00
|
|
|
struct tar_header_s;
|
|
|
|
typedef struct tar_header_s *tar_header_t;
|
|
|
|
struct tar_header_s
|
|
|
|
{
|
2019-03-06 17:46:40 +01:00
|
|
|
tar_header_t next; /* Used to build a linked list of entries. */
|
2010-06-07 15:33:02 +02:00
|
|
|
|
|
|
|
unsigned long mode; /* The file mode. */
|
|
|
|
unsigned long nlink; /* Number of hard links. */
|
|
|
|
unsigned long uid; /* The user id of the file. */
|
|
|
|
unsigned long gid; /* The group id of the file. */
|
|
|
|
unsigned long long size; /* The size of the file. */
|
|
|
|
unsigned long long mtime; /* Modification time since Epoch. Note
|
|
|
|
that we don't use time_t here but a
|
|
|
|
type which is more likely to be larger
|
More cleanup of "allow to".
* README, agent/command.c, agent/keyformat.txt, common/i18n.c,
common/iobuf.c, common/keyserver.h, dirmngr/cdblib.c,
dirmngr/ldap-wrapper.c, doc/DETAILS, doc/TRANSLATE,
doc/announce-2.1.txt, doc/gpg.texi, doc/gpgsm.texi,
doc/scdaemon.texi, doc/tools.texi, doc/whats-new-in-2.1.txt,
g10/export.c, g10/getkey.c, g10/import.c, g10/keyedit.c, m4/ksba.m4,
m4/libgcrypt.m4, m4/ntbtls.m4, po/ca.po, po/cs.po, po/da.po,
po/de.po, po/el.po, po/eo.po, po/es.po, po/et.po, po/fi.po,
po/fr.po, po/gl.po, po/hu.po, po/id.po, po/it.po, po/ja.po,
po/nb.po, po/pl.po, po/pt.po, po/ro.po, po/ru.po, po/sk.po,
po/sv.po, po/tr.po, po/uk.po, po/zh_CN.po, po/zh_TW.po,
scd/app-p15.c, scd/ccid-driver.c, scd/command.c, sm/gpgsm.c,
sm/sign.c, tools/gpgconf-comp.c, tools/gpgtar.h: replace "Allow to"
with clearer text.
In standard English, the normal construction is "${XXX} allows ${YYY}
to" -- that is, the subject (${XXX}) of the sentence is allowing the
object (${YYY}) to do something. When the object is missing, the
phrasing sounds awkward, even if the object is implied by context.
There's almost always a better construction that isn't as awkward.
These changes should make the language a bit clearer.
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2016-08-02 04:19:17 +02:00
|
|
|
that 32 bit and thus allows tracking
|
2010-06-07 15:33:02 +02:00
|
|
|
times beyond 2106. */
|
|
|
|
typeflag_t typeflag; /* The type of the file. */
|
2019-03-06 17:46:40 +01:00
|
|
|
|
2010-06-07 15:33:02 +02:00
|
|
|
|
|
|
|
unsigned long long nrecords; /* Number of data records. */
|
|
|
|
|
2020-08-21 21:28:28 +02:00
|
|
|
char name[1]; /* Filename (UTF-8, dynamically extended). */
|
2010-06-07 15:33:02 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*-- gpgtar.c --*/
|
|
|
|
gpg_error_t read_record (estream_t stream, void *record);
|
|
|
|
gpg_error_t write_record (estream_t stream, const void *record);
|
|
|
|
|
|
|
|
/*-- gpgtar-create.c --*/
|
2020-08-20 15:50:50 +02:00
|
|
|
gpg_error_t gpgtar_create (char **inpattern, const char *files_from,
|
|
|
|
int null_names, int encrypt, int sign);
|
2010-06-07 15:33:02 +02:00
|
|
|
|
|
|
|
/*-- gpgtar-extract.c --*/
|
2015-11-25 13:39:50 +01:00
|
|
|
gpg_error_t gpgtar_extract (const char *filename, int decrypt);
|
2010-06-07 15:33:02 +02:00
|
|
|
|
|
|
|
/*-- gpgtar-list.c --*/
|
2015-11-25 13:39:50 +01:00
|
|
|
gpg_error_t gpgtar_list (const char *filename, int decrypt);
|
2019-03-06 17:46:40 +01:00
|
|
|
gpg_error_t gpgtar_read_header (estream_t stream, tarinfo_t info,
|
2022-01-09 18:34:04 +01:00
|
|
|
tar_header_t *r_header, strlist_t *r_extheader);
|
|
|
|
void gpgtar_print_header (tar_header_t header, strlist_t extheader,
|
|
|
|
estream_t out);
|
2010-06-07 15:33:02 +02:00
|
|
|
|
|
|
|
|
|
|
|
#endif /*GPGTAR_H*/
|