[svn] GnuPG - r4938 - in trunk: . agent common jnlib po tools

svn author wk cvs at cvs.gnupg.org
Tue Mar 3 10:03:03 CET 2009


Author: wk
Date: 2009-03-03 10:02:58 +0100 (Tue, 03 Mar 2009)
New Revision: 4938

Modified:
   trunk/ChangeLog
   trunk/NEWS
   trunk/agent/ChangeLog
   trunk/agent/agent.h
   trunk/agent/call-scd.c
   trunk/agent/command.c
   trunk/agent/gpg-agent.c
   trunk/common/ChangeLog
   trunk/common/exechelp.c
   trunk/configure.ac
   trunk/jnlib/argparse.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/tools/ChangeLog
   trunk/tools/gpgconf-comp.c
   trunk/tools/gpgconf.c
   trunk/tools/gpgconf.h
Log:
Add --reload command to gpgconf.
Fix a problem in exechelp.c
Get ready for a release.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-03-02 12:32:54 UTC (rev 4937)
+++ trunk/ChangeLog	2009-03-03 09:02:58 UTC (rev 4938)
@@ -1,3 +1,7 @@
+2009-03-03  Werner Koch  <wk at g10code.com>
+
+	Release 2.0.11.
+
 2009-01-12  Werner Koch  <wk at g10code.com>
 
 	Release 2.0.10.

Modified: trunk/agent/ChangeLog
===================================================================
--- trunk/agent/ChangeLog	2009-03-02 12:32:54 UTC (rev 4937)
+++ trunk/agent/ChangeLog	2009-03-03 09:02:58 UTC (rev 4938)
@@ -1,5 +1,9 @@
 2009-03-02  Werner Koch  <wk at g10code.com>
 
+	* command.c (cmd_getinfo): Add subcommand "scd_running".
+
+	* call-scd.c (agent_scd_check_running): New.
+
 	* gpg-agent.c: Add missing option strings for "--batch" and
 	"--homedir".  Reported by Petr Uzel.
 

Modified: trunk/common/ChangeLog
===================================================================
--- trunk/common/ChangeLog	2009-03-02 12:32:54 UTC (rev 4937)
+++ trunk/common/ChangeLog	2009-03-03 09:02:58 UTC (rev 4938)
@@ -1,3 +1,8 @@
+2009-03-03  Werner Koch  <wk at g10code.com>
+
+	* exechelp.c (do_exec): Make sure that /dev/null connected FDs are
+	not closed.
+
 2009-01-19  Werner Koch  <wk at g10code.com>
 
 	* audit.c (writeout_li): Translate a few more result strings.

Modified: trunk/tools/ChangeLog
===================================================================
--- trunk/tools/ChangeLog	2009-03-02 12:32:54 UTC (rev 4937)
+++ trunk/tools/ChangeLog	2009-03-03 09:02:58 UTC (rev 4938)
@@ -1,3 +1,14 @@
+2009-03-03  Werner Koch  <wk at g10code.com>
+
+	* gpgconf.c: New command --reload.
+
+	* gpgconf-comp.c (gc_component_reload): New.
+
+2009-03-02  Werner Koch  <wk at g10code.com>
+
+	* gpgconf-comp.c (scdaemon_runtime_change): Killsc d only if it is
+	not running.
+
 2009-02-27  Werner Koch  <wk at g10code.com>
 
 	* gpgconf-comp.c (gpg_agent_runtime_change): Declare static.

Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2009-03-02 12:32:54 UTC (rev 4937)
+++ trunk/NEWS	2009-03-03 09:02:58 UTC (rev 4938)
@@ -1,4 +1,4 @@
-Noteworthy changes in version 2.0.11 (unreleased)
+Noteworthy changes in version 2.0.11 (2009-03-03)
 -------------------------------------------------
 
  * Fixed a problem in SCDAEMON which caused unexpected card resets.
@@ -7,6 +7,8 @@
 
  * The SCDAEMON option --allow-admin is now used by default.
 
+ * GPGCONF now restarts SCdaemon if necessary.
+
  * The default cipher algorithm in GPGSM is now again 3DES.  This is
    due to interoperability problems with Outlook 2003 which still
    can't cope with AES.

Modified: trunk/agent/agent.h
===================================================================
--- trunk/agent/agent.h	2009-03-02 12:32:54 UTC (rev 4937)
+++ trunk/agent/agent.h	2009-03-03 09:02:58 UTC (rev 4938)
@@ -320,6 +320,7 @@
 /*-- call-scd.c --*/
 void initialize_module_call_scd (void);
 void agent_scd_dump_state (void);
+int agent_scd_check_running (void);
 void agent_scd_check_aliveness (void);
 int agent_reset_scd (ctrl_t ctrl);
 int agent_card_learn (ctrl_t ctrl,

Modified: trunk/agent/call-scd.c
===================================================================
--- trunk/agent/call-scd.c	2009-03-02 12:32:54 UTC (rev 4937)
+++ trunk/agent/call-scd.c	2009-03-03 09:02:58 UTC (rev 4938)
@@ -409,6 +409,16 @@
 }
 
 
