[PATCH 1/3] dirmngr: report actual socket name.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Wed Oct 26 22:37:06 CEST 2016
* 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 at fifthhorseman.net>
---
dirmngr/dirmngr.c | 8 ++++++++
dirmngr/dirmngr.h | 1 +
dirmngr/server.c | 2 +-
3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c
index 41e897b..f7f0d37 100644
--- a/dirmngr/dirmngr.c
+++ b/dirmngr/dirmngr.c
@@ -2074,3 +2074,11 @@ 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 ()
+{
+ if (socket_name)
+ return socket_name;
+ else
+ return dirmngr_socket_name ();
+}
diff --git a/dirmngr/dirmngr.h b/dirmngr/dirmngr.h
index d823519..2a6ae3c 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 ();
/*-- Various housekeeping functions. --*/
diff --git a/dirmngr/server.c b/dirmngr/server.c
index 0ad2713..1e2196c 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"))
--
2.9.3
More information about the Gnupg-devel
mailing list