summaryrefslogtreecommitdiffstats
path: root/dirmngr
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2014-03-12 19:33:30 +0100
committerWerner Koch <wk@gnupg.org>2014-03-14 12:36:36 +0100
commit5d321eb00be0774418de1a05678ac0ec44d7193b (patch)
tree6a794d25d31daba2681fec6bb421e1f615e0b88b /dirmngr
parentgpg: Add option --dirmngr-program. (diff)
downloadgnupg2-5d321eb00be0774418de1a05678ac0ec44d7193b.tar.xz
gnupg2-5d321eb00be0774418de1a05678ac0ec44d7193b.zip
dirmngr: Default to a user socket name and enable autostart.
* common/homedir.c (dirmngr_socket_name): Rename to dirmngr_sys_socket_name. (dirmngr_user_socket_name): New. * common/asshelp.c (start_new_dirmngr): Handle sys and user dirmngr socket. * dirmngr/dirmngr.c (main): Ditto. * dirmngr/server.c (cmd_getinfo): Ditto. * sm/server.c (gpgsm_server): Ditto. * dirmngr/dirmngr-client.c (start_dirmngr): Likewise. * tools/gpgconf.c (main): Print "dirmngr-sys-socket" with --list-dirs. * configure.ac (USE_DIRMNGR_AUTO_START): Set by default.
Diffstat (limited to 'dirmngr')
-rw-r--r--dirmngr/dirmngr-client.c5
-rw-r--r--dirmngr/dirmngr.c6
-rw-r--r--dirmngr/server.c5
3 files changed, 13 insertions, 3 deletions
diff --git a/dirmngr/dirmngr-client.c b/dirmngr/dirmngr-client.c
index da9744359..0e627642d 100644
--- a/dirmngr/dirmngr-client.c
+++ b/dirmngr/dirmngr-client.c
@@ -443,7 +443,10 @@ start_dirmngr (int only_daemon)
infostr = opt.force_pipe_server? NULL : getenv (DIRMNGR_INFO_NAME);
if (only_daemon && (!infostr || !*infostr))
{
- infostr = xstrdup (dirmngr_socket_name ());
+ if (dirmngr_user_socket_name ())
+ infostr = xstrdup (dirmngr_user_socket_name ());
+ else
+ infostr = xstrdup (dirmngr_sys_socket_name ());
try_default = 1;
}
diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c
index 7bcff7a6a..e3f98c04e 100644
--- a/dirmngr/dirmngr.c
+++ b/dirmngr/dirmngr.c
@@ -666,7 +666,6 @@ main (int argc, char **argv)
opt.ldaptimeout = DEFAULT_LDAP_TIMEOUT;
/* Other defaults. */
- socket_name = dirmngr_socket_name ();
/* Check whether we have a config file given on the commandline */
orig_argc = argc;
@@ -721,7 +720,12 @@ main (int argc, char **argv)
#endif
opt.homedir_data = gnupg_datadir ();
opt.homedir_cache = gnupg_cachedir ();
+ socket_name = dirmngr_sys_socket_name ();
}
+ else if (dirmngr_user_socket_name ())
+ socket_name = dirmngr_user_socket_name ();
+ else
+ socket_name = dirmngr_sys_socket_name ();
if (default_config)
configname = make_filename (opt.homedir, DIRMNGR_NAME".conf", NULL );
diff --git a/dirmngr/server.c b/dirmngr/server.c
index a1d20334b..f1319ad28 100644
--- a/dirmngr/server.c
+++ b/dirmngr/server.c
@@ -1781,7 +1781,10 @@ cmd_getinfo (assuan_context_t ctx, char *line)
}
else if (!strcmp (line, "socket_name"))
{
- const char *s = dirmngr_socket_name ();
+ const char *s = dirmngr_user_socket_name ();
+
+ if (!s)
+ s = dirmngr_sys_socket_name ();
if (s)
err = assuan_send_data (ctx, s, strlen (s));