GNUPG-1-9-BRANCH gnupg (18 files)
cvs user wk
cvs at cvs.gnupg.org
Mon Dec 20 17:12:32 CET 2004
Date: Monday, December 20, 2004 @ 17:17:25
Author: wk
Path: /cvs/gnupg/gnupg
Tag: GNUPG-1-9-BRANCH
Modified: ChangeLog NEWS TODO agent/ChangeLog agent/gpg-agent.c
agent/protect-tool.c common/ChangeLog common/mkdtemp.c
common/sysutils.h common/util.h configure.ac doc/gpg-agent.texi
doc/gpgsm.texi doc/scdaemon.texi sm/ChangeLog sm/call-agent.c
sm/call-dirmngr.c sm/import.c
* 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.
----------------------+
ChangeLog | 5 +
NEWS | 6 +
TODO | 7 +
agent/ChangeLog | 6 +
agent/gpg-agent.c | 181 ++++++++++++++++++++++++++++++-------------------
agent/protect-tool.c | 14 ++-
common/ChangeLog | 3
common/mkdtemp.c | 3
common/sysutils.h | 8 ++
common/util.h | 4 +
configure.ac | 16 ++--
doc/gpg-agent.texi | 29 +++++++
doc/gpgsm.texi | 10 ++
doc/scdaemon.texi | 9 ++
sm/ChangeLog | 8 ++
sm/call-agent.c | 72 +++++++++++--------
sm/call-dirmngr.c | 2
sm/import.c | 1
18 files changed, 270 insertions(+), 114 deletions(-)
Index: gnupg/ChangeLog
diff -u gnupg/ChangeLog:1.131.2.62 gnupg/ChangeLog:1.131.2.63
--- gnupg/ChangeLog:1.131.2.62 Sat Dec 18 19:53:32 2004
+++ gnupg/ChangeLog Mon Dec 20 17:17:25 2004
@@ -1,3 +1,8 @@
+2004-12-20 Werner Koch <wk at 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 at g10code.com>
* configure.ac (AH_BOTTOM): Define EXEEXT_S.
Index: gnupg/NEWS
diff -u gnupg/NEWS:1.165.2.60 gnupg/NEWS:1.165.2.61
--- gnupg/NEWS:1.165.2.60 Mon Dec 6 14:49:14 2004
+++ gnupg/NEWS Mon Dec 20 17:17:25 2004
@@ -1,6 +1,12 @@
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)
-------------------------------------------------
Index: gnupg/TODO
diff -u gnupg/TODO:1.165.2.33 gnupg/TODO:1.165.2.34
--- gnupg/TODO:1.165.2.33 Tue Nov 23 18:09:51 2004
+++ gnupg/TODO Mon Dec 20 17:17:24 2004
@@ -95,3 +95,10 @@
This needs support in libksba/src/cert.c as well as in sm/*.c.
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
+
Index: gnupg/agent/ChangeLog
diff -u gnupg/agent/ChangeLog:1.59.2.51 gnupg/agent/ChangeLog:1.59.2.52
--- gnupg/agent/ChangeLog:1.59.2.51 Mon Dec 20 09:32:56 2004
+++ gnupg/agent/ChangeLog Mon Dec 20 17:17:24 2004
@@ -1,5 +1,11 @@
2004-12-20 Werner Koch <wk at 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
now use the identical implementation from ../common/membuf.c.
Index: gnupg/agent/gpg-agent.c
diff -u gnupg/agent/gpg-agent.c:1.31.2.27 gnupg/agent/gpg-agent.c:1.31.2.28
--- gnupg/agent/gpg-agent.c:1.31.2.27 Sun Dec 19 18:44:20 2004
+++ gnupg/agent/gpg-agent.c Mon Dec 20 17:17:24 2004
@@ -84,13 +84,14 @@
oDisablePth,
oDefCacheTTL,
oMaxCacheTTL,
+ oUseStandardSocket,
+ oNoUseStandardSocket,
oIgnoreCacheForSigning,
oAllowMarkTrusted,
oKeepTTY,
- oKeepDISPLAY,
-
-aTest };
+ oKeepDISPLAY
+};
@@ -115,6 +116,9 @@
{ oNoGrab, "no-grab" ,0, N_("do not grab keyboard and mouse")},
{ oLogFile, "log-file" ,2, N_("use a log file for the server")},
{ 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 ,
N_("|PGM|use PGM as the PIN-Entry program") },
@@ -154,7 +158,7 @@
static int maybe_setuid = 1;
/* Name of the communication socket */
-static char socket_name[128];
+static char *socket_name;
/* Default values for options passed to the pinentry. */
static char *default_display;
@@ -177,12 +181,11 @@
static void create_directories (void);
#ifdef USE_GNU_PTH
static void handle_connections (int listen_fd);
-
/* Pth wrapper function definitions. */
GCRY_THREAD_OPTION_PTH_IMPL;
-
#endif /*USE_GNU_PTH*/
-static void check_for_running_agent (void);
+
+static int check_for_running_agent (int);
@@ -293,7 +296,7 @@
static void
cleanup (void)
{
- if (*socket_name)
+ if (socket_name && *socket_name)
{
char *p;
@@ -419,6 +422,7 @@
int debug_wait = 0;
int disable_pth = 0;
int gpgconf_list = 0;
+ int standard_socket = 0;
gpg_error_t err;
@@ -437,17 +441,12 @@
/* Libgcrypt requires us to register the threading model first.
Note that this will also do the pth_init. */
#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);
if (err)
{
log_fatal ("can't register GNU Pth with Libgcrypt: %s\n",
gpg_strerror (err));
}
-#endif
#endif /*USE_GNU_PTH*/
@@ -468,18 +467,28 @@
may_coredump = disable_core_dumps ();
+ /* Set default options. */
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");
if (shell && strlen (shell) >= 3 && !strcmp (shell+strlen (shell)-3, "csh") )
csh_style = 1;
-
+
+
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)
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_argv = argv;
pargs.argc = &argc;
@@ -509,7 +518,6 @@
Now we are now working under our real uid
*/
-
if (default_config)
configname = make_filename (opt.homedir, "gpg-agent.conf", NULL );
@@ -584,6 +592,9 @@
case oLCmessages: default_lc_messages = xstrdup (pargs.r.ret_str);
break;
+ case oUseStandardSocket: standard_socket = 1; break;
+ case oNoUseStandardSocket: standard_socket = 0; break;
+
case oKeepTTY: opt.keep_tty = 1; break;
case oKeepDISPLAY: opt.keep_display = 1; break;
@@ -695,7 +706,7 @@
if (!pipe_server && !is_daemon)
{
log_set_prefix (NULL, JNLIB_LOG_WITH_PREFIX);
- check_for_running_agent ();
+ check_for_running_agent (0);
agent_exit (0);
}
@@ -736,6 +747,7 @@
else
{ /* Regular server mode */
int fd;
+ int rc;
pid_t pid;
int len;
struct sockaddr_un serv_addr;
@@ -750,28 +762,28 @@
unsetenv ("DISPLAY");
#endif
- *socket_name = 0;
- snprintf (socket_name, DIM(socket_name)-1,
- "/tmp/gpg-XXXXXX/S.gpg-agent");
- socket_name[DIM(socket_name)-1] = 0;
- p = strrchr (socket_name, '/');
- if (!p)
- BUG ();
- *p = 0;;
-
-#ifndef HAVE_W32_SYSTEM
- if (!mkdtemp(socket_name))
+ /* Create the socket name . */
+ if (standard_socket)
+ socket_name = make_filename (opt.homedir, "S.gpg-agent", NULL);
+ else
{
- log_error ("can't create directory `%s': %s\n",
- socket_name, strerror(errno) );
- exit (1);
+ socket_name = xstrdup ("/tmp/gpg-XXXXXX/S.gpg-agent");
+ p = strrchr (socket_name, '/');
+ 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);
}
if (strlen (socket_name)+1 >= sizeof serv_addr.sun_path )
@@ -797,13 +809,22 @@
len = (offsetof (struct sockaddr_un, sun_path)
+ strlen(serv_addr.sun_path) + 1);
- if (
#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
- 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
- (fd, (struct sockaddr*)&serv_addr, len) == -1)
+ if (rc == -1)
{
log_error ("error binding socket to `%s': %s\n",
serv_addr.sun_path, strerror (errno) );
@@ -823,7 +844,10 @@
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 ();
if (pid == (pid_t)-1)
{
@@ -1286,53 +1310,72 @@
/* Figure out whether an agent is available and running. Prints an
- error if not. */
-static void
-check_for_running_agent ()
+ error if not. Usually started with MODE 0. */
+static int
+check_for_running_agent (int mode)
{
int rc;
char *infostr, *p;
assuan_context_t ctx;
int prot, pid;
- infostr = getenv ("GPG_AGENT_INFO");
- if (!infostr || !*infostr)
+ if (!mode)
{
- log_error (_("no gpg-agent running in this session\n"));
- return;
- }
+ infostr = getenv ("GPG_AGENT_INFO");
+ 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;
+ }
- infostr = xstrdup (infostr);
- if ( !(p = strchr (infostr, ':')) || p == infostr)
+ *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 */
{
- log_error (_("malformed GPG_AGENT_INFO environment variable\n"));
- xfree (infostr);
- return;
+ infostr = make_filename (opt.homedir, "S.gpg-agent", NULL);
}
- *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);
xfree (infostr);
if (rc)
{
- log_error ("can't connect to the agent: %s\n", assuan_strerror (rc));
- return;
+ if (!mode && !check_for_running_agent (1))
+ 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)
log_info ("gpg-agent running and available\n");
assuan_disconnect (ctx);
+ return 0;
}
Index: gnupg/agent/protect-tool.c
diff -u gnupg/agent/protect-tool.c:1.15.2.11 gnupg/agent/protect-tool.c:1.15.2.12
--- gnupg/agent/protect-tool.c:1.15.2.11 Wed Dec 15 15:15:09 2004
+++ gnupg/agent/protect-tool.c Mon Dec 20 17:17:24 2004
@@ -44,6 +44,8 @@
#include "minip12.h"
#include "simple-pwquery.h"
#include "i18n.h"
+#include "sysutils.h"
+
enum cmd_and_opt_values
{ aNull = 0,
@@ -1065,12 +1067,12 @@
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");
-#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)
opt_homedir = GNUPG_DEFAULT_HOMEDIR;
@@ -1162,7 +1164,9 @@
char *pw;
int err;
const char *desc;
+#ifdef HAVE_LANGINFO_CODESET
char *orig_codeset = NULL;
+#endif
int error_msgno;
Index: gnupg/common/ChangeLog
diff -u gnupg/common/ChangeLog:1.30.2.37 gnupg/common/ChangeLog:1.30.2.38
--- gnupg/common/ChangeLog:1.30.2.37 Mon Dec 20 09:32:55 2004
+++ gnupg/common/ChangeLog Mon Dec 20 17:17:24 2004
@@ -1,5 +1,8 @@
2004-12-20 Werner Koch <wk at g10code.com>
+ * sysutils.h [W32]: Define sleep.
+ * util.h: Add prototype for mkdtemp.
+
* membuf.c (put_membuf): Wipe out buffer after a failed realloc.
2004-12-19 Werner Koch <wk at g10code.com>
Index: gnupg/common/mkdtemp.c
diff -u gnupg/common/mkdtemp.c:1.2.2.1 gnupg/common/mkdtemp.c:1.2.2.2
--- gnupg/common/mkdtemp.c:1.2.2.1 Mon Nov 17 13:20:11 2003
+++ gnupg/common/mkdtemp.c Mon Dec 20 17:17:24 2004
@@ -35,7 +35,8 @@
# define mkdir(a,b) mkdir(a)
#endif
-char *mkdtemp(char *template)
+char *
+mkdtemp (char *template)
{
int attempts,idx,count=0;
unsigned char *ch;
Index: gnupg/common/sysutils.h
diff -u gnupg/common/sysutils.h:1.1.2.2 gnupg/common/sysutils.h:1.1.2.3
--- gnupg/common/sysutils.h:1.1.2.2 Wed Dec 15 15:15:09 2004
+++ gnupg/common/sysutils.h Mon Dec 20 17:17:24 2004
@@ -28,11 +28,19 @@
int check_permissions (const char *path,int extension,int checkonly);
#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 --*/
char *read_w32_registry_string( const char *root,
const char *dir, const char *name );
int write_w32_registry_string(const char *root, const char *dir,
const char *name, const char *value);
+
#endif /*HAVE_W32_SYSTEM*/
+
+
+
#endif /*GNUPG_COMMON_SYSUTILS_H*/
Index: gnupg/common/util.h
diff -u gnupg/common/util.h:1.12.2.12 gnupg/common/util.h:1.12.2.13
--- gnupg/common/util.h:1.12.2.12 Sat Dec 18 11:22:10 2004
+++ gnupg/common/util.h Mon Dec 20 17:17:24 2004
@@ -150,6 +150,10 @@
#ifndef HAVE_TTYNAME
char *ttyname (int fd);
#endif
+#ifndef HAVE_MKDTEMP
+char *mkdtemp (char *template);
+#endif
+
/*-- some macros to replace ctype ones and avoid locale problems --*/
#define spacep(p) (*(p) == ' ' || *(p) == '\t')
Index: gnupg/configure.ac
diff -u gnupg/configure.ac:1.36.2.74 gnupg/configure.ac:1.36.2.75
--- gnupg/configure.ac:1.36.2.74 Sat Dec 18 19:53:32 2004
+++ gnupg/configure.ac Mon Dec 20 17:17:24 2004
@@ -34,7 +34,7 @@
NEED_LIBGCRYPT_API=1
NEED_LIBGCRYPT_VERSION=1.1.94
-NEED_LIBASSUAN_VERSION=0.6.6
+NEED_LIBASSUAN_VERSION=0.6.9
NEED_KSBA_VERSION=0.9.7
@@ -252,15 +252,19 @@
than one character because the code assumes strlen()==1 */
#ifdef HAVE_DOSISH_SYSTEM
#define DIRSEP_C '\\'
-#define EXTSEP_C '.'
#define DIRSEP_S "\\"
+#define EXTSEP_C '.'
#define EXTSEP_S "."
+#define PATHSEP_C ';'
+#define PATHSEP_S ";"
#define EXEEXT_S ".exe"
#else
#define DIRSEP_C '/'
-#define EXTSEP_C '.'
#define DIRSEP_S "/"
+#define EXTSEP_C '.'
#define EXTSEP_S "."
+#define PATHSEP_C ':'
+#define PATHSEP_S ":"
#define EXEEXT_S ""
#endif
@@ -278,9 +282,9 @@
comply with the GNU coding standards. */
#ifdef HAVE_DRIVE_LETTERS
#define GNUPG_BINDIR "c:\\gnupg"
-#define GNUPG_LIBEXECDIR "c:\\lib\\gnupg"
-#define GNUPG_LIBDIR "c:\\lib\\gnupg"
-#define GNUPG_DATADIR "c:\\lib\\gnupg"
+#define GNUPG_LIBEXECDIR "c:\\gnupg"
+#define GNUPG_LIBDIR "c:\\gnupg"
+#define GNUPG_DATADIR "c:\\gnupg"
#endif
/* Setup the hardwired names of modules. */
Index: gnupg/doc/gpg-agent.texi
diff -u gnupg/doc/gpg-agent.texi:1.1.2.12 gnupg/doc/gpg-agent.texi:1.1.2.13
--- gnupg/doc/gpg-agent.texi:1.1.2.12 Tue Nov 23 18:09:51 2004
+++ gnupg/doc/gpg-agent.texi Mon Dec 20 17:17:24 2004
@@ -43,7 +43,7 @@
@end smallexample
@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:
@smallexample
@@ -53,7 +53,8 @@
@noindent
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
under the default filename (which is system dependant) or use the
@@ -129,6 +130,15 @@
@file{gpg-agent.conf} and expected in the @file{.gnupg} directory directly
below the home directory of the user.
+ at item --homedir @var{dir}
+ at 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
+ at var{HKCU\Software\GNU\GnuPG:HomeDir}.
+
@item -v
@item --verbose
@opindex v
@@ -279,6 +289,21 @@
installation dependend and can be shown with the @code{--version}
command.
+ at item --use-standard-socket
+ at itemx --no-use-standard-socket
+ at opindex use-standard-socket
+ at 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
+ at 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.
+
+ at noindent
+Note, that as of now, W32 systems default to this option.
+
@item --display @var{string}
@itemx --ttyname @var{string}
Index: gnupg/doc/gpgsm.texi
diff -u gnupg/doc/gpgsm.texi:1.1.2.18 gnupg/doc/gpgsm.texi:1.1.2.19
--- gnupg/doc/gpgsm.texi:1.1.2.18 Tue Nov 23 18:09:51 2004
+++ gnupg/doc/gpgsm.texi Mon Dec 20 17:17:24 2004
@@ -236,6 +236,16 @@
@file{gpgsm.conf} and expected in the @file{.gnupg} directory directly
below the home directory of the user.
+ at item --homedir @var{dir}
+ at 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
+ at var{HKCU\Software\GNU\GnuPG:HomeDir}.
+
+
@item -v
@item --verbose
@opindex v
Index: gnupg/doc/scdaemon.texi
diff -u gnupg/doc/scdaemon.texi:1.1.2.10 gnupg/doc/scdaemon.texi:1.1.2.11
--- gnupg/doc/scdaemon.texi:1.1.2.10 Wed Oct 20 10:54:45 2004
+++ gnupg/doc/scdaemon.texi Mon Dec 20 17:17:24 2004
@@ -81,6 +81,15 @@
@file{scdaemon.conf} and expected in the @file{.gnupg} directory directly
below the home directory of the user.
+ at item --homedir @var{dir}
+ at 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
+ at var{HKCU\Software\GNU\GnuPG:HomeDir}.
+
@item -v
@item --verbose
@opindex v
Index: gnupg/sm/ChangeLog
diff -u gnupg/sm/ChangeLog:1.101.2.83 gnupg/sm/ChangeLog:1.101.2.84
--- gnupg/sm/ChangeLog:1.101.2.83 Sat Dec 18 11:22:09 2004
+++ gnupg/sm/ChangeLog Mon Dec 20 17:17:24 2004
@@ -1,3 +1,11 @@
+2004-12-20 Werner Koch <wk at 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 at g10code.com>
* gpgsm.h (map_assuan_err): Define in terms of
Index: gnupg/sm/call-agent.c
diff -u gnupg/sm/call-agent.c:1.35.2.9 gnupg/sm/call-agent.c:1.35.2.10
--- gnupg/sm/call-agent.c:1.35.2.9 Sat Dec 18 11:22:09 2004
+++ gnupg/sm/call-agent.c Mon Dec 20 17:17:24 2004
@@ -81,41 +81,53 @@
{
const char *pgmname;
const char *argv[3];
+ char *sockname;
int no_close_list[3];
int i;
- if (opt.verbose)
- log_info (_("no running gpg-agent - starting one\n"));
-
- gpgsm_status (ctrl, STATUS_PROGRESS, "starting_agent ? 0 0");
+ /* First check whether we can connect at the standard
+ socket. */
+ sockname = make_filename (opt.homedir, "S.gpg-agent", NULL);
+ 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));
- log_error ("error flushing pending output: %s\n", strerror (errno));
- return tmperr;
+ /* With no success start a new server. */
+ if (opt.verbose)
+ 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
{
@@ -123,7 +135,7 @@
int pid;
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"));
xfree (infostr);
Index: gnupg/sm/call-dirmngr.c
diff -u gnupg/sm/call-dirmngr.c:1.16.2.11 gnupg/sm/call-dirmngr.c:1.16.2.12
--- gnupg/sm/call-dirmngr.c:1.16.2.11 Fri Dec 17 15:36:16 2004
+++ gnupg/sm/call-dirmngr.c Mon Dec 20 17:17:24 2004
@@ -209,7 +209,7 @@
infostr = xstrdup (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"));
xfree (infostr);
Index: gnupg/sm/import.c
diff -u gnupg/sm/import.c:1.22.2.15 gnupg/sm/import.c:1.22.2.16
--- gnupg/sm/import.c:1.22.2.15 Mon Dec 6 19:28:56 2004
+++ gnupg/sm/import.c Mon Dec 20 17:17:24 2004
@@ -25,6 +25,7 @@
#include <errno.h>
#include <time.h>
#include <assert.h>
+#include <unistd.h>
#include "gpgsm.h"
#include <gcrypt.h>
More information about the Gnupg-commits
mailing list