summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-02-09 16:00:56 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-02-09 16:00:56 +0900
commitcba93c71d2653bae01faf0c092b6b7ea1c2a601f (patch)
treee038af5f70b9adabd5c3cfe205e456923cd49114 /tools
parent809c8ad8209b0f5248cfc52eb6e1d437099fb228 (diff)
downloadgpg2-cba93c71d2653bae01faf0c092b6b7ea1c2a601f.tar.gz
gpg2-cba93c71d2653bae01faf0c092b6b7ea1c2a601f.tar.bz2
gpg2-cba93c71d2653bae01faf0c092b6b7ea1c2a601f.zip
Imported Upstream version 2.2.24upstream/2.2.24
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile.am45
-rw-r--r--tools/gpg-check-pattern-w32info.rc52
-rw-r--r--tools/gpg-check-pattern.c24
-rw-r--r--tools/gpg-check-pattern.w32-manifest.in18
-rw-r--r--tools/gpg-connect-agent-w32info.rc7
-rw-r--r--tools/gpg-connect-agent.c44
-rw-r--r--tools/gpg-connect-agent.w32-manifest.in18
-rw-r--r--tools/gpg-wks-client-w32info.rc52
-rw-r--r--tools/gpg-wks-client.c2
-rw-r--r--tools/gpg-wks-client.w32-manifest.in18
-rw-r--r--tools/gpg-wks-server.c47
-rw-r--r--tools/gpgconf-comp.c9
-rw-r--r--tools/gpgconf-w32info.rc52
-rw-r--r--tools/gpgconf.c173
-rw-r--r--tools/gpgconf.w32-manifest.in18
-rw-r--r--tools/gpgsplit.c4
-rw-r--r--tools/gpgtar-create.c4
-rw-r--r--tools/gpgtar-w32info.rc52
-rw-r--r--tools/gpgtar.w32-manifest.in18
-rw-r--r--tools/symcryptrun.c6
-rw-r--r--tools/wks-util.c11
21 files changed, 588 insertions, 86 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 0b31eca..60bd1e2 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -20,14 +20,35 @@ EXTRA_DIST = \
Manifest watchgnupg.c no-libgcrypt.c \
addgnupghome applygnupgdefaults \
lspgpot mail-signed-keys convert-from-106 sockprox.c \
- ccidmon.c ChangeLog-2011 gpg-connect-agent-w32info.rc
+ ccidmon.c ChangeLog-2011 \
+ gpgconf-w32info.rc gpgconf.w32-manifest.in \
+ gpgtar-w32info.rc gpgtar.w32-manifest.in \
+ gpg-connect-agent-w32info.rc gpg-connect-agent.w32-manifest.in \
+ gpg-check-pattern-w32info.rc gpg-check-pattern.w32-manifest.in \
+ gpg-wks-client-w32info.rc gpg-wks-client.w32-manifest.in
AM_CPPFLAGS =
include $(top_srcdir)/am/cmacros.am
if HAVE_W32_SYSTEM
-resource_objs += gpg-connect-agent-w32info.o
+gpgconf_robjs = $(resource_objs) gpgconf-w32info.o
+gpgtar_robjs = $(resource_objs) gpgtar-w32info.o
+gpg_connect_agent_robjs = $(resource_objs) gpg-connect-agent-w32info.o
+gpg_check_pattern_robjs = $(resource_objs) gpg-check-pattern-w32info.o
+gpg_wks_client_robjs = $(resource_objs) gpg-wks-client-w32info.o
+
+gpgconf-w32info.o: gpgconf.w32-manifest
+gpgtar-w32info.o: gpgtar.w32-manifest
+gpg-connect-agent-w32info.o: gpg-connect-agent.w32-manifest
+gpg-check-pattern-w32info.o: gpg-check-pattern.w32-manifest
+gpg-wks-client-w32info.o: gpg-wks-client.w32-manifest
+else
+gpg_connect_agent_robjs =
+gpgconf_robjs =
+gpg_check_pattern_robjs =
+gpgtar_robjs =
+gpg_wks_client_robjs =
endif
AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(GPG_ERROR_CFLAGS) $(LIBASSUAN_CFLAGS)
@@ -56,6 +77,8 @@ libexec_PROGRAMS = gpg-wks-client
bin_PROGRAMS = gpgconf gpg-connect-agent ${symcryptrun}
if !HAVE_W32_SYSTEM
bin_PROGRAMS += watchgnupg gpgparsemail ${gpg_wks_server} gpgsplit
+else
+bin_PROGRAMS += gpgconf-w32
endif
libexec_PROGRAMS += gpg-check-pattern
@@ -105,9 +128,14 @@ gpgconf_SOURCES = gpgconf.c gpgconf.h gpgconf-comp.c
# do not eliminate the supposed-to-be-unused-inline-functions).
gpgconf_LDADD = $(maybe_commonpth_libs) $(opt_libassuan_libs) \
$(LIBINTL) $(LIBGCRYPT_LIBS) $(GPG_ERROR_LIBS) $(NETLIBS) \
- $(LIBICONV) $(W32SOCKLIBS)
+ $(LIBICONV) $(W32SOCKLIBS) \
+ $(gpgconf_robjs)
gpgconf_LDFLAGS = $(extra_bin_ldflags)
+gpgconf_w32_SOURCES = $(gpgconf_SOURCES)
+gpgconf_w32_LDADD = $(gpgconf_LDADD)
+gpgconf_w32_LDFLAGS = $(gpgconf_LDFLAGS) -Wl,-subsystem,windows
+
gpgparsemail_SOURCES = gpgparsemail.c rfc822parse.c rfc822parse.h
gpgparsemail_LDADD =
@@ -124,15 +152,14 @@ gpg_connect_agent_LDADD = ../common/libgpgrl.a $(common_libs) \
$(LIBASSUAN_LIBS) $(LIBGCRYPT_LIBS) \
$(GPG_ERROR_LIBS) \
$(LIBREADLINE) $(LIBINTL) $(NETLIBS) $(LIBICONV) \
- $(resource_objs)
-
+ $(gpg_connect_agent_robjs)
gpg_check_pattern_SOURCES = gpg-check-pattern.c
gpg_check_pattern_CFLAGS = $(LIBGCRYPT_CFLAGS) $(GPG_ERROR_CFLAGS) $(INCICONV)
gpg_check_pattern_LDADD = $(common_libs) $(regexp_libs) $(LIBGCRYPT_LIBS) \
$(GPG_ERROR_LIBS) \
$(LIBINTL) $(NETLIBS) $(LIBICONV) $(W32SOCKLIBS) \
- $(LIBICONV)
+ $(LIBICONV) $(gpg_check_pattern_robjs)
gpgtar_SOURCES = \
gpgtar.c gpgtar.h \
@@ -141,7 +168,8 @@ gpgtar_SOURCES = \
gpgtar-list.c
gpgtar_CFLAGS = $(GPG_ERROR_CFLAGS)
gpgtar_LDADD = $(libcommon) $(LIBGCRYPT_LIBS) $(GPG_ERROR_LIBS) \
- $(LIBINTL) $(NETLIBS) $(LIBICONV) $(W32SOCKLIBS)
+ $(LIBINTL) $(NETLIBS) $(LIBICONV) $(W32SOCKLIBS) \
+ $(gpgtar_robjs)
gpg_wks_server_SOURCES = \
gpg-wks-server.c \
@@ -171,7 +199,8 @@ gpg_wks_client_SOURCES = \
gpg_wks_client_CFLAGS = $(LIBASSUAN_CFLAGS) $(GPG_ERROR_CFLAGS) $(INCICONV)
gpg_wks_client_LDADD = $(libcommon) \
$(LIBASSUAN_LIBS) $(LIBGCRYPT_LIBS) $(GPG_ERROR_LIBS) \
- $(LIBINTL) $(LIBICONV) $(NETLIBS)
+ $(LIBINTL) $(LIBICONV) $(NETLIBS) \
+ $(gpg_wks_client_robjs)
# Make sure that all libs are build before we use them. This is
diff --git a/tools/gpg-check-pattern-w32info.rc b/tools/gpg-check-pattern-w32info.rc
new file mode 100644
index 0000000..ed50301
--- /dev/null
+++ b/tools/gpg-check-pattern-w32info.rc
@@ -0,0 +1,52 @@
+/* gpg-check-pattern-w32info.rc -*- c -*-
+ * Copyright (C) 2020 g10 Code GmbH
+ *
+ * This file is free software; as a special exception the author gives
+ * unlimited permission to copy and/or distribute it, with or without
+ * modifications, as long as this notice is preserved.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#include "afxres.h"
+#include "../common/w32info-rc.h"
+
+1 ICON "../common/gnupg.ico"
+
+1 VERSIONINFO
+ FILEVERSION W32INFO_VI_FILEVERSION
+ PRODUCTVERSION W32INFO_VI_PRODUCTVERSION
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x01L /* VS_FF_DEBUG (0x1)*/
+#else
+ FILEFLAGS 0x00L
+#endif
+ FILEOS 0x40004L /* VOS_NT (0x40000) | VOS__WINDOWS32 (0x4) */
+ FILETYPE 0x1L /* VFT_APP (0x1) */
+ FILESUBTYPE 0x0L /* VFT2_UNKNOWN */
+ BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0" /* US English (0409), Unicode (04b0) */
+ BEGIN
+ VALUE "FileDescription", L"GnuPG\x2019s pattern checker\0"
+ VALUE "InternalName", "gpg-check-pattern\0"
+ VALUE "OriginalFilename", "gpg-check-pattern.exe\0"
+ VALUE "ProductName", W32INFO_PRODUCTNAME
+ VALUE "ProductVersion", W32INFO_PRODUCTVERSION
+ VALUE "CompanyName", W32INFO_COMPANYNAME
+ VALUE "FileVersion", W32INFO_FILEVERSION
+ VALUE "LegalCopyright", W32INFO_LEGALCOPYRIGHT
+ VALUE "Comments", W32INFO_COMMENTS
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 0x4b0
+ END
+ END
+
+1 RT_MANIFEST "gpg-check-pattern.w32-manifest"
diff --git a/tools/gpg-check-pattern.c b/tools/gpg-check-pattern.c
index e4906d2..46b9e58 100644
--- a/tools/gpg-check-pattern.c
+++ b/tools/gpg-check-pattern.c
@@ -227,7 +227,7 @@ main (int argc, char **argv )
static char *
read_file (const char *fname, size_t *r_length)
{
- FILE *fp;
+ estream_t fp;
char *buf;
size_t buflen;
@@ -235,10 +235,8 @@ read_file (const char *fname, size_t *r_length)
{
size_t nread, bufsize = 0;
- fp = stdin;
-#ifdef HAVE_DOSISH_SYSTEM
- setmode ( fileno(fp) , O_BINARY );
-#endif
+ fp = es_stdin;
+ es_set_binary (fp);
buf = NULL;
buflen = 0;
#define NCHUNK 8192
@@ -250,8 +248,8 @@ read_file (const char *fname, size_t *r_length)
else
buf = xrealloc (buf, bufsize+1);
- nread = fread (buf+buflen, 1, NCHUNK, fp);
- if (nread < NCHUNK && ferror (fp))
+ nread = es_fread (buf+buflen, 1, NCHUNK, fp);
+ if (nread < NCHUNK && es_ferror (fp))
{
log_error ("error reading '[stdin]': %s\n", strerror (errno));
xfree (buf);
@@ -267,30 +265,30 @@ read_file (const char *fname, size_t *r_length)
{
struct stat st;
- fp = fopen (fname, "rb");
+ fp = es_fopen (fname, "rb");
if (!fp)
{
log_error ("can't open '%s': %s\n", fname, strerror (errno));
return NULL;
}
- if (fstat (fileno(fp), &st))
+ if (fstat (es_fileno (fp), &st))
{
log_error ("can't stat '%s': %s\n", fname, strerror (errno));
- fclose (fp);
+ es_fclose (fp);
return NULL;
}
buflen = st.st_size;
buf = xmalloc (buflen+1);
- if (fread (buf, buflen, 1, fp) != 1)
+ if (es_fread (buf, buflen, 1, fp) != 1)
{
log_error ("error reading '%s': %s\n", fname, strerror (errno));
- fclose (fp);
+ es_fclose (fp);
xfree (buf);
return NULL;
}
- fclose (fp);
+ es_fclose (fp);
}
buf[buflen] = 0;
*r_length = buflen;
diff --git a/tools/gpg-check-pattern.w32-manifest.in b/tools/gpg-check-pattern.w32-manifest.in
new file mode 100644
index 0000000..2a5f8ec
--- /dev/null
+++ b/tools/gpg-check-pattern.w32-manifest.in
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<description>GNU Privacy Guard (Pattern checker)</description>
+<assemblyIdentity
+ type="win32"
+ name="GnuPG.gpg-check-pattern"
+ version="@BUILD_VERSION@"
+ />
+<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/><!-- 10 -->
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/><!-- 8.1 -->
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/><!-- 8 -->
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/><!-- 7 -->
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/><!-- Vista -->
+ </application>
+</compatibility>
+</assembly>
diff --git a/tools/gpg-connect-agent-w32info.rc b/tools/gpg-connect-agent-w32info.rc
index 4e7b19d..06612f8 100644
--- a/tools/gpg-connect-agent-w32info.rc
+++ b/tools/gpg-connect-agent-w32info.rc
@@ -1,4 +1,4 @@
-/* scdaemon-w32info.rc -*- c -*-
+/* gpg-connect-agent-w32info.rc -*- c -*-
* Copyright (C) 2013 g10 Code GmbH
*
* This file is free software; as a special exception the author gives
@@ -32,8 +32,7 @@
BEGIN
BLOCK "040904b0" /* US English (0409), Unicode (04b0) */
BEGIN
- VALUE "FileDescription", L"GnuPG\x2019s command line access \
-to the agent\0"
+ VALUE "FileDescription", L"GnuPG\x2019s IPC tool\0"
VALUE "InternalName", "gpg-connect-agent\0"
VALUE "OriginalFilename", "gpg-connect-agent.exe\0"
VALUE "ProductName", W32INFO_PRODUCTNAME
@@ -49,3 +48,5 @@ to the agent\0"
VALUE "Translation", 0x409, 0x4b0
END
END
+
+1 RT_MANIFEST "gpg-connect-agent.w32-manifest"
diff --git a/tools/gpg-connect-agent.c b/tools/gpg-connect-agent.c
index 7eb7ffa..0dabdad 100644
--- a/tools/gpg-connect-agent.c
+++ b/tools/gpg-connect-agent.c
@@ -166,7 +166,7 @@ typedef struct loopline_s *loopline_t;
static pid_t server_pid = (pid_t)(-1);
/* The current datasink file or NULL. */
-static FILE *current_datasink;
+static estream_t current_datasink;
/* A list of open file descriptors. */
static struct
@@ -874,7 +874,7 @@ clear_definq (void)
static void
do_sendfd (assuan_context_t ctx, char *line)
{
- FILE *fp;
+ estream_t fp;
char *name, *mode, *p;
int rc, fd;
@@ -900,14 +900,14 @@ do_sendfd (assuan_context_t ctx, char *line)
}
/* Open and send. */
- fp = fopen (name, mode);
+ fp = es_fopen (name, mode);
if (!fp)
{
log_error ("can't open '%s' in \"%s\" mode: %s\n",
name, mode, strerror (errno));
return;
}
- fd = fileno (fp);
+ fd = es_fileno (fp);
if (opt.verbose)
log_error ("file '%s' opened in \"%s\" mode, fd=%d\n",
@@ -916,7 +916,7 @@ do_sendfd (assuan_context_t ctx, char *line)
rc = assuan_sendfd (ctx, INT2FD (fd) );
if (rc)
log_error ("sending descriptor %d failed: %s\n", fd, gpg_strerror (rc));
- fclose (fp);
+ es_fclose (fp);
}
@@ -932,7 +932,7 @@ do_recvfd (assuan_context_t ctx, char *line)
static void
do_open (char *line)
{
- FILE *fp;
+ estream_t fp;
char *varname, *name, *mode, *p;
int fd;
@@ -976,14 +976,14 @@ do_open (char *line)
}
/* Open and send. */
- fp = fopen (name, mode);
+ fp = es_fopen (name, mode);
if (!fp)
{
log_error ("can't open '%s' in \"%s\" mode: %s\n",
name, mode, strerror (errno));
return;
}
- fd = dup (fileno (fp));
+ fd = dup (es_fileno (fp));
if (fd >= 0 && fd < DIM (open_fd_table))
{
open_fd_table[fd].inuse = 1;
@@ -1033,7 +1033,7 @@ do_open (char *line)
if (fd != -1)
close (fd); /* Table was full. */
}
- fclose (fp);
+ es_fclose (fp);
}
@@ -1182,6 +1182,7 @@ main (int argc, char **argv)
assuan_set_gpg_err_source (0);
+ gnupg_init_signals (0, NULL);
opt.autostart = 1;
opt.connect_flags = 1;
@@ -1565,17 +1566,17 @@ main (int argc, char **argv)
if (current_datasink)
{
- if (current_datasink != stdout)
- fclose (current_datasink);
+ if (current_datasink != es_stdout)
+ es_fclose (current_datasink);
current_datasink = NULL;
}
tmpline = opt.enable_varsubst? substitute_line (p) : NULL;
fname = tmpline? tmpline : p;
if (fname && !strcmp (fname, "-"))
- current_datasink = stdout;
+ current_datasink = es_stdout;
else if (fname && *fname)
{
- current_datasink = fopen (fname, "wb");
+ current_datasink = es_fopen (fname, "wb");
if (!current_datasink)
log_error ("can't open '%s': %s\n",
fname, strerror (errno));
@@ -1904,6 +1905,7 @@ handle_inquire (assuan_context_t ctx, char *line)
{
const char *name;
definq_t d;
+ /* FIXME: Due to the use of popen we can't easily switch to estream. */
FILE *fp = NULL;
char buffer[1024];
int rc, n;
@@ -1965,7 +1967,7 @@ handle_inquire (assuan_context_t ctx, char *line)
}
else
{
- fp = fopen (d->file, "rb");
+ fp = gnupg_fopen (d->file, "rb");
if (!fp)
log_error ("error opening '%s': %s\n", d->file, strerror (errno));
else if (opt.verbose)
@@ -2055,7 +2057,7 @@ read_and_print_response (assuan_context_t ctx, int withhash, int *r_goterr)
}
else
c = *s;
- putc (c, current_datasink);
+ es_putc (c, current_datasink);
}
}
else if (opt.hex)
@@ -2126,7 +2128,7 @@ read_and_print_response (assuan_context_t ctx, int withhash, int *r_goterr)
{
if (need_lf)
{
- if (!current_datasink || current_datasink != stdout)
+ if (!current_datasink || current_datasink != es_stdout)
putchar ('\n');
need_lf = 0;
}
@@ -2135,7 +2137,7 @@ read_and_print_response (assuan_context_t ctx, int withhash, int *r_goterr)
&& line[0] == 'S'
&& (line[1] == '\0' || line[1] == ' '))
{
- if (!current_datasink || current_datasink != stdout)
+ if (!current_datasink || current_datasink != es_stdout)
{
fwrite (line, linelen, 1, stdout);
putchar ('\n');
@@ -2145,7 +2147,7 @@ read_and_print_response (assuan_context_t ctx, int withhash, int *r_goterr)
&& line[0] == 'O' && line[1] == 'K'
&& (line[2] == '\0' || line[2] == ' '))
{
- if (!current_datasink || current_datasink != stdout)
+ if (!current_datasink || current_datasink != es_stdout)
{
fwrite (line, linelen, 1, stdout);
putchar ('\n');
@@ -2163,7 +2165,7 @@ read_and_print_response (assuan_context_t ctx, int withhash, int *r_goterr)
if (!errval)
errval = -1;
set_int_var ("?", errval);
- if (!current_datasink || current_datasink != stdout)
+ if (!current_datasink || current_datasink != es_stdout)
{
fwrite (line, linelen, 1, stdout);
putchar ('\n');
@@ -2177,7 +2179,7 @@ read_and_print_response (assuan_context_t ctx, int withhash, int *r_goterr)
&& line[6] == 'E'
&& (line[7] == '\0' || line[7] == ' '))
{
- if (!current_datasink || current_datasink != stdout)
+ if (!current_datasink || current_datasink != es_stdout)
{
fwrite (line, linelen, 1, stdout);
putchar ('\n');
@@ -2189,7 +2191,7 @@ read_and_print_response (assuan_context_t ctx, int withhash, int *r_goterr)
&& line[0] == 'E' && line[1] == 'N' && line[2] == 'D'
&& (line[3] == '\0' || line[3] == ' '))
{
- if (!current_datasink || current_datasink != stdout)
+ if (!current_datasink || current_datasink != es_stdout)
{
fwrite (line, linelen, 1, stdout);
putchar ('\n');
diff --git a/tools/gpg-connect-agent.w32-manifest.in b/tools/gpg-connect-agent.w32-manifest.in
new file mode 100644
index 0000000..aba5420
--- /dev/null
+++ b/tools/gpg-connect-agent.w32-manifest.in
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<description>GNU Privacy Guard (IPC tool)</description>
+<assemblyIdentity
+ type="win32"
+ name="GnuPG.gpg-connect-agent"
+ version="@BUILD_VERSION@"
+ />
+<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/><!-- 10 -->
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/><!-- 8.1 -->
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/><!-- 8 -->
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/><!-- 7 -->
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/><!-- Vista -->
+ </application>
+</compatibility>
+</assembly>
diff --git a/tools/gpg-wks-client-w32info.rc b/tools/gpg-wks-client-w32info.rc
new file mode 100644
index 0000000..60021a7
--- /dev/null
+++ b/tools/gpg-wks-client-w32info.rc
@@ -0,0 +1,52 @@
+/* gpg-wks-client-w32info.rc -*- c -*-
+ * Copyright (C) 2020 g10 Code GmbH
+ *
+ * This file is free software; as a special exception the author gives
+ * unlimited permission to copy and/or distribute it, with or without
+ * modifications, as long as this notice is preserved.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#include "afxres.h"
+#include "../common/w32info-rc.h"
+
+1 ICON "../common/gnupg.ico"
+
+1 VERSIONINFO
+ FILEVERSION W32INFO_VI_FILEVERSION
+ PRODUCTVERSION W32INFO_VI_PRODUCTVERSION
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x01L /* VS_FF_DEBUG (0x1)*/
+#else
+ FILEFLAGS 0x00L
+#endif
+ FILEOS 0x40004L /* VOS_NT (0x40000) | VOS__WINDOWS32 (0x4) */
+ FILETYPE 0x1L /* VFT_APP (0x1) */
+ FILESUBTYPE 0x0L /* VFT2_UNKNOWN */
+ BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0" /* US English (0409), Unicode (04b0) */
+ BEGIN
+ VALUE "FileDescription", L"GnuPG\x2019s Web Key Service client\0"
+ VALUE "InternalName", "gpg-wks-client\0"
+ VALUE "OriginalFilename", "gpg-wks-client.exe\0"
+ VALUE "ProductName", W32INFO_PRODUCTNAME
+ VALUE "ProductVersion", W32INFO_PRODUCTVERSION
+ VALUE "CompanyName", W32INFO_COMPANYNAME
+ VALUE "FileVersion", W32INFO_FILEVERSION
+ VALUE "LegalCopyright", W32INFO_LEGALCOPYRIGHT
+ VALUE "Comments", W32INFO_COMMENTS
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 0x4b0
+ END
+ END
+
+1 RT_MANIFEST "gpg-wks-client.w32-manifest"
diff --git a/tools/gpg-wks-client.c b/tools/gpg-wks-client.c
index 5ec670e..56768aa 100644
--- a/tools/gpg-wks-client.c
+++ b/tools/gpg-wks-client.c
@@ -307,7 +307,7 @@ main (int argc, char **argv)
{
struct stat sb;
- if (stat (opt.directory, &sb))
+ if (gnupg_stat (opt.directory, &sb))
{
err = gpg_error_from_syserror ();
log_error ("error accessing directory '%s': %s\n",
diff --git a/tools/gpg-wks-client.w32-manifest.in b/tools/gpg-wks-client.w32-manifest.in
new file mode 100644
index 0000000..ba2508e
--- /dev/null
+++ b/tools/gpg-wks-client.w32-manifest.in
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<description>GNU Privacy Guard (Web Key Service client)</description>
+<assemblyIdentity
+ type="win32"
+ name="GnuPG.gpg-wks-client"
+ version="@BUILD_VERSION@"
+ />
+<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/><!-- 10 -->
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/><!-- 8.1 -->
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/><!-- 8 -->
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/><!-- 7 -->
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/><!-- Vista -->
+ </application>
+</compatibility>
+</assembly>
diff --git a/tools/gpg-wks-server.c b/tools/gpg-wks-server.c
index 8cdbfaf..addafa2 100644
--- a/tools/gpg-wks-server.c
+++ b/tools/gpg-wks-server.c
@@ -332,7 +332,7 @@ main (int argc, char **argv)
{
struct stat sb;
- if (stat (opt.directory, &sb))
+ if (gnupg_stat (opt.directory, &sb))
{
err = gpg_error_from_syserror ();
log_error ("error accessing directory '%s': %s\n",
@@ -1177,7 +1177,7 @@ process_new_key (server_ctx_t ctx, estream_t key)
goto leave;
}
- if (access (dname, W_OK))
+ if (gnupg_access (dname, W_OK))
{
log_info ("skipping address '%s': Domain not configured\n", sl->mbox);
continue;
@@ -1454,7 +1454,7 @@ check_and_publish (server_ctx_t ctx, const char *address, const char *nonce)
err = gpg_error_from_syserror ();
goto leave;
}
- if (!access (fnewname, W_OK))
+ if (!gnupg_access (fnewname, W_OK))
{
/* Yes, we have a dane directory. */
s = strchr (address, '@');
@@ -1608,22 +1608,22 @@ static gpg_error_t
get_domain_list (strlist_t *r_list)
{
gpg_error_t err;
- DIR *dir = NULL;
+ gnupg_dir_t dir = NULL;
char *fname = NULL;
- struct dirent *dentry;
+ gnupg_dirent_t dentry;
struct stat sb;
strlist_t list = NULL;
*r_list = NULL;
- dir = opendir (opt.directory);
+ dir = gnupg_opendir (opt.directory);
if (!dir)
{
err = gpg_error_from_syserror ();
goto leave;
}
- while ((dentry = readdir (dir)))
+ while ((dentry = gnupg_readdir (dir)))
{
if (*dentry->d_name == '.')
continue;
@@ -1640,7 +1640,7 @@ get_domain_list (strlist_t *r_list)
goto leave;
}
- if (stat (fname, &sb))
+ if (gnupg_stat (fname, &sb))
{
err = gpg_error_from_syserror ();
log_error ("error accessing '%s': %s\n", fname, gpg_strerror (err));
@@ -1663,8 +1663,7 @@ get_domain_list (strlist_t *r_list)
leave:
free_strlist (list);
- if (dir)
- closedir (dir);
+ gnupg_closedir (dir);
xfree (fname);
return err;
}
@@ -1677,8 +1676,8 @@ expire_one_domain (const char *top_dirname, const char *domain)
gpg_error_t err;
char *dirname;
char *fname = NULL;
- DIR *dir = NULL;
- struct dirent *dentry;
+ gnupg_dir_t dir = NULL;
+ gnupg_dirent_t dentry;
struct stat sb;
time_t now = gnupg_get_time ();
@@ -1691,7 +1690,7 @@ expire_one_domain (const char *top_dirname, const char *domain)
goto leave;
}
- dir = opendir (dirname);
+ dir = gnupg_opendir (dirname);
if (!dir)
{
err = gpg_error_from_syserror ();
@@ -1700,7 +1699,7 @@ expire_one_domain (const char *top_dirname, const char *domain)
goto leave;
}
- while ((dentry = readdir (dir)))
+ while ((dentry = gnupg_readdir (dir)))
{
if (*dentry->d_name == '.')
continue;
@@ -1718,7 +1717,7 @@ expire_one_domain (const char *top_dirname, const char *domain)
log_info ("garbage file '%s' ignored\n", fname);
continue;
}
- if (stat (fname, &sb))
+ if (gnupg_stat (fname, &sb))
{
err = gpg_error_from_syserror ();
log_error ("error accessing '%s': %s\n", fname, gpg_strerror (err));
@@ -1749,8 +1748,7 @@ expire_one_domain (const char *top_dirname, const char *domain)
err = 0;
leave:
- if (dir)
- closedir (dir);
+ gnupg_closedir (dir);
xfree (dirname);
xfree (fname);
return err;
@@ -1790,7 +1788,7 @@ command_list_domains (void)
{ "pending", "-rwx" },
{ "hu", "-rwxr-xr-x" }
};
-
+ gpg_err_code_t ec;
gpg_error_t err;
strlist_t domaindirs;
strlist_t sl;
@@ -1827,9 +1825,9 @@ command_list_domains (void)
err = gpg_error_from_syserror ();
goto leave;
}
- if (access (fname, W_OK))
+ if ((ec = gnupg_access (fname, W_OK)))
{
- err = gpg_error_from_syserror ();
+ err = gpg_error (ec);
if (gpg_err_code (err) == GPG_ERR_ENOENT)
{
if (gnupg_mkdir (fname, requireddirs[i].perm))
@@ -1857,9 +1855,9 @@ command_list_domains (void)
err = gpg_error_from_syserror ();
goto leave;
}
- if (access (fname, F_OK))
+ if ((ec = gnupg_access (fname, F_OK)))
{
- err = gpg_error_from_syserror ();
+ err = gpg_error (ec);
if (gpg_err_code (err) == GPG_ERR_ENOENT)
log_error ("domain %s: submission address not configured\n",
domain);
@@ -1936,6 +1934,7 @@ command_cron (void)
static gpg_error_t
command_check_key (const char *userid)
{
+ gpg_err_code_t ec;
gpg_error_t err;
char *addrspec = NULL;
char *fname = NULL;
@@ -1944,9 +1943,9 @@ command_check_key (const char *userid)
if (err)
goto leave;
- if (access (fname, R_OK))
+ if ((ec = gnupg_access (fname, R_OK)))
{
- err = gpg_error_from_syserror ();
+ err = gpg_error (ec);
if (opt_with_file)
es_printf ("%s n %s\n", addrspec, fname);
if (gpg_err_code (err) == GPG_ERR_ENOENT)
diff --git a/tools/gpgconf-comp.c b/tools/gpgconf-comp.c
index 135d800..5903cf4 100644
--- a/tools/gpgconf-comp.c
+++ b/tools/gpgconf-comp.c
@@ -2115,7 +2115,7 @@ retrieve_options_from_program (gc_component_t component, gc_backend_t backend,
argv[i++] = "--gpgconf-list";
argv[i++] = NULL;
- if (only_installed && access (pgmname, X_OK))
+ if (only_installed && gnupg_access (pgmname, X_OK))
{
return; /* The component is not installed. */
}
@@ -3016,8 +3016,9 @@ change_options_program (gc_component_t component, gc_backend_t backend,
*dest_filenamep = dest_filename;
*orig_filenamep = orig_filename;
- /* Use open() so that we can use O_EXCL. */
- fd = open (src_filename, O_CREAT | O_EXCL | O_WRONLY, 0644);
+ /* Use open() so that we can use O_EXCL.
+ * FIXME: gpgrt has an x flag for quite some time now - use that. */
+ fd = gnupg_open (src_filename, O_CREAT | O_EXCL | O_WRONLY, 0644);
if (fd < 0)
return -1;
src_file = gpgrt_fdopen (fd, "w");
@@ -4055,7 +4056,7 @@ gc_apply_profile (const char *fname)
* is installed and use that instead of the given file name. */
fname_buffer = xstrconcat (gnupg_datadir (), DIRSEP_S,
fname, ".prf", NULL);
- if (!access (fname_buffer, F_OK))
+ if (!gnupg_access (fname_buffer, F_OK))
fname = fname_buffer;
}
diff --git a/tools/gpgconf-w32info.rc b/tools/gpgconf-w32info.rc
new file mode 100644
index 0000000..cd8df29
--- /dev/null
+++ b/tools/gpgconf-w32info.rc
@@ -0,0 +1,52 @@
+/* gpgconf-w32info.rc -*- c -*-
+ * Copyright (C) 2020 g10 Code GmbH
+ *
+ * This file is free software; as a special exception the author gives
+ * unlimited permission to copy and/or distribute it, with or without
+ * modifications, as long as this notice is preserved.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#include "afxres.h"
+#include "../common/w32info-rc.h"
+
+1 ICON "../common/gnupg.ico"
+
+1 VERSIONINFO
+ FILEVERSION W32INFO_VI_FILEVERSION
+ PRODUCTVERSION W32INFO_VI_PRODUCTVERSION
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x01L /* VS_FF_DEBUG (0x1)*/
+#else
+ FILEFLAGS 0x00L
+#endif
+ FILEOS 0x40004L /* VOS_NT (0x40000) | VOS__WINDOWS32 (0x4) */
+ FILETYPE 0x1L /* VFT_APP (0x1) */
+ FILESUBTYPE 0x0L /* VFT2_UNKNOWN */
+ BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0" /* US English (0409), Unicode (04b0) */
+ BEGIN
+ VALUE "FileDescription", L"GnuPG\x2019s config tool\0"
+ VALUE "InternalName", "gpgconf\0"
+ VALUE "OriginalFilename", "gpgconf.exe\0"
+ VALUE "ProductName", W32INFO_PRODUCTNAME
+ VALUE "ProductVersion", W32INFO_PRODUCTVERSION
+ VALUE "CompanyName", W32INFO_COMPANYNAME
+ VALUE "FileVersion", W32INFO_FILEVERSION
+ VALUE "LegalCopyright", W32INFO_LEGALCOPYRIGHT
+ VALUE "Comments", W32INFO_COMMENTS
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 0x4b0
+ END
+ END
+
+1 RT_MANIFEST "gpgconf.w32-manifest"
diff --git a/tools/gpgconf.c b/tools/gpgconf.c
index 945d0e5..b6afc8b 100644
--- a/tools/gpgconf.c
+++ b/tools/gpgconf.c
@@ -31,6 +31,7 @@
#include "../common/sysutils.h"
#include "../common/init.h"
#include "../common/status.h"
+#include "../common/exechelp.h"
/* Constants to identify the commands and options. */
@@ -65,7 +66,8 @@ enum cmd_and_opt_values
aCreateSocketDir,
aRemoveSocketDir,
aApplyProfile,
- aReload
+ aReload,
+ aShowVersions
};
@@ -96,6 +98,8 @@ static ARGPARSE_OPTS opts[] =
{ aKill, "kill", 256, N_("kill a given component")},
{ aCreateSocketDir, "create-socketdir", 256, "@"},
{ aRemoveSocketDir, "remove-socketdir", 256, "@"},
+ ARGPARSE_c (aShowVersions, "show-versions", "@"),
+
{ 301, NULL, 0, N_("@\nOptions:\n ") },
@@ -120,6 +124,9 @@ static ARGPARSE_OPTS opts[] =
* this is NULL. */
static estream_t statusfp;
+static void show_versions (estream_t fp);
+
+
/* Print usage information and provide strings for help. */
static const char *
@@ -594,6 +601,7 @@ main (int argc, char **argv)
case aKill:
case aCreateSocketDir:
case aRemoveSocketDir:
+ case aShowVersions:
cmd = pargs.r_opt;
break;
@@ -773,12 +781,16 @@ main (int argc, char **argv)
es_putc ('\n', es_stderr);
gpgconf_failure (GPG_ERR_USER_2);
}
+ if (!opt.dry_run && gnupg_access (gnupg_homedir (), F_OK))
+ gnupg_maybe_make_homedir (gnupg_homedir (), opt.quiet);
gc_component_retrieve_options (-1);
if (gc_process_gpgconf_conf (NULL, 1, 1, NULL))
gpgconf_failure (0);
break;
case aApplyProfile:
+ if (!opt.dry_run && gnupg_access (gnupg_homedir (), F_OK))
+ gnupg_maybe_make_homedir (gnupg_homedir (), opt.quiet);
gc_component_retrieve_options (-1);
if (gc_apply_profile (fname))
gpgconf_failure (0);
@@ -897,6 +909,13 @@ main (int argc, char **argv)
}
break;
+ case aShowVersions:
+ {
+ get_outfp (&outfp);
+ show_versions (outfp);
+ }
+ break;
+
}
if (outfp != es_stdout)
@@ -923,3 +942,155 @@ gpgconf_failure (gpg_error_t err)
gpg_err_code (err) == GPG_ERR_USER_2? GPG_ERR_EINVAL : err);
exit (gpg_err_code (err) == GPG_ERR_USER_2? 2 : 1);
}
+
+
+
+/* Parse the revision part from the extended version blurb. */
+static const char *
+get_revision_from_blurb (const char *blurb, int *r_len)
+{
+ const char *s = blurb? blurb : "";
+ int n;
+
+ for (; *s; s++)
+ if (*s == '\n' && s[1] == '(')
+ break;
+ if (s)
+ {
+ s += 2;
+ for (n=0; s[n] && s[n] != ' '; n++)
+ ;
+ }
+ else
+ {
+ s = "?";
+ n = 1;
+ }
+ *r_len = n;
+ return s;
+}
+
+
+static void
+show_version_gnupg (estream_t fp)
+{
+ es_fprintf (fp, "* GnuPG %s (%s)\n%s\n",
+ strusage (13), BUILD_REVISION, strusage (17));
+#ifdef HAVE_W32_SYSTEM
+ {
+ OSVERSIONINFO osvi = { sizeof (osvi) };
+
+ GetVersionEx (&osvi);
+ es_fprintf (fp, "Windows %lu.%lu build %lu%s%s%s\n",
+ (unsigned long)osvi.dwMajorVersion,
+ (unsigned long)osvi.dwMinorVersion,
+ (unsigned long)osvi.dwBuildNumber,
+ *osvi.szCSDVersion? " (":"",
+ osvi.szCSDVersion,
+ *osvi.szCSDVersion? ")":""
+ );
+ }
+#endif /*HAVE_W32_SYSTEM*/
+}
+
+
+static void
+show_version_libgcrypt (estream_t fp)
+{
+ const char *s;
+ int n;
+
+ s = get_revision_from_blurb (gcry_check_version ("\x01\x01"), &n);
+ es_fprintf (fp, "* Libgcrypt %s (%.*s)\n",
+ gcry_check_version (NULL), n, s);
+ s = gcry_get_config (0, NULL);
+ if (s)
+ es_fputs (s, fp);
+}
+
+
+static void
+show_version_gpgrt (estream_t fp)
+{
+ const char *s;
+ int n;
+
+ s = get_revision_from_blurb (gpg_error_check_version ("\x01\x01"), &n);
+ es_fprintf (fp, "* GpgRT %s (%.*s)\n",
+ gpg_error_check_version (NULL), n, s);
+}
+
+
+/* Printing version information for other libraries is problematic
+ * because we don't want to link gpgconf to all these libraries. The
+ * best solution is delegating this to dirmngr which uses libassuan,
+ * libksba, libnpth and ntbtls anyway. */
+static void
+show_versions_via_dirmngr (estream_t fp)
+{
+ gpg_error_t err;
+ const char *pgmname;
+ const char *argv[2];
+ estream_t outfp;
+ pid_t pid;
+ char *line = NULL;
+ size_t line_len = 0;
+ ssize_t length;
+ int exitcode;
+
+ pgmname = gnupg_module_name (GNUPG_MODULE_NAME_DIRMNGR);
+ argv[0] = "--gpgconf-versions";
+ argv[1] = NULL;
+ err = gnupg_spawn_process (pgmname, argv, NULL, NULL, 0,
+ NULL, &outfp, NULL, &pid);
+ if (err)
+ {
+ log_error ("error spawning %s: %s", pgmname, gpg_strerror (err));
+ es_fprintf (fp, "[error: can't get further info]\n");
+ return;
+ }
+
+ while ((length = es_read_line (outfp, &line, &line_len, NULL)) > 0)
+ {
+ /* Strip newline and carriage return, if present. */
+ while (length > 0
+ && (line[length - 1] == '\n' || line[length - 1] == '\r'))
+ line[--length] = '\0';
+ es_fprintf (fp, "%s\n", line);
+ }
+ if (length < 0 || es_ferror (outfp))
+ {
+ err = gpg_error_from_syserror ();
+ log_error ("error reading from %s: %s\n", pgmname, gpg_strerror (err));
+ }
+ if (es_fclose (outfp))
+ {
+ err = gpg_error_from_syserror ();
+ log_error ("error closing output stream of %s: %s\n",
+ pgmname, gpg_strerror (err));
+ }
+
+ err = gnupg_wait_process (pgmname, pid, 1, &exitcode);
+ if (err)
+ {
+ log_error ("running %s failed (exitcode=%d): %s\n",
+ pgmname, exitcode, gpg_strerror (err));
+ es_fprintf (fp, "[error: can't get further info]\n");
+ }
+ gnupg_release_process (pid);
+ xfree (line);
+}
+
+
+/* Show all kind of version information. */
+static void
+show_versions (estream_t fp)
+{
+ show_version_gnupg (fp);
+ es_fputc ('\n', fp);
+ show_version_libgcrypt (fp);
+ es_fputc ('\n', fp);
+ show_version_gpgrt (fp);
+ es_fputc ('\n', fp);
+ show_versions_via_dirmngr (fp);
+}
diff --git a/tools/gpgconf.w32-manifest.in b/tools/gpgconf.w32-manifest.in
new file mode 100644
index 0000000..d7a1b01
--- /dev/null
+++ b/tools/gpgconf.w32-manifest.in
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<description>GNU Privacy Guard (Config tool)</description>
+<assemblyIdentity
+ type="win32"
+ name="GnuPG.gpgconf"
+ version="@BUILD_VERSION@"
+ />
+<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/><!-- 10 -->
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/><!-- 8.1 -->
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/><!-- 8 -->
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/><!-- 7 -->
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/><!-- Vista -->
+ </application>
+</compatibility>
+</assembly>
diff --git a/tools/gpgsplit.c b/tools/gpgsplit.c
index 674be62..e844008 100644
--- a/tools/gpgsplit.c
+++ b/tools/gpgsplit.c
@@ -552,7 +552,7 @@ write_part (FILE *fpin, unsigned long pktlen,
{
if (opt_verbose)
log_info ("writing '%s'\n", outname);
- fpout = fopen (outname, "wb");
+ fpout = gnupg_fopen (outname, "wb");
if (!fpout)
{
log_error ("error creating '%s': %s\n", outname, strerror(errno));
@@ -873,7 +873,7 @@ split_packets (const char *fname)
fp = stdin;
fname = "-";
}
- else if ( !(fp = fopen (fname,"rb")) )
+ else if ( !(fp = gnupg_fopen (fname,"rb")) )
{
log_error ("can't open '%s': %s\n", fname, strerror (errno));
return;
diff --git a/tools/gpgtar-create.c b/tools/gpgtar-create.c
index 8a54c70..c196b96 100644
--- a/tools/gpgtar-create.c
+++ b/tools/gpgtar-create.c
@@ -42,7 +42,7 @@
#include "gpgtar.h"
#ifndef HAVE_LSTAT
-#define lstat(a,b) stat ((a), (b))
+#define lstat(a,b) gnupg_stat ((a), (b))
#endif
@@ -301,6 +301,8 @@ scan_directory (const char *dname, scanctrl_t scanctrl)
gpg_error_t err = 0;
#ifdef HAVE_W32_SYSTEM
+ /* Note that we introduced gnupg_opendir only after we had deployed
+ * this code and thus we don't change it for now. */
WIN32_FIND_DATAW fi;
HANDLE hd = INVALID_HANDLE_VALUE;
char *p;
diff --git a/tools/gpgtar-w32info.rc b/tools/gpgtar-w32info.rc
new file mode 100644
index 0000000..211528b
--- /dev/null
+++ b/tools/gpgtar-w32info.rc
@@ -0,0 +1,52 @@
+/* gpgtar-w32info.rc -*- c -*-
+ * Copyright (C) 2020 g10 Code GmbH
+ *
+ * This file is free software; as a special exception the author gives
+ * unlimited permission to copy and/or distribute it, with or without
+ * modifications, as long as this notice is preserved.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#include "afxres.h"
+#include "../common/w32info-rc.h"
+
+1 ICON "../common/gnupg.ico"
+
+1 VERSIONINFO
+ FILEVERSION W32INFO_VI_FILEVERSION
+ PRODUCTVERSION W32INFO_VI_PRODUCTVERSION
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x01L /* VS_FF_DEBUG (0x1)*/
+#else
+ FILEFLAGS 0x00L
+#endif
+ FILEOS 0x40004L /* VOS_NT (0x40000) | VOS__WINDOWS32 (0x4) */
+ FILETYPE 0x1L /* VFT_APP (0x1) */
+ FILESUBTYPE 0x0L /* VFT2_UNKNOWN */
+ BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0" /* US English (0409), Unicode (04b0) */
+ BEGIN
+ VALUE "FileDescription", L"GnuPG\x2019s archive tool\0"
+ VALUE "InternalName", "gpgtar\0"
+ VALUE "OriginalFilename", "gpgtar.exe\0"
+ VALUE "ProductName", W32INFO_PRODUCTNAME
+ VALUE "ProductVersion", W32INFO_PRODUCTVERSION
+ VALUE "CompanyName", W32INFO_COMPANYNAME
+ VALUE "FileVersion", W32INFO_FILEVERSION
+ VALUE "LegalCopyright", W32INFO_LEGALCOPYRIGHT
+ VALUE "Comments", W32INFO_COMMENTS
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 0x4b0
+ END
+ END
+
+1 RT_MANIFEST "gpgtar.w32-manifest"
diff --git a/tools/gpgtar.w32-manifest.in b/tools/gpgtar.w32-manifest.in
new file mode 100644
index 0000000..62d5937
--- /dev/null
+++ b/tools/gpgtar.w32-manifest.in
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<description>GNU Privacy Guard (Archive tool)</description>
+<assemblyIdentity
+ type="win32"
+ name="GnuPG.gpgtar"
+ version="@BUILD_VERSION@"
+ />
+<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/><!-- 10 -->
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/><!-- 8.1 -->
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/><!-- 8 -->
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/><!-- 7 -->
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/><!-- Vista -->
+ </application>
+</compatibility>
+</assembly>
diff --git a/tools/symcryptrun.c b/tools/symcryptrun.c
index c5780fd..d1f953c 100644
--- a/tools/symcryptrun.c
+++ b/tools/symcryptrun.c
@@ -363,7 +363,7 @@ confucius_copy_file (char *infile, char *outfile, int plain)
}
else
{
- in = fopen (infile, "rb");
+ in = gnupg_fopen (infile, "rb");
if (!in)
{
log_error (_("could not open %s for writing: %s\n"),
@@ -380,7 +380,7 @@ confucius_copy_file (char *infile, char *outfile, int plain)
}
else
{
- out = fopen (outfile, "wb");
+ out = gnupg_fopen (outfile, "wb");
if (!out)
{
log_error (_("could not open %s for writing: %s\n"),
@@ -936,7 +936,7 @@ main (int argc, char **argv)
if (configname)
{
configlineno = 0;
- configfp = fopen (configname, "r");
+ configfp = gnupg_fopen (configname, "r");
if (!configfp)
{
if (!default_config)
diff --git a/tools/wks-util.c b/tools/wks-util.c
index 52c89ba..085301f 100644
--- a/tools/wks-util.c
+++ b/tools/wks-util.c
@@ -843,13 +843,13 @@ wks_compute_hu_fname (char **r_fname, const char *addrspec)
/* Try to create missing directories below opt.directory. */
fname = make_filename_try (opt.directory, domain, NULL);
- if (fname && stat (fname, &sb)
+ if (fname && gnupg_stat (fname, &sb)
&& gpg_err_code_from_syserror () == GPG_ERR_ENOENT)
if (!gnupg_mkdir (fname, "-rwxr--r--") && opt.verbose)
log_info ("directory '%s' created\n", fname);
xfree (fname);
fname = make_filename_try (opt.directory, domain, "hu", NULL);
- if (fname && stat (fname, &sb)
+ if (fname && gnupg_stat (fname, &sb)
&& gpg_err_code_from_syserror () == GPG_ERR_ENOENT)
if (!gnupg_mkdir (fname, "-rwxr--r--") && opt.verbose)
log_info ("directory '%s' created\n", fname);
@@ -873,6 +873,7 @@ wks_compute_hu_fname (char **r_fname, const char *addrspec)
static gpg_error_t
ensure_policy_file (const char *addrspec)
{
+ gpg_err_code_t ec;
gpg_error_t err;
const char *domain;
char *fname;
@@ -890,12 +891,12 @@ ensure_policy_file (const char *addrspec)
goto leave;
/* First a quick check whether it already exists. */
- if (!access (fname, F_OK))
+ if (!(ec = gnupg_access (fname, F_OK)))
{
err = 0; /* File already exists. */
goto leave;
}
- err = gpg_error_from_syserror ();
+ err = gpg_error (ec);
if (gpg_err_code (err) == GPG_ERR_ENOENT)
err = 0;
else
@@ -911,7 +912,7 @@ ensure_policy_file (const char *addrspec)
{
err = gpg_error_from_syserror ();
if (gpg_err_code (err) == GPG_ERR_EEXIST)
- err = 0; /* Was created between the access() and fopen(). */
+ err = 0; /* Was created between the gnupg_access() and es_fopen(). */
else
log_error ("domain %s: error creating '%s': %s\n",
domain, fname, gpg_strerror (err));