GNUPG-1-9-BRANCH gnupg (18 files)

cvs user wk cvs at cvs.gnupg.org
Tue Dec 21 10:58:04 CET 2004


    Date: Tuesday, December 21, 2004 @ 11:03:00
  Author: wk
    Path: /cvs/gnupg/gnupg
     Tag: GNUPG-1-9-BRANCH

   Added: common/homedir.c
Modified: TODO agent/ChangeLog agent/gpg-agent.c agent/protect-tool.c
          common/ChangeLog common/Makefile.am common/signal.c
          common/simple-gettext.c common/util.h g10/ChangeLog g10/g10.c
          g10/gpgv.c scd/ChangeLog scd/command.c scd/scdaemon.c
          sm/ChangeLog sm/gpgsm.c

* gpg-agent.c (main): Use default_homedir().
* protect-tool.c (main): Ditto.

* signal.c (got_fatal_signal, got_usr_signal)
(got_fatal_signal) [DOSISH]: Don't build.
* simple-gettext.c: Include sysutils.h 

* homedir.c: New.
* Makefile.am (libcommon_a_SOURCES): Add it.
(EXTRA_DIST): Removed mkerror and mkerrtok.

* gpgv.c, g10.c (main): Use default_hoemdir ().

* scdaemon.c (main): Use default_homedir().

* gpgsm.c (main): Use default_homedir().


-------------------------+
 TODO                    |    2 ++
 agent/ChangeLog         |    6 ++++++
 agent/gpg-agent.c       |    9 +--------
 agent/protect-tool.c    |   11 ++---------
 common/ChangeLog        |   10 ++++++++++
 common/Makefile.am      |    3 +--
 common/homedir.c        |   44 ++++++++++++++++++++++++++++++++++++++++++++
 common/signal.c         |   14 ++++++++++----
 common/simple-gettext.c |    2 +-
 common/util.h           |    4 ++++
 g10/ChangeLog           |    4 ++++
 g10/g10.c               |   11 ++---------
 g10/gpgv.c              |   11 ++---------
 scd/ChangeLog           |    4 ++++
 scd/command.c           |    4 +---
 scd/scdaemon.c          |   14 ++------------
 sm/ChangeLog            |    4 ++++
 sm/gpgsm.c              |   11 ++---------
 18 files changed, 102 insertions(+), 66 deletions(-)


Index: gnupg/TODO
diff -u gnupg/TODO:1.165.2.34 gnupg/TODO:1.165.2.35
--- gnupg/TODO:1.165.2.34	Mon Dec 20 17:17:24 2004
+++ gnupg/TODO	Tue Dec 21 11:03:00 2004
@@ -101,4 +101,6 @@
     Fix is to change everything to libestream
 ** Signals are not support 
     This means we can't reread a configuration
+** No card status notifications.
+
 
Index: gnupg/agent/ChangeLog
diff -u gnupg/agent/ChangeLog:1.59.2.52 gnupg/agent/ChangeLog:1.59.2.53
--- gnupg/agent/ChangeLog:1.59.2.52	Mon Dec 20 17:17:24 2004
+++ gnupg/agent/ChangeLog	Tue Dec 21 11:03:00 2004
@@ -1,3 +1,9 @@
+2004-12-21  Werner Koch  <wk at g10code.com>
+
+	* gpg-agent.c (main): Use default_homedir().
+	* protect-tool.c (main): Ditto.
+	
+
 2004-12-20  Werner Koch  <wk at g10code.com>
 
 	* gpg-agent.c (main) [W32]: Now that Mutexes work we can remove
Index: gnupg/agent/gpg-agent.c
diff -u gnupg/agent/gpg-agent.c:1.31.2.28 gnupg/agent/gpg-agent.c:1.31.2.29
--- gnupg/agent/gpg-agent.c:1.31.2.28	Mon Dec 20 17:17:24 2004
+++ gnupg/agent/gpg-agent.c	Tue Dec 21 11:03:00 2004
@@ -478,15 +478,8 @@
   if (shell && strlen (shell) >= 3 && !strcmp (shell+strlen (shell)-3, "csh") )
     csh_style = 1;
 
