1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

Use Assuan socket wrapper calls.

Made socket servers secure under Windows.
This commit is contained in:
Werner Koch 2007-10-01 14:48:39 +00:00
parent a6b11ea482
commit 31c19d1d68
46 changed files with 464 additions and 260 deletions

View File

@ -1,3 +1,7 @@
2007-10-01 Werner Koch <wk@g10code.com>
* configure.ac: Require assuan 1.0.4.
2007-09-14 Werner Koch <wk@g10code.com>
* configure.ac (GNUPG_LIBASSUAN_VERSION): New.

4
NEWS
View File

@ -1,6 +1,10 @@
Noteworthy changes in version 2.0.8
------------------------------------------------
* Make sure that under Windows the file permissions of the socket are
taken into account. This required a change of our the socket
emulation code; thus old GnuPG modules can't be used anymore.
Noteworthy changes in version 2.0.7 (2007-09-10)
------------------------------------------------

View File

@ -1,3 +1,17 @@
2007-10-01 Werner Koch <wk@g10code.com>
* agent.h (struct server_control_s): Remove unused CONNECTION_FD.
* gpg-agent.c: Remove w32-afunix.h. Include mkdtemp.h.
(socket_nonce, socket_nonce_ssh): New.
(create_server_socket): Use assuan socket wrappers. Remove W32
specific stuff. Save the server nonce.
(check_nonce): New.
(start_connection_thread, start_connection_thread_ssh): Call it.
(handle_connections): Change args to gnupg_fd_t.
* command.c (start_command_handler): Change LISTEN_FD to gnupg_fd_t.
* command-ssh.c (start_command_handler_ssh): Ditto.
2007-09-18 Werner Koch <wk@g10code.com>
* agent.h (struct pin_entry_info_s): Add element WITH_QUALITYBAR.

View File

