1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

Allow to run the test without a running agent.

Add new gpg-agent commands.
This commit is contained in:
Werner Koch 2010-05-11 17:52:00 +00:00
parent bf761927c9
commit ce9be10163
11 changed files with 102 additions and 38 deletions

View file

@ -217,9 +217,6 @@ static int shutdown_pending;
/* Counter for the currently running own socket checks. */
static int check_own_socket_running;
/* True if we are listening on the standard socket. */
static int use_standard_socket;
/* It is possible that we are currently running under setuid permissions */
static int maybe_setuid = 1;
@ -631,8 +628,8 @@ main (int argc, char **argv )
/* Set default options. */
parse_rereadable_options (NULL, 0); /* Reset them to default values. */
#ifdef USE_STANDARD_SOCKET
use_standard_socket = 1; /* Under Windows we always use a standard
socket. */
opt.use_standard_socket = 1; /* Under Windows we always use a standard
socket. */
#endif
shell = getenv ("SHELL");
@ -783,8 +780,8 @@ main (int argc, char **argv )
case oXauthority: default_xauthority = xstrdup (pargs.r.ret_str);
break;
case oUseStandardSocket: use_standard_socket = 1; break;
case oNoUseStandardSocket: use_standard_socket = 0; break;
case oUseStandardSocket: opt.use_standard_socket = 1; break;
case oNoUseStandardSocket: opt.use_standard_socket = 0; break;
case oFakedSystemTime:
{
@ -862,7 +859,7 @@ main (int argc, char **argv )
}
if (gpgconf_list == 3)
agent_exit (!use_standard_socket);
agent_exit (!opt.use_standard_socket);
if (gpgconf_list == 2)
agent_exit (0);
if (gpgconf_list)
@ -1437,7 +1434,7 @@ create_socket_name (char *standard_name, char *template)
{
char *name, *p;
if (use_standard_socket)
if (opt.use_standard_socket)
name = make_filename (opt.homedir, standard_name, NULL);
else
{
@ -1500,7 +1497,7 @@ create_server_socket (char *name, int is_ssh, assuan_sock_nonce_t *nonce)
strcpy (serv_addr->sun_path, name);
len = SUN_LEN (serv_addr);
rc = assuan_sock_bind (fd, (struct sockaddr*) serv_addr, len);
if (use_standard_socket && rc == -1 && errno == EADDRINUSE)
if (opt.use_standard_socket && rc == -1 && errno == EADDRINUSE)
{
/* Check whether a gpg-agent is already running on the standard
socket. We do this test only if this is not the ssh socket.
@ -1533,7 +1530,7 @@ create_server_socket (char *name, int is_ssh, assuan_sock_nonce_t *nonce)
gpg_strerror (gpg_error_from_errno (errno)));
assuan_sock_close (fd);
if (use_standard_socket)
if (opt.use_standard_socket)
*name = 0; /* Inhibit removal of the socket by cleanup(). */
agent_exit (2);
}
@ -2170,7 +2167,7 @@ check_own_socket (void)
char *sockname;
pth_attr_t tattr;
if (!use_standard_socket)
if (!opt.use_standard_socket)
return; /* This check makes only sense in standard socket mode. */
if (check_own_socket_running || shutdown_pending)