aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--TODO2
-rw-r--r--agent/ChangeLog6
-rw-r--r--agent/gpg-agent.c9
-rw-r--r--agent/protect-tool.c11
-rw-r--r--common/ChangeLog10
-rw-r--r--common/Makefile.am3
-rw-r--r--common/homedir.c44
-rw-r--r--common/signal.c14
-rw-r--r--common/simple-gettext.c2
-rw-r--r--common/util.h4
-rw-r--r--g10/ChangeLog4
-rw-r--r--g10/g10.c11
-rw-r--r--g10/gpgv.c11
-rw-r--r--scd/ChangeLog4
-rw-r--r--scd/command.c4
-rw-r--r--scd/scdaemon.c16
-rw-r--r--sm/ChangeLog4
-rw-r--r--sm/gpgsm.c11
18 files changed, 103 insertions, 67 deletions
diff --git a/TODO b/TODO
index c7eca304e..16311a204 100644
--- a/TODO
+++ b/TODO
@@ -101,4 +101,6 @@ might want to have an agent context for each service request
Fix is to change everything to libestream
** Signals are not support
This means we can't reread a configuration
+** No card status notifications.
+
diff --git a/agent/ChangeLog b/agent/ChangeLog
index 507a90c9d..cf3569264 100644
--- a/agent/ChangeLog
+++ b/agent/ChangeLog
@@ -1,3 +1,9 @@
+2004-12-21 Werner Koch <[email protected]>
+
+ * gpg-agent.c (main): Use default_homedir().
+ * protect-tool.c (main): Ditto.
+
+
2004-12-20 Werner Koch <[email protected]>
* gpg-agent.c (main) [W32]: Now that Mutexes work we can remove
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index 911afb881..2c3d834a5 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -478,15 +478,8 @@ main (int argc, char **argv )
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;
diff --git a/agent/protect-tool.c b/agent/protect-tool.c
index 43dd67eea..ee0276a43 100644
--- a/agent/protect-tool.c
+++ b/agent/protect-tool.c
@@ -84,7 +84,7 @@ struct rsa_secret_key_s
};
-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 @@ main (int argc, char **argv )
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;
diff --git a/common/ChangeLog b/common/ChangeLog
index 11bf8029a..667deb51a 100644
--- a/common/ChangeLog
+++ b/common/ChangeLog
@@ -1,3 +1,13 @@
+2004-12-21 Werner Koch <[email protected]>
+
+ * 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 <[email protected]>
* sysutils.h [W32]: Define sleep.
diff --git a/common/Makefile.am b/common/Makefile.am
index 795d66a1a..ccbaaad75 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -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 @@ libcommon_a_SOURCES = \
sexp-parse.h \
maperror.c \
sysutils.c sysutils.h \
+ homedir.c \
gettime.c \
yesno.c \
b64enc.c \
diff --git a/common/homedir.c b/common/homedir.c
new file mode 100644
index 000000000..8b5bc9f05
--- /dev/null
+++ b/common/homedir.c
@@ -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;
+}
diff --git a/common/signal.c b/common/signal.c
index dc026c10f..4e773c4c0 100644
--- a/common/signal.c
+++ b/common/signal.c
@@ -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 @@ init_one_signal (int sig, RETSIGTYPE (*handler)(int), int check_ign )
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 @@ get_signal_name( int signum )
return "some signal";
#endif
}
+#endif /*!HAVE_DOSISH_SYSTEM*/
+#ifndef HAVE_DOSISH_SYSTEM
static RETSIGTYPE
got_fatal_signal (int sig)
{
@@ -106,14 +111,15 @@ got_fatal_signal (int sig)
#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))
diff --git a/common/simple-gettext.c b/common/simple-gettext.c
index 4287606e3..b6b851c77 100644
--- a/common/simple-gettext.c
+++ b/common/simple-gettext.c
@@ -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
diff --git a/common/util.h b/common/util.h
index 1159da925..4ab55acb4 100644
--- a/common/util.h
+++ b/common/util.h
@@ -121,6 +121,10 @@ gpg_error_t b64enc_write (struct b64state *state,
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
diff --git a/g10/ChangeLog b/g10/ChangeLog
index 6966bbd7b..bd4b54894 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,7 @@
+2004-12-21 Werner Koch <[email protected]>
+
+ * gpgv.c, g10.c (main): Use default_hoemdir ().
+
2004-12-18 Werner Koch <[email protected]>
* gpg.h (map_assuan_err): Define in terms of
diff --git a/g10/g10.c b/g10/g10.c
index 039074f6b..e02ad0d13 100644
--- a/g10/g10.c
+++ b/g10/g10.c
@@ -1264,16 +1264,9 @@ main( int argc, char **argv )
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;
diff --git a/g10/gpgv.c b/g10/gpgv.c
index 015736c33..0a97d56b9 100644
--- a/g10/gpgv.c
+++ b/g10/gpgv.c
@@ -150,15 +150,8 @@ main( int argc, char **argv )
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();
diff --git a/scd/ChangeLog b/scd/ChangeLog
index 68421fc86..ece9abc4f 100644
--- a/scd/ChangeLog
+++ b/scd/ChangeLog
@@ -1,3 +1,7 @@
+2004-12-21 Werner Koch <[email protected]>
+
+ * scdaemon.c (main): Use default_homedir().
+
2004-12-18 Werner Koch <[email protected]>
* scdaemon.c (main) [W32]: Remove special Pth initialize..
diff --git a/scd/command.c b/scd/command.c
index b99fffc09..b41e7aa16 100644
--- a/scd/command.c
+++ b/scd/command.c
@@ -1261,9 +1261,7 @@ scd_update_reader_status_file (void)
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
diff --git a/scd/scdaemon.c b/scd/scdaemon.c
index 49e392e7d..88f393bb1 100644
--- a/scd/scdaemon.c
+++ b/scd/scdaemon.c
@@ -351,17 +351,12 @@ main (int argc, char **argv )
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 @@ main (int argc, char **argv )
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;
-
- /* check whether we have a config file on the commandline */
+ opt.homedir = default_homedir ();
+
+ /* Check whether we have a config file on the commandline */
orig_argc = argc;
orig_argv = argv;
pargs.argc = &argc;
diff --git a/sm/ChangeLog b/sm/ChangeLog
index 19e7b0e8d..0dcaa9c20 100644
--- a/sm/ChangeLog
+++ b/sm/ChangeLog
@@ -1,3 +1,7 @@
+2004-12-21 Werner Koch <[email protected]>
+
+ * gpgsm.c (main): Use default_homedir().
+
2004-12-20 Werner Koch <[email protected]>
* call-agent.c (start_agent): Before starting a pipe server start
diff --git a/sm/gpgsm.c b/sm/gpgsm.c
index 709263cba..935d50474 100644
--- a/sm/gpgsm.c
+++ b/sm/gpgsm.c
@@ -756,16 +756,9 @@ main ( int argc, char **argv)
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;