@ -32,7 +32,8 @@
#include <gcrypt.h>
#include "../common/util.h"
#include "../common/errors.h"
#include "membuf.h"
#include "../common/membuf.h"
#include "../common/sysutils.h" /* (gnupg_fd_t) */
/* To convey some special hash algorithms we use algorithm numbers
reserved for application use. */
@ -131,7 +132,7 @@ struct server_control_s
/* Private data used to fire up the connection thread. We use this
structure do avoid an extra allocation for just a few bytes. */
struct {
int fd;
gnupg_fd_t fd;
} thread_startup;
/* Private data of the server (command.c). */
@ -140,8 +141,6 @@ struct server_control_s
/* Private data of the SCdaemon (call-scd.c). */
struct scd_local_s *scd_local;
int connection_fd; /* -1 or an identifier for the current connection. */
char *display;
char *ttyname;
char *ttytype;
@ -209,10 +208,10 @@ void agent_sighup_action (void);
gpg_error_t agent_write_status (ctrl_t ctrl, const char *keyword, ...);
void bump_key_eventcounter (void);
void bump_card_eventcounter (void);
void start_command_handler (ctrl_t, int, int);
void start_command_handler (ctrl_t, gnupg_fd_t, gnupg_fd_t);
/*-- command-ssh.c --*/
void start_command_handler_ssh (ctrl_t, int);
void start_command_handler_ssh (ctrl_t, gnupg_fd_t);
/*-- findkey.c --*/
int agent_write_private_key (const unsigned char *grip,

View File

@ -2818,15 +2818,12 @@ ssh_request_process (ctrl_t ctrl, estream_t stream_sock)
/* Start serving client on SOCK_CLIENT. */
void
start_command_handler_ssh (ctrl_t ctrl, int sock_client)
start_command_handler_ssh (ctrl_t ctrl, gnupg_fd_t sock_client)
{
estream_t stream_sock;
gpg_error_t err;
int ret;
/* Setup control structure. */
ctrl->connection_fd = sock_client;
/* Because the ssh protocol does not send us information about the
the current TTY setting, we resort here to use those from startup
or those explictly set. */
@ -2843,7 +2840,7 @@ start_command_handler_ssh (ctrl_t ctrl, int sock_client)
/* Create stream from socket. */
stream_sock = es_fdopen (sock_client, "r+");
stream_sock = es_fdopen (FD2INT(sock_client), "r+");
if (!stream_sock)
{
err = gpg_error_from_syserror ();

View File

@ -1544,12 +1544,12 @@ register_commands (assuan_context_t ctx)
control structure for this connection; it has only the basic
intialization. */
void
start_command_handler (ctrl_t ctrl, int listen_fd, int fd)
start_command_handler (ctrl_t ctrl, gnupg_fd_t listen_fd, gnupg_fd_t fd)
{
int rc;
assuan_context_t ctx;
if (listen_fd == -1 && fd == -1)
if (listen_fd == GNUPG_INVALID_FD && fd == GNUPG_INVALID_FD)
{
int filedes[2];
@ -1557,14 +1557,13 @@ start_command_handler (ctrl_t ctrl, int listen_fd, int fd)
filedes[1] = 1;
rc = assuan_init_pipe_server (&ctx, filedes);
}
else if (listen_fd != -1)
else if (listen_fd != GNUPG_INVALID_FD)
{
rc = assuan_init_socket_server_ext (&ctx, listen_fd, 0);
}
else
{
rc = assuan_init_socket_server_ext (&ctx, fd, 2);
ctrl->connection_fd = fd;
}
if (rc)
{

View File

@ -40,13 +40,11 @@
#define JNLIB_NEED_LOG_LOGV
#include "agent.h"
#include <assuan.h> /* Malloc hooks */
#include <assuan.h> /* Malloc hooks and socket wrappers. */
#include "i18n.h"
#include "mkdtemp.h" /* Gnulib replacement. */
#include "sysutils.h"
#ifdef HAVE_W32_SYSTEM
# include "../jnlib/w32-afunix.h"
#endif
#include "setenv.h"
#include "gc-opt-flags.h"
@ -207,6 +205,12 @@ static char *socket_name;
/* Name of the communication socket used for ssh-agent-emulation. */
static char *socket_name_ssh;
/* We need to keep track of the server's nonces (these are dummies for
POSIX systems). */
static assuan_sock_nonce_t socket_nonce;
static assuan_sock_nonce_t socket_nonce_ssh;
/* Default values for options passed to the pinentry. */
static char *default_display;
static char *default_ttyname;
@ -236,13 +240,15 @@ static pid_t parent_pid = (pid_t)(-1);
static char *create_socket_name (int use_standard_socket,
char *standard_name, char *template);
static int create_server_socket (int is_standard_name, char *name);
static gnupg_fd_t create_server_socket (int is_standard_name, char *name,
assuan_sock_nonce_t *nonce);
static void create_directories (void);
static void agent_init_default_ctrl (ctrl_t ctrl);
static void agent_deinit_default_ctrl (ctrl_t ctrl);
static void handle_connections (int listen_fd, int listen_fd_ssh);
static void handle_connections (gnupg_fd_t listen_fd,
gnupg_fd_t listen_fd_ssh);
static int check_for_running_agent (int silent, int mode);
/* Pth wrapper function definitions. */
@ -845,7 +851,7 @@ main (int argc, char **argv )
agent_exit (1);
}
agent_init_default_ctrl (ctrl);
start_command_handler (ctrl, -1, -1);
start_command_handler (ctrl, GNUPG_INVALID_FD, GNUPG_INVALID_FD);
agent_deinit_default_ctrl (ctrl);
xfree (ctrl);
}
@ -853,8 +859,8 @@ main (int argc, char **argv )
; /* NOTREACHED */
else
{ /* Regular server mode */
int fd;
int fd_ssh;
gnupg_fd_t fd;
gnupg_fd_t fd_ssh;
pid_t pid;
/* Remove the DISPLAY variable so that a pinentry does not
@ -878,11 +884,13 @@ main (int argc, char **argv )
"S.gpg-agent.ssh",
"/tmp/gpg-XXXXXX/S.gpg-agent.ssh");
fd = create_server_socket (standard_socket, socket_name);
fd = create_server_socket (standard_socket, socket_name,
&socket_nonce);
if (opt.ssh_support)
fd_ssh = create_server_socket (standard_socket, socket_name_ssh);
fd_ssh = create_server_socket (standard_socket, socket_name_ssh,
&socket_nonce_ssh);
else
fd_ssh = -1;
fd_ssh = GNUPG_INVALID_FD;
/* If we are going to exec a program in the parent, we record
the PID, so that the child may check whether the program is
@ -1079,8 +1087,8 @@ main (int argc, char **argv )
}
#endif /*!HAVE_W32_SYSTEM*/
handle_connections (fd, opt.ssh_support ? fd_ssh : -1);
close (fd);
handle_connections (fd, opt.ssh_support ? fd_ssh : GNUPG_INVALID_FD);
assuan_sock_close (fd);
}
return 0;
@ -1109,8 +1117,6 @@ agent_exit (int rc)
static void
agent_init_default_ctrl (ctrl_t ctrl)
{
ctrl->connection_fd = -1;
/* Note we ignore malloc errors because we can't do much about it
and the request will fail anyway shortly after this
initialization. */
@ -1269,20 +1275,17 @@ 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 or
terminates the process in case of an error. */
static int
create_server_socket (int is_standard_name, char *name)
static gnupg_fd_t
create_server_socket (int is_standard_name, char *name,
assuan_sock_nonce_t *nonce)
{
struct sockaddr_un *serv_addr;
socklen_t len;
int fd;
gnupg_fd_t fd;
int rc;
#ifdef HAVE_W32_SYSTEM
fd = _w32_sock_new (AF_UNIX, SOCK_STREAM, 0);
#else
fd = socket (AF_UNIX, SOCK_STREAM, 0);
#endif
if (fd == -1)
fd = assuan_sock_new (AF_UNIX, SOCK_STREAM, 0);
if (fd == ASSUAN_INVALID_FD)
{
log_error (_("can't create socket: %s\n"), strerror (errno));
agent_exit (2);
@ -1291,43 +1294,32 @@ create_server_socket (int is_standard_name, char *name)
serv_addr = xmalloc (sizeof (*serv_addr));
memset (serv_addr, 0, sizeof *serv_addr);
serv_addr->sun_family = AF_UNIX;
assert (strlen (name) + 1 < sizeof (serv_addr->sun_path));
if (strlen (name) + 1 >= sizeof (serv_addr->sun_path))
{
log_error (_("socket name `%s' is too long\n"), name);
agent_exit (2);
}
strcpy (serv_addr->sun_path, name);
len = (offsetof (struct sockaddr_un, sun_path)
+ strlen (serv_addr->sun_path) + 1);
#ifdef HAVE_W32_SYSTEM
rc = _w32_sock_bind (fd, (struct sockaddr*) serv_addr, len);
if (is_standard_name && rc == -1 && errno == WSAEADDRINUSE)
{
if (!check_for_running_agent (1, 1))
{
log_error (_("a gpg-agent is already running - "
"not starting a new one\n"));
*name = 0; /* Inhibit removal of the socket by cleanup(). */
close (fd);
agent_exit (2);
}
remove (name);
rc = _w32_sock_bind (fd, (struct sockaddr*) serv_addr, len);
}
#else
rc = bind (fd, (struct sockaddr*) serv_addr, len);
rc = assuan_sock_bind (fd, (struct sockaddr*) serv_addr, len);
if (is_standard_name && rc == -1 && errno == EADDRINUSE)
{
if (!check_for_running_agent (1, 1))
{
log_error (_("a gpg-agent is already running - "
"not starting a new one\n"));
"not starting a new one\n"));
*name = 0; /* Inhibit removal of the socket by cleanup(). */
close (fd);
assuan_sock_close (fd);
agent_exit (2);
}
remove (name);
rc = bind (fd, (struct sockaddr*) serv_addr, len);
rc = assuan_sock_bind (fd, (struct sockaddr*) serv_addr, len);
}
#endif
if (rc != -1
&& (rc=assuan_sock_get_nonce ((struct sockaddr*)serv_addr, len, nonce)))
log_error (_("error getting nonce for the socket\n"));
if (rc == -1)
{
/* We use gpg_strerror here because it allows us to get strings
@ -1336,16 +1328,16 @@ create_server_socket (int is_standard_name, char *name)
serv_addr->sun_path,
gpg_strerror (gpg_error_from_errno (errno)));
close (fd);
assuan_sock_close (fd);
if (is_standard_name)
*name = 0; /* Inhibit removal of the socket by cleanup(). */
agent_exit (2);
}
if (listen (fd, 5 ) == -1)
if (listen (FD2INT(fd), 5 ) == -1)
{
log_error (_("listen() failed: %s\n"), strerror (errno));
close (fd);
assuan_sock_close (fd);
agent_exit (2);
}
@ -1538,21 +1530,42 @@ handle_signal (int signo)
}
/* Check the nonce on a new connection. This is a NOP unless we we
are using our Unix domain socket emulation under Windows. */
static int
check_nonce (ctrl_t ctrl, assuan_sock_nonce_t *nonce)
{
if (assuan_sock_check_nonce (ctrl->thread_startup.fd, nonce))
{
log_info (_("error reading nonce on fd %d: %s\n"),
FD2INT(ctrl->thread_startup.fd), strerror (errno));
assuan_sock_close (ctrl->thread_startup.fd);
xfree (ctrl);
return -1;
}
else
return 0;
}
/* This is the standard connection thread's main function. */
static void *
start_connection_thread (void *arg)
{
ctrl_t ctrl = arg;
if (check_nonce (ctrl, &socket_nonce))
return NULL;
agent_init_default_ctrl (ctrl);
if (opt.verbose)
log_info (_("handler 0x%lx for fd %d started\n"),
(long)pth_self (), ctrl->thread_startup.fd);
(long)pth_self (), FD2INT(ctrl->thread_startup.fd));
start_command_handler (ctrl, -1, ctrl->thread_startup.fd);
start_command_handler (ctrl, GNUPG_INVALID_FD, ctrl->thread_startup.fd);
if (opt.verbose)
log_info (_("handler 0x%lx for fd %d terminated\n"),
(long)pth_self (), ctrl->thread_startup.fd);
(long)pth_self (), FD2INT(ctrl->thread_startup.fd));
agent_deinit_default_ctrl (ctrl);
xfree (ctrl);
@ -1566,15 +1579,18 @@ start_connection_thread_ssh (void *arg)
{
ctrl_t ctrl = arg;
if (check_nonce (ctrl, &socket_nonce_ssh))
return NULL;
agent_init_default_ctrl (ctrl);
if (opt.verbose)
log_info (_("ssh handler 0x%lx for fd %d started\n"),
(long)pth_self (), ctrl->thread_startup.fd);
(long)pth_self (), FD2INT(ctrl->thread_startup.fd));
start_command_handler_ssh (ctrl, ctrl->thread_startup.fd);
if (opt.verbose)
log_info (_("ssh handler 0x%lx for fd %d terminated\n"),
(long)pth_self (), ctrl->thread_startup.fd);
(long)pth_self (), FD2INT(ctrl->thread_startup.fd));
agent_deinit_default_ctrl (ctrl);
xfree (ctrl);
@ -1585,7 +1601,7 @@ start_connection_thread_ssh (void *arg)
/* Connection handler loop. Wait for connection requests and spawn a
thread after accepting a connection. */
static void
handle_connections (int listen_fd, int listen_fd_ssh)
handle_connections (gnupg_fd_t listen_fd, gnupg_fd_t listen_fd_ssh)
{
pth_attr_t tattr;
pth_event_t ev, time_ev;
@ -1595,7 +1611,7 @@ handle_connections (int listen_fd, int listen_fd_ssh)
socklen_t plen;
fd_set fdset, read_fdset;
int ret;
int fd;
gnupg_fd_t fd;
int nfd;
tattr = pth_attr_new();
@ -1620,13 +1636,13 @@ handle_connections (int listen_fd, int listen_fd_ssh)
time_ev = NULL;
FD_ZERO (&fdset);
FD_SET (listen_fd, &fdset);
nfd = listen_fd;
if (listen_fd_ssh != -1)
FD_SET (FD2INT (listen_fd), &fdset);
nfd = FD2INT (listen_fd);
if (listen_fd_ssh != GNUPG_INVALID_FD)
{
FD_SET (listen_fd_ssh, &fdset);
if (listen_fd_ssh > nfd)
nfd = listen_fd_ssh;
FD_SET ( FD2INT(listen_fd_ssh), &fdset);
if (FD2INT (listen_fd_ssh) > nfd)
nfd = FD2INT (listen_fd_ssh);
}
for (;;)
@ -1701,13 +1717,14 @@ handle_connections (int listen_fd, int listen_fd_ssh)
new thread. Thus we need to block those signals. */
pth_sigmask (SIG_BLOCK, &sigs, &oldsigs);
if (FD_ISSET (listen_fd, &read_fdset))
if (FD_ISSET (FD2INT (listen_fd), &read_fdset))
{
ctrl_t ctrl;
plen = sizeof paddr;
fd = pth_accept (listen_fd, (struct sockaddr *)&paddr, &plen);
if (fd == -1)
fd = INT2FD (pth_accept (FD2INT(listen_fd),
(struct sockaddr *)&paddr, &plen));
if (fd == GNUPG_INVALID_FD)
{
log_error ("accept failed: %s\n", strerror (errno));
}
@ -1715,14 +1732,14 @@ handle_connections (int listen_fd, int listen_fd_ssh)
{
log_error ("error allocating connection control data: %s\n",
strerror (errno) );
close (fd);
assuan_sock_close (fd);
}
else
{
char threadname[50];
snprintf (threadname, sizeof threadname-1,
"conn fd=%d (gpg)", fd);
"conn fd=%d (gpg)", FD2INT(fd));
threadname[sizeof threadname -1] = 0;
pth_attr_set (tattr, PTH_ATTR_NAME, threadname);
ctrl->thread_startup.fd = fd;
@ -1730,20 +1747,22 @@ handle_connections (int listen_fd, int listen_fd_ssh)
{
log_error ("error spawning connection handler: %s\n",
strerror (errno) );
close (fd);
assuan_sock_close (fd);
xfree (ctrl);
}
}
fd = -1;
fd = GNUPG_INVALID_FD;
}
if (listen_fd_ssh != -1 && FD_ISSET (listen_fd_ssh, &read_fdset))
if (listen_fd_ssh != GNUPG_INVALID_FD
&& FD_ISSET ( FD2INT (listen_fd_ssh), &read_fdset))
{
ctrl_t ctrl;
plen = sizeof paddr;
fd = pth_accept (listen_fd_ssh, (struct sockaddr *)&paddr, &plen);
if (fd == -1)
fd = INT2FD(pth_accept (FD2INT(listen_fd_ssh),
(struct sockaddr *)&paddr, &plen));
if (fd == GNUPG_INVALID_FD)
{
log_error ("accept failed for ssh: %s\n", strerror (errno));
}
@ -1751,7 +1770,7 @@ handle_connections (int listen_fd, int listen_fd_ssh)
{
log_error ("error allocating connection control data: %s\n",
strerror (errno) );
close (fd);
assuan_sock_close (fd);
}
else
{
@ -1759,7 +1778,7 @@ handle_connections (int listen_fd, int listen_fd_ssh)
agent_init_default_ctrl (ctrl);
snprintf (threadname, sizeof threadname-1,
"conn fd=%d (ssh)", fd);
"conn fd=%d (ssh)", FD2INT(fd));
threadname[sizeof threadname -1] = 0;
pth_attr_set (tattr, PTH_ATTR_NAME, threadname);
ctrl->thread_startup.fd = fd;
@ -1767,11 +1786,11 @@ handle_connections (int listen_fd, int listen_fd_ssh)
{
log_error ("error spawning ssh connection handler: %s\n",
strerror (errno) );
close (fd);
assuan_sock_close (fd);
xfree (ctrl);
}
}
fd = -1;
fd = GNUPG_INVALID_FD;
}
/* Restore the signal mask. */

