diff options
Diffstat (limited to 'g10')
-rw-r--r-- | g10/dearmor.c | 4 | ||||
-rw-r--r-- | g10/decrypt.c | 8 | ||||
-rw-r--r-- | g10/encrypt.c | 10 | ||||
-rw-r--r-- | g10/export.c | 2 | ||||
-rw-r--r-- | g10/revoke.c | 4 | ||||
-rw-r--r-- | g10/server.c | 27 | ||||
-rw-r--r-- | g10/sign.c | 6 |
7 files changed, 51 insertions, 10 deletions
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; |