* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* GnuPG comes with a shell script gpg-zip which creates archive files
gpg. So here we go. */
#include <config.h>
-#include <assuan.h>
#include <ctype.h>
#include <errno.h>
-#include <npth.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "util.h"
#include "i18n.h"
#include "sysutils.h"
-#include "../common/asshelp.h"
#include "../common/openpgpdefs.h"
#include "../common/init.h"
#include "../common/strlist.h"
enum cmd_and_opt_values
{
aNull = 0,
+ aCreate = 600,
+ aExtract,
aEncrypt = 'e',
aDecrypt = 'd',
aSign = 's',
static ARGPARSE_OPTS opts[] = {
ARGPARSE_group (300, N_("@Commands:\n ")),
- ARGPARSE_c (aEncrypt, "encrypt", N_("create an archive")),
- ARGPARSE_c (aDecrypt, "decrypt", N_("extract an archive")),
+ ARGPARSE_c (aCreate, "create", N_("create an archive")),
+ ARGPARSE_c (aExtract, "extract", N_("extract an archive")),
+ ARGPARSE_c (aEncrypt, "encrypt", N_("create an encrypted archive")),
+ ARGPARSE_c (aDecrypt, "decrypt", N_("extract an encrypted archive")),
ARGPARSE_c (aSign, "sign", N_("create a signed archive")),
ARGPARSE_c (aList, "list-archive", N_("list an archive")),
\f
-/* Print usage information and and provide strings for help. */
+/* Print usage information and provide strings for help. */
static const char *
my_strusage( int level )
{
return 1;
for (i = 0; list; i++)
- (*r_argv)[i] = list->d, list = list->next;
+ {
+ gpgrt_annotate_leaked_object (list);
+ (*r_argv)[i] = list->d;
+ list = list->next;
+ }
+ gpgrt_annotate_leaked_object (*r_argv);
return 0;
}
\f
-/* Define Assuan hooks for NPTH. */
-
-ASSUAN_SYSTEM_NPTH_IMPL;
-
-\f
/* Global flags. */
enum cmd_and_opt_values cmd = 0;
int skip_crypto = 0;
set_cmd (&cmd, pargs->r_opt);
break;
+ case aCreate:
+ set_cmd (&cmd, aEncrypt);
+ skip_crypto = 1;
+ break;
+
+ case aExtract:
+ set_cmd (&cmd, aDecrypt);
+ skip_crypto = 1;
+ break;
+
case oRecipient:
add_to_strlist (&opt.recipients, pargs->r.ret_str);
break;
case oUser:
- log_info ("note: ignoring option --user\n");
opt.user = pargs->r.ret_str;
break;
case oSymmetric:
- log_info ("note: ignoring option --symmetric\n");
set_cmd (&cmd, aEncrypt);
opt.symmetric = 1;
break;
gnupg_reopen_std (GPGTAR_NAME);
set_strusage (my_strusage);
- log_set_prefix (GPGTAR_NAME, 1);
+ log_set_prefix (GPGTAR_NAME, GPGRT_LOG_WITH_PREFIX);
/* Make sure that our subsystems are ready. */
i18n_init();
init_common_subsystems (&argc, &argv);
- npth_init ();
- assuan_set_assuan_log_prefix (log_get_prefix (NULL));
- assuan_set_gpg_err_source (GPG_ERR_SOURCE_DEFAULT);
- assuan_set_system_hooks (ASSUAN_SYSTEM_NPTH);
- assuan_sock_init ();
/* Parse the command line. */
pargs.argc = &argc;
log_info (_("NOTE: '%s' is not considered an option\n"), argv[i]);
}
+ if (! opt.gpg_program)
+ opt.gpg_program = gnupg_module_name (GNUPG_MODULE_NAME_GPG);
+
if (opt.verbose > 1)
opt.debug_level = 1024;
- setup_libassuan_logging (&opt.debug_level);
switch (cmd)
{
break;
case aEncrypt:
+ case aSign:
+ case aSignEncrypt:
if ((!argc && !null_names)
|| (argc && null_names))
usage (1);
if (opt.filename)
log_info ("note: ignoring option --set-filename\n");
- err = gpgtar_create (null_names? NULL :argv, !skip_crypto);
+ err = gpgtar_create (null_names? NULL :argv,
+ !skip_crypto
+ && (cmd == aEncrypt || cmd == aSignEncrypt),
+ cmd == aSign || cmd == aSignEncrypt);
if (err && log_get_errorcount (0) == 0)
log_error ("creating archive failed: %s\n", gpg_strerror (err));
break;
/* Read the next record from STREAM. RECORD is a buffer provided by
the caller and must be at leadt of size RECORDSIZE. The function
- return 0 on success and and error code on failure; a diagnostic
+ return 0 on success and error code on failure; a diagnostic
printed as well. Note that there is no need for an EOF indicator
because a tarball has an explicit EOF record. */
gpg_error_t