mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-13 22:21:09 +02:00
A bunch of minor changes for Windows.
This commit is contained in:
parent
a7fe86bc02
commit
f54b85bc2d
@ -1,3 +1,7 @@
|
|||||||
|
2007-07-03 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* configure.ac [W32]: Use ws2_32 instead of wsock32.
|
||||||
|
|
||||||
2007-06-25 Werner Koch <wk@g10code.com>
|
2007-06-25 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* gl/mkdtemp.c (gen_tempname) [MKDIR_TAKES_ONE_ARG]: Avoid
|
* gl/mkdtemp.c (gen_tempname) [MKDIR_TAKES_ONE_ARG]: Avoid
|
||||||
|
@ -1,3 +1,25 @@
|
|||||||
|
2007-07-04 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* gpg-agent.c (TIMERTICK_INTERVAL): New.
|
||||||
|
|
||||||
|
2007-07-03 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* gpg-agent.c (handle_connections): Do not use FD_SETSIZE for
|
||||||
|
select but compute the correct number.
|
||||||
|
|
||||||
|
2007-07-02 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* command.c (cmd_reloadagent) [W32]: New.
|
||||||
|
(register_commands) [W32]: New command RELOADAGENT.
|
||||||
|
|
||||||
|
* Makefile.am (gpg_agent_SOURCES): Remove w32main.c and w32main.h.
|
||||||
|
(gpg_agent_res_ldflags): Remove icon file as we don't have a
|
||||||
|
proper icon yet.
|
||||||
|
* gpg-agent.c (main): do not include w32main.h. Remove all calls
|
||||||
|
to w32main.c.
|
||||||
|
(agent_sighup_action): New.
|
||||||
|
(handle_signal): Use it.
|
||||||
|
|
||||||
2007-06-26 Werner Koch <wk@g10code.com>
|
2007-06-26 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* gpg-agent.c (create_directories) [W32]: Made it work.
|
* gpg-agent.c (create_directories) [W32]: Made it work.
|
||||||
|
@ -23,7 +23,7 @@ bin_PROGRAMS = gpg-agent
|
|||||||
libexec_PROGRAMS = gpg-protect-tool gpg-preset-passphrase
|
libexec_PROGRAMS = gpg-protect-tool gpg-preset-passphrase
|
||||||
noinst_PROGRAMS = $(TESTS)
|
noinst_PROGRAMS = $(TESTS)
|
||||||
|
|
||||||
EXTRA_DIST = gpg-agent.ico gpg-agent-resource.rc
|
# EXTRA_DIST = gpg-agent.ico gpg-agent-resource.rc
|
||||||
|
|
||||||
AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_srcdir)/common -I$(top_srcdir)/intl
|
AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_srcdir)/common -I$(top_srcdir)/intl
|
||||||
|
|
||||||
@ -47,25 +47,21 @@ gpg_agent_SOURCES = \
|
|||||||
call-scd.c \
|
call-scd.c \
|
||||||
learncard.c
|
learncard.c
|
||||||
|
|
||||||
if HAVE_W32_SYSTEM
|
|
||||||
gpg_agent_SOURCES += w32main.c w32main.h
|
|
||||||
endif
|
|
||||||
|
|
||||||
common_libs = ../jnlib/libjnlib.a $(libcommon) ../gl/libgnu.a
|
common_libs = ../jnlib/libjnlib.a $(libcommon) ../gl/libgnu.a
|
||||||
commonpth_libs = ../jnlib/libjnlib.a $(libcommonpth) ../gl/libgnu.a
|
commonpth_libs = ../jnlib/libjnlib.a $(libcommonpth) ../gl/libgnu.a
|
||||||
pwquery_libs = ../common/libsimple-pwquery.a
|
pwquery_libs = ../common/libsimple-pwquery.a
|
||||||
|
|
||||||
if HAVE_W32_SYSTEM
|
#if HAVE_W32_SYSTEM
|
||||||
.rc.o:
|
#.rc.o:
|
||||||
$(WINDRES) `echo $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) | \
|
# $(WINDRES) `echo $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) | \
|
||||||
sed -e 's/-I/--include-dir /g;s/-D/--define /g'` -i $< -o $@
|
# sed -e 's/-I/--include-dir /g;s/-D/--define /g'` -i $< -o $@
|
||||||
|
#
|
||||||
gpg_agent_res_ldflags = -Wl,gpg-agent-resource.o -Wl,--subsystem,windows
|
#gpg_agent_res_ldflags = -Wl,gpg-agent-resource.o -Wl,--subsystem,windows
|
||||||
gpg_agent_res_deps = gpg-agent-resource.o
|
#gpg_agent_res_deps = gpg-agent-resource.o
|
||||||
else
|
#else
|
||||||
gpg_agent_res_ldflags =
|
gpg_agent_res_ldflags =
|
||||||
gpg_agent_res_deps =
|
gpg_agent_res_deps =
|
||||||
endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
gpg_agent_CFLAGS = $(AM_CFLAGS) $(LIBASSUAN_PTH_CFLAGS) $(PTH_CFLAGS)
|
gpg_agent_CFLAGS = $(AM_CFLAGS) $(LIBASSUAN_PTH_CFLAGS) $(PTH_CFLAGS)
|
||||||
|
@ -190,6 +190,7 @@ cache_mode_t;
|
|||||||
void agent_exit (int rc) JNLIB_GCC_A_NR; /* Also implemented in other tools */
|
void agent_exit (int rc) JNLIB_GCC_A_NR; /* Also implemented in other tools */
|
||||||
const char *get_agent_socket_name (void);
|
const char *get_agent_socket_name (void);
|
||||||
const char *get_agent_ssh_socket_name (void);
|
const char *get_agent_ssh_socket_name (void);
|
||||||
|
void agent_sighup_action (void);
|
||||||
|
|
||||||
/*-- command.c --*/
|
/*-- command.c --*/
|
||||||
gpg_error_t agent_write_status (ctrl_t ctrl, const char *keyword, ...);
|
gpg_error_t agent_write_status (ctrl_t ctrl, const char *keyword, ...);
|
||||||
|
@ -225,7 +225,7 @@ start_pinentry (ctrl_t ctrl)
|
|||||||
pgmname++;
|
pgmname++;
|
||||||
|
|
||||||
/* OS X needs the entire file name in argv[0], so that it can locate
|
/* OS X needs the entire file name in argv[0], so that it can locate
|
||||||
the resource bundle. For other systems we stick to the the usual
|
the resource bundle. For other systems we stick to the usual
|
||||||
convention of supplying only the name of the program. */
|
convention of supplying only the name of the program. */
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
argv[0] = opt.pinentry_program;
|
argv[0] = opt.pinentry_program;
|
||||||
|
@ -1323,6 +1323,17 @@ cmd_killagent (assuan_context_t ctx, char *line)
|
|||||||
ctrl->server_local->stopme = 1;
|
ctrl->server_local->stopme = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* RELOADAGENT
|
||||||
|
|
||||||
|
As signals are inconvenient under Windows, we provide this command
|
||||||
|
to allow reloading of the configuration. */
|
||||||
|
static int
|
||||||
|
cmd_reloadagent (assuan_context_t ctx, char *line)
|
||||||
|
{
|
||||||
|
agent_sighup_action ();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#endif /*HAVE_W32_SYSTEM*/
|
#endif /*HAVE_W32_SYSTEM*/
|
||||||
|
|
||||||
|
|
||||||
@ -1506,6 +1517,7 @@ register_commands (assuan_context_t ctx)
|
|||||||
{ "UPDATESTARTUPTTY", cmd_updatestartuptty },
|
{ "UPDATESTARTUPTTY", cmd_updatestartuptty },
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
{ "KILLAGENT", cmd_killagent },
|
{ "KILLAGENT", cmd_killagent },
|
||||||
|
{ "RELOADAGENT", cmd_reloadagent },
|
||||||
#endif
|
#endif
|
||||||
{ "GETINFO", cmd_getinfo },
|
{ "GETINFO", cmd_getinfo },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
|
@ -48,7 +48,6 @@
|
|||||||
#include "sysutils.h"
|
#include "sysutils.h"
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
# include "../jnlib/w32-afunix.h"
|
# include "../jnlib/w32-afunix.h"
|
||||||
# include "w32main.h"
|
|
||||||
#endif
|
#endif
|
||||||
#include "setenv.h"
|
#include "setenv.h"
|
||||||
|
|
||||||
@ -171,6 +170,14 @@ static ARGPARSE_OPTS opts[] = {
|
|||||||
#define MAX_CACHE_TTL_SSH (120*60) /* 2 hours */
|
#define MAX_CACHE_TTL_SSH (120*60) /* 2 hours */
|
||||||
#define MIN_PASSPHRASE_LEN (8)
|
#define MIN_PASSPHRASE_LEN (8)
|
||||||
|
|
||||||
|
/* The timer tick used for housekeeping stuff. For Windows we use a
|
||||||
|
longer period as the SetWaitableTimer seems to signal earlier than
|
||||||
|
the 2 seconds. */
|
||||||
|
#ifdef HAVE_W32_SYSTEM
|
||||||
|
#define TIMERTICK_INTERVAL (4)
|
||||||
|
#else
|
||||||
|
#define TIMERTICK_INTERVAL (2) /* Seconds. */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* flag to indicate that a shutdown was requested */
|
/* flag to indicate that a shutdown was requested */
|
||||||
static int shutdown_pending;
|
static int shutdown_pending;
|
||||||
@ -408,16 +415,9 @@ parse_rereadable_options (ARGPARSE_ARGS *pargs, int reread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* The main entry point. For W32 another name is used as the real
|
/* The main entry point. */
|
||||||
entry points needs to be named WinMain and is defined in
|
|
||||||
w32main.c. */
|
|
||||||
#ifdef HAVE_W32_SYSTEM
|
|
||||||
int
|
|
||||||
w32_main (int argc, char **argv )
|
|
||||||
#else
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv )
|
main (int argc, char **argv )
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
ARGPARSE_ARGS pargs;
|
ARGPARSE_ARGS pargs;
|
||||||
int orig_argc;
|
int orig_argc;
|
||||||
@ -851,7 +851,6 @@ main (int argc, char **argv )
|
|||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
pid = getpid ();
|
pid = getpid ();
|
||||||
printf ("set GPG_AGENT_INFO=%s;%lu;1\n", socket_name, (ulong)pid);
|
printf ("set GPG_AGENT_INFO=%s;%lu;1\n", socket_name, (ulong)pid);
|
||||||
w32_setup_taskbar ();
|
|
||||||
#else /*!HAVE_W32_SYSTEM*/
|
#else /*!HAVE_W32_SYSTEM*/
|
||||||
pid = fork ();
|
pid = fork ();
|
||||||
if (pid == (pid_t)-1)
|
if (pid == (pid_t)-1)
|
||||||
@ -1430,6 +1429,17 @@ handle_tick (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* A global fucntion which allows us to call the reload stuff from
|
||||||
|
other palces too. This is only used when build for W32. */
|
||||||
|
void
|
||||||
|
agent_sighup_action (void)
|
||||||
|
{
|
||||||
|
agent_flush_cache ();
|
||||||
|
reread_configuration ();
|
||||||
|
agent_reload_trustlist ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_signal (int signo)
|
handle_signal (int signo)
|
||||||
{
|
{
|
||||||
@ -1439,9 +1449,7 @@ handle_signal (int signo)
|
|||||||
case SIGHUP:
|
case SIGHUP:
|
||||||
log_info ("SIGHUP received - "
|
log_info ("SIGHUP received - "
|
||||||
"re-reading configuration and flushing cache\n");
|
"re-reading configuration and flushing cache\n");
|
||||||
agent_flush_cache ();
|
agent_sighup_action ();
|
||||||
reread_configuration ();
|
|
||||||
agent_reload_trustlist ();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIGUSR1:
|
case SIGUSR1:
|
||||||
@ -1545,6 +1553,7 @@ handle_connections (int listen_fd, int listen_fd_ssh)
|
|||||||
fd_set fdset, read_fdset;
|
fd_set fdset, read_fdset;
|
||||||
int ret;
|
int ret;
|
||||||
int fd;
|
int fd;
|
||||||
|
int nfd;
|
||||||
|
|
||||||
tattr = pth_attr_new();
|
tattr = pth_attr_new();
|
||||||
pth_attr_set (tattr, PTH_ATTR_JOINABLE, 0);
|
pth_attr_set (tattr, PTH_ATTR_JOINABLE, 0);
|
||||||
@ -1562,24 +1571,25 @@ handle_connections (int listen_fd, int listen_fd_ssh)
|
|||||||
pth_sigmask (SIG_UNBLOCK, &sigs, NULL);
|
pth_sigmask (SIG_UNBLOCK, &sigs, NULL);
|
||||||
ev = pth_event (PTH_EVENT_SIGS, &sigs, &signo);
|
ev = pth_event (PTH_EVENT_SIGS, &sigs, &signo);
|
||||||
#else
|
#else
|
||||||
ev = NULL;
|
sigs = 0;
|
||||||
signo = 0;
|
ev = pth_event (PTH_EVENT_SIGS, &sigs, &signo);
|
||||||
#endif
|
#endif
|
||||||
time_ev = NULL;
|
time_ev = NULL;
|
||||||
|
|
||||||
FD_ZERO (&fdset);
|
FD_ZERO (&fdset);
|
||||||
FD_SET (listen_fd, &fdset);
|
FD_SET (listen_fd, &fdset);
|
||||||
|
nfd = listen_fd;
|
||||||
if (listen_fd_ssh != -1)
|
if (listen_fd_ssh != -1)
|
||||||
FD_SET (listen_fd_ssh, &fdset);
|
{
|
||||||
|
FD_SET (listen_fd_ssh, &fdset);
|
||||||
|
if (listen_fd_ssh > nfd)
|
||||||
|
nfd = listen_fd_ssh;
|
||||||
|
}
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
sigset_t oldsigs;
|
sigset_t oldsigs;
|
||||||
|
|
||||||
#ifdef HAVE_W32_SYSTEM
|
|
||||||
w32_poll_events ();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (shutdown_pending)
|
if (shutdown_pending)
|
||||||
{
|
{
|
||||||
if (pth_ctrl (PTH_CTRL_GETTHREADS) == 1)
|
if (pth_ctrl (PTH_CTRL_GETTHREADS) == 1)
|
||||||
@ -1596,7 +1606,8 @@ handle_connections (int listen_fd, int listen_fd_ssh)
|
|||||||
|
|
||||||
/* Create a timeout event if needed. */
|
/* Create a timeout event if needed. */
|
||||||
if (!time_ev)
|
if (!time_ev)
|
||||||
time_ev = pth_event (PTH_EVENT_TIME, pth_timeout (2, 0));
|
time_ev = pth_event (PTH_EVENT_TIME,
|
||||||
|
pth_timeout (TIMERTICK_INTERVAL, 0));
|
||||||
|
|
||||||
/* POSIX says that fd_set should be implemented as a structure,
|
/* POSIX says that fd_set should be implemented as a structure,
|
||||||
thus a simple assignment is fine to copy the entire set. */
|
thus a simple assignment is fine to copy the entire set. */
|
||||||
@ -1604,7 +1615,7 @@ handle_connections (int listen_fd, int listen_fd_ssh)
|
|||||||
|
|
||||||
if (time_ev)
|
if (time_ev)
|
||||||
pth_event_concat (ev, time_ev, NULL);
|
pth_event_concat (ev, time_ev, NULL);
|
||||||
ret = pth_select_ev (FD_SETSIZE, &read_fdset, NULL, NULL, NULL, ev);
|
ret = pth_select_ev (nfd+1, &read_fdset, NULL, NULL, NULL, ev);
|
||||||
if (time_ev)
|
if (time_ev)
|
||||||
pth_event_isolate (time_ev);
|
pth_event_isolate (time_ev);
|
||||||
|
|
||||||
@ -1643,8 +1654,8 @@ handle_connections (int listen_fd, int listen_fd_ssh)
|
|||||||
|
|
||||||
|
|
||||||
/* We now might create new threads and because we don't want any
|
/* We now might create new threads and because we don't want any
|
||||||
signals - we are handling here - to be delivered to a new
|
signals (as we are handling them here) to be delivered to a
|
||||||
thread. Thus we need to block those signals. */
|
new thread. Thus we need to block those signals. */
|
||||||
pth_sigmask (SIG_BLOCK, &sigs, &oldsigs);
|
pth_sigmask (SIG_BLOCK, &sigs, &oldsigs);
|
||||||
|
|
||||||
if (FD_ISSET (listen_fd, &read_fdset))
|
if (FD_ISSET (listen_fd, &read_fdset))
|
||||||
|
@ -1160,7 +1160,7 @@ GNUPG_CHECK_GNUMAKE
|
|||||||
# requiring any network stuff but linking to code in libcommon which
|
# requiring any network stuff but linking to code in libcommon which
|
||||||
# tracks in winsock stuff (e.g. init_common_subsystems.
|
# tracks in winsock stuff (e.g. init_common_subsystems.
|
||||||
if test "$have_w32_system" = yes; then
|
if test "$have_w32_system" = yes; then
|
||||||
W32SOCKLIBS="-lwsock32"
|
W32SOCKLIBS="-lws2_32"
|
||||||
NETLIBS="${NETLIBS} ${W32SOCKLIBS}"
|
NETLIBS="${NETLIBS} ${W32SOCKLIBS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2007-07-01 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* argparse.c (strusage): Use id 10 for the license string;
|
||||||
|
default to GPL3+. Change long note to version 3 or later.
|
||||||
|
(show_version): Print the license info.
|
||||||
|
|
||||||
2007-06-19 Werner Koch <wk@g10code.com>
|
2007-06-19 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* Makefile.am: Add support for regression tests.
|
* Makefile.am: Add support for regression tests.
|
||||||
|
106
jnlib/argparse.c
106
jnlib/argparse.c
@ -844,64 +844,71 @@ show_help( ARGPARSE_OPTS *opts, unsigned flags )
|
|||||||
static void
|
static void
|
||||||
show_version()
|
show_version()
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
int i;
|
int i;
|
||||||
/* version line */
|
|
||||||
fputs(strusage(11), stdout);
|
/* Version line. */
|
||||||
if( (s=strusage(12)) )
|
fputs (strusage (11), stdout);
|
||||||
printf(" (%s)", s );
|
if ((s=strusage (12)))
|
||||||
printf(" %s\n", strusage(13) );
|
printf (" (%s)", s );
|
||||||
/* additional version lines */
|
printf (" %s\n", strusage (13) );
|
||||||
for(i=20; i < 30; i++ )
|
/* Additional version lines. */
|
||||||
if( (s=strusage(i)) )
|
for (i=20; i < 30; i++)
|
||||||
printf("%s\n", s );
|
if ((s=strusage (i)))
|
||||||
/* copyright string */
|
printf ("%s\n", s );
|
||||||
if( (s=strusage(14)) )
|
/* Copyright string. */
|
||||||
printf("%s\n", s );
|
if( (s=strusage (14)) )
|
||||||
/* copying conditions */
|
printf("%s\n", s );
|
||||||
if( (s=strusage(15)) )
|
/* Licence string. */
|
||||||
fputs(s, stdout);
|
if( (s=strusage (10)) )
|
||||||
/* thanks */
|
printf("%s\n", s );
|
||||||
if( (s=strusage(18)) )
|
/* Copying conditions. */
|
||||||
fputs(s, stdout);
|
if ( (s=strusage(15)) )
|
||||||
/* additional program info */
|
fputs (s, stdout);
|
||||||
for(i=30; i < 40; i++ )
|
/* Thanks. */
|
||||||
if( (s=strusage(i)) )
|
if ((s=strusage(18)))
|
||||||
fputs (s, stdout);
|
fputs (s, stdout);
|
||||||
fflush(stdout);
|
/* Additional program info. */
|
||||||
|
for (i=30; i < 40; i++ )
|
||||||
|
if ( (s=strusage (i)) )
|
||||||
|
fputs (s, stdout);
|
||||||
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
usage( int level )
|
usage (int level)
|
||||||
{
|
{
|
||||||
if( !level ) {
|
if (!level)
|
||||||
fprintf(stderr,"%s %s; %s\n", strusage(11), strusage(13),
|
{
|
||||||
strusage(14) );
|
fprintf(stderr,"%s %s; %s\n", strusage(11), strusage(13), strusage (14));
|
||||||
fflush(stderr);
|
fflush (stderr);
|
||||||
}
|
}
|
||||||
else if( level == 1 ) {
|
else if (level == 1)
|
||||||
fputs(strusage(40),stderr);
|
{
|
||||||
exit(2);
|
fputs (strusage (40), stderr);
|
||||||
|
exit (2);
|
||||||
}
|
}
|
||||||
else if( level == 2 ) {
|
else if (level == 2)
|
||||||
puts(strusage(41));
|
{
|
||||||
exit(0);
|
puts (strusage(41));
|
||||||
|
exit (0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Level
|
/* Level
|
||||||
* 0: Copyright String auf stderr ausgeben
|
* 0: Print copyright string to stderr
|
||||||
* 1: Kurzusage auf stderr ausgeben und beenden
|
* 1: Print a short usage hint to stderr and terminate
|
||||||
* 2: Langusage auf stdout ausgeben und beenden
|
* 2: Print a long usage hint to stdout and terminate
|
||||||
* 11: name of program
|
* 10: Return license info string
|
||||||
* 12: optional name of package which includes this program.
|
* 11: Return the name of the program
|
||||||
|
* 12: Return optional name of package which includes this program.
|
||||||
* 13: version string
|
* 13: version string
|
||||||
* 14: copyright string
|
* 14: copyright string
|
||||||
* 15: Short copying conditions (with LFs)
|
* 15: Short copying conditions (with LFs)
|
||||||
* 16: Long copying conditions (with LFs)
|
* 16: Long copying conditions (with LFs)
|
||||||
* 17: Optional printable OS name
|
* 17: Optional printable OS name
|
||||||
* 18: Optional thanks list (with LFs)
|
* 18: Optional thanks list (with LFs)
|
||||||
* 19: Bug report info
|
* 19: Bug report info
|
||||||
*20..29: Additional lib version strings.
|
*20..29: Additional lib version strings.
|
||||||
*30..39: Additional program info (with LFs)
|
*30..39: Additional program info (with LFs)
|
||||||
@ -917,26 +924,27 @@ strusage( int level )
|
|||||||
return p;
|
return p;
|
||||||
|
|
||||||
switch( level ) {
|
switch( level ) {
|
||||||
|
case 10: p = ("License GPLv2+: GNU GPL version 2 or later "
|
||||||
|
"<http://gnu.org/licenses/old-licenses/gpl-2.0.html>");
|
||||||
|
break;
|
||||||
case 11: p = "foo"; break;
|
case 11: p = "foo"; break;
|
||||||
case 13: p = "0.0"; break;
|
case 13: p = "0.0"; break;
|
||||||
case 14: p = "Copyright (C) 2007 Free Software Foundation, Inc."; break;
|
case 14: p = "Copyright (C) 2007 Free Software Foundation, Inc."; break;
|
||||||
case 15: p =
|
case 15: p =
|
||||||
"This program comes with ABSOLUTELY NO WARRANTY.\n"
|
"This is free software: you are free to change and redistribute it.\n"
|
||||||
"This is free software, and you are welcome to redistribute it\n"
|
"There is NO WARRANTY, to the extent permitted by law.\n";
|
||||||
"under certain conditions. See the file COPYING for details.\n"; break;
|
break;
|
||||||
case 16: p =
|
case 16: p =
|
||||||
"This is free software; you can redistribute it and/or modify\n"
|
"This is free software; you can redistribute it and/or modify\n"
|
||||||
"it under the terms of the GNU General Public License as published by\n"
|
"it under the terms of the GNU General Public License as published by\n"
|
||||||
"the Free Software Foundation; either version 2 of the License, or\n"
|
"the Free Software Foundation; either version 3 of the License, or\n"
|
||||||
"(at your option) any later version.\n\n"
|
"(at your option) any later version.\n\n"
|
||||||
"It is distributed in the hope that it will be useful,\n"
|
"It is distributed in the hope that it will be useful,\n"
|
||||||
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
|
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
|
||||||
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
|
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
|
||||||
"GNU General Public License for more details.\n\n"
|
"GNU General Public License for more details.\n\n"
|
||||||
"You should have received a copy of the GNU General Public License\n"
|
"You should have received a copy of the GNU General Public License\n"
|
||||||
"along with this program; if not, write to the Free Software\n"
|
"along with this software. If not, see <http://www.gnu.org/licenses/>.\n";
|
||||||
"Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n"
|
|
||||||
"USA.\n";
|
|
||||||
break;
|
break;
|
||||||
case 40: /* short and long usage */
|
case 40: /* short and long usage */
|
||||||
case 41: p = ""; break;
|
case 41: p = ""; break;
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
2007-07-04 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* command.c (cmd_getinfo): New subcommand "version".
|
||||||
|
|
||||||
|
* scdaemon.c (TIMERTICK_INTERVAL): New.
|
||||||
|
(handle_connections) [W32]: Enable a dummy sigs event.
|
||||||
|
(handle_connections): Use a proper count for select and not
|
||||||
|
FD_SETSIZE.
|
||||||
|
|
||||||
2007-06-21 Werner Koch <wk@g10code.com>
|
2007-06-21 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* scdaemon.h (ctrl_t): Remove. It is now declared in ../common/util.h.
|
* scdaemon.h (ctrl_t): Remove. It is now declared in ../common/util.h.
|
||||||
|
@ -1402,6 +1402,8 @@ cmd_unlock (assuan_context_t ctx, char *line)
|
|||||||
Multi purpose command to return certain information.
|
Multi purpose command to return certain information.
|
||||||
Supported values of WHAT are:
|
Supported values of WHAT are:
|
||||||
|
|
||||||
|
version - Return the version of the program.
|
||||||
|
|
||||||
socket_name - Return the name of the socket.
|
socket_name - Return the name of the socket.
|
||||||
|
|
||||||
status - Return the status of the current slot (in the future, may
|
status - Return the status of the current slot (in the future, may
|
||||||
@ -1420,7 +1422,12 @@ cmd_getinfo (assuan_context_t ctx, char *line)
|
|||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
if (!strcmp (line, "socket_name"))
|
if (!strcmp (line, "version"))
|
||||||
|
{
|
||||||
|
const char *s = VERSION;
|
||||||
|
rc = assuan_send_data (ctx, s, strlen (s));
|
||||||
|
}
|
||||||
|
else if (!strcmp (line, "socket_name"))
|
||||||
{
|
{
|
||||||
const char *s = scd_get_socket_name ();
|
const char *s = scd_get_socket_name ();
|
||||||
|
|
||||||
|
@ -150,6 +150,15 @@ static ARGPARSE_OPTS opts[] = {
|
|||||||
#define DEFAULT_PCSC_DRIVER "libpcsclite.so"
|
#define DEFAULT_PCSC_DRIVER "libpcsclite.so"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* The timer tick used for housekeeping stuff. For Windows we use a
|
||||||
|
longer period as the SetWaitableTimer seems to signal earlier than
|
||||||
|
the 2 seconds. */
|
||||||
|
#ifdef HAVE_W32_SYSTEM
|
||||||
|
#define TIMERTICK_INTERVAL (4)
|
||||||
|
#else
|
||||||
|
#define TIMERTICK_INTERVAL (2) /* Seconds. */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Flag to indicate that a shutdown was requested. */
|
/* Flag to indicate that a shutdown was requested. */
|
||||||
static int shutdown_pending;
|
static int shutdown_pending;
|
||||||
@ -280,7 +289,7 @@ main (int argc, char **argv )
|
|||||||
FILE *configfp = NULL;
|
FILE *configfp = NULL;
|
||||||
char *configname = NULL;
|
char *configname = NULL;
|
||||||
const char *shell;
|
const char *shell;
|
||||||
unsigned configlineno;
|
unsigned int configlineno;
|
||||||
int parse_debug = 0;
|
int parse_debug = 0;
|
||||||
const char *debug_level = NULL;
|
const char *debug_level = NULL;
|
||||||
int default_config =1;
|
int default_config =1;
|
||||||
@ -1040,6 +1049,7 @@ handle_connections (int listen_fd)
|
|||||||
fd_set fdset, read_fdset;
|
fd_set fdset, read_fdset;
|
||||||
int ret;
|
int ret;
|
||||||
int fd;
|
int fd;
|
||||||
|
int nfd;
|
||||||
|
|
||||||
tattr = pth_attr_new();
|
tattr = pth_attr_new();
|
||||||
pth_attr_set (tattr, PTH_ATTR_JOINABLE, 0);
|
pth_attr_set (tattr, PTH_ATTR_JOINABLE, 0);
|
||||||
@ -1055,13 +1065,18 @@ handle_connections (int listen_fd)
|
|||||||
pth_sigmask (SIG_UNBLOCK, &sigs, NULL);
|
pth_sigmask (SIG_UNBLOCK, &sigs, NULL);
|
||||||
ev = pth_event (PTH_EVENT_SIGS, &sigs, &signo);
|
ev = pth_event (PTH_EVENT_SIGS, &sigs, &signo);
|
||||||
#else
|
#else
|
||||||
ev = NULL;
|
sigs = 0;
|
||||||
|
ev = pth_event (PTH_EVENT_SIGS, &sigs, &signo);
|
||||||
#endif
|
#endif
|
||||||
time_ev = NULL;
|
time_ev = NULL;
|
||||||
|
|
||||||
FD_ZERO (&fdset);
|
FD_ZERO (&fdset);
|
||||||
|
nfd = 0;
|
||||||
if (listen_fd != -1)
|
if (listen_fd != -1)
|
||||||
FD_SET (listen_fd, &fdset);
|
{
|
||||||
|
FD_SET (listen_fd, &fdset);
|
||||||
|
nfd = listen_fd;
|
||||||
|
}
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
@ -1081,7 +1096,8 @@ handle_connections (int listen_fd)
|
|||||||
|
|
||||||
/* Create a timeout event if needed. */
|
/* Create a timeout event if needed. */
|
||||||
if (!time_ev)
|
if (!time_ev)
|
||||||
time_ev = pth_event (PTH_EVENT_TIME, pth_timeout (2, 0));
|
time_ev = pth_event (PTH_EVENT_TIME,
|
||||||
|
pth_timeout (TIMERTICK_INTERVAL, 0));
|
||||||
|
|
||||||
/* POSIX says that fd_set should be implemented as a structure,
|
/* POSIX says that fd_set should be implemented as a structure,
|
||||||
thus a simple assignment is fine to copy the entire set. */
|
thus a simple assignment is fine to copy the entire set. */
|
||||||
@ -1089,7 +1105,7 @@ handle_connections (int listen_fd)
|
|||||||
|
|
||||||
if (time_ev)
|
if (time_ev)
|
||||||
pth_event_concat (ev, time_ev, NULL);
|
pth_event_concat (ev, time_ev, NULL);
|
||||||
ret = pth_select_ev (FD_SETSIZE, &read_fdset, NULL, NULL, NULL, ev);
|
ret = pth_select_ev (nfd+1, &read_fdset, NULL, NULL, NULL, ev);
|
||||||
if (time_ev)
|
if (time_ev)
|
||||||
pth_event_isolate (time_ev);
|
pth_event_isolate (time_ev);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user