View File

@ -1,3 +1,12 @@
2007-10-01 Werner Koch <wk@g10code.com>
* sysutils.h (FD2INT, INT2FD): New.
2007-09-21 Werner Koch <wk@g10code.com>
* homedir.c (default_homedir): Make registry work. Reported by
Marc Mutz.
2007-08-29 Werner Koch <wk@g10code.com>
* exechelp.c (gnupg_wait_process): Add arg EXITCODE. Changed all

View File

@ -143,7 +143,7 @@ default_homedir (void)
tmp = read_w32_registry_string (NULL, "Software\\GNU\\GnuPG",
"HomeDir");
if (tmp && *tmp)
if (tmp && !*tmp)
{
xfree (tmp);
tmp = NULL;

View File

@ -27,9 +27,13 @@
#ifdef HAVE_W32_SYSTEM
typedef void *gnupg_fd_t;
#define GNUPG_INVALID_FD ((void*)(-1))
#define INT2FD(s) ((void *)(s))
#define FD2INT(h) ((unsigned int)(h))
#else
typedef int gnupg_fd_t;
#define GNUPG_INVALID_FD (-1)
#define INT2FD(s) (s)
#define FD2INT(h) (h)
#endif

View File

@ -43,7 +43,7 @@ NEED_LIBGCRYPT_API=1
NEED_LIBGCRYPT_VERSION=1.2.2
NEED_LIBASSUAN_API=1
NEED_LIBASSUAN_VERSION=1.0.2
NEED_LIBASSUAN_VERSION=1.0.4
NEED_KSBA_API=1
NEED_KSBA_VERSION=1.0.2

View File

@ -32,7 +32,7 @@
#include "util.h"
#include "i18n.h"
#include "options.h"
#include "../common/sysutils.h"
#define set_error(e,t) assuan_set_error (ctx, gpg_error (e), (t))
@ -44,7 +44,7 @@ struct server_local_s
/* Our current Assuan context. */
assuan_context_t assuan_ctx;
/* File descriptor as set by the MESSAGE command. */
int message_fd;
gnupg_fd_t message_fd;
};
@ -53,10 +53,10 @@ struct server_local_s
static void
close_message_fd (ctrl_t ctrl)
{
if (ctrl->server_local->message_fd != -1)
if (ctrl->server_local->message_fd != GNUPG_INVALID_FD)
{
close (ctrl->server_local->message_fd);
ctrl->server_local->message_fd = -1;
assuan_sock_close (ctrl->server_local->message_fd);
ctrl->server_local->message_fd = GNUPG_INVALID_FD;
}
}
@ -229,27 +229,28 @@ cmd_verify (assuan_context_t ctx, char *line)
{
int rc;
ctrl_t ctrl = assuan_get_pointer (ctx);
int fd = assuan_get_input_fd (ctx);
int out_fd = assuan_get_output_fd (ctx);
gnupg_fd_t fd = assuan_get_input_fd (ctx);
gnupg_fd_t out_fd = assuan_get_output_fd (ctx);
FILE *out_fp = NULL;
if (fd == -1)
if (fd == GNUPG_INVALID_FD)
return gpg_error (GPG_ERR_ASS_NO_INPUT);
if (out_fd != -1)
if (out_fd != GNUPG_INVALID_FD)
{
out_fp = fdopen ( dup(out_fd), "w");
out_fp = fdopen ( dup (FD2INT (out_fd)), "w");
if (!out_fp)
return set_error (GPG_ERR_ASS_GENERAL, "fdopen() failed");
}
log_debug ("WARNING: The server mode work in progress and not ready for use\n");
log_debug ("WARNING: The server mode work "
"in progress and not ready for use\n");
/* Need to dup it because it might get closed and libassuan won't
know about it then. */
rc = gpg_verify (ctrl,
dup (fd),
dup (ctrl->server_local->message_fd),
dup ( FD2INT (fd)),
dup ( FD2INT (ctrl->server_local->message_fd)),
out_fp);
if (out_fp)
@ -326,13 +327,13 @@ static int
cmd_message (assuan_context_t ctx, char *line)
{
int rc;
int fd;
gnupg_fd_t fd;
ctrl_t ctrl = assuan_get_pointer (ctx);
rc = assuan_command_parse_fd (ctx, line, &fd);
if (rc)
return rc;
if (fd == -1)
if (fd == GNUPG_INVALID_FD)
return gpg_error (GPG_ERR_ASS_NO_INPUT);
ctrl->server_local->message_fd = fd;
return 0;
@ -488,7 +489,7 @@ gpg_server (ctrl_t ctrl)
goto leave;
}
ctrl->server_local->assuan_ctx = ctx;
ctrl->server_local->message_fd = -1;
ctrl->server_local->message_fd = GNUPG_INVALID_FD;
if (DBG_ASSUAN)
assuan_set_log_stream (ctx, log_get_stream ());

View File

@ -1,3 +1,9 @@
2007-10-01 Werner Koch <wk@g10code.com>
* w32-afunix.c: Only keep the client related code.
(read_port_and_nonce): New. Taken from Assuan.
(_w32_sock_connect): Rewritten.
2007-08-29 Werner Koch <wk@g10code.com>
* argparse.c (initialize): Make strings translatable and remove

View File

@ -1,4 +1,4 @@
/* w32-afunix.c - AF_UNIX emulation for Windows.
/* w32-afunix.c - AF_UNIX emulation for Windows (Client only).
* Copyright (C) 2004, 2006 g10 Code GmbH
*
* This file is part of JNLIB.
@ -17,8 +17,13 @@
* License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
/* Use of this code is preprecated - you better use the sockt wrappers
from libassuan. */
#ifdef _WIN32
#include <stdio.h>
#include <stdlib.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <fcntl.h>
#include <sys/stat.h>
@ -27,10 +32,48 @@
#include "w32-afunix.h"
#ifndef S_IRGRP
# define S_IRGRP 0
# define S_IWGRP 0
#endif
/* The buffer for NONCE needs to be at least 16 bytes. Returns 0 on
success. */
static int
read_port_and_nonce (const char *fname, unsigned short *port, char *nonce)
{
FILE *fp;
char buffer[50], *p;
size_t nread;
int aval;
fp = fopen (fname, "rb");
if (!fp)
return -1;
nread = fread (buffer, 1, sizeof buffer - 1, fp);
fclose (fp);
if (!nread)
{
errno = ENOFILE;
return -1;
}
buffer[nread] = 0;
aval = atoi (buffer);
if (aval < 1 || aval > 65535)
{
errno = EINVAL;
return -1;
}
*port = (unsigned int)aval;
for (p=buffer; nread && *p != '\n'; p++, nread--)
;
if (*p != '\n' || nread != 17)
{
errno = EINVAL;
return -1;
}
p++; nread--;
memcpy (nonce, p, 16);
return 0;
}
int
@ -53,97 +96,40 @@ _w32_sock_new (int domain, int type, int proto)
int
_w32_sock_connect (int sockfd, struct sockaddr * addr, int addrlen)
_w32_sock_connect (int sockfd, struct sockaddr *addr, int addrlen)
{
struct sockaddr_in myaddr;
struct sockaddr_un * unaddr;
FILE * fp;
int port;
struct sockaddr_un *unaddr;
unsigned short port;
char nonce[16];
int ret;
unaddr = (struct sockaddr_un *)addr;
fp = fopen (unaddr->sun_path, "rb");
if (!fp)
if (read_port_and_nonce (unaddr->sun_path, &port, nonce))
return -1;
fscanf (fp, "%d", &port);
fclose (fp);
if (port < 0 || port > 65535)
{
errno = EINVAL;
return -1;
}
myaddr.sin_family = AF_INET;
myaddr.sin_port = port;
myaddr.sin_port = htons (port);
myaddr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
/* we need this later. */
/* Set return values. */
unaddr->sun_family = myaddr.sin_family;
unaddr->sun_port = myaddr.sin_port;
unaddr->sun_addr.s_addr = myaddr.sin_addr.s_addr;
return connect (sockfd, (struct sockaddr *)&myaddr, sizeof myaddr);
}
int
_w32_sock_bind (int sockfd, struct sockaddr *addr, int addrlen)
{
if (addr->sa_family == AF_LOCAL || addr->sa_family == AF_UNIX)
ret = connect (sockfd, (struct sockaddr *)&myaddr, sizeof myaddr);
if (!ret)
{
struct sockaddr_in myaddr;
struct sockaddr_un *unaddr;
int filefd;
FILE *fp;
int len = sizeof myaddr;
int rc;
unaddr = (struct sockaddr_un *)addr;
myaddr.sin_port = 0;
myaddr.sin_family = AF_INET;
myaddr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
filefd = open (unaddr->sun_path,
(O_WRONLY|O_CREAT|O_EXCL|O_BINARY),
(S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP));
if (filefd == -1)
/* Send the nonce. */
ret = send (sockfd, nonce, 16, 0);
if (ret >= 0 && ret != 16)
{
if (errno == EEXIST)
errno = WSAEADDRINUSE;
return -1;
errno = EIO;
ret = -1;
}
fp = fdopen (filefd, "wb");
if (!fp)
{
int save_e = errno;
close (filefd);
errno = save_e;
return -1;
}
rc = bind (sockfd, (struct sockaddr *)&myaddr, len);
if (!rc)
rc = getsockname (sockfd, (struct sockaddr *)&myaddr, &len);
if (rc)
{
int save_e = errno;
fclose (fp);
remove (unaddr->sun_path);
errno = save_e;
return rc;
}
fprintf (fp, "%d", myaddr.sin_port);
fclose (fp);
/* The caller expects these values. */
unaddr->sun_family = myaddr.sin_family;
unaddr->sun_port = myaddr.sin_port;
unaddr->sun_addr.s_addr = myaddr.sin_addr.s_addr;
return 0;
}
return bind (sockfd, addr, addrlen);
return ret;
}
#endif /*_WIN32*/

View File

@ -39,10 +39,11 @@ struct sockaddr_un
char sun_path[108-2-4]; /* Path name. */
};
int _w32_close (int fd);
int _w32_sock_new (int domain, int type, int proto);
int _w32_sock_bind (int sockfd, struct sockaddr *addr, int addrlen);
int _w32_sock_connect (int sockfd, struct sockaddr *addr, int addrlen);
#endif /*W32AFUNIX_DEFS_H*/
#endif /*_WIN32*/