+/* Check whether the SCdaemon is active.  This is a fast check without
+   any locking and might give a wrong result if another thread is about
+   to start the daemon or the daemon is about to be stopped.. */
+int
+agent_scd_check_running (void)
+{
+  return !!primary_scd_ctx;
+}
+
+
 /* Check whether the Scdaemon is still alive and clean it up if not. */
 void
 agent_scd_check_aliveness (void)

Modified: trunk/agent/command.c
===================================================================
--- trunk/agent/command.c	2009-03-02 12:32:54 UTC (rev 4937)
+++ trunk/agent/command.c	2009-03-03 09:02:58 UTC (rev 4938)
@@ -1396,7 +1396,7 @@
      pid         - Return the process id of the server.
      socket_name - Return the name of the socket.
      ssh_socket_name - Return the name of the ssh socket.
-
+     scd_running - Return OK if the SCdaemon is already running.
  */
 static int
 cmd_getinfo (assuan_context_t ctx, char *line)
@@ -1433,6 +1433,10 @@
       else
         rc = gpg_error (GPG_ERR_NO_DATA);
     }
+  else if (!strcmp (line, "scd_running"))
+    {
+      rc = agent_scd_check_running ()? 0 : gpg_error (GPG_ERR_GENERAL);
+    }
   else
     rc = set_error (GPG_ERR_ASS_PARAMETER, "unknown value for WHAT");
   return rc;

Modified: trunk/agent/gpg-agent.c
===================================================================
--- trunk/agent/gpg-agent.c	2009-03-02 12:32:54 UTC (rev 4937)
+++ trunk/agent/gpg-agent.c	2009-03-03 09:02:58 UTC (rev 4938)
@@ -2022,7 +2022,7 @@
       log_error ("socket is now serviced by another server\n");
       rc = 1;
     }
-  else if (opt.verbose)
+  else if (opt.verbose > 1)
     log_error ("socket is still served by this server\n");
     
   xfree (buffer);

Modified: trunk/common/exechelp.c
===================================================================
--- trunk/common/exechelp.c	2009-03-02 12:32:54 UTC (rev 4937)
+++ trunk/common/exechelp.c	2009-03-03 09:02:58 UTC (rev 4938)
@@ -238,7 +238,7 @@
     for (i=0,j=1; argv[i]; i++, j++)
       arg_list[j] = (char*)argv[i];
 
-  /* Connect the standard files. */
+  /* Assign /dev/null to unused FDs. */
   for (i=0; i <= 2; i++)
     {
       if (fds[i] == -1 )
@@ -248,7 +248,12 @@
             log_fatal ("failed to open `%s': %s\n",
                        "/dev/null", strerror (errno));
         }
-      else if (fds[i] != i && dup2 (fds[i], i) == -1)
+    }
+
+  /* Connect the standard files.  */
+  for (i=0; i <= 2; i++)
+    {
+      if (fds[i] != i && dup2 (fds[i], i) == -1)
         log_fatal ("dup2 std%s failed: %s\n",
                    i==0?"in":i==1?"out":"err", strerror (errno));
     }

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2009-03-02 12:32:54 UTC (rev 4937)
+++ trunk/configure.ac	2009-03-03 09:02:58 UTC (rev 4938)
@@ -25,7 +25,7 @@
 # Set my_issvn to "yes" for non-released code.  Remember to run an
 # "svn up" and "autogen.sh" right before creating a distribution.
 m4_define([my_version], [2.0.11])
-m4_define([my_issvn], [yes])
+m4_define([my_issvn], [no])
 
 m4_define([svn_revision], m4_esyscmd([printf "%d" $(svn info 2>/dev/null \
           | sed -n '/^Revision:/ s/[^0-9]//gp'|head -1)]))

Modified: trunk/jnlib/argparse.c
===================================================================
--- trunk/jnlib/argparse.c	2009-03-02 12:32:54 UTC (rev 4937)
+++ trunk/jnlib/argparse.c	2009-03-03 09:02:58 UTC (rev 4938)
@@ -1023,7 +1023,7 @@
   fputs (strusage (11), stdout);
   if ((s=strusage (12)))
     printf (" (%s)", s );
-  printf (" %s\n", strusage (13) );
+  printf (" %s %s\n", strusage (13), "(Gpg4win @PACKAGE_VERSION@)");
   /* Additional version lines. */
   for (i=20; i < 30; i++)
     if ((s=strusage (i)))

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/tools/gpgconf-comp.c
===================================================================
--- trunk/tools/gpgconf-comp.c	2009-03-02 12:32:54 UTC (rev 4937)
+++ trunk/tools/gpgconf-comp.c	2009-03-03 09:02:58 UTC (rev 4938)
@@ -1,5 +1,5 @@
 /* gpgconf-comp.c - Configuration utility for GnuPG.
- * Copyright (C) 2004, 2007, 2008 Free Software Foundation, Inc.
+ * Copyright (C) 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
  *
  * This file is part of GnuPG.
  *
@@ -1051,12 +1051,21 @@
 {
   gpg_error_t err;
   const char *pgmname;
-  const char *argv[2];
+  const char *argv[6];
   pid_t pid;
   
+  /* We use "GETINFO app_running" to see whether the agent is already
+     running and kill it only in this case.  This avoids an explicit
+     starting of the agent in case it is not yet running.  There is
+     obviously a race condition but that should not harm too much.  */
+
   pgmname = gnupg_module_name (GNUPG_MODULE_NAME_CONNECT_AGENT);
