1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-11-09 21:28:51 +01:00

agent: Adjust supervised mode for the new default socket names.

* agent/gpg-agent.c (main): In supervised mode do not provide default
socket names.  Unset DISPLAY and INSIDE_EMACS.  Use log_error and
agent_exit.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2016-10-04 11:23:18 +02:00
parent 9f92b62a51
commit dc059af1ff
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -1244,10 +1244,10 @@ main (int argc, char **argv )
agent_exit (0); agent_exit (0);
} }
if (! opt.extra_socket) if (is_supervised)
{ ;
opt.extra_socket = 1; else if (!opt.extra_socket)
} opt.extra_socket = 1;
else if (socket_name_extra else if (socket_name_extra
&& (!strcmp (socket_name_extra, "none") && (!strcmp (socket_name_extra, "none")
|| !strcmp (socket_name_extra, "/dev/null"))) || !strcmp (socket_name_extra, "/dev/null")))
@ -1257,10 +1257,10 @@ main (int argc, char **argv )
socket_name_extra = NULL; socket_name_extra = NULL;
} }
if (! opt.browser_socket) if (is_supervised)
{ ;
opt.browser_socket = 1; else if (!opt.browser_socket)
} opt.browser_socket = 1;
else if (socket_name_browser else if (socket_name_browser
&& (!strcmp (socket_name_browser, "none") && (!strcmp (socket_name_browser, "none")
|| !strcmp (socket_name_browser, "/dev/null"))) || !strcmp (socket_name_browser, "/dev/null")))
@ -1429,11 +1429,19 @@ main (int argc, char **argv )
log_info ("%s %s starting in supervised mode.\n", log_info ("%s %s starting in supervised mode.\n",
strusage(11), strusage(13) ); strusage(11), strusage(13) );
/* See below on why we remove certain envvars. */
#ifndef HAVE_W32_SYSTEM
if (!opt.keep_display)
gnupg_unsetenv ("DISPLAY");
#endif
gnupg_unsetenv ("INSIDE_EMACS");
/* Virtually create the sockets. */
map_supervised_sockets (&fd, &fd_extra, &fd_browser, &fd_ssh); map_supervised_sockets (&fd, &fd_extra, &fd_browser, &fd_ssh);
if (fd == GNUPG_INVALID_FD) if (fd == GNUPG_INVALID_FD)
{ {
log_fatal ("no standard socket provided\n"); log_error ("no standard socket provided\n");
exit (1); agent_exit (1);
} }
/* record socket names where possible: */ /* record socket names where possible: */
socket_name = get_socket_path (fd); socket_name = get_socket_path (fd);
@ -1456,8 +1464,8 @@ main (int argc, char **argv )
log_info ("no saved signal mask\n"); log_info ("no saved signal mask\n");
#endif /*HAVE_SIGPROCMASK*/ #endif /*HAVE_SIGPROCMASK*/
log_debug ("FDs: std: %d extra: %d browser: %d ssh: %d\n", log_info ("listening on: std=%d extra=%d browser=%d ssh=%d\n",
fd, fd_extra, fd_browser, fd_ssh); fd, fd_extra, fd_browser, fd_ssh);
handle_connections (fd, fd_extra, fd_browser, fd_ssh); handle_connections (fd, fd_extra, fd_browser, fd_ssh);
assuan_sock_close (fd); assuan_sock_close (fd);
} }