+  opt.homedir = default_homedir ();
 
-  opt.homedir = getenv("GNUPGHOME");
-#ifdef HAVE_W32_SYSTEM
-  if (!opt.homedir || !*opt.homedir)
-    opt.homedir = read_w32_registry_string (NULL,
-                                            "Software\\GNU\\GnuPG", "HomeDir");
-#endif /*HAVE_W32_SYSTEM*/
-  if (!opt.homedir || !*opt.homedir)
-    opt.homedir = GNUPG_DEFAULT_HOMEDIR;
 
   /* Check whether we have a config file on the commandline */
   orig_argc = argc;
Index: gnupg/agent/protect-tool.c
diff -u gnupg/agent/protect-tool.c:1.15.2.12 gnupg/agent/protect-tool.c:1.15.2.13
--- gnupg/agent/protect-tool.c:1.15.2.12	Mon Dec 20 17:17:24 2004
+++ gnupg/agent/protect-tool.c	Tue Dec 21 11:03:00 2004
@@ -84,7 +84,7 @@
   };
 
 
-static char *opt_homedir;
+static const char *opt_homedir;
 static int opt_armor;
 static int opt_store;
 static int opt_force;
@@ -1067,14 +1067,7 @@
   gcry_control (GCRYCTL_INIT_SECMEM, 16384, 0);
 
 
-  opt_homedir = getenv ("GNUPGHOME");
-#ifdef HAVE_W32_SYSTEM
-  if (!opt_homedir || !*opt_homedir)
-    opt_homedir = read_w32_registry_string (NULL,
-                                            "Software\\GNU\\GnuPG", "HomeDir");
-#endif /*HAVE_W32_SYSTEM*/
-  if (!opt_homedir || !*opt_homedir)
-    opt_homedir = GNUPG_DEFAULT_HOMEDIR;
+  opt_homedir = default_homedir ();
 
 
   pargs.argc = &argc;
Index: gnupg/common/ChangeLog
diff -u gnupg/common/ChangeLog:1.30.2.38 gnupg/common/ChangeLog:1.30.2.39
--- gnupg/common/ChangeLog:1.30.2.38	Mon Dec 20 17:17:24 2004
+++ gnupg/common/ChangeLog	Tue Dec 21 11:03:00 2004
@@ -1,3 +1,13 @@
+2004-12-21  Werner Koch  <wk at g10code.com>
+
+	* signal.c (got_fatal_signal, got_usr_signal)
+	(got_fatal_signal) [DOSISH]: Don't build.
+	* simple-gettext.c: Include sysutils.h 
+
+	* homedir.c: New.
+	* Makefile.am (libcommon_a_SOURCES): Add it.
+	(EXTRA_DIST): Removed mkerror and mkerrtok.
+
 2004-12-20  Werner Koch  <wk at g10code.com>
 
 	* sysutils.h [W32]: Define sleep.
Index: gnupg/common/Makefile.am
diff -u gnupg/common/Makefile.am:1.15.2.10 gnupg/common/Makefile.am:1.15.2.11
--- gnupg/common/Makefile.am:1.15.2.10	Mon Dec  6 19:28:56 2004
+++ gnupg/common/Makefile.am	Tue Dec 21 11:03:00 2004
@@ -19,8 +19,6 @@
 
 ## Process this file with automake to produce Makefile.in
 
-EXTRA_DIST = mkerrors mkerrtok
-
 noinst_LIBRARIES = libcommon.a libsimple-pwquery.a
 
 AM_CFLAGS =  $(LIBGCRYPT_CFLAGS) $(KSBA_CFLAGS)
@@ -31,6 +29,7 @@
 	sexp-parse.h \
 	maperror.c \
 	sysutils.c sysutils.h \
+	homedir.c \
 	gettime.c \
 	yesno.c \
 	b64enc.c \
