summaryrefslogtreecommitdiffstats
path: root/scd
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2014-10-03 11:58:58 +0200
committerWerner Koch <wk@gnupg.org>2014-10-03 11:58:58 +0200
commit9c380384dafb213334f8834178c5ceb0bf33db6e (patch)
tree3522eab22d31542094d95c605394542a857e1c55 /scd
parentgpg: Fix regression removing SHA256. (diff)
downloadgnupg2-9c380384dafb213334f8834178c5ceb0bf33db6e.tar.xz
gnupg2-9c380384dafb213334f8834178c5ceb0bf33db6e.zip
Remove support for the GPG_AGENT_INFO envvar.
* agent/agent.h (opt): Remove field use_standard_socket. * agent/command.c (cmd_killagent): Always allow killing. * agent/gpg-agent.c (main): Turn --{no,}use-standard-socket and --write-env-file into dummy options. Always return true for --use-standard-socket-p. Do not print the GPG_AGENT_INFO envvar setting or set that envvar. (create_socket_name): Simplify by removing non standard socket support. (check_for_running_agent): Ditto. * common/asshelp.c (start_new_gpg_agent): Remove GPG_AGENT_INFO use. * common/simple-pwquery.c (agent_open): Ditto. * configure.ac (GPG_AGENT_INFO_NAME): Remove. * g10/server.c (gpg_server): Do not print the AgentInfo comment. * g13/server.c (g13_server): Ditto. * sm/server.c (gpgsm_server): Ditto. * tools/gpgconf.c (main): Simplify by removing non standard socket support. -- The indented fix to allow using a different socket than the one in the gnupg home directory is to change Libassuan to check whether the socket files exists as a regualr file with a special keyword to redirect to another socket file name.
Diffstat (limited to 'scd')
-rw-r--r--scd/scdaemon.c81
1 files changed, 17 insertions, 64 deletions
diff --git a/scd/scdaemon.c b/scd/scdaemon.c
index 9cc4d117c..be99b001a 100644
--- a/scd/scdaemon.c
+++ b/scd/scdaemon.c
@@ -206,9 +206,8 @@ static int ticker_disabled;
-static char *create_socket_name (int use_standard_socket,
- char *standard_name, char *template);
-static gnupg_fd_t create_server_socket (int is_standard_name, const char *name,
+static char *create_socket_name (char *standard_name);
+static gnupg_fd_t create_server_socket (const char *name,
assuan_sock_nonce_t *nonce);
static void *start_connection_thread (void *arg);
@@ -399,7 +398,6 @@ main (int argc, char **argv )
int gpgconf_list = 0;
const char *config_filename = NULL;
int allow_coredump = 0;
- int standard_socket = 0;
struct assuan_malloc_hooks malloc_hooks;
int res;
npth_t pipecon_handler;
@@ -445,12 +443,6 @@ main (int argc, char **argv )
opt.allow_admin = 1;
opt.pcsc_driver = DEFAULT_PCSC_DRIVER;
-#ifdef HAVE_W32_SYSTEM
- standard_socket = 1; /* Under Windows we always use a standard
- socket. */
-#endif
-
-
shell = getenv ("SHELL");
if (shell && strlen (shell) >= 3 && !strcmp (shell+strlen (shell)-3, "csh") )
csh_style = 1;
@@ -744,12 +736,8 @@ main (int argc, char **argv )
back the name of that socket. */
if (multi_server)
{
- socket_name = create_socket_name (standard_socket,
- SCDAEMON_SOCK_NAME,
- "gpg-XXXXXX/" SCDAEMON_SOCK_NAME);
-
- fd = FD2INT(create_server_socket (standard_socket,
- socket_name, &socket_nonce));
+ socket_name = create_socket_name (SCDAEMON_SOCK_NAME);
+ fd = FD2INT(create_server_socket (socket_name, &socket_nonce));
}
res = npth_attr_init (&tattr);
@@ -800,12 +788,8 @@ main (int argc, char **argv )
#endif
/* Create the socket. */
- socket_name = create_socket_name (standard_socket,
- SCDAEMON_SOCK_NAME,
- "gpg-XXXXXX/" SCDAEMON_SOCK_NAME);
-
- fd = FD2INT (create_server_socket (standard_socket,
- socket_name, &socket_nonce));
+ socket_name = create_socket_name (SCDAEMON_SOCK_NAME);
+ fd = FD2INT (create_server_socket (socket_name, &socket_nonce));
fflush (NULL);
@@ -1026,46 +1010,17 @@ handle_tick (void)
}
-/* Create a name for the socket. With USE_STANDARD_SOCKET given as
- true using STANDARD_NAME in the home directory or if given has
- false from the mkdir type name TEMPLATE. In the latter case a
- unique name in a unique new directory will be created. In both
- cases check for valid characters as well as against a maximum
- allowed length for a unix domain socket is done. The function
- terminates the process in case of an error. Retunrs: Pointer to an
- allcoated string with the absolute name of the socket used. */
+/* Create a name for the socket. We check for valid characters as
+ well as against a maximum allowed length for a unix domain socket
+ is done. The function terminates the process in case of an error.
+ Retunrs: Pointer to an allcoated string with the absolute name of
+ the socket used. */
static char *
-create_socket_name (int use_standard_socket,
- char *standard_name, char *template)
+create_socket_name (char *standard_name)
{
- char *name, *p;
-
- if (use_standard_socket)
- name = make_filename (opt.homedir, standard_name, NULL);
- else
- {
- /* Prepend the tmp directory to the template. */
- p = getenv ("TMPDIR");
- if (!p || !*p)
- p = "/tmp";
- if (p[strlen (p) - 1] == '/')
- name = xstrconcat (p, template, NULL);
- else
- name = xstrconcat (p, "/", template, NULL);
-
- p = strrchr (name, '/');
- if (!p)
- BUG ();
- *p = 0;
- if (!mkdtemp (name))
- {
- log_error (_("can't create directory '%s': %s\n"),
- name, strerror (errno));
- scd_exit (2);
- }
- *p = '/';
- }
+ char *name;
+ name = make_filename (opt.homedir, standard_name, NULL);
if (strchr (name, PATHSEP_C))
{
log_error (("'%s' are not allowed in the socket name\n"), PATHSEP_S);
@@ -1081,12 +1036,10 @@ create_socket_name (int use_standard_socket,
-/* Create a Unix domain socket with NAME. IS_STANDARD_NAME indicates
- whether a non-random socket is used. Returns the file descriptor
+/* Create a Unix domain socket with NAME. Returns the file descriptor
or terminates the process in case of an error. */
static gnupg_fd_t
-create_server_socket (int is_standard_name, const char *name,
- assuan_sock_nonce_t *nonce)
+create_server_socket (const char *name, assuan_sock_nonce_t *nonce)
{
struct sockaddr_un *serv_addr;
socklen_t len;
@@ -1108,7 +1061,7 @@ create_server_socket (int is_standard_name, const char *name,
len = SUN_LEN (serv_addr);
rc = assuan_sock_bind (fd, (struct sockaddr*) serv_addr, len);
- if (is_standard_name && rc == -1 && errno == EADDRINUSE)
+ if (rc == -1 && errno == EADDRINUSE)
{
remove (name);
rc = assuan_sock_bind (fd, (struct sockaddr*) serv_addr, len);