mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
* configure.ac: Add PATHSEP_C and PATHSEP_S. For W32 let all
directories default to c:/gnupg. Require libassuan 0.6.9. * gpg-agent.c (main) [W32]: Now that Mutexes work we can remove the pth_init kludge. (main): Add new options --[no-]use-standard-socket. (check_for_running_agent): Check whether it is running on the standard socket. * sysutils.h [W32]: Define sleep. * util.h: Add prototype for mkdtemp. * call-agent.c (start_agent): Before starting a pipe server start to connect to a server on the standard socket. Use PATHSEP * call-dirmngr.c (start_dirmngr): Use PATHSEP. * import.c: Include unistd.h for dup and close.
This commit is contained in:
parent
f105ceb39c
commit
581f5ddb17
@ -1,3 +1,8 @@
|
|||||||
|
2004-12-20 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* configure.ac: Add PATHSEP_C and PATHSEP_S. For W32 let all
|
||||||
|
directories default to c:/gnupg. Require libassuan 0.6.9.
|
||||||
|
|
||||||
2004-12-18 Werner Koch <wk@g10code.com>
|
2004-12-18 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* configure.ac (AH_BOTTOM): Define EXEEXT_S.
|
* configure.ac (AH_BOTTOM): Define EXEEXT_S.
|
||||||
|
6
NEWS
6
NEWS
@ -1,6 +1,12 @@
|
|||||||
Noteworthy changes in version 1.9.14
|
Noteworthy changes in version 1.9.14
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
|
|
||||||
|
* [gpg-agent] New option --use-standard-socket to allow the use of a
|
||||||
|
fixed socket. gpgsm falls back to this socket if GPG_AGENT_INFO
|
||||||
|
has not been set.
|
||||||
|
|
||||||
|
* Ported to MS Windows.
|
||||||
|
|
||||||
|
|
||||||
Noteworthy changes in version 1.9.13 (2004-12-03)
|
Noteworthy changes in version 1.9.13 (2004-12-03)
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
|
7
TODO
7
TODO
@ -95,3 +95,10 @@ might want to have an agent context for each service request
|
|||||||
This needs support in libksba/src/cert.c as well as in sm/*.c.
|
This needs support in libksba/src/cert.c as well as in sm/*.c.
|
||||||
Need test certs as well. Same goes for CRL authorityKeyIdentifier.
|
Need test certs as well. Same goes for CRL authorityKeyIdentifier.
|
||||||
|
|
||||||
|
|
||||||
|
* Windows port
|
||||||
|
** gpgsm's LISTKEYS does not yet work
|
||||||
|
Fix is to change everything to libestream
|
||||||
|
** Signals are not support
|
||||||
|
This means we can't reread a configuration
|
||||||
|
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
2004-12-20 Werner Koch <wk@g10code.com>
|
2004-12-20 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* gpg-agent.c (main) [W32]: Now that Mutexes work we can remove
|
||||||
|
the pth_init kludge.
|
||||||
|
(main): Add new options --[no-]use-standard-socket.
|
||||||
|
(check_for_running_agent): Check whether it is running on the
|
||||||
|
standard socket.
|
||||||
|
|
||||||
* call-scd.c (init_membuf, put_membuf, get_membuf): Removed. We
|
* call-scd.c (init_membuf, put_membuf, get_membuf): Removed. We
|
||||||
now use the identical implementation from ../common/membuf.c.
|
now use the identical implementation from ../common/membuf.c.
|
||||||
|
|
||||||
|
@ -84,13 +84,14 @@ enum cmd_and_opt_values
|
|||||||
oDisablePth,
|
oDisablePth,
|
||||||
oDefCacheTTL,
|
oDefCacheTTL,
|
||||||
oMaxCacheTTL,
|
oMaxCacheTTL,
|
||||||
|
oUseStandardSocket,
|
||||||
|
oNoUseStandardSocket,
|
||||||
|
|
||||||
oIgnoreCacheForSigning,
|
oIgnoreCacheForSigning,
|
||||||
oAllowMarkTrusted,
|
oAllowMarkTrusted,
|
||||||
oKeepTTY,
|
oKeepTTY,
|
||||||
oKeepDISPLAY,
|
oKeepDISPLAY
|
||||||
|
};
|
||||||
aTest };
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -115,6 +116,9 @@ static ARGPARSE_OPTS opts[] = {
|
|||||||
{ oNoGrab, "no-grab" ,0, N_("do not grab keyboard and mouse")},
|
{ oNoGrab, "no-grab" ,0, N_("do not grab keyboard and mouse")},
|
||||||
{ oLogFile, "log-file" ,2, N_("use a log file for the server")},
|
{ oLogFile, "log-file" ,2, N_("use a log file for the server")},
|
||||||
{ oDisablePth, "disable-pth", 0, N_("do not allow multiple connections")},
|
{ oDisablePth, "disable-pth", 0, N_("do not allow multiple connections")},
|
||||||
|
{ oUseStandardSocket, "use-standard-socket", 0,
|
||||||
|
N_("use a standard location for the socket")},
|
||||||
|
{ oNoUseStandardSocket, "no-use-standard-socket", 0, "@"},
|
||||||
|
|
||||||
{ oPinentryProgram, "pinentry-program", 2 ,
|
{ oPinentryProgram, "pinentry-program", 2 ,
|
||||||
N_("|PGM|use PGM as the PIN-Entry program") },
|
N_("|PGM|use PGM as the PIN-Entry program") },
|
||||||
@ -154,7 +158,7 @@ static int shutdown_pending;
|
|||||||
static int maybe_setuid = 1;
|
static int maybe_setuid = 1;
|
||||||
|
|
||||||
/* Name of the communication socket */
|
/* Name of the communication socket */
|
||||||
static char socket_name[128];
|
static char *socket_name;
|
||||||
|
|
||||||
/* Default values for options passed to the pinentry. */
|
/* Default values for options passed to the pinentry. */
|
||||||
static char *default_display;
|
static char *default_display;
|
||||||
@ -177,12 +181,11 @@ static char *current_logfile;
|
|||||||
static void create_directories (void);
|
static void create_directories (void);
|
||||||
#ifdef USE_GNU_PTH
|
#ifdef USE_GNU_PTH
|
||||||
static void handle_connections (int listen_fd);
|
static void handle_connections (int listen_fd);
|
||||||
|
|
||||||
/* Pth wrapper function definitions. */
|
/* Pth wrapper function definitions. */
|
||||||
GCRY_THREAD_OPTION_PTH_IMPL;
|
GCRY_THREAD_OPTION_PTH_IMPL;
|
||||||
|
|
||||||
#endif /*USE_GNU_PTH*/
|
#endif /*USE_GNU_PTH*/
|
||||||
static void check_for_running_agent (void);
|
|
||||||
|
static int check_for_running_agent (int);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -293,7 +296,7 @@ set_debug (void)
|
|||||||
static void
|
static void
|
||||||
cleanup (void)
|
cleanup (void)
|
||||||
{
|
{
|
||||||
if (*socket_name)
|
if (socket_name && *socket_name)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
@ -419,6 +422,7 @@ main (int argc, char **argv )
|
|||||||
int debug_wait = 0;
|
int debug_wait = 0;
|
||||||
int disable_pth = 0;
|
int disable_pth = 0;
|
||||||
int gpgconf_list = 0;
|
int gpgconf_list = 0;
|
||||||
|
int standard_socket = 0;
|
||||||
gpg_error_t err;
|
gpg_error_t err;
|
||||||
|
|
||||||
|
|
||||||
@ -437,17 +441,12 @@ main (int argc, char **argv )
|
|||||||
/* Libgcrypt requires us to register the threading model first.
|
/* Libgcrypt requires us to register the threading model first.
|
||||||
Note that this will also do the pth_init. */
|
Note that this will also do the pth_init. */
|
||||||
#ifdef USE_GNU_PTH
|
#ifdef USE_GNU_PTH
|
||||||
#ifdef HAVE_W32_SYSTEM
|
|
||||||
/* For W32 we need pth. */
|
|
||||||
pth_init ();
|
|
||||||
#else
|
|
||||||
err = gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pth);
|
err = gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pth);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
log_fatal ("can't register GNU Pth with Libgcrypt: %s\n",
|
log_fatal ("can't register GNU Pth with Libgcrypt: %s\n",
|
||||||
gpg_strerror (err));
|
gpg_strerror (err));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif /*USE_GNU_PTH*/
|
#endif /*USE_GNU_PTH*/
|
||||||
|
|
||||||
|
|
||||||
@ -468,18 +467,28 @@ main (int argc, char **argv )
|
|||||||
|
|
||||||
may_coredump = disable_core_dumps ();
|
may_coredump = disable_core_dumps ();
|
||||||
|
|
||||||
|
/* Set default options. */
|
||||||
parse_rereadable_options (NULL, 0); /* Reset them to default values. */
|
parse_rereadable_options (NULL, 0); /* Reset them to default values. */
|
||||||
|
#ifdef HAVE_W32_SYSTEM
|
||||||
|
standard_socket = 1; /* Under Windows we always use a standard
|
||||||
|
socket. */
|
||||||
|
#endif
|
||||||
|
|
||||||
shell = getenv ("SHELL");
|
shell = getenv ("SHELL");
|
||||||
if (shell && strlen (shell) >= 3 && !strcmp (shell+strlen (shell)-3, "csh") )
|
if (shell && strlen (shell) >= 3 && !strcmp (shell+strlen (shell)-3, "csh") )
|
||||||
csh_style = 1;
|
csh_style = 1;
|
||||||
|
|
||||||
|
|
||||||
opt.homedir = getenv("GNUPGHOME");
|
opt.homedir = getenv("GNUPGHOME");
|
||||||
|
#ifdef HAVE_W32_SYSTEM
|
||||||
|
if (!opt.homedir || !*opt.homedir)
|
||||||
|
opt.homedir = read_w32_registry_string (NULL,
|
||||||
|
"Software\\GNU\\GnuPG", "HomeDir");
|
||||||
|
#endif /*HAVE_W32_SYSTEM*/
|
||||||
if (!opt.homedir || !*opt.homedir)
|
if (!opt.homedir || !*opt.homedir)
|
||||||
opt.homedir = GNUPG_DEFAULT_HOMEDIR;
|
opt.homedir = GNUPG_DEFAULT_HOMEDIR;
|
||||||
|
|
||||||
|
/* Check whether we have a config file on the commandline */
|
||||||
/* check whether we have a config file on the commandline */
|
|
||||||
orig_argc = argc;
|
orig_argc = argc;
|
||||||
orig_argv = argv;
|
orig_argv = argv;
|
||||||
pargs.argc = &argc;
|
pargs.argc = &argc;
|
||||||
@ -509,7 +518,6 @@ main (int argc, char **argv )
|
|||||||
Now we are now working under our real uid
|
Now we are now working under our real uid
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
if (default_config)
|
if (default_config)
|
||||||
configname = make_filename (opt.homedir, "gpg-agent.conf", NULL );
|
configname = make_filename (opt.homedir, "gpg-agent.conf", NULL );
|
||||||
|
|
||||||
@ -584,6 +592,9 @@ main (int argc, char **argv )
|
|||||||
case oLCmessages: default_lc_messages = xstrdup (pargs.r.ret_str);
|
case oLCmessages: default_lc_messages = xstrdup (pargs.r.ret_str);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case oUseStandardSocket: standard_socket = 1; break;
|
||||||
|
case oNoUseStandardSocket: standard_socket = 0; break;
|
||||||
|
|
||||||
case oKeepTTY: opt.keep_tty = 1; break;
|
case oKeepTTY: opt.keep_tty = 1; break;
|
||||||
case oKeepDISPLAY: opt.keep_display = 1; break;
|
case oKeepDISPLAY: opt.keep_display = 1; break;
|
||||||
|
|
||||||
@ -695,7 +706,7 @@ main (int argc, char **argv )
|
|||||||
if (!pipe_server && !is_daemon)
|
if (!pipe_server && !is_daemon)
|
||||||
{
|
{
|
||||||
log_set_prefix (NULL, JNLIB_LOG_WITH_PREFIX);
|
log_set_prefix (NULL, JNLIB_LOG_WITH_PREFIX);
|
||||||
check_for_running_agent ();
|
check_for_running_agent (0);
|
||||||
agent_exit (0);
|
agent_exit (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -736,6 +747,7 @@ main (int argc, char **argv )
|
|||||||
else
|
else
|
||||||
{ /* Regular server mode */
|
{ /* Regular server mode */
|
||||||
int fd;
|
int fd;
|
||||||
|
int rc;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int len;
|
int len;
|
||||||
struct sockaddr_un serv_addr;
|
struct sockaddr_un serv_addr;
|
||||||
@ -750,28 +762,28 @@ main (int argc, char **argv )
|
|||||||
unsetenv ("DISPLAY");
|
unsetenv ("DISPLAY");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*socket_name = 0;
|
/* Create the socket name . */
|
||||||
snprintf (socket_name, DIM(socket_name)-1,
|
if (standard_socket)
|
||||||
"/tmp/gpg-XXXXXX/S.gpg-agent");
|
socket_name = make_filename (opt.homedir, "S.gpg-agent", NULL);
|
||||||
socket_name[DIM(socket_name)-1] = 0;
|
else
|
||||||
p = strrchr (socket_name, '/');
|
|
||||||
if (!p)
|
|
||||||
BUG ();
|
|
||||||
*p = 0;;
|
|
||||||
|
|
||||||
#ifndef HAVE_W32_SYSTEM
|
|
||||||
if (!mkdtemp(socket_name))
|
|
||||||
{
|
{
|
||||||
log_error ("can't create directory `%s': %s\n",
|
socket_name = xstrdup ("/tmp/gpg-XXXXXX/S.gpg-agent");
|
||||||
socket_name, strerror(errno) );
|
p = strrchr (socket_name, '/');
|
||||||
exit (1);
|
if (!p)
|
||||||
|
BUG ();
|
||||||
|
*p = 0;;
|
||||||
|
if (!mkdtemp(socket_name))
|
||||||
|
{
|
||||||
|
log_error (_("can't create directory `%s': %s\n"),
|
||||||
|
socket_name, strerror(errno) );
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
*p = '/';
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
*p = '/';
|
|
||||||
|
|
||||||
if (strchr (socket_name, ':') )
|
if (strchr (socket_name, PATHSEP_C) )
|
||||||
{
|
{
|
||||||
log_error ("colons are not allowed in the socket name\n");
|
log_error ("`%s' are not allowed in the socket name\n", PATHSEP_S);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
if (strlen (socket_name)+1 >= sizeof serv_addr.sun_path )
|
if (strlen (socket_name)+1 >= sizeof serv_addr.sun_path )
|
||||||
@ -797,13 +809,22 @@ main (int argc, char **argv )
|
|||||||
len = (offsetof (struct sockaddr_un, sun_path)
|
len = (offsetof (struct sockaddr_un, sun_path)
|
||||||
+ strlen(serv_addr.sun_path) + 1);
|
+ strlen(serv_addr.sun_path) + 1);
|
||||||
|
|
||||||
if (
|
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
_w32_sock_bind
|
rc = _w32_sock_bind (fd, (struct sockaddr*)&serv_addr, len);
|
||||||
|
if (rc == -1 && standard_socket)
|
||||||
|
{
|
||||||
|
remove (socket_name);
|
||||||
|
rc = bind (fd, (struct sockaddr*)&serv_addr, len);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
bind
|
rc = bind (fd, (struct sockaddr*)&serv_addr, len);
|
||||||
|
if (rc == -1 && standard_socket && errno == EADDRINUSE)
|
||||||
|
{
|
||||||
|
remove (socket_name);
|
||||||
|
rc = bind (fd, (struct sockaddr*)&serv_addr, len);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
(fd, (struct sockaddr*)&serv_addr, len) == -1)
|
if (rc == -1)
|
||||||
{
|
{
|
||||||
log_error ("error binding socket to `%s': %s\n",
|
log_error ("error binding socket to `%s': %s\n",
|
||||||
serv_addr.sun_path, strerror (errno) );
|
serv_addr.sun_path, strerror (errno) );
|
||||||
@ -823,7 +844,10 @@ main (int argc, char **argv )
|
|||||||
|
|
||||||
|
|
||||||
fflush (NULL);
|
fflush (NULL);
|
||||||
#ifndef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
|
pid = getpid ();
|
||||||
|
printf ("set GPG_AGENT_INFO=%s;%lu;1\n", socket_name, (ulong)pid);
|
||||||
|
#else /*!HAVE_W32_SYSTEM*/
|
||||||
pid = fork ();
|
pid = fork ();
|
||||||
if (pid == (pid_t)-1)
|
if (pid == (pid_t)-1)
|
||||||
{
|
{
|
||||||
@ -1286,53 +1310,72 @@ handle_connections (int listen_fd)
|
|||||||
|
|
||||||
|
|
||||||
/* Figure out whether an agent is available and running. Prints an
|
/* Figure out whether an agent is available and running. Prints an
|
||||||
error if not. */
|
error if not. Usually started with MODE 0. */
|
||||||
static void
|
static int
|
||||||
check_for_running_agent ()
|
check_for_running_agent (int mode)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
char *infostr, *p;
|
char *infostr, *p;
|
||||||
assuan_context_t ctx;
|
assuan_context_t ctx;
|
||||||
int prot, pid;
|
int prot, pid;
|
||||||
|
|
||||||
infostr = getenv ("GPG_AGENT_INFO");
|
if (!mode)
|
||||||
if (!infostr || !*infostr)
|
|
||||||
{
|
{
|
||||||
log_error (_("no gpg-agent running in this session\n"));
|
infostr = getenv ("GPG_AGENT_INFO");
|
||||||
return;
|
if (!infostr || !*infostr)
|
||||||
|
{
|
||||||
|
if (!check_for_running_agent (1))
|
||||||
|
return 0; /* Okay, its running on the standard socket. */
|
||||||
|
log_error (_("no gpg-agent running in this session\n"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
infostr = xstrdup (infostr);
|
||||||
|
if ( !(p = strchr (infostr, PATHSEP_C)) || p == infostr)
|
||||||
|
{
|
||||||
|
xfree (infostr);
|
||||||
|
if (!check_for_running_agent (1))
|
||||||
|
return 0; /* Okay, its running on the standard socket. */
|
||||||
|
log_error (_("malformed GPG_AGENT_INFO environment variable\n"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
*p++ = 0;
|
||||||
|
pid = atoi (p);
|
||||||
|
while (*p && *p != PATHSEP_C)
|
||||||
|
p++;
|
||||||
|
prot = *p? atoi (p+1) : 0;
|
||||||
|
if (prot != 1)
|
||||||
|
{
|
||||||
|
xfree (infostr);
|
||||||
|
log_error (_("gpg-agent protocol version %d is not supported\n"),
|
||||||
|
prot);
|
||||||
|
if (!check_for_running_agent (1))
|
||||||
|
return 0; /* Okay, its running on the standard socket. */
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else /* MODE != 0 */
|
||||||
|
{
|
||||||
|
infostr = make_filename (opt.homedir, "S.gpg-agent", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
infostr = xstrdup (infostr);
|
|
||||||
if ( !(p = strchr (infostr, ':')) || p == infostr)
|
|
||||||
{
|
|
||||||
log_error (_("malformed GPG_AGENT_INFO environment variable\n"));
|
|
||||||
xfree (infostr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
*p++ = 0;
|
|
||||||
pid = atoi (p);
|
|
||||||
while (*p && *p != ':')
|
|
||||||
p++;
|
|
||||||
prot = *p? atoi (p+1) : 0;
|
|
||||||
if (prot != 1)
|
|
||||||
{
|
|
||||||
log_error (_("gpg-agent protocol version %d is not supported\n"),
|
|
||||||
prot);
|
|
||||||
xfree (infostr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = assuan_socket_connect (&ctx, infostr, pid);
|
rc = assuan_socket_connect (&ctx, infostr, pid);
|
||||||
xfree (infostr);
|
xfree (infostr);
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
log_error ("can't connect to the agent: %s\n", assuan_strerror (rc));
|
if (!mode && !check_for_running_agent (1))
|
||||||
return;
|
return 0; /* Okay, its running on the standard socket. */
|
||||||
|
|
||||||
|
if (!mode)
|
||||||
|
log_error ("can't connect to the agent: %s\n", assuan_strerror (rc));
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!opt.quiet)
|
if (!opt.quiet)
|
||||||
log_info ("gpg-agent running and available\n");
|
log_info ("gpg-agent running and available\n");
|
||||||
|
|
||||||
assuan_disconnect (ctx);
|
assuan_disconnect (ctx);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,8 @@
|
|||||||
#include "minip12.h"
|
#include "minip12.h"
|
||||||
#include "simple-pwquery.h"
|
#include "simple-pwquery.h"
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
#include "sysutils.h"
|
||||||
|
|
||||||
|
|
||||||
enum cmd_and_opt_values
|
enum cmd_and_opt_values
|
||||||
{ aNull = 0,
|
{ aNull = 0,
|
||||||
@ -1065,12 +1067,12 @@ main (int argc, char **argv )
|
|||||||
gcry_control (GCRYCTL_INIT_SECMEM, 16384, 0);
|
gcry_control (GCRYCTL_INIT_SECMEM, 16384, 0);
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_W32_SYSTEM
|
|
||||||
opt_homedir = read_w32_registry_string ( NULL,
|
|
||||||
"Software\\GNU\\GnuPG", "HomeDir" );
|
|
||||||
#else /*!HAVE_W32_SYSTEM*/
|
|
||||||
opt_homedir = getenv ("GNUPGHOME");
|
opt_homedir = getenv ("GNUPGHOME");
|
||||||
#endif /*!HAVE_W32_SYSTEM*/
|
#ifdef HAVE_W32_SYSTEM
|
||||||
|
if (!opt_homedir || !*opt_homedir)
|
||||||
|
opt_homedir = read_w32_registry_string (NULL,
|
||||||
|
"Software\\GNU\\GnuPG", "HomeDir");
|
||||||
|
#endif /*HAVE_W32_SYSTEM*/
|
||||||
if (!opt_homedir || !*opt_homedir)
|
if (!opt_homedir || !*opt_homedir)
|
||||||
opt_homedir = GNUPG_DEFAULT_HOMEDIR;
|
opt_homedir = GNUPG_DEFAULT_HOMEDIR;
|
||||||
|
|
||||||
@ -1162,7 +1164,9 @@ get_passphrase (int promptno)
|
|||||||
char *pw;
|
char *pw;
|
||||||
int err;
|
int err;
|
||||||
const char *desc;
|
const char *desc;
|
||||||
|
#ifdef HAVE_LANGINFO_CODESET
|
||||||
char *orig_codeset = NULL;
|
char *orig_codeset = NULL;
|
||||||
|
#endif
|
||||||
int error_msgno;
|
int error_msgno;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
2004-12-20 Werner Koch <wk@g10code.com>
|
2004-12-20 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* sysutils.h [W32]: Define sleep.
|
||||||
|
* util.h: Add prototype for mkdtemp.
|
||||||
|
|
||||||
* membuf.c (put_membuf): Wipe out buffer after a failed realloc.
|
* membuf.c (put_membuf): Wipe out buffer after a failed realloc.
|
||||||
|
|
||||||
2004-12-19 Werner Koch <wk@g10code.com>
|
2004-12-19 Werner Koch <wk@g10code.com>
|
||||||
|
@ -35,7 +35,8 @@
|
|||||||
# define mkdir(a,b) mkdir(a)
|
# define mkdir(a,b) mkdir(a)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *mkdtemp(char *template)
|
char *
|
||||||
|
mkdtemp (char *template)
|
||||||
{
|
{
|
||||||
int attempts,idx,count=0;
|
int attempts,idx,count=0;
|
||||||
unsigned char *ch;
|
unsigned char *ch;
|
||||||
|
@ -28,11 +28,19 @@ const unsigned char *get_session_marker (size_t *rlen);
|
|||||||
int check_permissions (const char *path,int extension,int checkonly);
|
int check_permissions (const char *path,int extension,int checkonly);
|
||||||
|
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
|
/* Windows declares sleep as obsolete, but provides a definition for
|
||||||
|
_sleep but non for the still existing sleep. */
|
||||||
|
#define sleep(a) _sleep ((a))
|
||||||
|
|
||||||
/*-- w32reg.c --*/
|
/*-- w32reg.c --*/
|
||||||
char *read_w32_registry_string( const char *root,
|
char *read_w32_registry_string( const char *root,
|
||||||
const char *dir, const char *name );
|
const char *dir, const char *name );
|
||||||
int write_w32_registry_string(const char *root, const char *dir,
|
int write_w32_registry_string(const char *root, const char *dir,
|
||||||
const char *name, const char *value);
|
const char *name, const char *value);
|
||||||
|
|
||||||
#endif /*HAVE_W32_SYSTEM*/
|
#endif /*HAVE_W32_SYSTEM*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /*GNUPG_COMMON_SYSUTILS_H*/
|
#endif /*GNUPG_COMMON_SYSUTILS_H*/
|
||||||
|
@ -150,6 +150,10 @@ char *strsep (char **stringp, const char *delim);
|
|||||||
#ifndef HAVE_TTYNAME
|
#ifndef HAVE_TTYNAME
|
||||||
char *ttyname (int fd);
|
char *ttyname (int fd);
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef HAVE_MKDTEMP
|
||||||
|
char *mkdtemp (char *template);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*-- some macros to replace ctype ones and avoid locale problems --*/
|
/*-- some macros to replace ctype ones and avoid locale problems --*/
|
||||||
#define spacep(p) (*(p) == ' ' || *(p) == '\t')
|
#define spacep(p) (*(p) == ' ' || *(p) == '\t')
|
||||||
|
16
configure.ac
16
configure.ac
@ -34,7 +34,7 @@ NEED_GPG_ERROR_VERSION=0.7
|
|||||||
NEED_LIBGCRYPT_API=1
|
NEED_LIBGCRYPT_API=1
|
||||||
NEED_LIBGCRYPT_VERSION=1.1.94
|
NEED_LIBGCRYPT_VERSION=1.1.94
|
||||||
|
|
||||||
NEED_LIBASSUAN_VERSION=0.6.6
|
NEED_LIBASSUAN_VERSION=0.6.9
|
||||||
|
|
||||||
NEED_KSBA_VERSION=0.9.7
|
NEED_KSBA_VERSION=0.9.7
|
||||||
|
|
||||||
@ -252,15 +252,19 @@ AH_BOTTOM([
|
|||||||
than one character because the code assumes strlen()==1 */
|
than one character because the code assumes strlen()==1 */
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
#ifdef HAVE_DOSISH_SYSTEM
|
||||||
#define DIRSEP_C '\\'
|
#define DIRSEP_C '\\'
|
||||||
#define EXTSEP_C '.'
|
|
||||||
#define DIRSEP_S "\\"
|
#define DIRSEP_S "\\"
|
||||||
|
#define EXTSEP_C '.'
|
||||||
#define EXTSEP_S "."
|
#define EXTSEP_S "."
|
||||||
|
#define PATHSEP_C ';'
|
||||||
|
#define PATHSEP_S ";"
|
||||||
#define EXEEXT_S ".exe"
|
#define EXEEXT_S ".exe"
|
||||||
#else
|
#else
|
||||||
#define DIRSEP_C '/'
|
#define DIRSEP_C '/'
|
||||||
#define EXTSEP_C '.'
|
|
||||||
#define DIRSEP_S "/"
|
#define DIRSEP_S "/"
|
||||||
|
#define EXTSEP_C '.'
|
||||||
#define EXTSEP_S "."
|
#define EXTSEP_S "."
|
||||||
|
#define PATHSEP_C ':'
|
||||||
|
#define PATHSEP_S ":"
|
||||||
#define EXEEXT_S ""
|
#define EXEEXT_S ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -278,9 +282,9 @@ AH_BOTTOM([
|
|||||||
comply with the GNU coding standards. */
|
comply with the GNU coding standards. */
|
||||||
#ifdef HAVE_DRIVE_LETTERS
|
#ifdef HAVE_DRIVE_LETTERS
|
||||||
#define GNUPG_BINDIR "c:\\gnupg"
|
#define GNUPG_BINDIR "c:\\gnupg"
|
||||||
#define GNUPG_LIBEXECDIR "c:\\lib\\gnupg"
|
#define GNUPG_LIBEXECDIR "c:\\gnupg"
|
||||||
#define GNUPG_LIBDIR "c:\\lib\\gnupg"
|
#define GNUPG_LIBDIR "c:\\gnupg"
|
||||||
#define GNUPG_DATADIR "c:\\lib\\gnupg"
|
#define GNUPG_DATADIR "c:\\gnupg"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Setup the hardwired names of modules. */
|
/* Setup the hardwired names of modules. */
|
||||||
|
@ -43,7 +43,7 @@ fi
|
|||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
@noindent
|
@noindent
|
||||||
You should aleways add the following lines to your @code{.bashrc} or
|
You should always add the following lines to your @code{.bashrc} or
|
||||||
whatever initialization file is used for all shell invocations:
|
whatever initialization file is used for all shell invocations:
|
||||||
|
|
||||||
@smallexample
|
@smallexample
|
||||||
@ -53,7 +53,8 @@ export GPG_TTY
|
|||||||
|
|
||||||
@noindent
|
@noindent
|
||||||
It is important that this environment variable always reflects the
|
It is important that this environment variable always reflects the
|
||||||
output of the @code{tty} command.
|
output of the @code{tty} command. For W32 systems this option is not
|
||||||
|
required.
|
||||||
|
|
||||||
Please make sure that a proper pinentry program has been installed
|
Please make sure that a proper pinentry program has been installed
|
||||||
under the default filename (which is system dependant) or use the
|
under the default filename (which is system dependant) or use the
|
||||||
@ -129,6 +130,15 @@ per-user configuration file. The default configuration file is named
|
|||||||
@file{gpg-agent.conf} and expected in the @file{.gnupg} directory directly
|
@file{gpg-agent.conf} and expected in the @file{.gnupg} directory directly
|
||||||
below the home directory of the user.
|
below the home directory of the user.
|
||||||
|
|
||||||
|
@item --homedir @var{dir}
|
||||||
|
@opindex homedir
|
||||||
|
Set the name of the home directory to @var{dir}. If his option is not
|
||||||
|
used, the home directory defaults to @file{~/.gnupg}. It is only
|
||||||
|
recognized when given on the command line. It also overrides any home
|
||||||
|
directory stated through the environment variable @var{GNUPGHOME} or
|
||||||
|
(on W32 systems) by means on the Registry entry
|
||||||
|
@var{HKCU\Software\GNU\GnuPG:HomeDir}.
|
||||||
|
|
||||||
@item -v
|
@item -v
|
||||||
@item --verbose
|
@item --verbose
|
||||||
@opindex v
|
@opindex v
|
||||||
@ -279,6 +289,21 @@ Use program @var{filename} as the Smartcard daemon. The default is
|
|||||||
installation dependend and can be shown with the @code{--version}
|
installation dependend and can be shown with the @code{--version}
|
||||||
command.
|
command.
|
||||||
|
|
||||||
|
@item --use-standard-socket
|
||||||
|
@itemx --no-use-standard-socket
|
||||||
|
@opindex use-standard-socket
|
||||||
|
@opindex no-use-standard-socket
|
||||||
|
By enabling this option @command{gpg-agent} will listen on the socket
|
||||||
|
named @file{S.gpg-agent}, located in the home directory, and not create
|
||||||
|
a random socket below a temporary directory. Tools connecting to
|
||||||
|
@command{gpg-agent} should first try to connect to the socket given in
|
||||||
|
environment variable @var{GPG_AGENT_INFO} and the fall back to this
|
||||||
|
socket. This option may not be used if the home directory is mounted as
|
||||||
|
a remote file system.
|
||||||
|
|
||||||
|
@noindent
|
||||||
|
Note, that as of now, W32 systems default to this option.
|
||||||
|
|
||||||
|
|
||||||
@item --display @var{string}
|
@item --display @var{string}
|
||||||
@itemx --ttyname @var{string}
|
@itemx --ttyname @var{string}
|
||||||
|
@ -236,6 +236,16 @@ per-user configuration file. The default configuration file is named
|
|||||||
@file{gpgsm.conf} and expected in the @file{.gnupg} directory directly
|
@file{gpgsm.conf} and expected in the @file{.gnupg} directory directly
|
||||||
below the home directory of the user.
|
below the home directory of the user.
|
||||||
|
|
||||||
|
@item --homedir @var{dir}
|
||||||
|
@opindex homedir
|
||||||
|
Set the name of the home directory to @var{dir}. If his option is not
|
||||||
|
used, the home directory defaults to @file{~/.gnupg}. It is only
|
||||||
|
recognized when given on the command line. It also overrides any home
|
||||||
|
directory stated through the environment variable @var{GNUPGHOME} or
|
||||||
|
(on W32 systems) by means on the Registry entry
|
||||||
|
@var{HKCU\Software\GNU\GnuPG:HomeDir}.
|
||||||
|
|
||||||
|
|
||||||
@item -v
|
@item -v
|
||||||
@item --verbose
|
@item --verbose
|
||||||
@opindex v
|
@opindex v
|
||||||
|
@ -81,6 +81,15 @@ per-user configuration file. The default configuration file is named
|
|||||||
@file{scdaemon.conf} and expected in the @file{.gnupg} directory directly
|
@file{scdaemon.conf} and expected in the @file{.gnupg} directory directly
|
||||||
below the home directory of the user.
|
below the home directory of the user.
|
||||||
|
|
||||||
|
@item --homedir @var{dir}
|
||||||
|
@opindex homedir
|
||||||
|
Set the name of the home directory to @var{dir}. If his option is not
|
||||||
|
used, the home directory defaults to @file{~/.gnupg}. It is only
|
||||||
|
recognized when given on the command line. It also overrides any home
|
||||||
|
directory stated through the environment variable @var{GNUPGHOME} or
|
||||||
|
(on W32 systems) by means on the Registry entry
|
||||||
|
@var{HKCU\Software\GNU\GnuPG:HomeDir}.
|
||||||
|
|
||||||
@item -v
|
@item -v
|
||||||
@item --verbose
|
@item --verbose
|
||||||
@opindex v
|
@opindex v
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2004-12-20 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* call-agent.c (start_agent): Before starting a pipe server start
|
||||||
|
to connect to a server on the standard socket. Use PATHSEP
|
||||||
|
* call-dirmngr.c (start_dirmngr): Use PATHSEP.
|
||||||
|
|
||||||
|
* import.c: Include unistd.h for dup and close.
|
||||||
|
|
||||||
2004-12-18 Werner Koch <wk@g10code.com>
|
2004-12-18 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* gpgsm.h (map_assuan_err): Define in terms of
|
* gpgsm.h (map_assuan_err): Define in terms of
|
||||||
|
@ -81,41 +81,53 @@ start_agent (ctrl_t ctrl)
|
|||||||
{
|
{
|
||||||
const char *pgmname;
|
const char *pgmname;
|
||||||
const char *argv[3];
|
const char *argv[3];
|
||||||
|
char *sockname;
|
||||||
int no_close_list[3];
|
int no_close_list[3];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (opt.verbose)
|
/* First check whether we can connect at the standard
|
||||||
log_info (_("no running gpg-agent - starting one\n"));
|
socket. */
|
||||||
|
sockname = make_filename (opt.homedir, "S.gpg-agent", NULL);
|
||||||
gpgsm_status (ctrl, STATUS_PROGRESS, "starting_agent ? 0 0");
|
rc = assuan_socket_connect (&ctx, sockname, 0);
|
||||||
|
xfree (sockname);
|
||||||
|
|
||||||
if (fflush (NULL))
|
if (rc)
|
||||||
{
|
{
|
||||||
gpg_error_t tmperr = gpg_error (gpg_err_code_from_errno (errno));
|
/* With no success start a new server. */
|
||||||
log_error ("error flushing pending output: %s\n", strerror (errno));
|
if (opt.verbose)
|
||||||
return tmperr;
|
log_info (_("no running gpg-agent - starting one\n"));
|
||||||
|
|
||||||
|
gpgsm_status (ctrl, STATUS_PROGRESS, "starting_agent ? 0 0");
|
||||||
|
|
||||||
|
if (fflush (NULL))
|
||||||
|
{
|
||||||
|
gpg_error_t tmperr = gpg_error (gpg_err_code_from_errno (errno));
|
||||||
|
log_error ("error flushing pending output: %s\n",
|
||||||
|
strerror (errno));
|
||||||
|
return tmperr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!opt.agent_program || !*opt.agent_program)
|
||||||
|
opt.agent_program = GNUPG_DEFAULT_AGENT;
|
||||||
|
if ( !(pgmname = strrchr (opt.agent_program, '/')))
|
||||||
|
pgmname = opt.agent_program;
|
||||||
|
else
|
||||||
|
pgmname++;
|
||||||
|
|
||||||
|
argv[0] = pgmname;
|
||||||
|
argv[1] = "--server";
|
||||||
|
argv[2] = NULL;
|
||||||
|
|
||||||
|
i=0;
|
||||||
|
if (log_get_fd () != -1)
|
||||||
|
no_close_list[i++] = log_get_fd ();
|
||||||
|
no_close_list[i++] = fileno (stderr);
|
||||||
|
no_close_list[i] = -1;
|
||||||
|
|
||||||
|
/* Connect to the agent and perform initial handshaking. */
|
||||||
|
rc = assuan_pipe_connect (&ctx, opt.agent_program, (char**)argv,
|
||||||
|
no_close_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!opt.agent_program || !*opt.agent_program)
|
|
||||||
opt.agent_program = GNUPG_DEFAULT_AGENT;
|
|
||||||
if ( !(pgmname = strrchr (opt.agent_program, '/')))
|
|
||||||
pgmname = opt.agent_program;
|
|
||||||
else
|
|
||||||
pgmname++;
|
|
||||||
|
|
||||||
argv[0] = pgmname;
|
|
||||||
argv[1] = "--server";
|
|
||||||
argv[2] = NULL;
|
|
||||||
|
|
||||||
i=0;
|
|
||||||
if (log_get_fd () != -1)
|
|
||||||
no_close_list[i++] = log_get_fd ();
|
|
||||||
no_close_list[i++] = fileno (stderr);
|
|
||||||
no_close_list[i] = -1;
|
|
||||||
|
|
||||||
/* Connect to the agent and perform initial handshaking. */
|
|
||||||
rc = assuan_pipe_connect (&ctx, opt.agent_program, (char**)argv,
|
|
||||||
no_close_list);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -123,7 +135,7 @@ start_agent (ctrl_t ctrl)
|
|||||||
int pid;
|
int pid;
|
||||||
|
|
||||||
infostr = xstrdup (infostr);
|
infostr = xstrdup (infostr);
|
||||||
if ( !(p = strchr (infostr, ':')) || p == infostr)
|
if ( !(p = strchr (infostr, PATHSEP_C)) || p == infostr)
|
||||||
{
|
{
|
||||||
log_error (_("malformed GPG_AGENT_INFO environment variable\n"));
|
log_error (_("malformed GPG_AGENT_INFO environment variable\n"));
|
||||||
xfree (infostr);
|
xfree (infostr);
|
||||||
|
@ -209,7 +209,7 @@ start_dirmngr (void)
|
|||||||
infostr = xstrdup (infostr);
|
infostr = xstrdup (infostr);
|
||||||
if (!try_default && *infostr)
|
if (!try_default && *infostr)
|
||||||
{
|
{
|
||||||
if ( !(p = strchr (infostr, ':')) || p == infostr)
|
if ( !(p = strchr (infostr, PATHSEP_C)) || p == infostr)
|
||||||
{
|
{
|
||||||
log_error (_("malformed DIRMNGR_INFO environment variable\n"));
|
log_error (_("malformed DIRMNGR_INFO environment variable\n"));
|
||||||
xfree (infostr);
|
xfree (infostr);
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "gpgsm.h"
|
#include "gpgsm.h"
|
||||||
#include <gcrypt.h>
|
#include <gcrypt.h>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user