View File

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg 1.2.2\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2003-10-30 16:35+0200\n"
"Last-Translator: Ales Nyakhaychyk <nab@mail.by>\n"
"Language-Team: Belarusian <i18n@mova.org>\n"
@ -7509,6 +7509,10 @@ msgstr "|ІМЯ| зашыфраваць для вылучанай асобы"
msgid "Configuration for Keyservers"
msgstr ""
#: tools/gpgconf-comp.c:673
msgid "|URL|use keyserver at URL"
msgstr ""
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -27,7 +27,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg 1.4.0\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2005-02-04 02:04+0100\n"
"Last-Translator: Jordi Mallach <jordi@gnu.org>\n"
"Language-Team: Catalan <ca@dodds.net>\n"
@ -8097,6 +8097,11 @@ msgstr "|NOM|xifra per a NOM"
msgid "Configuration for Keyservers"
msgstr ""
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "no s'ha pogut analitzar sintàcticament la URI del servidor de claus\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg-1.3.92\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2004-11-26 09:12+0200\n"
"Last-Translator: Roman Pavlik <rp@tns.cz>\n"
"Language-Team: Czech <translations.cs@gnupg.cz>\n"
@ -7779,6 +7779,11 @@ msgstr "|JM
msgid "Configuration for Keyservers"
msgstr ""
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "nelze zpracovat URL serveru klíèù\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg 1.0.0h\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2003-12-03 16:11+0100\n"
"Last-Translator: Birger Langkjer <birger.langkjer@image.dk>\n"
"Language-Team: Danish <dansk@klid.dk>\n"
@ -7663,6 +7663,11 @@ msgstr "|NAME|krypt
msgid "Configuration for Keyservers"
msgstr ""
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "importér nøgler fra en nøgleserver: %s\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg-1.1.92\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2003-06-27 12:00+0200\n"
"Last-Translator: Dokianakis Theofanis <madf@hellug.gr>\n"
"Language-Team: Greek <nls@tux.hellug.gr>\n"
@ -7951,6 +7951,11 @@ msgstr "|
msgid "Configuration for Keyservers"
msgstr ""
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "αδυναμία επεξεργασίας του URI του διακομιση κλειδιών\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg 1.0.6d\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2002-04-14 14:33+0100\n"
"Last-Translator: Edmund GRIMLEY EVANS <edmundo@rano.org>\n"
"Language-Team: Esperanto <translation-team-eo@lists.sourceforge.net>\n"
@ -7897,6 +7897,11 @@ msgstr "|NOMO|
msgid "Configuration for Keyservers"
msgstr ""
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "ne povis analizi URI de þlosilservilo\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -10,7 +10,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg 1.4.1\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2007-08-16 11:35+0200\n"
"Last-Translator: Jaime Suárez <jsuarez@ono.com>\n"
"Language-Team: Spanish <es@li.org>\n"
@ -7825,6 +7825,11 @@ msgstr "|NOMBRE|cifra para NOMBRE"
msgid "Configuration for Keyservers"
msgstr ""
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "no se puede interpretar la URL del servidor de claves\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg 1.2.2\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2004-06-17 11:04+0300\n"
"Last-Translator: Toomas Soome <Toomas.Soome@microlink.ee>\n"
"Language-Team: Estonian <et@li.org>\n"
@ -7856,6 +7856,11 @@ msgstr "|NIMI|kr
msgid "Configuration for Keyservers"
msgstr ""
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "ei saa parsida võtmeserveri URI\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg 1.2.2\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2004-06-16 22:40+0300\n"
"Last-Translator: Tommi Vainikainen <Tommi.Vainikainen@iki.fi>\n"
"Language-Team: Finnish <translation-team-fi@lists.sourceforge.net>\n"
@ -7935,6 +7935,11 @@ msgstr "|NIMI|salaa vastaanottajalle NIMI"
msgid "Configuration for Keyservers"
msgstr ""
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "avainpalvelimen URI:iä ei voi jäsentää\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg 1.4.2rc2\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2005-06-28 00:24+0200\n"
"Last-Translator: Gaël Quéri <gael@lautre.net>\n"
"Language-Team: French <traduc@traduc.org>\n"
@ -7983,6 +7983,11 @@ msgstr "|NOM|chiffrer pour NOM"
msgid "Configuration for Keyservers"
msgstr ""
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "impossible d'interpréter l'URL du serveur de clés\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg 1.2.4\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2003-12-04 11:39+0100\n"
"Last-Translator: Jacobo Tarrio <jtarrio@trasno.net>\n"
"Language-Team: Galician <gpul-traduccion@ceu.fi.udc.es>\n"
@ -7946,6 +7946,11 @@ msgstr "|NOME|cifrar para NOME"
msgid "Configuration for Keyservers"
msgstr ""
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "non se puido analisa-lo URI do servidor de chaves\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg 1.2.5\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2004-06-19 21:53+0200\n"
"Last-Translator: Nagy Ferenc László <nfl@nfllab.com>\n"
"Language-Team: Hungarian <translation-team-hu@lists.sourceforge.net>\n"
@ -7897,6 +7897,11 @@ msgstr "|N
msgid "Configuration for Keyservers"
msgstr ""
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "Értelmezhetetlen a kulcsszerver URI-ja!\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg-id\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2004-06-17 16:32+0700\n"
"Last-Translator: Tedi Heriyanto <tedi_h@gmx.net>\n"
"Language-Team: Indonesian <translation-team-id@lists.sourceforge.net>\n"
@ -7899,6 +7899,11 @@ msgstr "|NAMA|enkripsi untuk NAMA"
msgid "Configuration for Keyservers"
msgstr ""
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "tidak dapat memparsing URI keyserver\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg 1.1.92\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2004-06-16 17:01+0200\n"
"Last-Translator: Marco d'Itri <md@linux.it>\n"
"Language-Team: Italian <tp@lists.linux.it>\n"
@ -7945,6 +7945,11 @@ msgstr "|NOME|cifra per NOME"
msgid "Configuration for Keyservers"
msgstr ""
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "impossibile fare il parsing dell'URI del keyserver\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg 1.3.92\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2004-11-23 11:14+0900\n"
"Last-Translator: IIDA Yosiaki <iida@gnu.org>\n"
"Language-Team: Japanese <translation-team-ja@lists.sourceforge.net>\n"
@ -7713,6 +7713,11 @@ msgstr "|̾
msgid "Configuration for Keyservers"
msgstr ""
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "鍵サーバーのURLを解析不能\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -10,7 +10,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg 1.4.3\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2006-06-13 20:31+0200\n"
"Last-Translator: Trond Endrestøl <Trond.Endrestol@fagskolen.gjovik.no>\n"
"Language-Team: Norwegian Bokmål <i18n-nb@lister.ping.uio.no>\n"
@ -7582,6 +7582,11 @@ msgstr "|NAVN|kryptere for NAVN"
msgid "Configuration for Keyservers"
msgstr ""
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "kunne ikke parse nøkkelserverens URL\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg-1.2.2\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2004-06-23 15:54+0200\n"
"Last-Translator: Janusz A. Urbanowicz <alex@bofh.net.pl>\n"
"Language-Team: Polish <pl@li.org>\n"
@ -7942,6 +7942,11 @@ msgstr "|NAZWA|szyfrowanie dla odbiorcy NAZWA"
msgid "Configuration for Keyservers"
msgstr ""
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "niezrozuma³y URI serwera kluczy\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2002-09-13 18:26+0100\n"
"Last-Translator: Pedro Morais <morais@kde.org>\n"
"Language-Team: pt <morais@kde.org>\n"
@ -7911,6 +7911,11 @@ msgstr "|NOME|cifrar para NOME"
msgid "Configuration for Keyservers"
msgstr ""
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "não consegui processar a URI do servidor de chaves\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -13,7 +13,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg 1.0\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2007-08-16 11:35+0200\n"
"Last-Translator:\n"
"Language-Team: ?\n"
@ -7863,6 +7863,11 @@ msgstr "|NOME|criptografar para NOME"
msgid "Configuration for Keyservers"
msgstr ""
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "impossível escrever para o chaveiro: %s\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg 1.4.2rc1\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2005-05-31 22:00-0500\n"
"Last-Translator: Laurentiu Buzdugan <lbuz@rolix.org>\n"
"Language-Team: Romanian <translation-team-ro@lists.sourceforge.net>\n"
@ -7806,6 +7806,12 @@ msgstr "|NUME|cifrare pentru NUME"
msgid "Configuration for Keyservers"
msgstr ""
#
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "nu am putut interpreta URL-ul serverului de chei\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: GnuPG 2.0.0\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2006-11-07 19:31+0300\n"
"Last-Translator: Maxim Britov <maxim.britov@gmail.com>\n"
"Language-Team: Russian <gnupg-ru@gnupg.org>\n"
@ -7667,6 +7667,11 @@ msgstr "|NAME|зашифровать для получателя NAME"
msgid "Configuration for Keyservers"
msgstr "Конфигурация серверов ключей"
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "не могу проанализировать URL сервера ключей\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg 1.2.5\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2004-07-20 15:52+0200\n"
"Last-Translator: Michal Majer <mmajer@econ.umb.sk>\n"
"Language-Team: Slovak <sk-i18n@lists.linux.sk>\n"
@ -7917,6 +7917,11 @@ msgstr "|MENO|
msgid "Configuration for Keyservers"
msgstr ""
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "nemo¾no pou¾i» URI servera kµúèov - chyba analýzy URI\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -24,7 +24,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg 2.0\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2007-02-17 13:13+0100\n"
"Last-Translator: Daniel Nylander <po@danielnylander.se>\n"
"Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n"
@ -7880,6 +7880,11 @@ msgstr "|NAMN|kryptera för NAMN"
msgid "Configuration for Keyservers"
msgstr "Konfiguration för nyckelservrar"
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "kunde inte tolka url till nyckelserver\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr "tillåt PKA-uppslag (DNS-förfrågningar)"