Index: gnupg/common/homedir.c
diff -u /dev/null gnupg/common/homedir.c:1.1.2.1
--- /dev/null	Tue Dec 21 11:03:00 2004
+++ gnupg/common/homedir.c	Tue Dec 21 11:03:00 2004
@@ -0,0 +1,44 @@
+/* homedir.c - Setup the home directory.
+ *	Copyright (C) 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GnuPG.
+ *
+ * GnuPG is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GnuPG is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include "util.h"
+#include "sysutils.h"
+
+/* Set up the default home directory.  The usual --homedir option
+   should be parsed later. */
+const char *
+default_homedir (void)
+{
+  const char *dir;
+
+  dir = getenv("GNUPGHOME");
+#ifdef HAVE_W32_SYSTEM
+  if (!dir || !*dir)
+    dir = read_w32_registry_string (NULL, "Software\\GNU\\GnuPG", "HomeDir");
+#endif /*HAVE_W32_SYSTEM*/
+  if (!dir || !*dir)
+    dir = GNUPG_DEFAULT_HOMEDIR;
+
+  return dir;
+}
Index: gnupg/common/signal.c
diff -u gnupg/common/signal.c:1.2 gnupg/common/signal.c:1.2.2.1
--- gnupg/common/signal.c:1.2	Thu Jan  9 13:53:52 2003
+++ gnupg/common/signal.c	Tue Dec 21 11:03:00 2004
@@ -30,15 +30,17 @@
 #include "util.h"
 
 
+#ifndef HAVE_DOSISH_SYSTEM
 static volatile int caught_fatal_sig;
 static volatile int caught_sigusr1;
+#endif
 static void (*cleanup_fnc)(void);
 
 
+#ifndef HAVE_DOSISH_SYSTEM
 static void
 init_one_signal (int sig, RETSIGTYPE (*handler)(int), int check_ign )
 {
-#ifndef HAVE_DOSISH_SYSTEM
 # ifdef HAVE_SIGACTION
   struct sigaction oact, nact;
   
@@ -64,9 +66,10 @@
       signal (sig, SIG_IGN);
     }
 # endif
-#endif /*!HAVE_DOSISH_SYSTEM*/
 }
+#endif /*!HAVE_DOSISH_SYSTEM*/
 
+#ifndef HAVE_DOSISH_SYSTEM
 static const char *
 get_signal_name( int signum )
 {
@@ -76,7 +79,9 @@
   return "some signal";
 #endif
 }
+#endif /*!HAVE_DOSISH_SYSTEM*/
 
+#ifndef HAVE_DOSISH_SYSTEM
 static RETSIGTYPE
 got_fatal_signal (int sig)
 {
@@ -106,14 +111,15 @@
 #endif /* __riscos__ */
   raise( sig );
 }
+#endif /*!HAVE_DOSISH_SYSTEM*/
 
-
+#ifndef HAVE_DOSISH_SYSTEM
 static RETSIGTYPE
 got_usr_signal (int sig)
 {
   caught_sigusr1 = 1;
 }
-
+#endif /*!HAVE_DOSISH_SYSTEM*/
 
 void
 gnupg_init_signals (int mode, void (*fast_cleanup)(void))
Index: gnupg/common/simple-gettext.c
diff -u gnupg/common/simple-gettext.c:1.1.2.1 gnupg/common/simple-gettext.c:1.1.2.2
--- gnupg/common/simple-gettext.c:1.1.2.1	Thu Dec  2 08:48:09 2004
+++ gnupg/common/simple-gettext.c	Tue Dec 21 11:03:00 2004
@@ -40,7 +40,7 @@
 #include <sys/stat.h>
 
 #include "util.h"
-
+#include "sysutils.h"
 
 /* The magic number of the GNU message catalog format.	*/
 #define MAGIC	      0x950412de
Index: gnupg/common/util.h
diff -u gnupg/common/util.h:1.12.2.13 gnupg/common/util.h:1.12.2.14
--- gnupg/common/util.h:1.12.2.13	Mon Dec 20 17:17:24 2004
+++ gnupg/common/util.h	Tue Dec 21 11:03:00 2004
@@ -121,6 +121,10 @@
 gpg_error_t b64enc_finish (struct b64state *state);
 
 
