[svn] GnuPG - r4869 - in trunk: . agent jnlib po scd tools

svn author wk cvs at cvs.gnupg.org
Tue Nov 11 09:22:10 CET 2008


Author: wk
Date: 2008-11-11 09:22:06 +0100 (Tue, 11 Nov 2008)
New Revision: 4869

Modified:
   trunk/NEWS
   trunk/TODO
   trunk/agent/ChangeLog
   trunk/agent/call-scd.c
   trunk/agent/command.c
   trunk/jnlib/stringhelp.c
   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/command.c
   trunk/tools/clean-sat.c
Log:
Minor cleanups.


Modified: trunk/agent/ChangeLog
===================================================================
--- trunk/agent/ChangeLog	2008-11-04 19:54:02 UTC (rev 4868)
+++ trunk/agent/ChangeLog	2008-11-11 08:22:06 UTC (rev 4869)
@@ -1,3 +1,13 @@
+2008-11-11  Werner Koch  <wk at g10code.com>
+
+	* 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  <wk at g10code.com>
+
+	* command.c (cmd_killagent): Stop the agent immediately.
+	(start_command_handler): Take care of GPG_ERR_EOF.
+
 2008-10-29  Werner Koch  <wk at g10code.com>
 
 	* gpg-agent.c (main): Move USE_STANDARD_SOCKET to the outer scope.

Modified: trunk/scd/ChangeLog
===================================================================
--- trunk/scd/ChangeLog	2008-11-04 19:54:02 UTC (rev 4868)
+++ trunk/scd/ChangeLog	2008-11-11 08:22:06 UTC (rev 4869)
@@ -1,5 +1,10 @@
 2008-11-03  Werner Koch  <wk at g10code.com>
 
+	* 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.

Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2008-11-04 19:54:02 UTC (rev 4868)
+++ trunk/NEWS	2008-11-11 08:22:06 UTC (rev 4869)
@@ -35,6 +35,9 @@
  * [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).

Modified: trunk/TODO
===================================================================
--- trunk/TODO	2008-11-04 19:54:02 UTC (rev 4868)
+++ trunk/TODO	2008-11-11 08:22:06 UTC (rev 4869)
@@ -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,10 +96,8 @@
   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
 

Modified: trunk/agent/call-scd.c
===================================================================
--- trunk/agent/call-scd.c	2008-11-04 19:54:02 UTC (rev 4868)
+++ trunk/agent/call-scd.c	2008-11-11 08:22:06 UTC (rev 4869)
@@ -710,7 +710,7 @@
 
 
 
-static int
+static assuan_error_t
 membuf_data_cb (void *opaque, const void *buffer, size_t length)
 {
   membuf_t *data = opaque;

Modified: trunk/agent/command.c
===================================================================
--- trunk/agent/command.c	2008-11-04 19:54:02 UTC (rev 4868)
+++ trunk/agent/command.c	2008-11-11 08:22:06 UTC (rev 4869)
@@ -1362,8 +1362,11 @@
 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 @@
 static int
 cmd_reloadagent (assuan_context_t ctx, char *line)
 {
+  (void)ctx;
+  (void)line;
+
   agent_sighup_action ();
   return 0;
 }
@@ -1666,7 +1672,7 @@
   for (;;)
     {
       rc = assuan_accept (ctx);
-      if (rc == -1)
+      if (gpg_err_code (rc) == GPG_ERR_EOF || rc == -1)
         {
           break;
         }

Modified: trunk/jnlib/stringhelp.c
===================================================================
--- trunk/jnlib/stringhelp.c	2008-11-04 19:54:02 UTC (rev 4868)
+++ trunk/jnlib/stringhelp.c	2008-11-11 08:22:06 UTC (rev 4869)
@@ -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++)

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/command.c
===================================================================
--- trunk/scd/command.c	2008-11-04 19:54:02 UTC (rev 4868)
+++ trunk/scd/command.c	2008-11-11 08:22:06 UTC (rev 4869)
@@ -111,6 +111,9 @@
   /* 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 @@
     {
       /* 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 @@
 
 /* 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 @@
   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 @@
           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 @@
               }
 
         }
+      
+      /* 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);
+        }
+      
     }
 }
 

Modified: trunk/tools/clean-sat.c
===================================================================
--- trunk/tools/clean-sat.c	2008-11-04 19:54:02 UTC (rev 4868)
+++ trunk/tools/clean-sat.c	2008-11-11 08:22:06 UTC (rev 4869)
@@ -17,6 +17,8 @@
 {
     int c;
 
+    (void)argv;
+
     if( argc > 1 ) {
 	fprintf(stderr, "no arguments, please\n");
 	return 1;




More information about the Gnupg-commits mailing list