From e80d79dcf9f5f9c01c3389f062df7c223ef19c4a Mon Sep 17 00:00:00 2001 From: wk Date: Tue, 11 Nov 2008 08:22:06 +0000 Subject: [PATCH] Minor cleanups. git-svn-id: svn://cvs.gnupg.org/gnupg/trunk@4869 8a63c251-dffc-0310-8ec6-d64dca2275b1 --- NEWS | 3 +++ TODO | 13 +++---------- agent/ChangeLog | 10 ++++++++++ agent/call-scd.c | 2 +- agent/command.c | 10 ++++++++-- jnlib/stringhelp.c | 2 +- po/be.po | 2 +- po/ca.po | 2 +- po/cs.po | 2 +- po/da.po | 2 +- po/de.po | 12 ++++-------- po/el.po | 2 +- po/eo.po | 2 +- po/es.po | 2 +- po/et.po | 2 +- po/fi.po | 2 +- po/fr.po | 2 +- po/gl.po | 2 +- po/hu.po | 2 +- po/id.po | 2 +- po/it.po | 2 +- po/ja.po | 2 +- po/nb.po | 2 +- po/pl.po | 2 +- po/pt.po | 2 +- po/pt_BR.po | 2 +- po/ro.po | 2 +- po/ru.po | 2 +- po/sk.po | 2 +- po/sv.po | 2 +- po/tr.po | 2 +- po/zh_CN.po | 2 +- po/zh_TW.po | 2 +- scd/ChangeLog | 5 +++++ scd/command.c | 35 ++++++++++++++++++++++++++++------- tools/clean-sat.c | 2 ++ 36 files changed, 91 insertions(+), 55 deletions(-) diff --git a/NEWS b/NEWS index 81458a6a..977df647 100644 --- a/NEWS +++ b/NEWS @@ -35,6 +35,9 @@ Noteworthy changes in version 2.0.10 (unreleased) * [w32] The sysconf directory has been moved from a subdirectory of the installation directory to %CSIDL_COMMON_APPDATA%/GNU/etc/gnupg. + * [w32] The gnupg2.nls directory is not anymore used. The standard + locale directory is now used. + * The gpg-preset-passphrase mechanism works again. * Admin PINs are cached again (bug in 2.0.9). diff --git a/TODO b/TODO index ff785799..431a75a5 100644 --- a/TODO +++ b/TODO @@ -59,20 +59,14 @@ * scd ** Application context vs. reader slot We have 2 concurrent method of tracking whether a reader is in use: - Using the session_list in command.c and the lock_table in app.c. IT + Using the session_list in command.c and the lock_table in app.c. It would be better to do this just at one place. First we need to see how we can support cards with multiple applications. -** Detecting a removed card works only after the ticker detected it. - We should check the card status in open-card to make this smoother. - Needs to be integrated with the status file update, though. It is - not a real problem because application will get a card removed - status and should then send a reset to try solving the problem. ** Resolve fixme in do_sign of app-dinsig. ** Add a regression test to check the extkeyusage. * Windows port (W32) -** No card status notifications. ** Regex support is disabled We need to adjust the test to find the regex we have anyway in gpg4win. Is that regex compatible to the OpenPGP requirement? @@ -91,6 +85,7 @@ ** issue a NO_SECKEY xxxx if a -u key was not found. * Extend selinux support to other modules + See also http://etbe.coker.com.au/2008/06/06/se-linux-support-gpg/ * UTF-8 specific TODOs None. @@ -101,9 +96,7 @@ some more work. * Bugs -** After disabling scdaemon and sending a HUP - scdaemon stays as a zombie and gpg-agent does not perform any more - commands. + * Howtos ** Migrate OpenPGP keys to another system diff --git a/agent/ChangeLog b/agent/ChangeLog index caefc5c1..c22797d3 100644 --- a/agent/ChangeLog +++ b/agent/ChangeLog @@ -1,3 +1,13 @@ +2008-11-11 Werner Koch + + * call-scd.c (membuf_data_cb): Change return type to + assuan_error_t to avoid warnings with newer libassuan versions. + +2008-11-04 Werner Koch + + * command.c (cmd_killagent): Stop the agent immediately. + (start_command_handler): Take care of GPG_ERR_EOF. + 2008-10-29 Werner Koch * gpg-agent.c (main): Move USE_STANDARD_SOCKET to the outer scope. diff --git a/agent/call-scd.c b/agent/call-scd.c index 48998da7..c162ad14 100644 --- a/agent/call-scd.c +++ b/agent/call-scd.c @@ -710,7 +710,7 @@ agent_card_serialno (ctrl_t ctrl, char **r_serialno) -static int +static assuan_error_t membuf_data_cb (void *opaque, const void *buffer, size_t length) { membuf_t *data = opaque; diff --git a/agent/command.c b/agent/command.c index f5787621..e3e51f4d 100644 --- a/agent/command.c +++ b/agent/command.c @@ -1362,8 +1362,11 @@ static int cmd_killagent (assuan_context_t ctx, char *line) { ctrl_t ctrl = assuan_get_pointer (ctx); + + (void)line; + ctrl->server_local->stopme = 1; - return 0; + return gpg_error (GPG_ERR_EOF); } /* RELOADAGENT @@ -1373,6 +1376,9 @@ cmd_killagent (assuan_context_t ctx, char *line) static int cmd_reloadagent (assuan_context_t ctx, char *line) { + (void)ctx; + (void)line; + agent_sighup_action (); return 0; } @@ -1666,7 +1672,7 @@ start_command_handler (ctrl_t ctrl, gnupg_fd_t listen_fd, gnupg_fd_t fd) for (;;) { rc = assuan_accept (ctx); - if (rc == -1) + if (gpg_err_code (rc) == GPG_ERR_EOF || rc == -1) { break; } diff --git a/jnlib/stringhelp.c b/jnlib/stringhelp.c index 83c0a9c1..7f09c517 100644 --- a/jnlib/stringhelp.c +++ b/jnlib/stringhelp.c @@ -42,9 +42,9 @@ static inline char * change_slashes (char *name) { +#ifdef HAVE_DRIVE_LETTERS char *p; -#ifdef HAVE_DRIVE_LETTERS if (strchr (name, '\\')) { for (p=name; *p; p++) diff --git a/po/be.po b/po/be.po index 1b0e908d..27d21f91 100644 --- a/po/be.po +++ b/po/be.po @@ -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: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2003-10-30 16:35+0200\n" "Last-Translator: Ales Nyakhaychyk \n" "Language-Team: Belarusian \n" diff --git a/po/ca.po b/po/ca.po index 4c472fcb..b5a68b59 100644 --- a/po/ca.po +++ b/po/ca.po @@ -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: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2005-02-04 02:04+0100\n" "Last-Translator: Jordi Mallach \n" "Language-Team: Catalan \n" diff --git a/po/cs.po b/po/cs.po index cf80ed57..87e8032e 100644 --- a/po/cs.po +++ b/po/cs.po @@ -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: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2004-11-26 09:12+0200\n" "Last-Translator: Roman Pavlik \n" "Language-Team: Czech \n" diff --git a/po/da.po b/po/da.po index fd53ba6c..4cdf4057 100644 --- a/po/da.po +++ b/po/da.po @@ -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: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2003-12-03 16:11+0100\n" "Last-Translator: Birger Langkjer \n" "Language-Team: Danish \n" diff --git a/po/de.po b/po/de.po index f9ea531e..2fbbedf2 100644 --- a/po/de.po +++ b/po/de.po @@ -9,8 +9,8 @@ msgid "" msgstr "" "Project-Id-Version: gnupg-2.0.6\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-28 15:18+0100\n" -"PO-Revision-Date: 2008-06-27 14:10+0200\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" +"PO-Revision-Date: 2008-11-04 18:44+0100\n" "Last-Translator: Walter Koch \n" "Language-Team: German \n" "MIME-Version: 1.0\n" @@ -233,12 +233,8 @@ msgid "" msgid_plural "" "Warning: You have entered an insecure passphrase.%%0AA passphrase should be " "at least %u characters long." -msgstr[0] "" -"WARNUNG: Sie haben eine offensichtlich unsichere%%0APassphrase eingegeben. " -"Eine Passphrase sollte%%0A mindestens %u Zeichen lang sein." -msgstr[1] "" -"WARNUNG: Sie haben eine offensichtlich unsichere%%0APassphrase eingegeben. " -"Eine Passphrase sollte%%0A mindestens %u Zeichen lang sein." +msgstr[0] "WARNUNG: Sie haben eine offensichtlich unsichere%%0APassphrase eingegeben. Eine Passphrase sollte%%0A mindestens %u Zeichen lang sein." +msgstr[1] "WARNUNG: Sie haben eine offensichtlich unsichere%%0APassphrase eingegeben. Eine Passphrase sollte%%0A mindestens %u Zeichen lang sein." #: agent/genkey.c:214 #, c-format diff --git a/po/el.po b/po/el.po index a8a2beea..ee2a6d8e 100644 --- a/po/el.po +++ b/po/el.po @@ -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: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2003-06-27 12:00+0200\n" "Last-Translator: Dokianakis Theofanis \n" "Language-Team: Greek \n" diff --git a/po/eo.po b/po/eo.po index 1a583df5..28bc2bb9 100644 --- a/po/eo.po +++ b/po/eo.po @@ -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: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2002-04-14 14:33+0100\n" "Last-Translator: Edmund GRIMLEY EVANS \n" "Language-Team: Esperanto \n" diff --git a/po/es.po b/po/es.po index 8d307d56..61c5b84e 100644 --- a/po/es.po +++ b/po/es.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg 2.0.9\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2008-05-27 22:38+0100\n" "Last-Translator: Jaime Suárez \n" "Language-Team: Spanish \n" diff --git a/po/et.po b/po/et.po index d1444119..fcb38530 100644 --- a/po/et.po +++ b/po/et.po @@ -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: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2004-06-17 11:04+0300\n" "Last-Translator: Toomas Soome \n" "Language-Team: Estonian \n" diff --git a/po/fi.po b/po/fi.po index 188a09f5..e0554b91 100644 --- a/po/fi.po +++ b/po/fi.po @@ -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: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2004-06-16 22:40+0300\n" "Last-Translator: Tommi Vainikainen \n" "Language-Team: Finnish \n" diff --git a/po/fr.po b/po/fr.po index cb821fe9..2e7d3d07 100644 --- a/po/fr.po +++ b/po/fr.po @@ -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: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2008-09-30 19:38+0200\n" "Last-Translator: Gaël Quéri \n" "Language-Team: French \n" diff --git a/po/gl.po b/po/gl.po index b794e519..3f970a15 100644 --- a/po/gl.po +++ b/po/gl.po @@ -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: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2003-12-04 11:39+0100\n" "Last-Translator: Jacobo Tarrio \n" "Language-Team: Galician \n" diff --git a/po/hu.po b/po/hu.po index fb5c5cca..3bc7b31a 100644 --- a/po/hu.po +++ b/po/hu.po @@ -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: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2004-06-19 21:53+0200\n" "Last-Translator: Nagy Ferenc László \n" "Language-Team: Hungarian \n" diff --git a/po/id.po b/po/id.po index 9d2cd811..d49c0761 100644 --- a/po/id.po +++ b/po/id.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg-id\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2004-06-17 16:32+0700\n" "Last-Translator: Tedi Heriyanto \n" "Language-Team: Indonesian \n" diff --git a/po/it.po b/po/it.po index 0fa3ffc9..0061db30 100644 --- a/po/it.po +++ b/po/it.po @@ -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: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2008-05-26 12:02+0200\n" "Last-Translator: Marco d'Itri \n" "Language-Team: Italian \n" diff --git a/po/ja.po b/po/ja.po index 964b4dbe..4bb0fcd7 100644 --- a/po/ja.po +++ b/po/ja.po @@ -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: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2004-11-23 11:14+0900\n" "Last-Translator: IIDA Yosiaki \n" "Language-Team: Japanese \n" diff --git a/po/nb.po b/po/nb.po index a7556b73..2e7cd3f6 100644 --- a/po/nb.po +++ b/po/nb.po @@ -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: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2006-06-13 20:31+0200\n" "Last-Translator: Trond Endrestøl \n" "Language-Team: Norwegian Bokmål \n" diff --git a/po/pl.po b/po/pl.po index 0203c84e..815b97aa 100644 --- a/po/pl.po +++ b/po/pl.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg-2.0.7\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2007-11-26 19:01+0100\n" "Last-Translator: Jakub Bogusz \n" "Language-Team: Polish \n" diff --git a/po/pt.po b/po/pt.po index 096b8042..74175291 100644 --- a/po/pt.po +++ b/po/pt.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2002-09-13 18:26+0100\n" "Last-Translator: Pedro Morais \n" "Language-Team: pt \n" diff --git a/po/pt_BR.po b/po/pt_BR.po index d37b4e78..b246c250 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg 1.0\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2007-08-16 11:35+0200\n" "Last-Translator:\n" "Language-Team: ?\n" diff --git a/po/ro.po b/po/ro.po index e3d1b2ce..3c6bd7ff 100644 --- a/po/ro.po +++ b/po/ro.po @@ -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: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2005-05-31 22:00-0500\n" "Last-Translator: Laurentiu Buzdugan \n" "Language-Team: Romanian \n" diff --git a/po/ru.po b/po/ru.po index cff79ccd..c4ff56c3 100644 --- a/po/ru.po +++ b/po/ru.po @@ -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: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2006-11-07 19:31+0300\n" "Last-Translator: Maxim Britov \n" "Language-Team: Russian \n" diff --git a/po/sk.po b/po/sk.po index 0f341116..ee784ce2 100644 --- a/po/sk.po +++ b/po/sk.po @@ -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: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2004-07-20 15:52+0200\n" "Last-Translator: Michal Majer \n" "Language-Team: Slovak \n" diff --git a/po/sv.po b/po/sv.po index f26f1f07..8296410f 100644 --- a/po/sv.po +++ b/po/sv.po @@ -24,7 +24,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg trunk\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2008-07-21 09:04+0200\n" "Last-Translator: Daniel Nylander \n" "Language-Team: Swedish \n" diff --git a/po/tr.po b/po/tr.po index 1309328a..dec34e1c 100644 --- a/po/tr.po +++ b/po/tr.po @@ -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: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2006-11-04 03:45+0200\n" "Last-Translator: Nilgün Belma Bugüner \n" "Language-Team: Turkish \n" diff --git a/po/zh_CN.po b/po/zh_CN.po index f40f1d46..0f7e0eb3 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -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: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2006-07-02 10:58+0800\n" "Last-Translator: Meng Jie \n" "Language-Team: Chinese (simplified) \n" diff --git a/po/zh_TW.po b/po/zh_TW.po index a582ced3..10b017e6 100644 --- a/po/zh_TW.po +++ b/po/zh_TW.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg 2.0.9\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2008-10-28 15:18+0100\n" +"POT-Creation-Date: 2008-10-29 09:04+0100\n" "PO-Revision-Date: 2008-03-26 22:35+0800\n" "Last-Translator: Jedi Lin \n" "Language-Team: Chinese (traditional) \n" diff --git a/scd/ChangeLog b/scd/ChangeLog index 14eafd99..200381ca 100644 --- a/scd/ChangeLog +++ b/scd/ChangeLog @@ -1,5 +1,10 @@ 2008-11-03 Werner Koch + * command.c (server_local_s): Add field DISCONNECT_ALLOWED. + (cmd_disconnect): Implement command. + (open_card): Reset disconnect flag. + (update_reader_status_file): Disconnect if allowed. + * app-common.h (app_ctx_s): Remove INITIALIZED. Make REF_COUNT unsigned. * app.c (select_application): Remove INITIALIZED. diff --git a/scd/command.c b/scd/command.c index 9385cbd9..7e1a12a5 100644 --- a/scd/command.c +++ b/scd/command.c @@ -111,6 +111,9 @@ struct server_local_s /* True if the card has been removed and a reset is required to continue operation. */ int card_removed; + + /* A disconnect command has been sent. */ + int disconnect_allowed; }; @@ -408,7 +411,10 @@ open_card (ctrl_t ctrl, const char *apptype) { /* Fixme: We should move the apdu_connect call to select_application. */ - int sw = apdu_connect (slot); + int sw; + + ctrl->server_local->disconnect_allowed = 0; + sw = apdu_connect (slot); if (sw && sw != SW_HOST_ALREADY_CONNECTED) { if (sw == SW_HOST_NO_CARD) @@ -1655,15 +1661,18 @@ cmd_restart (assuan_context_t ctx, char *line) /* DISCONNECT - TBD - -*/ + Disconnect the card if it is not any longer used by other + connections and the backend supports a disconnect operation. + */ static int cmd_disconnect (assuan_context_t ctx, char *line) { - (void)ctx; + ctrl_t ctrl = assuan_get_pointer (ctx); + (void)line; - return gpg_error (GPG_ERR_NOT_IMPLEMENTED); + + ctrl->server_local->disconnect_allowed = 1; + return 0; } @@ -1975,6 +1984,7 @@ update_reader_status_file (int set_card_removed_flag) for (idx=0; idx < DIM(slot_table); idx++) { struct slot_status_s *ss = slot_table + idx; + struct server_local_s *sl; if (!ss->valid || ss->slot == -1) continue; /* Not valid or reader not yet open. */ @@ -1987,7 +1997,6 @@ update_reader_status_file (int set_card_removed_flag) char *fname; char templ[50]; FILE *fp; - struct server_local_s *sl; log_info ("updating status of slot %d to 0x%04X\n", ss->slot, status); @@ -2084,6 +2093,18 @@ update_reader_status_file (int set_card_removed_flag) } } + + /* Check whether a disconnect is pending. */ + for (sl=session_list; sl; sl = sl->next_session) + if (!sl->disconnect_allowed) + break; + if (session_list && !sl) + { + /* At least one connection and all allow a disconnect. */ + log_debug ("disconnecting card in slot %d\n", ss->slot); + apdu_disconnect (ss->slot); + } + } } diff --git a/tools/clean-sat.c b/tools/clean-sat.c index 8b6bfd77..4b44a7bc 100644 --- a/tools/clean-sat.c +++ b/tools/clean-sat.c @@ -17,6 +17,8 @@ main(int argc, char **argv) { int c; + (void)argv; + if( argc > 1 ) { fprintf(stderr, "no arguments, please\n"); return 1; -- 2.11.4.GIT