[svn] GnuPG - r4882 - in trunk: . agent common doc po scd tools
svn author wk
cvs at cvs.gnupg.org
Fri Dec 5 13:01:06 CET 2008
Author: wk
Date: 2008-12-05 13:01:01 +0100 (Fri, 05 Dec 2008)
New Revision: 4882
Modified:
trunk/TODO
trunk/agent/ChangeLog
trunk/agent/learncard.c
trunk/agent/minip12.c
trunk/autogen.sh
trunk/common/ChangeLog
trunk/common/exechelp.c
trunk/doc/scdaemon.texi
trunk/po/be.po
trunk/po/ca.po
trunk/po/cs.po
trunk/po/da.po
trunk/po/de.po
trunk/po/el.po
trunk/po/eo.po
trunk/po/es.po
trunk/po/et.po
trunk/po/fi.po
trunk/po/fr.po
trunk/po/gl.po
trunk/po/hu.po
trunk/po/id.po
trunk/po/it.po
trunk/po/ja.po
trunk/po/nb.po
trunk/po/pl.po
trunk/po/pt.po
trunk/po/pt_BR.po
trunk/po/ro.po
trunk/po/ru.po
trunk/po/sk.po
trunk/po/sv.po
trunk/po/tr.po
trunk/po/zh_CN.po
trunk/po/zh_TW.po
trunk/scd/ChangeLog
trunk/scd/app-openpgp.c
trunk/scd/command.c
trunk/scd/scdaemon.c
trunk/scd/scdaemon.h
trunk/tools/ChangeLog
trunk/tools/gpg-connect-agent.c
trunk/tools/gpgconf-comp.c
Log:
Add option --card-timeout.
Add a new attribyte to app-openpgp.c
Fix two portability bugs.
Have gpg-connect-agent autostart gpg-agent on W32.
Modified: trunk/agent/ChangeLog
===================================================================
--- trunk/agent/ChangeLog 2008-11-20 21:54:47 UTC (rev 4881)
+++ trunk/agent/ChangeLog 2008-12-05 12:01:01 UTC (rev 4882)
@@ -1,3 +1,9 @@
+2008-12-05 Werner Koch <wk at g10code.com>
+
+ * minip12.c (decrypt_block): Fix const modified of CHARSETS.
+ * learncard.c (sinfo_cb_parm_s): Remove superflous semicolon.
+ Reported by Stoyan Angelov.
+
2008-11-18 Werner Koch <wk at g10code.com>
* gpg-agent.c (make_libversion): New.
Modified: trunk/common/ChangeLog
===================================================================
--- trunk/common/ChangeLog 2008-11-20 21:54:47 UTC (rev 4881)
+++ trunk/common/ChangeLog 2008-12-05 12:01:01 UTC (rev 4882)
@@ -1,3 +1,8 @@
+2008-12-05 Werner Koch <wk at g10code.com>
+
+ * exechelp.c (gnupg_spawn_process, gnupg_spawn_process_fd)
+ (gnupg_spawn_process_detached) [W32]: Remove debug output.
+
2008-11-20 Werner Koch <wk at g10code.com>
* audit.c (writeout_li): Translate OKTEXT.
Modified: trunk/scd/ChangeLog
===================================================================
--- trunk/scd/ChangeLog 2008-11-20 21:54:47 UTC (rev 4881)
+++ trunk/scd/ChangeLog 2008-12-05 12:01:01 UTC (rev 4882)
@@ -1,3 +1,15 @@
+2008-12-05 Werner Koch <wk at g10code.com>
+
+ * app-openpgp.c (app_local_s): Add field ALGO_ATTR_CHANGE.
+ (app_select_openpgp): Parse new capability.
+ (show_caps): Show new capability.
+
+2008-12-03 Werner Koch <wk at g10code.com>
+
+ * scdaemon.c (opts): Use ARGPARSE_ macros. Add option
+ --card-timeout.
+ * command.c (update_reader_status_file): Implement it.
+
2008-11-18 Werner Koch <wk at g10code.com>
* scdaemon.c (make_libversion): New.
Modified: trunk/tools/ChangeLog
===================================================================
--- trunk/tools/ChangeLog 2008-11-20 21:54:47 UTC (rev 4881)
+++ trunk/tools/ChangeLog 2008-12-05 12:01:01 UTC (rev 4882)
@@ -1,3 +1,13 @@
+2008-12-05 Werner Koch <wk at g10code.com>
+
+ * gpg-connect-agent.c (opts): Use ARGPARSE_ macros.
+ (start_agent) [W32]: Start agent if not running.
+
+2008-12-03 Werner Koch <wk at g10code.com>
+
+ * gpgconf-comp.c <scdaemon>: Add option --card-timeout. Remove
+ unused option --disable-opensc.
+
2008-10-20 Werner Koch <wk at g10code.com>
* gpgsplit.c (write_part): Remove unused arg FNAME. Change caller.
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2008-11-20 21:54:47 UTC (rev 4881)
+++ trunk/TODO 2008-12-05 12:01:01 UTC (rev 4882)
@@ -63,7 +63,11 @@
would be better to do this just at one place. First we need to see
how we can support cards with multiple applications.
** Resolve fixme in do_sign of app-dinsig.
+** Disconnect
+ Card timeout is currently used as a boolean.
+ Add disconnect support for the ccid driver.
+* Regression tests
** Add a regression test to check the extkeyusage.
* Windows port (W32)
@@ -75,8 +79,6 @@
* sm/
** check that we issue NO_SECKEY xxx if a -u key was not found
We don't. The messages returned are also wrong (recipient vs. signer).
-** gpgsm_format_name2
- Replace by an estream based implementation.
* jnlib/
** Try to remove all jnlib_xmalloc.
Modified: trunk/agent/learncard.c
===================================================================
--- trunk/agent/learncard.c 2008-11-20 21:54:47 UTC (rev 4881)
+++ trunk/agent/learncard.c 2008-12-05 12:01:01 UTC (rev 4882)
@@ -76,7 +76,7 @@
typedef struct sinfo_s *SINFO;
struct sinfo_cb_parm_s {
- int error;;
+ int error;
SINFO info;
};
Modified: trunk/agent/minip12.c
===================================================================
--- trunk/agent/minip12.c 2008-11-20 21:54:47 UTC (rev 4881)
+++ trunk/agent/minip12.c 2008-12-05 12:01:01 UTC (rev 4882)
@@ -498,7 +498,7 @@
int iter, const char *pw, int cipher_algo,
int (*check_fnc) (const void *, size_t))
{
- static const char const *charsets[] = {
+ static const char * const charsets[] = {
"", /* No conversion - use the UTF-8 passphrase direct. */
"ISO-8859-1",
"ISO-8859-15",
Modified: trunk/autogen.sh
===================================================================
--- trunk/autogen.sh 2008-11-20 21:54:47 UTC (rev 4881)
+++ trunk/autogen.sh 2008-12-05 12:01:01 UTC (rev 4882)
@@ -209,5 +209,5 @@
$AUTOCONF${FORCE}
echo "You may now run:
- ./configure --sysconfdir=/etc --enable-maintainer-mode && make
+ ./configure --sysconfdir=/etc --enable-maintainer-mode --enable-symcryptrun --enable-mailto && make
"
Modified: trunk/common/exechelp.c
===================================================================
--- trunk/common/exechelp.c 2008-11-20 21:54:47 UTC (rev 4881)
+++ trunk/common/exechelp.c 2008-12-05 12:01:01 UTC (rev 4882)
@@ -396,7 +396,7 @@
| ((flags & 128)? DETACHED_PROCESS : 0)
| GetPriorityClass (GetCurrentProcess ())
| CREATE_SUSPENDED);
- log_debug ("CreateProcess, path=`%s' cmdline=`%s'\n", pgmname, cmdline);
+/* log_debug ("CreateProcess, path=`%s' cmdline=`%s'\n", pgmname, cmdline); */
if (!CreateProcess (pgmname, /* Program to start. */
cmdline, /* Command line arguments. */
&sec_attr, /* Process security attributes. */
@@ -421,10 +421,10 @@
/* Close the other end of the pipe. */
CloseHandle (fd_to_handle (rp[1]));
- log_debug ("CreateProcess ready: hProcess=%p hThread=%p"
- " dwProcessID=%d dwThreadId=%d\n",
- pi.hProcess, pi.hThread,
- (int) pi.dwProcessId, (int) pi.dwThreadId);
+/* log_debug ("CreateProcess ready: hProcess=%p hThread=%p" */
+/* " dwProcessID=%d dwThreadId=%d\n", */
+/* pi.hProcess, pi.hThread, */
+/* (int) pi.dwProcessId, (int) pi.dwThreadId); */
/* Process has been created suspended; resume it now. */
ResumeThread (pi.hThread);
@@ -558,7 +558,7 @@
si.hStdOutput = outfd == -1? stdhd[1] : (void*)_get_osfhandle (outfd);
si.hStdError = errfd == -1? stdhd[2] : (void*)_get_osfhandle (errfd);
- log_debug ("CreateProcess, path=`%s' cmdline=`%s'\n", pgmname, cmdline);
+/* log_debug ("CreateProcess, path=`%s' cmdline=`%s'\n", pgmname, cmdline); */
if (!CreateProcess (pgmname, /* Program to start. */
cmdline, /* Command line arguments. */
&sec_attr, /* Process security attributes. */
@@ -585,10 +585,10 @@
if (err)
return err;
- log_debug ("CreateProcess ready: hProcess=%p hThread=%p"
- " dwProcessID=%d dwThreadId=%d\n",
- pi.hProcess, pi.hThread,
- (int) pi.dwProcessId, (int) pi.dwThreadId);
+/* log_debug ("CreateProcess ready: hProcess=%p hThread=%p" */
+/* " dwProcessID=%d dwThreadId=%d\n", */
+/* pi.hProcess, pi.hThread, */
+/* (int) pi.dwProcessId, (int) pi.dwThreadId); */
/* Process has been created suspended; resume it now. */
ResumeThread (pi.hThread);
@@ -796,8 +796,8 @@
| GetPriorityClass (GetCurrentProcess ())
| CREATE_NEW_PROCESS_GROUP
| DETACHED_PROCESS);
- log_debug ("CreateProcess(detached), path=`%s' cmdline=`%s'\n",
- pgmname, cmdline);
+/* log_debug ("CreateProcess(detached), path=`%s' cmdline=`%s'\n", */
+/* pgmname, cmdline); */
if (!CreateProcess (pgmname, /* Program to start. */
cmdline, /* Command line arguments. */
&sec_attr, /* Process security attributes. */
@@ -817,10 +817,10 @@
xfree (cmdline);
cmdline = NULL;
- log_debug ("CreateProcess(detached) ready: hProcess=%p hThread=%p"
- " dwProcessID=%d dwThreadId=%d\n",
- pi.hProcess, pi.hThread,
- (int) pi.dwProcessId, (int) pi.dwThreadId);
+/* log_debug ("CreateProcess(detached) ready: hProcess=%p hThread=%p" */
+/* " dwProcessID=%d dwThreadId=%d\n", */
+/* pi.hProcess, pi.hThread, */
+/* (int) pi.dwProcessId, (int) pi.dwThreadId); */
CloseHandle (pi.hThread);
Modified: trunk/doc/scdaemon.texi
===================================================================
--- trunk/doc/scdaemon.texi 2008-11-20 21:54:47 UTC (rev 4881)
+++ trunk/doc/scdaemon.texi 2008-12-05 12:01:01 UTC (rev 4882)
@@ -252,7 +252,21 @@
@end smallexample
+ at item --card-timeout @var{n}
+ at opindex card-timeout
+If @var{n} is not 0 and no client is actively using the card, the card
+will be powered down after @var{n} seconds. Powering down the card
+avoids a potential risk of damaging a card when used with certain
+cheap readers. This also allows non Scdaemon aware applications to
+access the card. The disadvantage of using a card timeout is that
+accessing the card takes longer and that the user needs to enter the
+PIN again after the next power up.
+Note that with the current version of Scdaemon the card is powered
+down immediatley at the next timer tick for any value of @var{n} other
+than 0.
+
+
@item --disable-keypad
@opindex disable-keypad
Even if a card reader features a keypad, do not try to use it.
Modified: trunk/po/be.po [not shown]
Modified: trunk/po/ca.po [not shown]
Modified: trunk/po/cs.po [not shown]
Modified: trunk/po/da.po [not shown]
Modified: trunk/po/de.po [not shown]
Modified: trunk/po/el.po [not shown]
Modified: trunk/po/eo.po [not shown]
Modified: trunk/po/es.po [not shown]
Modified: trunk/po/et.po [not shown]
Modified: trunk/po/fi.po [not shown]
Modified: trunk/po/fr.po [not shown]
Modified: trunk/po/gl.po [not shown]
Modified: trunk/po/hu.po [not shown]
Modified: trunk/po/id.po [not shown]
Modified: trunk/po/it.po [not shown]
Modified: trunk/po/ja.po [not shown]
Modified: trunk/po/nb.po [not shown]
Modified: trunk/po/pl.po [not shown]
Modified: trunk/po/pt.po [not shown]
Modified: trunk/po/pt_BR.po [not shown]
Modified: trunk/po/ro.po [not shown]
Modified: trunk/po/ru.po [not shown]
Modified: trunk/po/sk.po [not shown]
Modified: trunk/po/sv.po [not shown]
Modified: trunk/po/tr.po [not shown]
Modified: trunk/po/zh_CN.po [not shown]
Modified: trunk/po/zh_TW.po [not shown]
Modified: trunk/scd/app-openpgp.c
===================================================================
--- trunk/scd/app-openpgp.c 2008-11-20 21:54:47 UTC (rev 4881)
+++ trunk/scd/app-openpgp.c 2008-12-05 12:01:01 UTC (rev 4882)
@@ -167,13 +167,14 @@
/* Keep track of extended card capabilities. */
struct
{
- unsigned int is_v2:1; /* This is a v2.0 compatible card. */
+ unsigned int is_v2:1; /* This is a v2.0 compatible card. */
unsigned int get_challenge:1;
unsigned int key_import:1;
unsigned int change_force_chv:1;
unsigned int private_dos:1;
- unsigned int sm_supported:1; /* Secure Messaging is supported. */
- unsigned int sm_aes128:1; /* Use AES-128 for SM. */
+ unsigned int algo_attr_change:1; /* Algorithm attributes changeable. */
+ unsigned int sm_supported:1; /* Secure Messaging is supported. */
+ unsigned int sm_aes128:1; /* Use AES-128 for SM. */
unsigned int max_certlen_3:16;
unsigned int max_get_challenge:16; /* Maximum size for get_challenge. */
unsigned int max_cmd_data:16; /* Maximum data size for a command. */
@@ -3154,6 +3155,7 @@
log_info ("Key-Import .....: %s\n", s->extcap.key_import? "yes":"no");
log_info ("Change-Force-PW1: %s\n", s->extcap.change_force_chv? "yes":"no");
log_info ("Private-DOs ....: %s\n", s->extcap.private_dos? "yes":"no");
+ log_info ("Algo-Attr-Change: %s\n", s->extcap.algo_attr_change? "yes":"no");
log_info ("SM-Support .....: %s", s->extcap.sm_supported? "yes":"no");
if (s->extcap.sm_supported)
log_printf (" (%s)", s->extcap.sm_aes128? "AES-128":"3DES");
@@ -3376,6 +3378,7 @@
app->app_local->extcap.key_import = !!(*buffer & 0x20);
app->app_local->extcap.change_force_chv = !!(*buffer & 0x10);
app->app_local->extcap.private_dos = !!(*buffer & 0x08);
+ app->app_local->extcap.algo_attr_change = !!(*buffer & 0x04);
}
if (buflen >= 10)
{
Modified: trunk/scd/command.c
===================================================================
--- trunk/scd/command.c 2008-11-20 21:54:47 UTC (rev 4881)
+++ trunk/scd/command.c 2008-12-05 12:01:01 UTC (rev 4882)
@@ -2095,14 +2095,18 @@
}
/* Check whether a disconnect is pending. */
- for (sl=session_list; sl; sl = sl->next_session)
- if (!sl->disconnect_allowed)
- break;
- if (session_list && !sl)
+ if (opt.card_timeout)
{
- /* At least one connection and all allow a disconnect. */
- log_debug ("disconnecting card in slot %d\n", ss->slot);
- apdu_disconnect (ss->slot);
+ for (sl=session_list; sl; sl = sl->next_session)
+ if (!sl->disconnect_allowed)
+ break;
+ if (session_list && !sl)
+ {
+ /* FIXME: Use a real timeout. */
+ /* At least one connection and all allow a disconnect. */
+ log_debug ("disconnecting card in slot %d\n", ss->slot);
+ apdu_disconnect (ss->slot);
+ }
}
}
Modified: trunk/scd/scdaemon.c
===================================================================
--- trunk/scd/scdaemon.c 2008-11-20 21:54:47 UTC (rev 4881)
+++ trunk/scd/scdaemon.c 2008-12-05 12:01:01 UTC (rev 4882)
@@ -80,6 +80,7 @@
oDaemon,
oBatch,
oReaderPort,
+ oCardTimeout,
octapiDriver,
opcscDriver,
oDisableCCID,
@@ -94,46 +95,53 @@
static ARGPARSE_OPTS opts[] = {
-
- { aGPGConfList, "gpgconf-list", 256, "@" },
- { aGPGConfTest, "gpgconf-test", 256, "@" },
+ ARGPARSE_c (aGPGConfList, "gpgconf-list", "@"),
+ ARGPARSE_c (aGPGConfTest, "gpgconf-test", "@"),
- { 301, NULL, 0, N_("@Options:\n ") },
+ ARGPARSE_group (301, N_("@Options:\n ")),
- { oServer, "server", 0, N_("run in server mode (foreground)") },
- { oMultiServer, "multi-server", 0,
- N_("run in multi server mode (foreground)") },
- { oDaemon, "daemon", 0, N_("run in daemon mode (background)") },
- { oVerbose, "verbose", 0, N_("verbose") },
- { oQuiet, "quiet", 0, N_("be somewhat more quiet") },
- { oSh, "sh", 0, N_("sh-style command output") },
- { oCsh, "csh", 0, N_("csh-style command output") },
- { oOptions, "options" , 2, N_("read options from file")},
- { oDebug, "debug" ,4|16, "@"},
- { oDebugAll, "debug-all" ,0, "@"},
- { oDebugLevel, "debug-level" ,2, "@"},
- { oDebugWait,"debug-wait",1, "@"},
- { oDebugAllowCoreDump, "debug-allow-core-dump", 0, "@" },
- { oDebugCCIDDriver, "debug-ccid-driver", 0, "@"},
- { oDebugDisableTicker, "debug-disable-ticker", 0, "@"},
- { oNoDetach, "no-detach" ,0, N_("do not detach from the console")},
- { oLogFile, "log-file" ,2, N_("use a log file for the server")},
- { oReaderPort, "reader-port", 2, N_("|N|connect to reader at port N")},
- { octapiDriver, "ctapi-driver", 2, N_("|NAME|use NAME as ct-API driver")},
- { opcscDriver, "pcsc-driver", 2, N_("|NAME|use NAME as PC/SC driver")},
- { oDisableCCID, "disable-ccid", 0,
+ ARGPARSE_s_n (oServer,"server", N_("run in server mode (foreground)")),
+ ARGPARSE_s_n (oMultiServer, "multi-server",
+ N_("run in multi server mode (foreground)")),
+ ARGPARSE_s_n (oDaemon, "daemon", N_("run in daemon mode (background)")),
+ ARGPARSE_s_n (oVerbose, "verbose", N_("verbose")),
+ ARGPARSE_s_n (oQuiet, "quiet", N_("be somewhat more quiet")),
+ ARGPARSE_s_n (oSh, "sh", N_("sh-style command output")),
+ ARGPARSE_s_n (oCsh, "csh", N_("csh-style command output")),
+ ARGPARSE_s_s (oOptions, "options", N_("|FILE|read options from FILE")),
+ ARGPARSE_p_u (oDebug, "debug", "@"),
+ ARGPARSE_s_n (oDebugAll, "debug-all", "@"),
+ ARGPARSE_s_s (oDebugLevel, "debug-level" ,
+ N_("|LEVEL|set the debugging level to LEVEL")),
+ ARGPARSE_s_i (oDebugWait, "debug-wait", "@"),
+ ARGPARSE_s_n (oDebugAllowCoreDump, "debug-allow-core-dump", "@"),
+ ARGPARSE_s_n (oDebugCCIDDriver, "debug-ccid-driver", "@"),
+ ARGPARSE_s_n (oDebugDisableTicker, "debug-disable-ticker", "@"),
+ ARGPARSE_s_n (oNoDetach, "no-detach", N_("do not detach from the console")),
+ ARGPARSE_s_s (oLogFile, "log-file", N_("|FILE|write a log to FILE")),
+ ARGPARSE_s_s (oReaderPort, "reader-port",
+ N_("|N|connect to reader at port N")),
+ ARGPARSE_s_s (octapiDriver, "ctapi-driver",
+ N_("|NAME|use NAME as ct-API driver")),
+ ARGPARSE_s_s (opcscDriver, "pcsc-driver",
+ N_("|NAME|use NAME as PC/SC driver")),
+ ARGPARSE_s_n (oDisableCCID, "disable-ccid",
#ifdef HAVE_LIBUSB
N_("do not use the internal CCID driver")
#else
"@"
#endif
- /* end --disable-ccid */},
- { oDisableKeypad, "disable-keypad", 0, N_("do not use a reader's keypad")},
- { oAllowAdmin, "allow-admin", 0, N_("allow the use of admin card commands")},
- { oDenyAdmin, "deny-admin", 0, "@" },
- { oDisableApplication, "disable-application", 2, "@"},
-
- {0}
+ /* end --disable-ccid */),
+ ARGPARSE_s_u (oCardTimeout, "card-timeout",
+ N_("|N|disconnect the card after N seconds of inactivity")),
+ ARGPARSE_s_n (oDisableKeypad, "disable-keypad",
+ N_("do not use a reader's keypad")),
+ ARGPARSE_s_n (oAllowAdmin, "allow-admin",
+ N_("allow the use of admin card commands")),
+ ARGPARSE_s_n (oDenyAdmin, "deny-admin", "@"),
+ ARGPARSE_s_s (oDisableApplication, "disable-application", "@"),
+
+ ARGPARSE_end ()
};
@@ -528,12 +536,16 @@
case oAllowAdmin: opt.allow_admin = 1; break;
case oDenyAdmin: opt.allow_admin = 0; break;
+
+ case oCardTimeout: opt.card_timeout = pargs.r.ret_ulong; break;
case oDisableApplication:
add_to_strlist (&opt.disabled_applications, pargs.r.ret_str);
break;
- default : pargs.err = configfp? 1:2; break;
+ default:
+ pargs.err = configfp? ARGPARSE_PRINT_WARNING:ARGPARSE_PRINT_ERROR;
+ break;
}
}
if (configfp)
@@ -619,6 +631,7 @@
#endif
printf ("allow-admin:%lu:\n", GC_OPT_FLAG_NONE );
printf ("disable-keypad:%lu:\n", GC_OPT_FLAG_NONE );
+ printf ("card-timeout:%lu:%d:\n", GC_OPT_FLAG_DEFAULT, 0);
scd_exit (0);
}
Modified: trunk/scd/scdaemon.h
===================================================================
--- trunk/scd/scdaemon.h 2008-11-20 21:54:47 UTC (rev 4881)
+++ trunk/scd/scdaemon.h 2008-12-05 12:01:01 UTC (rev 4882)
@@ -61,6 +61,7 @@
cards. */
strlist_t disabled_applications; /* Card applications we do not
want to use. */
+ unsigned long card_timeout; /* Disconnect after N seconds of inactivity. */
} opt;
Modified: trunk/tools/gpg-connect-agent.c
===================================================================
--- trunk/tools/gpg-connect-agent.c 2008-11-20 21:54:47 UTC (rev 4881)
+++ trunk/tools/gpg-connect-agent.c 2008-12-05 12:01:01 UTC (rev 4882)
@@ -34,7 +34,11 @@
#include "../common/sysutils.h"
#include "../common/membuf.h"
#include "../common/ttyio.h"
+#ifdef HAVE_W32_SYSTEM
+# include "../common/exechelp.h"
+#endif
+
#define CONTROL_D ('D' - 'A' + 1)
#define octdigitp(p) (*(p) >= '0' && *(p) <= '7')
@@ -59,27 +63,30 @@
/* The list of commands and options. */
-static ARGPARSE_OPTS opts[] =
- {
- { 301, NULL, 0, N_("@\nOptions:\n ") },
+static ARGPARSE_OPTS opts[] = {
+ ARGPARSE_group (301, N_("@\nOptions:\n ")),
- { oVerbose, "verbose", 0, N_("verbose") },
- { oQuiet, "quiet", 0, N_("quiet") },
- { oHex, "hex", 0, N_("print data out hex encoded") },
- { oDecode,"decode", 0, N_("decode received data lines") },
- { oRawSocket, "raw-socket", 2, N_("|NAME|connect to Assuan socket NAME")},
- { oExec, "exec", 0, N_("run the Assuan server given on the command line")},
- { oNoExtConnect, "no-ext-connect",
- 0, N_("do not use extended connect mode")},
- { oRun, "run", 2, N_("|FILE|run commands from FILE on startup")},
- { oSubst, "subst", 0, N_("run /subst on startup")},
- /* hidden options */
- { oNoVerbose, "no-verbose", 0, "@"},
- { oHomedir, "homedir", 2, "@" },
- {0}
- };
+ ARGPARSE_s_n (oVerbose, "verbose", N_("verbose")),
+ ARGPARSE_s_n (oQuiet, "quiet", N_("quiet")),
+ ARGPARSE_s_n (oHex, "hex", N_("print data out hex encoded")),
+ ARGPARSE_s_n (oDecode,"decode", N_("decode received data lines")),
+ ARGPARSE_s_s (oRawSocket, "raw-socket",
+ N_("|NAME|connect to Assuan socket NAME")),
+ ARGPARSE_s_n (oExec, "exec",
+ N_("run the Assuan server given on the command line")),
+ ARGPARSE_s_n (oNoExtConnect, "no-ext-connect",
+ N_("do not use extended connect mode")),
+ ARGPARSE_s_s (oRun, "run",
+ N_("|FILE|run commands from FILE on startup")),
+ ARGPARSE_s_n (oSubst, "subst", N_("run /subst on startup")),
+ ARGPARSE_s_n (oNoVerbose, "no-verbose", "@"),
+ ARGPARSE_s_s (oHomedir, "homedir", "@" ),
+ ARGPARSE_end ()
+};
+
+
/* We keep all global options in the structure OPT. */
struct
{
@@ -2081,6 +2088,38 @@
/* Check whether we can connect at the standard socket. */
sockname = make_filename (opt.homedir, "S.gpg-agent", NULL);
rc = assuan_socket_connect (&ctx, sockname, 0);
+
+#ifdef HAVE_W32_SYSTEM
+ /* If we failed to connect under Windows, we fire up the agent. */
+ if (gpg_err_code (rc) == GPG_ERR_ASS_CONNECT_FAILED)
+ {
+ const char *agent_program;
+ const char *argv[3];
+ int save_rc = rc;
+
+ if (opt.verbose)
+ log_info (_("no running gpg-agent - starting one\n"));
+ agent_program = gnupg_module_name (GNUPG_MODULE_NAME_AGENT);
+
+ argv[0] = "--daemon";
+ argv[1] = "--use-standard-socket";
+ argv[2] = NULL;
+
+ rc = gnupg_spawn_process_detached (agent_program, argv, NULL);
+ if (rc)
+ log_debug ("failed to start agent `%s': %s\n",
+ agent_program, gpg_strerror (rc));
+ else
+ {
+ /* Give the agent some time to prepare itself. */
+ gnupg_sleep (3);
+ /* Now try again to connect the agent. */
+ rc = assuan_socket_connect (&ctx, sockname, 0);
+ }
+ if (rc)
+ rc = save_rc;
+ }
+#endif /*HAVE_W32_SYSTEM*/
xfree (sockname);
}
else
Modified: trunk/tools/gpgconf-comp.c
===================================================================
--- trunk/tools/gpgconf-comp.c 2008-11-20 21:54:47 UTC (rev 4881)
+++ trunk/tools/gpgconf-comp.c 2008-12-05 12:01:01 UTC (rev 4882)
@@ -599,15 +599,15 @@
{ "pcsc-driver", GC_OPT_FLAG_NONE, GC_LEVEL_ADVANCED,
"gnupg", "|NAME|use NAME as PC/SC driver",
GC_ARG_TYPE_STRING, GC_BACKEND_SCDAEMON },
- { "disable-opensc", GC_OPT_FLAG_NONE, GC_LEVEL_EXPERT,
- "gnupg", "do not use the OpenSC layer",
- GC_ARG_TYPE_NONE, GC_BACKEND_SCDAEMON },
{ "disable-ccid", GC_OPT_FLAG_NONE, GC_LEVEL_EXPERT,
"gnupg", "do not use the internal CCID driver",
GC_ARG_TYPE_NONE, GC_BACKEND_SCDAEMON },
{ "disable-keypad", GC_OPT_FLAG_NONE, GC_LEVEL_BASIC,
"gnupg", "do not use a reader's keypad",
GC_ARG_TYPE_NONE, GC_BACKEND_SCDAEMON },
+ { "card-timeout", GC_OPT_FLAG_NONE, GC_LEVEL_BASIC,
+ "gnupg", "|N|disconnect the card after N seconds of inactivity",
+ GC_ARG_TYPE_UINT32, GC_BACKEND_SCDAEMON },
{ "Debug",
GC_OPT_FLAG_GROUP, GC_LEVEL_ADVANCED,
@@ -616,7 +616,7 @@
"gnupg", "|LEVEL|set the debugging level to LEVEL",
GC_ARG_TYPE_STRING, GC_BACKEND_SCDAEMON },
{ "log-file", GC_OPT_FLAG_NONE, GC_LEVEL_ADVANCED,
- "gnupg", N_("|FILE|write server mode logs to FILE"),
+ "gnupg", N_("|FILE|write a log to FILE"),
GC_ARG_TYPE_FILENAME, GC_BACKEND_SCDAEMON },
{ "Security",
More information about the Gnupg-commits
mailing list