View File

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg 1.9.94\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2006-11-04 03:45+0200\n"
"Last-Translator: Nilgün Belma Bugüner <nilgun@belgeler.gen.tr>\n"
"Language-Team: Turkish <gnu-tr-u12a@lists.sourceforge.net>\n"
@ -7755,6 +7755,11 @@ msgstr "|İSİM|İSİM için şifreleme yapar"
msgid "Configuration for Keyservers"
msgstr "Anahtar sunucular için yapılandırma"
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "anahtar sunucusunun adresi çözümlenemedi\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr "PKA aramalarına izin verilir (DNS istekleri)"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg 1.4.4\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2006-07-02 10:58+0800\n"
"Last-Translator: Meng Jie <zuxyhere@eastday.com>\n"
"Language-Team: Chinese (simplified) <i18n-translation@lists.linux.net.cn>\n"
@ -7615,6 +7615,11 @@ msgstr "|某甲|为收件者“某甲”加密"
msgid "Configuration for Keyservers"
msgstr ""
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "无法解析公钥服务器 URL\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnupg 1.4.2\n"
"Report-Msgid-Bugs-To: translations@gnupg.org\n"
"POT-Creation-Date: 2007-09-10 17:28+0200\n"
"POT-Creation-Date: 2007-09-14 13:27+0200\n"
"PO-Revision-Date: 2005-07-29 09:49+0800\n"
"Last-Translator: Jedi <Jedi@Jedi.org>\n"
"Language-Team: Chinese (traditional) <zh-l10n@linux.org.tw>\n"
@ -7655,6 +7655,11 @@ msgstr "|名字|以「名字」作為加密對象"
msgid "Configuration for Keyservers"
msgstr ""
#: tools/gpgconf-comp.c:673
#, fuzzy
msgid "|URL|use keyserver at URL"
msgstr "無法剖析金鑰伺服器 URI\n"
#: tools/gpgconf-comp.c:676
msgid "allow PKA lookups (DNS requests)"
msgstr ""