+/*-- homedir. c --*/
+const char *default_homedir (void);
+
+
 /*-- miscellaneous.c --*/
 
 /* Same as asprintf but return an allocated buffer suitable to be
Index: gnupg/g10/ChangeLog
diff -u gnupg/g10/ChangeLog:1.372.2.53 gnupg/g10/ChangeLog:1.372.2.54
--- gnupg/g10/ChangeLog:1.372.2.53	Sat Dec 18 11:22:09 2004
+++ gnupg/g10/ChangeLog	Tue Dec 21 11:03:00 2004
@@ -1,3 +1,7 @@
+2004-12-21  Werner Koch  <wk at g10code.com>
+
+	* gpgv.c, g10.c (main): Use default_hoemdir ().
+
 2004-12-18  Werner Koch  <wk at g10code.com>
 
 	* gpg.h (map_assuan_err): Define in terms of
Index: gnupg/g10/g10.c
diff -u gnupg/g10/g10.c:1.202.2.18 gnupg/g10/g10.c:1.202.2.19
--- gnupg/g10/g10.c:1.202.2.18	Fri Oct 22 18:03:03 2004
+++ gnupg/g10/g10.c	Tue Dec 21 11:03:00 2004
@@ -1264,16 +1264,9 @@
     opt.mangle_dos_filenames = 1;
     opt.use_agent = 1;
 
-#if defined (_WIN32)
-    set_homedir ( read_w32_registry_string( NULL,
-                                    "Software\\GNU\\GnuPG", "HomeDir" ));
-#else
-    set_homedir ( getenv("GNUPGHOME") );
-#endif
-    if( !*opt.homedir )
-	set_homedir ( GNUPG_DEFAULT_HOMEDIR );
+    set_homedir ( default_homedir () );
 
-    /* check whether we have a config file on the commandline */
+    /* Check whether we have a config file on the commandline */
     orig_argc = argc;
     orig_argv = argv;
     pargs.argc = &argc;
Index: gnupg/g10/gpgv.c
diff -u gnupg/g10/gpgv.c:1.12.2.7 gnupg/g10/gpgv.c:1.12.2.8
--- gnupg/g10/gpgv.c:1.12.2.7	Thu Sep 30 23:37:09 2004
+++ gnupg/g10/gpgv.c	Tue Dec 21 11:02:59 2004
@@ -150,15 +150,8 @@
     opt.trust_model = TM_ALWAYS;
     opt.batch = 1;
 
-#if defined (_WIN32)
-    opt.homedir = read_w32_registry_string( NULL, "Software\\GNU\\GnuPG",
-                                            "HomeDir" );
-#else
-    opt.homedir = getenv("GNUPGHOME");
-#endif
-    if( !opt.homedir || !*opt.homedir ) {
-	opt.homedir = GNUPG_DEFAULT_HOMEDIR;
-    }
+    opt.homedir = default_homedir ();
+
     tty_no_terminal(1);
     tty_batchmode(1);
     disable_dotlock();
Index: gnupg/scd/ChangeLog
diff -u gnupg/scd/ChangeLog:1.25.2.62 gnupg/scd/ChangeLog:1.25.2.63
--- gnupg/scd/ChangeLog:1.25.2.62	Sat Dec 18 19:53:31 2004
+++ gnupg/scd/ChangeLog	Tue Dec 21 11:02:59 2004
@@ -1,3 +1,7 @@
+2004-12-21  Werner Koch  <wk at g10code.com>
+
+	* scdaemon.c (main): Use default_homedir().
+
 2004-12-18  Werner Koch  <wk at g10code.com>
 
 	* scdaemon.c (main) [W32]: Remove special Pth initialize..
Index: gnupg/scd/command.c
diff -u gnupg/scd/command.c:1.19.2.14 gnupg/scd/command.c:1.19.2.15
--- gnupg/scd/command.c:1.19.2.14	Wed Dec 15 15:15:08 2004
+++ gnupg/scd/command.c	Tue Dec 21 11:02:59 2004
@@ -1261,9 +1261,7 @@
 
                 log_info ("client pid is %d, sending signal %d\n", pid, signo);
 
