diff options
author | Werner Koch <wk@gnupg.org> | 2010-12-14 20:17:58 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2010-12-14 20:17:58 +0100 |
commit | 5fd7ff3488d64cddad9b0f767ef21059fe52be71 (patch) | |
tree | 5706364bf2658b80debc0f0f5d93a88b4f924534 | |
parent | Change --dameon home directory to /gnupg under Wince (diff) | |
download | gnupg2-5fd7ff3488d64cddad9b0f767ef21059fe52be71.tar.xz gnupg2-5fd7ff3488d64cddad9b0f767ef21059fe52be71.zip |
Tweaks for gpgconf.
Fixed dirmngr bug 1010.
Diffstat (limited to '')
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | configure.ac | 27 | ||||
-rw-r--r-- | dirmngr/ChangeLog | 7 | ||||
-rw-r--r-- | dirmngr/cdb.h | 3 | ||||
-rw-r--r-- | dirmngr/cdblib.c | 17 | ||||
-rw-r--r-- | dirmngr/crlcache.c | 31 | ||||
-rw-r--r-- | tools/ChangeLog | 6 | ||||
-rw-r--r-- | tools/gpgconf-comp.c | 23 |
9 files changed, 103 insertions, 19 deletions
@@ -1,3 +1,9 @@ +2010-12-14 Werner Koch <wk@g10code.com> + + * configure.ac (BUILD_WITH_GPG, BUILD_WITH_GPGSM) + (BUILD_WITH_AGENT, BUILD_WITH_SCDAEMON, BUILD_WITH_DIRMNGR) + (BUILD_WITH_G13): New defines. + 2010-11-23 Werner Koch <wk@g10code.com> * am/cmacros.am (extra_bin_ldflags): New. For W32CE set the stack @@ -12,6 +12,8 @@ Noteworthy changes in version 2.1.0beta2 (unreleased) these tools are written robust enough to accept this new algorithm name as well. + * Fixed CRL loading under W32 (bug#1010). + Noteworthy changes in version 2.1.0beta1 (2010-10-26) ----------------------------------------------------- diff --git a/configure.ac b/configure.ac index 1fa73e05a..b6ed4b34c 100644 --- a/configure.ac +++ b/configure.ac @@ -1523,7 +1523,9 @@ if test "$build_agent_only" = "yes" ; then build_doc=no fi - +# +# Set variables for use by th automake makefile. +# AM_CONDITIONAL(BUILD_GPG, test "$build_gpg" = "yes") AM_CONDITIONAL(BUILD_GPGSM, test "$build_gpgsm" = "yes") AM_CONDITIONAL(BUILD_AGENT, test "$build_agent" = "yes") @@ -1538,6 +1540,29 @@ AM_CONDITIONAL(BUILD_GPGTAR, test "$build_gpgtar" = "yes") AM_CONDITIONAL(RUN_GPG_TESTS, test x$cross_compiling = xno -a "$build_gpg" = yes ) +# +# Set some defines for use gpgconf. +# +if test "$build_gpg" = yes ; then + AC_DEFINE(BUILD_WITH_GPG,1,[Defined if GPG is to be build]) +fi +if test "$build_gpgsm" = yes ; then + AC_DEFINE(BUILD_WITH_GPGSM,1,[Defined if GPGSM is to be build]) +fi +if test "$build_agent" = yes ; then + AC_DEFINE(BUILD_WITH_AGENT,1,[Defined if GPG-AGENT is to be build]) +fi +if test "$build_scdaemon" = yes ; then + AC_DEFINE(BUILD_WITH_SCDAEMON,1,[Defined if SCDAEMON is to be build]) +fi +if test "$build_dirmngr" = yes ; then + AC_DEFINE(BUILD_WITH_DIRMNGR,1,[Defined if SCDAEMON is to be build]) +fi +if test "$build_g13" = yes ; then + AC_DEFINE(BUILD_WITH_G13,1,[Defined if G13 is to be build]) +fi + + # # Print errors here so that they are visible all diff --git a/dirmngr/ChangeLog b/dirmngr/ChangeLog index 11fd1b7f1..2c208755d 100644 --- a/dirmngr/ChangeLog +++ b/dirmngr/ChangeLog @@ -1,5 +1,12 @@ 2010-12-14 Werner Koch <wk@g10code.com> + * cdb.h (struct cdb) [W32]: Add field CDB_MAPPING. + * cdblib.c (cdb_init) [W32]: Save mapping handle. + (cdb_free) [W32]: Don't leak the mapping handle from cdb_init by + using the saved one. + + * crlcache.c (crl_cache_insert): Close unused matching files. + * dirmngr.c (main) [W32CE]: Change homedir in daemon mode to /gnupg. 2010-12-07 Werner Koch <wk@g10code.com> diff --git a/dirmngr/cdb.h b/dirmngr/cdb.h index 73cc9952e..0c0d2702a 100644 --- a/dirmngr/cdb.h +++ b/dirmngr/cdb.h @@ -20,6 +20,9 @@ void cdb_pack(cdbi_t num, unsigned char buf[4]); struct cdb { int cdb_fd; /* file descriptor */ /* private members */ +#ifdef HAVE_W32_SYSTEM + void *cdb_mapping; /* Mapping handle. */ +#endif cdbi_t cdb_fsize; /* datafile size */ const unsigned char *cdb_mem; /* mmap'ed file memory */ cdbi_t cdb_vpos, cdb_vlen; /* found data */ diff --git a/dirmngr/cdblib.c b/dirmngr/cdblib.c index 16d53aed8..3bfeffc11 100644 --- a/dirmngr/cdblib.c +++ b/dirmngr/cdblib.c @@ -135,7 +135,7 @@ cdb_init(struct cdb *cdbp, int fd) hFile = fd; # else hFile = (HANDLE) _get_osfhandle(fd); -#endif +# endif if (hFile == (HANDLE) -1) return -1; hMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL); @@ -144,6 +144,7 @@ cdb_init(struct cdb *cdbp, int fd) mem = (unsigned char *)MapViewOfFile(hMapping, FILE_MAP_READ, 0, 0, 0); if (!mem) return -1; + cdbp->cdb_mapping = hMapping; #else mem = (unsigned char*)mmap(NULL, fsize, PROT_READ, MAP_SHARED, fd, 0); if (mem == MAP_FAILED) @@ -180,17 +181,9 @@ cdb_free(struct cdb *cdbp) { if (cdbp->cdb_mem) { #ifdef _WIN32 - HANDLE hFile, hMapping; -#endif -#ifdef _WIN32 -#ifdef __MINGW32CE__ - hFile = cdbp->cdb_fd; -#else - hFile = (HANDLE) _get_osfhandle(cdbp->cdb_fd); -#endif - hMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL); - UnmapViewOfFile((void*) cdbp->cdb_mem); - CloseHandle(hMapping); + UnmapViewOfFile ((void*) cdbp->cdb_mem); + CloseHandle (cdbp->cdb_mapping); + cdbp->cdb_mapping = NULL; #else munmap((void*)cdbp->cdb_mem, cdbp->cdb_fsize); #endif /* _WIN32 */ diff --git a/dirmngr/crlcache.c b/dirmngr/crlcache.c index 5f0430525..12d451060 100644 --- a/dirmngr/crlcache.c +++ b/dirmngr/crlcache.c @@ -178,7 +178,7 @@ static crl_cache_entry_t find_entry (crl_cache_entry_t first, -/* The currently loaded cache object. This isi usually initialized +/* The currently loaded cache object. This is usually initialized right at startup. */ static crl_cache_t current_cache; @@ -393,7 +393,7 @@ release_cache (crl_cache_t cache) { entry2 = entry->next; release_one_cache_entry (entry); - } + } cache->entries = NULL; xfree (cache); } @@ -1189,6 +1189,7 @@ unlock_db_file (crl_cache_t cache, crl_cache_entry_t entry) cache->entries = enext; else eprev->next = enext; + /* FIXME: Do we leak ENTRY? */ } } @@ -1204,7 +1205,6 @@ find_entry (crl_cache_entry_t first, const char *issuer_hash) } - /* Create a new CRL cache. This fucntion is usually called only once. never fail. */ void @@ -2177,6 +2177,31 @@ crl_cache_insert (ctrl_t ctrl, const char *url, ksba_reader_t reader) newfname = make_db_file_name (entry->issuer_hash); if (opt.verbose) log_info (_("creating cache file `%s'\n"), newfname); + + /* Just in case close unused matching files. Actually we need this + only under Windows but saving file descriptors is never bad. */ + { + int any; + do + { + any = 0; + for (e = cache->entries; e; e = e->next) + if (!e->cdb_use_count && e->cdb + && !strcmp (e->issuer_hash, entry->issuer_hash)) + { + int fd = cdb_fileno (e->cdb); + cdb_free (e->cdb); + xfree (e->cdb); + e->cdb = NULL; + if (close (fd)) + log_error (_("error closing cache file: %s\n"), + strerror(errno)); + any = 1; + break; + } + } + while (any); + } #ifdef HAVE_W32_SYSTEM gnupg_remove (newfname); #endif diff --git a/tools/ChangeLog b/tools/ChangeLog index c6ac33207..110e43ef1 100644 --- a/tools/ChangeLog +++ b/tools/ChangeLog @@ -1,3 +1,9 @@ +2010-12-14 Werner Koch <wk@g10code.com> + + * gpgconf-comp.c (gc_options_gpg_agent, gc_options_scdaemon) + (gc_options_gpg, gc_options_gpgsm, gc_options_dirmngr): Define to + NULL if corresponding BUILD_WITH_foo is not defined. + 2010-12-02 Werner Koch <wk@g10code.com> * no-libgcrypt.c (gcry_cipher_algo_name): New. diff --git a/tools/gpgconf-comp.c b/tools/gpgconf-comp.c index d0372469d..74feadb6c 100644 --- a/tools/gpgconf-comp.c +++ b/tools/gpgconf-comp.c @@ -51,7 +51,6 @@ #include "gc-opt-flags.h" #include "gpgconf.h" - /* There is a problem with gpg 1.4 under Windows: --gpgconf-list returns a plain filename without escaping. As long as we have not fixed that we need to use gpg2. */ @@ -467,6 +466,9 @@ typedef struct gc_option gc_option_t; #define GC_OPTION_NULL { NULL } +#ifndef BUILD_WITH_AGENT +#define gc_options_gpg_agent NULL +#else /* The options of the GC_COMPONENT_GPG_AGENT component. */ static gc_option_t gc_options_gpg_agent[] = { @@ -569,8 +571,12 @@ static gc_option_t gc_options_gpg_agent[] = GC_OPTION_NULL }; +#endif /*BUILD_WITH_AGENT*/ +#ifndef BUILD_WITH_SCDAEMON +#define gc_options_scdaemon NULL +#else /* The options of the GC_COMPONENT_SCDAEMON component. */ static gc_option_t gc_options_scdaemon[] = { @@ -636,8 +642,11 @@ static gc_option_t gc_options_scdaemon[] = GC_OPTION_NULL }; +#endif /*BUILD_WITH_SCDAEMON*/ - +#ifndef BUILD_WITH_GPG +#define gc_options_gpg NULL +#else /* The options of the GC_COMPONENT_GPG component. */ static gc_option_t gc_options_gpg[] = { @@ -710,9 +719,12 @@ static gc_option_t gc_options_gpg[] = GC_OPTION_NULL }; +#endif /*BUILD_WITH_GPG*/ - +#ifndef BUILD_WITH_GPGSM +#define gc_options_gpgsm NULL +#else /* The options of the GC_COMPONENT_GPGSM component. */ static gc_option_t gc_options_gpgsm[] = { @@ -802,8 +814,12 @@ static gc_option_t gc_options_gpgsm[] = GC_OPTION_NULL }; +#endif /*BUILD_WITH_GPGSM*/ +#ifndef BUILD_WITH_DIRMNGR +#define gc_options_dirmngr NULL +#else /* The options of the GC_COMPONENT_DIRMNGR component. */ static gc_option_t gc_options_dirmngr[] = { @@ -942,6 +958,7 @@ static gc_option_t gc_options_dirmngr[] = GC_OPTION_NULL }; +#endif /*BUILD_WITH_DIRMNGR*/ /* The options of the GC_COMPONENT_PINENTRY component. */ |