diff options
author | Andre Heinecke <aheinecke@intevation.de> | 2018-04-20 15:53:58 +0200 |
---|---|---|
committer | Andre Heinecke <aheinecke@intevation.de> | 2018-04-20 15:58:42 +0200 |
commit | 64c1fddb253061a9773c6c4ed2a9c5a54702d21b (patch) | |
tree | ea4db68ba62ee0e908070849de71153f0c465822 /dirmngr | |
parent | doc: Remove unneccesary empty flags in vsndf.prf (diff) | |
download | gnupg2-64c1fddb253061a9773c6c4ed2a9c5a54702d21b.tar.xz gnupg2-64c1fddb253061a9773c6c4ed2a9c5a54702d21b.zip |
dirmngr: More binary I/O on Windows for CRLs
* dirmngr/crlcache.c (lock_db_file, crl_cache_insert): Open cache
file in binary mode.
--
CRLs on Windows would have line ending entries converted. This
did not cause problems in a surprising amount of cases but
can lead to unexpected and random parse / read errors. Especially
with large CRLs like cacert.
This bug has been around since 2004.
GnuPG-Bug-Id: T3923
Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
Diffstat (limited to 'dirmngr')
-rw-r--r-- | dirmngr/crlcache.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/dirmngr/crlcache.c b/dirmngr/crlcache.c index 6eeeb8dd3..0b2fe1641 100644 --- a/dirmngr/crlcache.c +++ b/dirmngr/crlcache.c @@ -125,6 +125,9 @@ idea anyway to limit the number of opened cache files. */ #define MAX_OPEN_DB_FILES 5 +#ifndef O_BINARY +# define O_BINARY 0 +#endif static const char oidstr_crlNumber[] = "2.5.29.20"; /* static const char oidstr_issuingDistributionPoint[] = "2.5.29.28"; */ @@ -1139,7 +1142,7 @@ lock_db_file (crl_cache_t cache, crl_cache_entry_t entry) xfree (fname); return NULL; } - fd = open (fname, O_RDONLY); + fd = open (fname, O_RDONLY | O_BINARY); if (fd == -1) { log_error (_("error opening cache file '%s': %s\n"), @@ -2051,7 +2054,7 @@ crl_cache_insert (ctrl_t ctrl, const char *url, ksba_reader_t reader) } } - fd_cdb = open (fname, O_WRONLY | O_CREAT | O_TRUNC, 0644); + fd_cdb = open (fname, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); if (fd_cdb == -1) { err = gpg_error_from_errno (errno); |