View File

@ -1,3 +1,10 @@
2007-10-01 Werner Koch <wk@g10code.com>
* scdaemon.c (create_server_socket): Use Assuan socket wrappers
and remove Windows specific code.
(socket_nonce): New.
(start_connection_thread): Check nonce.
2007-09-14 Marcus Brinkmann <marcus@g10code.de>
* scdaemon.c (main): New variable STANDARD_SOCKET, which is 1 for

View File

@ -47,9 +47,6 @@
#include "i18n.h"
#include "sysutils.h"
#include "app-common.h"
#ifdef HAVE_W32_SYSTEM
#include "../jnlib/w32-afunix.h"
#endif
#include "ccid-driver.h"
#include "mkdtemp.h"
#include "gc-opt-flags.h"
@ -170,6 +167,9 @@ static int maybe_setuid = 1;
/* Name of the communication socket */
static char *socket_name;
/* We need to keep track of the server's nonces (these are dummies for
POSIX systems). */
static assuan_sock_nonce_t socket_nonce;
/* Debug flag to disable the ticker. The ticker is in fact not
disabled but it won't perform any ticker specific actions. */
@ -179,7 +179,8 @@ static int ticker_disabled;
static char *create_socket_name (int use_standard_socket,
char *standard_name, char *template);
static int create_server_socket (int is_standard_name, const char *name);
static gnupg_fd_t create_server_socket (int is_standard_name, const char *name,
assuan_sock_nonce_t *nonce);
static void *start_connection_thread (void *arg);
static void handle_connections (int listen_fd);
@ -631,7 +632,7 @@ main (int argc, char **argv )
"S.scdaemon",
"/tmp/gpg-XXXXXX/S.scdaemon");
fd = create_server_socket (0, socket_name);
fd = FD2INT(create_server_socket (0, socket_name, &socket_nonce));
}
tattr = pth_attr_new();
@ -646,7 +647,7 @@ main (int argc, char **argv )
strerror (errno) );
scd_exit (2);
}
ctrl->thread_startup.fd = -1;
ctrl->thread_startup.fd = GNUPG_INVALID_FD;
if ( !pth_spawn (tattr, start_connection_thread, ctrl) )
{
log_error ("error spawning pipe connection handler: %s\n",
@ -667,15 +668,17 @@ main (int argc, char **argv )
else
{ /* Regular server mode */
int fd;
#ifndef HAVE_W32_SYSTEM
pid_t pid;
int i;
#endif
/* Create the socket. */
socket_name = create_socket_name (standard_socket,
"S.scdaemon",
"/tmp/gpg-XXXXXX/S.scdaemon");
fd = create_server_socket (0, socket_name);
fd = FD2INT (create_server_socket (0, socket_name, &socket_nonce));
fflush (NULL);
@ -936,20 +939,17 @@ 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
or terminates the process in case of an error. */
static int
create_server_socket (int is_standard_name, const char *name)
static gnupg_fd_t
create_server_socket (int is_standard_name, const char *name,
assuan_sock_nonce_t *nonce)
{
struct sockaddr_un *serv_addr;
socklen_t len;
int fd;
gnupg_fd_t fd;
int rc;
#ifdef HAVE_W32_SYSTEM
fd = _w32_sock_new (AF_UNIX, SOCK_STREAM, 0);
#else
fd = socket (AF_UNIX, SOCK_STREAM, 0);
#endif
if (fd == -1)
fd = assuan_sock_new (AF_UNIX, SOCK_STREAM, 0);
if (fd == GNUPG_INVALID_FD)
{
log_error (_("can't create socket: %s\n"), strerror (errno));
scd_exit (2);
@ -963,33 +963,27 @@ create_server_socket (int is_standard_name, const char *name)
len = (offsetof (struct sockaddr_un, sun_path)
+ strlen (serv_addr->sun_path) + 1);
#ifdef HAVE_W32_SYSTEM
rc = _w32_sock_bind (fd, (struct sockaddr*) serv_addr, len);
if (is_standard_name && rc == -1 )
{
remove (name);
rc = bind (fd, (struct sockaddr*) serv_addr, len);
}
#else
rc = bind (fd, (struct sockaddr*) serv_addr, len);
rc = assuan_sock_bind (fd, (struct sockaddr*) serv_addr, len);
if (is_standard_name && rc == -1 && errno == EADDRINUSE)
{
remove (name);
rc = bind (fd, (struct sockaddr*) serv_addr, len);
rc = assuan_sock_bind (fd, (struct sockaddr*) serv_addr, len);
}
#endif
if (rc == -1)
if (rc != -1
&& (rc=assuan_sock_get_nonce ((struct sockaddr*)serv_addr, len, nonce)))
log_error (_("error getting nonce for the socket\n"));
if (rc == -1)
{
log_error (_("error binding socket to `%s': %s\n"),
serv_addr->sun_path, strerror (errno));
close (fd);
assuan_sock_close (fd);
scd_exit (2);
}
if (listen (fd, 5 ) == -1)
if (listen (FD2INT(fd), 5 ) == -1)
{
log_error (_("listen() failed: %s\n"), strerror (errno));
close (fd);
assuan_sock_close (fd);
scd_exit (2);
}
@ -1007,20 +1001,31 @@ start_connection_thread (void *arg)
{
ctrl_t ctrl = arg;
if (assuan_sock_check_nonce (ctrl->thread_startup.fd, &socket_nonce))
{
log_info (_("error reading nonce on fd %d: %s\n"),
FD2INT(ctrl->thread_startup.fd), strerror (errno));
assuan_sock_close (ctrl->thread_startup.fd);
xfree (ctrl);
return NULL;
}
scd_init_default_ctrl (ctrl);
if (opt.verbose)
log_info (_("handler for fd %d started\n"), ctrl->thread_startup.fd);
log_info (_("handler for fd %d started\n"),
FD2INT(ctrl->thread_startup.fd));
scd_command_handler (ctrl, ctrl->thread_startup.fd);
scd_command_handler (ctrl, FD2INT(ctrl->thread_startup.fd));
if (opt.verbose)
log_info (_("handler for fd %d terminated\n"), ctrl->thread_startup.fd);
log_info (_("handler for fd %d terminated\n"),
FD2INT (ctrl->thread_startup.fd));
/* If this thread is the pipe connection thread, flag that a
shutdown is required. With the next ticker event and given that
no other connections are running the shutdown will then
happen. */
if (ctrl->thread_startup.fd == -1)
if (ctrl->thread_startup.fd == GNUPG_INVALID_FD)
shutdown_pending = 1;
scd_deinit_default_ctrl (ctrl);
@ -1166,7 +1171,7 @@ handle_connections (int listen_fd)
snprintf (threadname, sizeof threadname-1, "conn fd=%d", fd);
threadname[sizeof threadname -1] = 0;
pth_attr_set (tattr, PTH_ATTR_NAME, threadname);
ctrl->thread_startup.fd = fd;
ctrl->thread_startup.fd = INT2FD (fd);
if (!pth_spawn (tattr, start_connection_thread, ctrl))
{
log_error ("error spawning connection handler: %s\n",

View File

@ -30,7 +30,7 @@
#include <gcrypt.h>
#include "../common/util.h"
#include "../common/errors.h"
#include "../common/sysutils.h"
/* To convey some special hash algorithms we use algorithm numbers
reserved for application use. */
@ -91,7 +91,7 @@ struct server_control_s
/* Private data used to fire up the connection thread. We use this
structure do avoid an extra allocation for just a few bytes. */
struct {
int fd;
gnupg_fd_t fd;
} thread_startup;
/* Local data of the server; used only in command.c. */

View File

@ -1,3 +1,12 @@
2007-10-01 Werner Koch <wk@g10code.com>
* gpg-connect-agent.c (do_sendfd): Use INT2FD for assuan_sendfd.
2007-09-26 Werner Koch <wk@g10code.com>
* gpg-connect-agent.c (main): Print the first response from the
server.
2007-09-14 Werner Koch <wk@g10code.com>
* gpgconf-comp.c: Make a string translatable.

View File

@ -29,7 +29,7 @@
#include "i18n.h"
#include "../common/util.h"
#include "../common/asshelp.h"
#include "../common/sysutils.h"
/* Constants to identify the commands and options. */
@ -244,7 +244,7 @@ do_sendfd (assuan_context_t ctx, char *line)
log_error ("file `%s' opened in \"%s\" mode, fd=%d\n",
name, mode, fd);
rc = assuan_sendfd (ctx, fd);
rc = assuan_sendfd (ctx, INT2FD (fd) );
if (rc)
log_error ("sednig descriptor %d failed: %s\n", fd, gpg_strerror (rc));
fclose (fp);
@ -360,6 +360,16 @@ main (int argc, char **argv)
}
else
ctx = start_agent ();
/* See whether there is a line pending from the server (in case
assuan did not run the initial handshaking). */
if (assuan_pending_line (ctx))
{
rc = read_and_print_response (ctx);
if (rc)
log_info (_("receiving line failed: %s\n"), gpg_strerror (rc) );
}
line = NULL;
linesize = 0;
for (;;)