aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2014-03-07 08:46:44 +0000
committerWerner Koch <[email protected]>2014-03-07 15:06:35 +0000
commit3032fc3ad78ac9ed857570844547afed520d635a (patch)
tree5aa245750d356cbdf6e7d51fb97b7c0fc8d4dc17
parentw32: Include winsock2.h to silence warnings. (diff)
downloadgnupg-3032fc3ad78ac9ed857570844547afed520d635a.tar.gz
gnupg-3032fc3ad78ac9ed857570844547afed520d635a.zip
Silence several warnings when building under Windows.
* agent/call-scd.c (start_scd): Replace int by assuan_fd_t. (start_pinentry): Ditto. * common/asshelp.c (start_new_gpg_agent): Replace int by assuan_fd_t. * common/dotlock.c (GNUPG_MAJOR_VERSION): Include stringhelp.h for prototypes on Windows and some other platforms. * common/logging.c (fun_writer): Declare addrbuf only if needed. * g10/decrypt.c (decrypt_message_fd) [W32]: Return not_implemented. * g10/encrypt.c (encrypt_crypt) [W32]: Return error if used in server mode. * g10/dearmor.c (dearmor_file, enarmor_file): Replace GNUPG_INVALID_FD by -1 as temporary hack for Windows. * g10/export.c (do_export): Ditto. * g10/revoke.c (gen_desig_revoke, gen_revoke): Ditto. * g10/sign.c (sign_file, clearsign_file, sign_symencrypt_file): Ditto. * g10/server.c (cmd_verify, gpg_server) [W32]: Return an error. -- The gpg server mode is not actual working and thus we can avoid the warnings by explicitly disabling the mode. We keep it working under Unix, though.
Diffstat (limited to '')
-rw-r--r--agent/call-pinentry.c4
-rw-r--r--agent/call-scd.c4
-rw-r--r--common/asshelp.c4
-rw-r--r--common/dotlock.c1
-rw-r--r--common/logging.c6
-rw-r--r--g10/dearmor.c4
-rw-r--r--g10/decrypt.c8
-rw-r--r--g10/encrypt.c10
-rw-r--r--g10/export.c2
-rw-r--r--g10/revoke.c4
-rw-r--r--g10/server.c27
-rw-r--r--g10/sign.c6
12 files changed, 64 insertions, 16 deletions
diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c
index 78e1c1106..2562e51f4 100644
--- a/agent/call-pinentry.c
+++ b/agent/call-pinentry.c
@@ -208,7 +208,7 @@ start_pinentry (ctrl_t ctrl)
const char *pgmname;
assuan_context_t ctx;
const char *argv[5];
- int no_close_list[3];
+ assuan_fd_t no_close_list[3];
int i;
const char *tmpstr;
unsigned long pinentry_pid;
@@ -291,7 +291,7 @@ start_pinentry (ctrl_t ctrl)
no_close_list[i++] = assuan_fd_from_posix_fd (log_get_fd ());
no_close_list[i++] = assuan_fd_from_posix_fd (fileno (stderr));
}
- no_close_list[i] = -1;
+ no_close_list[i] = ASSUAN_INVALID_FD;
rc = assuan_new (&ctx);
if (rc)
diff --git a/agent/call-scd.c b/agent/call-scd.c
index a6c429c41..289b2d95a 100644
--- a/agent/call-scd.c
+++ b/agent/call-scd.c
@@ -198,7 +198,7 @@ start_scd (ctrl_t ctrl)
const char *pgmname;
assuan_context_t ctx = NULL;
const char *argv[3];
- int no_close_list[3];
+ assuan_fd_t no_close_list[3];
int i;
int rc;
@@ -324,7 +324,7 @@ start_scd (ctrl_t ctrl)
no_close_list[i++] = assuan_fd_from_posix_fd (log_get_fd ());
no_close_list[i++] = assuan_fd_from_posix_fd (fileno (stderr));
}
- no_close_list[i] = -1;
+ no_close_list[i] = ASSUAN_INVALID_FD;
/* Connect to the pinentry and perform initial handshaking. Use
detached flag (128) so that under W32 SCDAEMON does not show up a
diff --git a/common/asshelp.c b/common/asshelp.c
index cfbc3ac16..b5dde5a46 100644
--- a/common/asshelp.c
+++ b/common/asshelp.c
@@ -484,7 +484,7 @@ start_new_gpg_agent (assuan_context_t *r_ctx,
of the required features except for passphrase
caching etc. */
const char *pgmname;
- int no_close_list[3];
+ assuan_fd_t no_close_list[3];
int i;
if ( !(pgmname = strrchr (agent_program, '/')))
@@ -500,7 +500,7 @@ start_new_gpg_agent (assuan_context_t *r_ctx,
if (log_get_fd () != -1)
no_close_list[i++] = assuan_fd_from_posix_fd (log_get_fd ());
no_close_list[i++] = assuan_fd_from_posix_fd (fileno (stderr));
- no_close_list[i] = -1;
+ no_close_list[i] = ASSUAN_INVALID_FD;
/* Connect to the agent and perform initial handshaking. */
err = assuan_pipe_connect (ctx, agent_program, argv,
diff --git a/common/dotlock.c b/common/dotlock.c
index c111159d4..c5520dbb4 100644
--- a/common/dotlock.c
+++ b/common/dotlock.c
@@ -311,6 +311,7 @@
#ifdef GNUPG_MAJOR_VERSION
# include "libjnlib-config.h"
+# include "stringhelp.h" /* For stpcpy and w32_strerror. */
#endif
#ifdef HAVE_W32CE_SYSTEM
# include "utf8conv.h" /* WindowsCE requires filename conversion. */
diff --git a/common/logging.c b/common/logging.c
index bdc284fef..40d098c89 100644
--- a/common/logging.c
+++ b/common/logging.c
@@ -257,7 +257,9 @@ fun_writer (void *cookie_arg, const void *buffer, size_t size)
else
{
char *addrstr, *p;
+#ifdef HAVE_INET_PTON
void *addrbuf = NULL;
+#endif /*HAVE_INET_PTON*/
addrstr = jnlib_malloc (strlen (name) + 1);
if (!addrstr)
@@ -281,7 +283,9 @@ fun_writer (void *cookie_arg, const void *buffer, size_t size)
memset (&srvr_addr_in6, 0, sizeof srvr_addr_in6);
srvr_addr_in6.sin6_family = af;
srvr_addr_in6.sin6_port = htons (port);
+#ifdef HAVE_INET_PTON
addrbuf = &srvr_addr_in6.sin6_addr;
+#endif /*HAVE_INET_PTON*/
srvr_addr = (struct sockaddr *)&srvr_addr_in6;
addrlen = sizeof srvr_addr_in6;
#else
@@ -306,7 +310,9 @@ fun_writer (void *cookie_arg, const void *buffer, size_t size)
memset (&srvr_addr_in, 0, sizeof srvr_addr_in);
srvr_addr_in.sin_family = af;
srvr_addr_in.sin_port = htons (port);
+#ifdef HAVE_INET_PTON
addrbuf = &srvr_addr_in.sin_addr;
+#endif /*HAVE_INET_PTON*/
srvr_addr = (struct sockaddr *)&srvr_addr_in;
addrlen = sizeof srvr_addr_in;
}
diff --git a/g10/dearmor.c b/g10/dearmor.c
index 0f62f5465..d84fb30de 100644
--- a/g10/dearmor.c
+++ b/g10/dearmor.c
@@ -64,7 +64,7 @@ dearmor_file( const char *fname )
push_armor_filter ( afx, inp );
- if( (rc = open_outfile (GNUPG_INVALID_FD, fname, 0, &out )) )
+ if( (rc = open_outfile (-1, fname, 0, &out )) )
goto leave;
while( (c = iobuf_get(inp)) != -1 )
@@ -110,7 +110,7 @@ enarmor_file( const char *fname )
}
- if( (rc = open_outfile (GNUPG_INVALID_FD, fname, 1, &out )) )
+ if( (rc = open_outfile (-1, fname, 1, &out )) )
goto leave;
afx->what = 4;
diff --git a/g10/decrypt.c b/g10/decrypt.c
index f668ab83e..b0240f571 100644
--- a/g10/decrypt.c
+++ b/g10/decrypt.c
@@ -102,6 +102,13 @@ decrypt_message (ctrl_t ctrl, const char *filename)
gpg_error_t
decrypt_message_fd (ctrl_t ctrl, int input_fd, int output_fd)
{
+#ifdef HAVE_W32_SYSTEM
+ /* No server mode yet. */
+ (void)ctrl;
+ (void)input_fd;
+ (void)output_fd;
+ return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
+#else
gpg_error_t err;
IOBUF fp;
armor_filter_context_t *afx = NULL;
@@ -166,6 +173,7 @@ decrypt_message_fd (ctrl_t ctrl, int input_fd, int output_fd)
release_armor_context (afx);
release_progress_context (pfx);
return err;
+#endif
}
diff --git a/g10/encrypt.c b/g10/encrypt.c
index 671f8f6df..c8e796214 100644
--- a/g10/encrypt.c
+++ b/g10/encrypt.c
@@ -524,7 +524,17 @@ encrypt_crypt (ctrl_t ctrl, int filefd, const char *filename,
}
/* Prepare iobufs. */
+#ifdef HAVE_W32_SYSTEM
+ if (filefd == -1)
+ inp = iobuf_open_fd_or_name (GNUPG_INVALID_FD, filename, "rb");
+ else
+ {
+ inp = NULL;
+ gpg_err_set_errno (ENOSYS);
+ }
+#else
inp = iobuf_open_fd_or_name (filefd, filename, "rb");
+#endif
if (inp)
iobuf_ioctl (inp, IOBUF_IOCTL_NO_CACHE, 1, NULL);
if (inp && is_secured_file (iobuf_get_fd (inp)))
diff --git a/g10/export.c b/g10/export.c
index a7d1cf873..fffaf7935 100644
--- a/g10/export.c
+++ b/g10/export.c
@@ -200,7 +200,7 @@ do_export (ctrl_t ctrl, strlist_t users, int secret, unsigned int options )
memset( &zfx, 0, sizeof zfx);
- rc = open_outfile (GNUPG_INVALID_FD, NULL, 0, &out );
+ rc = open_outfile (-1, NULL, 0, &out );
if (rc)
return rc;
diff --git a/g10/revoke.c b/g10/revoke.c
index 6e47691d9..46fa87082 100644
--- a/g10/revoke.c
+++ b/g10/revoke.c
@@ -328,7 +328,7 @@ gen_desig_revoke( const char *uname, strlist_t locusr )
if( !opt.armor )
tty_printf(_("ASCII armored output forced.\n"));
- if( (rc = open_outfile (GNUPG_INVALID_FD, NULL, 0, &out )) )
+ if( (rc = open_outfile (-1, NULL, 0, &out )) )
goto leave;
afx->what = 1;
@@ -518,7 +518,7 @@ gen_revoke (const char *uname)
if (!opt.armor)
tty_printf (_("ASCII armored output forced.\n"));
- if ((rc = open_outfile (GNUPG_INVALID_FD, NULL, 0, &out )))
+ if ((rc = open_outfile (-1, NULL, 0, &out )))
goto leave;
afx->what = 1;
diff --git a/g10/server.c b/g10/server.c
index 8bf7a080a..e87c871e3 100644
--- a/g10/server.c
+++ b/g10/server.c
@@ -403,6 +403,11 @@ static gpg_error_t
cmd_verify (assuan_context_t ctx, char *line)
{
int rc;
+#ifdef HAVE_W32_SYSTEM
+ (void)ctx;
+ (void)line;
+ rc = gpg_error (GPG_ERR_NOT_IMPLEMENTED);
+#else
ctrl_t ctrl = assuan_get_pointer (ctx);
gnupg_fd_t fd = assuan_get_input_fd (ctx);
gnupg_fd_t out_fd = assuan_get_output_fd (ctx);
@@ -418,13 +423,22 @@ cmd_verify (assuan_context_t ctx, char *line)
if (out_fd != GNUPG_INVALID_FD)
{
- out_fp = es_fdopen_nc (out_fd, "w");
+ es_syshd_t syshd;
+
+#ifdef HAVE_W32_SYSTEM
+ syshd.type = ES_SYSHD_HANDLE;
+ syshd.u.handle = out_fd;
+#else
+ syshd.type = ES_SYSHD_FD;
+ syshd.u.fd = out_fd;
+#endif
+ out_fp = es_sysopen_nc (&syshd, "w");
if (!out_fp)
return set_error (gpg_err_code_from_syserror (), "fdopen() failed");
}
log_debug ("WARNING: The server mode is WORK "
- "iN PROGRESS and not ready for use\n");
+ "IN PROGRESS and not ready for use\n");
rc = gpg_verify (ctrl, fd, ctrl->server_local->message_fd, out_fp);
@@ -432,6 +446,7 @@ cmd_verify (assuan_context_t ctx, char *line)
close_message_fd (ctrl);
assuan_close_input_fd (ctx);
assuan_close_output_fd (ctx);
+#endif
if (rc)
log_error ("command '%s' failed: %s\n", "VERIFY", gpg_strerror (rc));
@@ -672,7 +687,9 @@ int
gpg_server (ctrl_t ctrl)
{
int rc;
+#ifndef HAVE_W32_SYSTEM
int filedes[2];
+#endif
assuan_context_t ctx = NULL;
static const char hello[] = ("GNU Privacy Guard's OpenPGP server "
VERSION " ready");
@@ -680,8 +697,10 @@ gpg_server (ctrl_t ctrl)
/* We use a pipe based server so that we can work from scripts.
assuan_init_pipe_server will automagically detect when we are
called with a socketpair and ignore FILEDES in this case. */
+#ifndef HAVE_W32_SYSTEM
filedes[0] = assuan_fdopen (0);
filedes[1] = assuan_fdopen (1);
+#endif
rc = assuan_new (&ctx);
if (rc)
{
@@ -690,7 +709,11 @@ gpg_server (ctrl_t ctrl)
goto leave;
}
+#ifdef HAVE_W32_SYSTEM
+ rc = gpg_error (GPG_ERR_NOT_IMPLEMENTED);
+#else
rc = assuan_init_pipe_server (ctx, filedes);
+#endif
if (rc)
{
log_error ("failed to initialize the server: %s\n", gpg_strerror (rc));
diff --git a/g10/sign.c b/g10/sign.c
index 098655dce..f5f0f95d2 100644
--- a/g10/sign.c
+++ b/g10/sign.c
@@ -881,7 +881,7 @@ sign_file (ctrl_t ctrl, strlist_t filenames, int detached, strlist_t locusr,
else if( opt.verbose )
log_info(_("writing to '%s'\n"), outfile );
}
- else if( (rc = open_outfile (GNUPG_INVALID_FD, fname,
+ else if( (rc = open_outfile (-1, fname,
opt.armor? 1: detached? 2:0, &out )))
goto leave;
@@ -1198,7 +1198,7 @@ clearsign_file( const char *fname, strlist_t locusr, const char *outfile )
else if( opt.verbose )
log_info(_("writing to '%s'\n"), outfile );
}
- else if( (rc = open_outfile (GNUPG_INVALID_FD, fname, 1, &out )) )
+ else if( (rc = open_outfile (-1, fname, 1, &out )) )
goto leave;
iobuf_writestr(out, "-----BEGIN PGP SIGNED MESSAGE-----" LF );
@@ -1366,7 +1366,7 @@ sign_symencrypt_file (const char *fname, strlist_t locusr)
cfx.dek->use_mdc=1;
/* now create the outfile */
- rc = open_outfile (GNUPG_INVALID_FD, fname, opt.armor? 1:0, &out);
+ rc = open_outfile (-1, fname, opt.armor? 1:0, &out);
if (rc)
goto leave;