summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2016-10-26 22:37:06 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2016-10-27 03:30:55 +0200
commit6bb6ac56cca8135666387a0b9d88dd6b50311418 (patch)
treee7d09e7e38142eec58aa14ed1d9020fd122d56aa
parentcommon: Fix gnupg_inotify_has_name. (diff)
downloadgnupg2-6bb6ac56cca8135666387a0b9d88dd6b50311418.tar.xz
gnupg2-6bb6ac56cca8135666387a0b9d88dd6b50311418.zip
dirmngr: report actual socket name.
* dirmngr/dirmngr.[ch] (dirmngr_get_current_socket_name): new function to report known socket name. * dirmngr/server.c (cmd_getinfo): use dirmngr_get_current_socket_name to report correct socket name. -- This fixes the output of 'getinfo socket_name' when dirmngr is invoked with --socket-name. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
-rw-r--r--dirmngr/dirmngr.c9
-rw-r--r--dirmngr/dirmngr.h1
-rw-r--r--dirmngr/server.c2
3 files changed, 11 insertions, 1 deletions
diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c
index 41e897b4f..c9e4a058b 100644
--- a/dirmngr/dirmngr.c
+++ b/dirmngr/dirmngr.c
@@ -2074,3 +2074,12 @@ handle_connections (assuan_fd_t listen_fd)
cleanup ();
log_info ("%s %s stopped\n", strusage(11), strusage(13));
}
+
+const char*
+dirmngr_get_current_socket_name (void)
+{
+ if (socket_name)
+ return socket_name;
+ else
+ return dirmngr_socket_name ();
+}
diff --git a/dirmngr/dirmngr.h b/dirmngr/dirmngr.h
index d8235199b..9e216cdb8 100644
--- a/dirmngr/dirmngr.h
+++ b/dirmngr/dirmngr.h
@@ -184,6 +184,7 @@ void dirmngr_exit( int ); /* Wrapper for exit() */
void dirmngr_init_default_ctrl (ctrl_t ctrl);
void dirmngr_deinit_default_ctrl (ctrl_t ctrl);
void dirmngr_sighup_action (void);
+const char* dirmngr_get_current_socket_name (void);
/*-- Various housekeeping functions. --*/
diff --git a/dirmngr/server.c b/dirmngr/server.c
index 57273c785..2d4f292f5 100644
--- a/dirmngr/server.c
+++ b/dirmngr/server.c
@@ -2271,7 +2271,7 @@ cmd_getinfo (assuan_context_t ctx, char *line)
}
else if (!strcmp (line, "socket_name"))
{
- const char *s = dirmngr_socket_name ();
+ const char *s = dirmngr_get_current_socket_name ();
err = assuan_send_data (ctx, s, strlen (s));
}
else if (!strcmp (line, "tor"))