mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-02 12:01:32 +01:00
* 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().
This commit is contained in:
parent
581f5ddb17
commit
878cf20766
2
TODO
2
TODO
@ -101,4 +101,6 @@ might want to have an agent context for each service request
|
|||||||
Fix is to change everything to libestream
|
Fix is to change everything to libestream
|
||||||
** Signals are not support
|
** Signals are not support
|
||||||
This means we can't reread a configuration
|
This means we can't reread a configuration
|
||||||
|
** No card status notifications.
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2004-12-21 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* gpg-agent.c (main): Use default_homedir().
|
||||||
|
* protect-tool.c (main): Ditto.
|
||||||
|
|
||||||
|
|
||||||
2004-12-20 Werner Koch <wk@g10code.com>
|
2004-12-20 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* gpg-agent.c (main) [W32]: Now that Mutexes work we can remove
|
* gpg-agent.c (main) [W32]: Now that Mutexes work we can remove
|
||||||
|
@ -478,15 +478,8 @@ main (int argc, char **argv )
|
|||||||
if (shell && strlen (shell) >= 3 && !strcmp (shell+strlen (shell)-3, "csh") )
|
if (shell && strlen (shell) >= 3 && !strcmp (shell+strlen (shell)-3, "csh") )
|
||||||
csh_style = 1;
|
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 */
|
/* Check whether we have a config file on the commandline */
|
||||||
orig_argc = argc;
|
orig_argc = argc;
|
||||||
|
@ -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_armor;
|
||||||
static int opt_store;
|
static int opt_store;
|
||||||
static int opt_force;
|
static int opt_force;
|
||||||
@ -1067,14 +1067,7 @@ main (int argc, char **argv )
|
|||||||
gcry_control (GCRYCTL_INIT_SECMEM, 16384, 0);
|
gcry_control (GCRYCTL_INIT_SECMEM, 16384, 0);
|
||||||
|
|
||||||
|
|
||||||
opt_homedir = getenv ("GNUPGHOME");
|
opt_homedir = default_homedir ();
|
||||||
#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;
|
|
||||||
|
|
||||||
|
|
||||||
pargs.argc = &argc;
|
pargs.argc = &argc;
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
2004-12-21 Werner Koch <wk@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@g10code.com>
|
2004-12-20 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* sysutils.h [W32]: Define sleep.
|
* sysutils.h [W32]: Define sleep.
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
## Process this file with automake to produce Makefile.in
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
EXTRA_DIST = mkerrors mkerrtok
|
|
||||||
|
|
||||||
noinst_LIBRARIES = libcommon.a libsimple-pwquery.a
|
noinst_LIBRARIES = libcommon.a libsimple-pwquery.a
|
||||||
|
|
||||||
AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(KSBA_CFLAGS)
|
AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(KSBA_CFLAGS)
|
||||||
@ -31,6 +29,7 @@ libcommon_a_SOURCES = \
|
|||||||
sexp-parse.h \
|
sexp-parse.h \
|
||||||
maperror.c \
|
maperror.c \
|
||||||
sysutils.c sysutils.h \
|
sysutils.c sysutils.h \
|
||||||
|
homedir.c \
|
||||||
gettime.c \
|
gettime.c \
|
||||||
yesno.c \
|
yesno.c \
|
||||||
b64enc.c \
|
b64enc.c \
|
||||||
|
44
common/homedir.c
Normal file
44
common/homedir.c
Normal file
@ -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;
|
||||||
|
}
|
@ -30,15 +30,17 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef HAVE_DOSISH_SYSTEM
|
||||||
static volatile int caught_fatal_sig;
|
static volatile int caught_fatal_sig;
|
||||||
static volatile int caught_sigusr1;
|
static volatile int caught_sigusr1;
|
||||||
|
#endif
|
||||||
static void (*cleanup_fnc)(void);
|
static void (*cleanup_fnc)(void);
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef HAVE_DOSISH_SYSTEM
|
||||||
static void
|
static void
|
||||||
init_one_signal (int sig, RETSIGTYPE (*handler)(int), int check_ign )
|
init_one_signal (int sig, RETSIGTYPE (*handler)(int), int check_ign )
|
||||||
{
|
{
|
||||||
#ifndef HAVE_DOSISH_SYSTEM
|
|
||||||
# ifdef HAVE_SIGACTION
|
# ifdef HAVE_SIGACTION
|
||||||
struct sigaction oact, nact;
|
struct sigaction oact, nact;
|
||||||
|
|
||||||
@ -64,9 +66,10 @@ init_one_signal (int sig, RETSIGTYPE (*handler)(int), int check_ign )
|
|||||||
signal (sig, SIG_IGN);
|
signal (sig, SIG_IGN);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
#endif /*!HAVE_DOSISH_SYSTEM*/
|
|
||||||
}
|
}
|
||||||
|
#endif /*!HAVE_DOSISH_SYSTEM*/
|
||||||
|
|
||||||
|
#ifndef HAVE_DOSISH_SYSTEM
|
||||||
static const char *
|
static const char *
|
||||||
get_signal_name( int signum )
|
get_signal_name( int signum )
|
||||||
{
|
{
|
||||||
@ -76,7 +79,9 @@ get_signal_name( int signum )
|
|||||||
return "some signal";
|
return "some signal";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif /*!HAVE_DOSISH_SYSTEM*/
|
||||||
|
|
||||||
|
#ifndef HAVE_DOSISH_SYSTEM
|
||||||
static RETSIGTYPE
|
static RETSIGTYPE
|
||||||
got_fatal_signal (int sig)
|
got_fatal_signal (int sig)
|
||||||
{
|
{
|
||||||
@ -106,14 +111,15 @@ got_fatal_signal (int sig)
|
|||||||
#endif /* __riscos__ */
|
#endif /* __riscos__ */
|
||||||
raise( sig );
|
raise( sig );
|
||||||
}
|
}
|
||||||
|
#endif /*!HAVE_DOSISH_SYSTEM*/
|
||||||
|
|
||||||
|
#ifndef HAVE_DOSISH_SYSTEM
|
||||||
static RETSIGTYPE
|
static RETSIGTYPE
|
||||||
got_usr_signal (int sig)
|
got_usr_signal (int sig)
|
||||||
{
|
{
|
||||||
caught_sigusr1 = 1;
|
caught_sigusr1 = 1;
|
||||||
}
|
}
|
||||||
|
#endif /*!HAVE_DOSISH_SYSTEM*/
|
||||||
|
|
||||||
void
|
void
|
||||||
gnupg_init_signals (int mode, void (*fast_cleanup)(void))
|
gnupg_init_signals (int mode, void (*fast_cleanup)(void))
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "sysutils.h"
|
||||||
|
|
||||||
/* The magic number of the GNU message catalog format. */
|
/* The magic number of the GNU message catalog format. */
|
||||||
#define MAGIC 0x950412de
|
#define MAGIC 0x950412de
|
||||||
|
@ -121,6 +121,10 @@ gpg_error_t b64enc_write (struct b64state *state,
|
|||||||
gpg_error_t b64enc_finish (struct b64state *state);
|
gpg_error_t b64enc_finish (struct b64state *state);
|
||||||
|
|
||||||
|
|
||||||
|
/*-- homedir. c --*/
|
||||||
|
const char *default_homedir (void);
|
||||||
|
|
||||||
|
|
||||||
/*-- miscellaneous.c --*/
|
/*-- miscellaneous.c --*/
|
||||||
|
|
||||||
/* Same as asprintf but return an allocated buffer suitable to be
|
/* Same as asprintf but return an allocated buffer suitable to be
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2004-12-21 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* gpgv.c, g10.c (main): Use default_hoemdir ().
|
||||||
|
|
||||||
2004-12-18 Werner Koch <wk@g10code.com>
|
2004-12-18 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* gpg.h (map_assuan_err): Define in terms of
|
* gpg.h (map_assuan_err): Define in terms of
|
||||||
|
11
g10/g10.c
11
g10/g10.c
@ -1264,16 +1264,9 @@ main( int argc, char **argv )
|
|||||||
opt.mangle_dos_filenames = 1;
|
opt.mangle_dos_filenames = 1;
|
||||||
opt.use_agent = 1;
|
opt.use_agent = 1;
|
||||||
|
|
||||||
#if defined (_WIN32)
|
set_homedir ( default_homedir () );
|
||||||
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 );
|
|
||||||
|
|
||||||
/* check whether we have a config file on the commandline */
|
/* Check whether we have a config file on the commandline */
|
||||||
orig_argc = argc;
|
orig_argc = argc;
|
||||||
orig_argv = argv;
|
orig_argv = argv;
|
||||||
pargs.argc = &argc;
|
pargs.argc = &argc;
|
||||||
|
11
g10/gpgv.c
11
g10/gpgv.c
@ -150,15 +150,8 @@ main( int argc, char **argv )
|
|||||||
opt.trust_model = TM_ALWAYS;
|
opt.trust_model = TM_ALWAYS;
|
||||||
opt.batch = 1;
|
opt.batch = 1;
|
||||||
|
|
||||||
#if defined (_WIN32)
|
opt.homedir = default_homedir ();
|
||||||
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;
|
|
||||||
}
|
|
||||||
tty_no_terminal(1);
|
tty_no_terminal(1);
|
||||||
tty_batchmode(1);
|
tty_batchmode(1);
|
||||||
disable_dotlock();
|
disable_dotlock();
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2004-12-21 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* scdaemon.c (main): Use default_homedir().
|
||||||
|
|
||||||
2004-12-18 Werner Koch <wk@g10code.com>
|
2004-12-18 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* scdaemon.c (main) [W32]: Remove special Pth initialize..
|
* scdaemon.c (main) [W32]: Remove special Pth initialize..
|
||||||
|
@ -1261,9 +1261,7 @@ scd_update_reader_status_file (void)
|
|||||||
|
|
||||||
log_info ("client pid is %d, sending signal %d\n", pid, signo);
|
log_info ("client pid is %d, sending signal %d\n", pid, signo);
|
||||||
|
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifndef HAVE_W32_SYSTEM
|
||||||
#warning Need to implement a notification service
|
|
||||||
#else
|
|
||||||
if (pid != (pid_t)(-1) && pid && signo > 0)
|
if (pid != (pid_t)(-1) && pid && signo > 0)
|
||||||
kill (pid, signo);
|
kill (pid, signo);
|
||||||
#endif
|
#endif
|
||||||
|
@ -351,17 +351,12 @@ main (int argc, char **argv )
|
|||||||
Note that this will also do the pth_init. */
|
Note that this will also do the pth_init. */
|
||||||
#ifndef HAVE_OPENSC
|
#ifndef HAVE_OPENSC
|
||||||
#ifdef USE_GNU_PTH
|
#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);
|
err = gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pth);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
log_fatal ("can't register GNU Pth with Libgcrypt: %s\n",
|
log_fatal ("can't register GNU Pth with Libgcrypt: %s\n",
|
||||||
gpg_strerror (err));
|
gpg_strerror (err));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif /*USE_GNU_PTH*/
|
#endif /*USE_GNU_PTH*/
|
||||||
#endif /*!HAVE_OPENSC*/
|
#endif /*!HAVE_OPENSC*/
|
||||||
|
|
||||||
@ -392,14 +387,9 @@ main (int argc, char **argv )
|
|||||||
if (shell && strlen (shell) >= 3 && !strcmp (shell+strlen (shell)-3, "csh") )
|
if (shell && strlen (shell) >= 3 && !strcmp (shell+strlen (shell)-3, "csh") )
|
||||||
csh_style = 1;
|
csh_style = 1;
|
||||||
|
|
||||||
/* FIXME: Using this homedir option does only make sense when not
|
opt.homedir = default_homedir ();
|
||||||
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 */
|
/* Check whether we have a config file on the commandline */
|
||||||
orig_argc = argc;
|
orig_argc = argc;
|
||||||
orig_argv = argv;
|
orig_argv = argv;
|
||||||
pargs.argc = &argc;
|
pargs.argc = &argc;
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2004-12-21 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* gpgsm.c (main): Use default_homedir().
|
||||||
|
|
||||||
2004-12-20 Werner Koch <wk@g10code.com>
|
2004-12-20 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* call-agent.c (start_agent): Before starting a pipe server start
|
* call-agent.c (start_agent): Before starting a pipe server start
|
||||||
|
11
sm/gpgsm.c
11
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*/
|
opt.def_cipher_algoid = "1.2.840.113549.3.7"; /*des-EDE3-CBC*/
|
||||||
|
|
||||||
#ifdef HAVE_W32_SYSTEM
|
opt.homedir = default_homedir ();
|
||||||
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;
|
|
||||||
|
|
||||||
/* 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_argc = argc;
|
||||||
orig_argv = argv;
|
orig_argv = argv;
|
||||||
pargs.argc = &argc;
|
pargs.argc = &argc;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user