Exemple #1
0
/* Helper to close the message fd if it is open. */
static void
close_message_fd (ctrl_t ctrl)
{
  if (ctrl->server_local->message_fd != GNUPG_INVALID_FD)
    {
      assuan_sock_close (ctrl->server_local->message_fd);
      ctrl->server_local->message_fd = GNUPG_INVALID_FD;
    }
}
Exemple #2
0
static
void
server_socket_close (const int fd) {
	if (fd != -1) {
		assuan_sock_close (fd);
	}
	if (s_socket_name != NULL) {
		unlink (s_socket_name);
		free (s_socket_name);
		s_socket_name = NULL;
	}
	if (s_socket_dir != NULL) {
		rmdir (s_socket_dir);
		free (s_socket_dir);
		s_socket_dir = NULL;
	}
	assuan_sock_deinit();
}
Exemple #3
0
/* Print a warning iff Tor is not running but Tor has been requested.
 * Also return true if it is not running.  */
static int
tor_not_running_p (ctrl_t ctrl)
{
  assuan_fd_t sock;

  if (!dirmngr_use_tor ())
    return 0;

  sock = assuan_sock_connect_byname (NULL, 0, 0, NULL, ASSUAN_SOCK_TOR);
  if (sock != ASSUAN_INVALID_FD)
    {
      assuan_sock_close (sock);
      return 0;
    }

  log_info ("(it seems Tor is not running)\n");
  dirmngr_status (ctrl, "WARNING", "tor_not_running 0",
                  "Tor is enabled but the local Tor daemon"
                  " seems to be down", NULL);
  return 1;
}