* passphrase.c (agent_send_all_options): Make use of $GPG_TTY.

* g10.c (main): Disable use-agent if passphrase-fd is given later.
Suggested by Kurt Garloff.

* exec.c, g10.c, gpgv.c, passphrase.c, photoid.c: s/__MINGW32__/_WIN32/ to
help building on native Windows compilers.  Requested by Brian Gladman.
From Werner on stable branch.
This commit is contained in:
David Shaw 2003-08-29 00:14:42 +00:00
parent 6eb9d6297f
commit 17e67cd29b
6 changed files with 36 additions and 20 deletions

View File

@ -1,3 +1,15 @@
2003-08-28 David Shaw <dshaw@jabberwocky.com>
* passphrase.c (agent_send_all_options): Make use of $GPG_TTY.
* g10.c (main): Disable use-agent if passphrase-fd is given
later. Suggested by Kurt Garloff.
* exec.c, g10.c, gpgv.c, passphrase.c, photoid.c:
s/__MINGW32__/_WIN32/ to help building on native Windows
compilers. Requested by Brian Gladman. From Werner on stable
branch.
2003-08-25 David Shaw <dshaw@jabberwocky.com>
* options.h, g10.c (main): Add list-option

View File

@ -1,5 +1,5 @@
/* exec.c - generic call-a-program code
* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@ -59,7 +59,7 @@ int set_exec_path(const char *path,int method) { return G10ERR_GENERAL; }
char *mkdtemp(char *template);
#endif
#if defined (__MINGW32__)
#if defined (_WIN32)
/* This is a nicer system() for windows that waits for programs to
return before returning control to the caller. I hate helpful
computers. */
@ -139,7 +139,7 @@ static int make_tempdir(struct exec_info *info)
if(tmp==NULL)
{
#if defined (__MINGW32__)
#if defined (_WIN32)
tmp=m_alloc(256);
if(GetTempPath(256,tmp)==0)
strcpy(tmp,"c:\\windows\\temp");
@ -176,7 +176,7 @@ static int make_tempdir(struct exec_info *info)
sprintf(info->tempdir,"%s" DIRSEP_S "gpg-XXXXXX",tmp);
#if defined (__MINGW32__)
#if defined (_WIN32)
m_free(tmp);
#endif
@ -502,7 +502,7 @@ int exec_read(struct exec_info *info)
if(DBG_EXTPROG)
log_debug("system() command is %s\n",info->command);
#if defined (__MINGW32__)
#if defined (_WIN32)
info->progreturn=win_system(info->command);
#else
info->progreturn=system(info->command);

View File

@ -1186,8 +1186,7 @@ main( int argc, char **argv )
VERIFY_SHOW_POLICY|VERIFY_SHOW_NOTATION|VERIFY_SHOW_KEYSERVER;
opt.trust_model=TM_AUTO;
opt.mangle_dos_filenames = 1;
#if defined (__MINGW32__)
#if defined (_WIN32)
set_homedir ( read_w32_registry_string( NULL,
"Software\\GNU\\GnuPG", "HomeDir" ));
#else
@ -1530,7 +1529,7 @@ main( int argc, char **argv )
break;
case oLoadExtension:
#ifndef __riscos__
#if defined(USE_DYNAMIC_LINKING) || defined(__MINGW32__)
#if defined(USE_DYNAMIC_LINKING) || defined(_WIN32)
if(check_permissions(pargs.r.ret_str,2))
log_info(_("cipher extension \"%s\" not loaded due to "
"unsafe permissions\n"),pargs.r.ret_str);
@ -1665,6 +1664,7 @@ main( int argc, char **argv )
case oCompress: opt.compress = pargs.r.ret_int; break;
case oPasswdFD:
pwfd = iobuf_translate_file_handle (pargs.r.ret_int, 0);
opt.use_agent = 0;
break;
#ifdef __riscos__
case oPasswdFile:

View File

@ -153,7 +153,7 @@ main( int argc, char **argv )
opt.trust_model = TM_ALWAYS;
opt.batch = 1;
#if defined (__MINGW32__)
#if defined (_WIN32)
opt.homedir = read_w32_registry_string( NULL, "Software\\GNU\\GnuPG", "HomeDir" );
#else
opt.homedir = getenv("GNUPGHOME");

View File

@ -29,7 +29,7 @@
#include <sys/socket.h>
#include <sys/un.h>
#endif
#if defined (__MINGW32__) || defined (__CYGWIN32__)
#if defined (_WIN32) || defined (__CYGWIN32__)
# include <windows.h>
#endif
#include <errno.h>
@ -100,7 +100,7 @@ static char *fd_passwd = NULL;
static char *next_pw = NULL;
static char *last_pw = NULL;
#if defined (__MINGW32__)
#if defined (_WIN32)
static int read_fd = 0;
static int write_fd = 0;
#endif
@ -190,7 +190,7 @@ read_passphrase_from_fd( int fd )
static int
writen ( int fd, const void *buf, size_t nbytes )
{
#if defined (__MINGW32__)
#if defined (_WIN32)
DWORD nwritten, nleft = nbytes;
while (nleft > 0) {
@ -233,7 +233,7 @@ writen ( int fd, const void *buf, size_t nbytes )
static int
readn ( int fd, void *buf, size_t buflen, size_t *ret_nread )
{
#if defined (__MINGW32__)
#if defined (_WIN32)
DWORD nread, nleft = buflen;
while (nleft > 0) {
@ -327,7 +327,7 @@ readline (int fd, char *buf, size_t buflen)
#if !defined (__riscos__)
#if !defined (__MINGW32__)
#if !defined (_WIN32)
/* For the new Assuan protocol we may have to send options */
static int
agent_send_option (int fd, const char *name, const char *value)
@ -375,7 +375,11 @@ agent_send_all_options (int fd)
}
if (!opt.ttyname)
dft_ttyname = tty_get_ttyname ();
{
dft_ttyname = getenv ("GPG_TTY");
if ((!dft_ttyname || !*dft_ttyname) && tty_get_ttyname ())
dft_ttyname = tty_get_ttyname ();
}
if (opt.ttyname || dft_ttyname)
{
if (agent_send_option (fd, "ttyname",
@ -432,7 +436,7 @@ agent_send_all_options (int fd)
#endif
return rc;
}
#endif /*!__MINGW32__*/
#endif /*!_WIN32*/
/*
@ -443,7 +447,7 @@ agent_send_all_options (int fd)
static int
agent_open (int *ret_prot)
{
#if defined (__MINGW32__)
#if defined (_WIN32)
int fd;
char *infostr, *p;
HANDLE h;
@ -588,7 +592,7 @@ agent_open (int *ret_prot)
static void
agent_close ( int fd )
{
#if defined (__MINGW32__)
#if defined (_WIN32)
HANDLE h = OpenEvent(EVENT_ALL_ACCESS, FALSE, "gpg_agent");
ResetEvent(h);
#else

View File

@ -22,7 +22,7 @@
#include <errno.h>
#include <stdio.h>
#include <string.h>
#ifdef __MINGW32__
#ifdef _WIN32
# include <windows.h>
# ifndef VER_PLATFORM_WIN32_WINDOWS
# define VER_PLATFORM_WIN32_WINDOWS 1
@ -223,7 +223,7 @@ char *image_type_to_string(byte type,int style)
#if !defined(FIXED_PHOTO_VIEWER) && !defined(DISABLE_PHOTO_VIEWER)
static const char *get_default_photo_command(void)
{
#if defined(__MINGW32__)
#if defined(_WIN32)
OSVERSIONINFO osvi;
memset(&osvi,0,sizeof(osvi));