-#ifdef HAVE_W32_SYSTEM
-#warning  Need to implement a notification service                
-#else
+#ifndef HAVE_W32_SYSTEM
                 if (pid != (pid_t)(-1) && pid && signo > 0)
                   kill (pid, signo);
 #endif
Index: gnupg/scd/scdaemon.c
diff -u gnupg/scd/scdaemon.c:1.12.2.23 gnupg/scd/scdaemon.c:1.12.2.24
--- gnupg/scd/scdaemon.c:1.12.2.23	Sun Dec 19 18:44:20 2004
+++ gnupg/scd/scdaemon.c	Tue Dec 21 11:02:59 2004
@@ -351,17 +351,12 @@
      Note that this will also do the pth_init. */
 #ifndef HAVE_OPENSC
 #ifdef USE_GNU_PTH
-#ifdef HAVE_W32_SYSTEM
-  /* For W32 we need pth.  */
-  pth_init ();
-#else
   err = gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pth);
   if (err)
     {
       log_fatal ("can't register GNU Pth with Libgcrypt: %s\n",
                  gpg_strerror (err));
     }
-#endif
 #endif /*USE_GNU_PTH*/
 #endif /*!HAVE_OPENSC*/
 
@@ -392,14 +387,9 @@
   if (shell && strlen (shell) >= 3 && !strcmp (shell+strlen (shell)-3, "csh") )
     csh_style = 1;
   
-  /* FIXME: Using this homedir option does only make sense when not
-     running as a system service.  We might want to check for this by
-     looking at the uid or ebtter use an explict option for this */
-  opt.homedir = getenv("GNUPGHOME");
-  if (!opt.homedir || !*opt.homedir)
-    opt.homedir = GNUPG_DEFAULT_HOMEDIR;
+  opt.homedir = default_homedir ();
 
-  /* check whether we have a config file on the commandline */
+  /* Check whether we have a config file on the commandline */
   orig_argc = argc;
   orig_argv = argv;
   pargs.argc = &argc;
Index: gnupg/sm/ChangeLog
diff -u gnupg/sm/ChangeLog:1.101.2.84 gnupg/sm/ChangeLog:1.101.2.85
--- gnupg/sm/ChangeLog:1.101.2.84	Mon Dec 20 17:17:24 2004
+++ gnupg/sm/ChangeLog	Tue Dec 21 11:02:59 2004
@@ -1,3 +1,7 @@
+2004-12-21  Werner Koch  <wk at g10code.com>
+
+	* gpgsm.c (main): Use default_homedir().
+
 2004-12-20  Werner Koch  <wk at g10code.com>
 
 	* call-agent.c (start_agent): Before starting a pipe server start
Index: gnupg/sm/gpgsm.c
diff -u gnupg/sm/gpgsm.c:1.67.2.35 gnupg/sm/gpgsm.c:1.67.2.36
--- gnupg/sm/gpgsm.c:1.67.2.35	Sat Dec 18 19:53:31 2004
+++ gnupg/sm/gpgsm.c	Tue Dec 21 11:02:59 2004
@@ -756,16 +756,9 @@
 
   opt.def_cipher_algoid = "1.2.840.113549.3.7";  /*des-EDE3-CBC*/
 
-#ifdef HAVE_W32_SYSTEM
-  opt.homedir = read_w32_registry_string ( NULL,
-                                           "Software\\GNU\\GnuPG", "HomeDir" );
-#else
-  opt.homedir = getenv ("GNUPGHOME");
-#endif
-  if (!opt.homedir || !*opt.homedir ) 
-    opt.homedir = GNUPG_DEFAULT_HOMEDIR;
+  opt.homedir = default_homedir ();
 
-  /* first check whether we have a config file on the commandline */
+  /* First check whether we have a config file on the commandline */
   orig_argc = argc;
   orig_argv = argv;
   pargs.argc = &argc;




More information about the Gnupg-commits mailing list