-  argv[0] = "scd killscd";
-  argv[1] = NULL;
+  argv[0] = "-s";
+  argv[1] = "GETINFO scd_running";
+  argv[2] = "/if ${! $?}";
+  argv[3] = "scd killscd";
+  argv[4] = "/end";
+  argv[5] = NULL;
   
   err = gnupg_spawn_process_fd (pgmname, argv, -1, -1, -1, &pid);
   if (!err)
@@ -1067,6 +1076,44 @@
 }
 
 
+/* Unconditionally reload COMPONENT or all components if COMPONENT is -1.  */
+void
+gc_component_reload (int component)
+{
+  int runtime[GC_BACKEND_NR];
+  gc_option_t *option;
+  gc_backend_t backend;
+
+  /* Set a flag for the backends to be reloaded.  */
+  for (backend = 0; backend < GC_BACKEND_NR; backend++)
+    runtime[backend] = 0;
+  
+  if (component == -1)
+    {
+      for (component = 0; component < GC_COMPONENT_NR; component++)
+        {
+          option = gc_component[component].options;
+          for (; option && option->name; option++)
+            runtime[option->backend] = 1;
+        }
+    }
+  else
+    {
+      assert (component < GC_COMPONENT_NR);
+      option = gc_component[component].options;
+      for (; option && option->name; option++)
+        runtime[option->backend] = 1;
+    }
+
+  /* Do the reload for all selected backends.  */
+  for (backend = 0; backend < GC_BACKEND_NR; backend++)  
+    {
+      if (runtime[backend] && gc_backend[backend].runtime_change)
+        (*gc_backend[backend].runtime_change) ();
+    }
+}
+
+
 
 /* More or less Robust version of dgettext.  It has the side effect of
    switching the codeset to utf-8 because this is what we want to

Modified: trunk/tools/gpgconf.c
===================================================================
--- trunk/tools/gpgconf.c	2009-03-02 12:32:54 UTC (rev 4937)
+++ trunk/tools/gpgconf.c	2009-03-03 09:02:58 UTC (rev 4938)
@@ -1,5 +1,5 @@
 /* gpgconf.c - Configuration utility for GnuPG
- *	Copyright (C) 2003, 2007 Free Software Foundation, Inc.
+ * Copyright (C) 2003, 2007, 2009 Free Software Foundation, Inc.
  *
  * This file is part of GnuPG.
  *
@@ -47,7 +47,8 @@
     aApplyDefaults,
     aListConfig,
     aCheckConfig,
-    aListDirs
+    aListDirs,
+    aReload
 
   };
 
@@ -70,6 +71,7 @@
       N_("list global configuration file") },
     { aCheckConfig,   "check-config", 256,
       N_("check global configuration file") },
+    { aReload,        "reload", 256, "@" },
 
     { 301, NULL, 0, N_("@\nOptions:\n ") },
     
@@ -176,6 +178,7 @@
         case aApplyDefaults:
         case aListConfig:
         case aCheckConfig:
+        case aReload:
 	  cmd = pargs.r_opt;
 	  break;
 
@@ -233,6 +236,31 @@
 	}
       break;
 
+    case aReload:
+      if (!fname)
+	{
+          /* Reload all.  */
+          gc_component_reload (-1);
+	}
+      else
+        {
+          /* Reload given component.  */
+          int idx;
+
+          idx = gc_component_find (fname);
+          if (idx < 0)
+            {
+              fputs (_("Component not found"), stderr);
+              putc ('\n', stderr);
+              exit (1);
+            }
+          else
+            {
+              gc_component_reload (idx);
+            }
+        }
+      break;
+
     case aListConfig:
       if (gc_process_gpgconf_conf (fname, 0, 0, get_outfp (&outfp)))
         exit (1);

Modified: trunk/tools/gpgconf.h
===================================================================
--- trunk/tools/gpgconf.h	2009-03-02 12:32:54 UTC (rev 4937)
+++ trunk/tools/gpgconf.h	2009-03-03 09:02:58 UTC (rev 4938)
@@ -44,6 +44,9 @@
 
 void gc_error (int status, int errnum, const char *fmt, ...);
 
+/* Reload given component.  */
+void gc_component_reload (int component);
+
 /* List all components that are available.  */
 void gc_component_list_components (FILE *out);
 




More information about the Gnupg-commits mailing list