mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
Fix bug#1307
This is a backport of the fixes for 2.0. There is only one real bug, the other changes are for clarity and for more picky compilers.
This commit is contained in:
parent
4fb59b1313
commit
c156a636c6
5 changed files with 147 additions and 133 deletions
|
@ -1,3 +1,9 @@
|
|||
2011-08-09 Werner Koch <wk@g10code.com>
|
||||
|
||||
* pka.c (get_pka_info): Turn ANSWER into a union to avoid aliasing
|
||||
problems with modern compilers. See bug#1307. Reported by Steve
|
||||
Grubb.
|
||||
|
||||
2010-10-27 Werner Koch <wk@g10code.com>
|
||||
|
||||
* miscutil.c (INVALID_TIME_CHECK): New.
|
||||
|
@ -449,7 +455,7 @@
|
|||
|
||||
* simple-gettext.c (set_gettext_file): Use MO files depending on
|
||||
the installation directory. Add new arg REGKEY.
|
||||
|
||||
|
||||
2005-01-18 Werner Koch <wk@g10code.com>
|
||||
|
||||
* argparse.c (default_strusage): Changed default copyright year to
|
||||
|
@ -461,7 +467,7 @@
|
|||
2005-01-11 Werner Koch <wk@g10code.com>
|
||||
|
||||
* strgutil.c (set_native_charset) [W32]: Use the alias table from
|
||||
libiconv 1.9.2.
|
||||
libiconv 1.9.2.
|
||||
|
||||
2005-01-13 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
|
@ -518,12 +524,12 @@
|
|||
header. Noted by Jason Harris.
|
||||
|
||||
2004-11-03 Timo Schulz <twoaday@g10code.com>
|
||||
|
||||
|
||||
* strgutil.c (w32_strerror): New.
|
||||
* ttyio.c (init_ttyfp, tty_printf, do_get): Use it here.
|
||||
* iobuf.c (fd_cache_open, file_filter): Likewise.
|
||||
(iobuf_seek, translate_file_handle): Likewise.
|
||||
|
||||
|
||||
2004-11-02 Werner Koch <wk@g10code.com>
|
||||
|
||||
* strgutil.c (load_libiconv): Use log_info to avoid failures when
|
||||
|
@ -559,7 +565,7 @@
|
|||
2004-10-21 Werner Koch <wk@g10code.com>
|
||||
|
||||
* vasprintf.c: Removed. It was used only at one place and I don't
|
||||
want to get into build problems in 1.4.
|
||||
want to get into build problems in 1.4.
|
||||
|
||||
2004-10-18 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
|
@ -748,7 +754,7 @@
|
|||
2003-09-28 Timo Schulz <twoaday@freakmail.de>
|
||||
|
||||
* strgutil.c [WIN32] (asprintf): New.
|
||||
|
||||
|
||||
2003-09-28 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* ttyio.c (tty_fprintf): New.
|
||||
|
@ -757,14 +763,14 @@
|
|||
|
||||
* http.c [WIN32]: Define MB_CUR_MAX.
|
||||
(connect_server): use unsigned long since W32 does not have in_addr_t.
|
||||
|
||||
|
||||
2003-08-28 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* dotlock.c, http.c, iobuf.c, simple-gettext.c, srv.c, srv.h,
|
||||
strgutil.c, ttyio.c, w32reg.c: s/__MINGW32__/_WIN32/ to help
|
||||
building on native Windows compilers. Requested by Brian Gladman.
|
||||
From Werner on stable branch.
|
||||
|
||||
|
||||
* http.c (connect_server): Oops - forgot to freeaddrinfo().
|
||||
|
||||
2003-08-24 David Shaw <dshaw@jabberwocky.com>
|
||||
|
@ -1001,7 +1007,7 @@
|
|||
|
||||
* fileutil.c (is_file_compressed): Corrected the magic values
|
||||
for bzip2 and gzip. Noted by David.
|
||||
|
||||
|
||||
2002-05-22 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* fileutil.c (compare_filenames): Replaced stricmp by strcasecmp.
|
||||
|
@ -1033,10 +1039,10 @@
|
|||
enclose the string, and do not occur within the string. This
|
||||
makes specifying a program under Win32 easier when you need quotes
|
||||
around part of a string, but not around the whole string.
|
||||
|
||||
|
||||
2002-05-02 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* memory.c (alloc): Malloc at least 1 byte. Noted by Winona Brown.
|
||||
* memory.c (alloc): Malloc at least 1 byte. Noted by Winona Brown.
|
||||
|
||||
2002-04-23 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
|
@ -1068,7 +1074,7 @@
|
|||
2002-02-28 Timo Schulz <ts@winpt.org>
|
||||
|
||||
* http.c (write_server): Convert integer to a HANDLE for W32.
|
||||
|
||||
|
||||
2002-01-27 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* iobuf.c (iobuf_fdopen, iobuf_sockopen): Do not cache fdopened
|
||||
|
@ -1136,7 +1142,7 @@
|
|||
|
||||
2001-09-17 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* miscutil.c (print_string): Use explicit ranges and not iscntrl().
|
||||
* miscutil.c (print_string): Use explicit ranges and not iscntrl().
|
||||
(make_printable_string): Ditto.
|
||||
|
||||
2001-09-07 Werner Koch <wk@gnupg.org>
|
||||
|
@ -1159,17 +1165,17 @@
|
|||
* secmem.c [__riscos__]: Disabled secure memory stuff.
|
||||
* dotlock.c, ttyio.c [__riscos__]: Adapted for RISC OS
|
||||
* fileutil.c, iobuf.c: Adapted for RISC OS; mainly replaced
|
||||
hardcoded path separators with EXTSEP_S like macros.
|
||||
hardcoded path separators with EXTSEP_S like macros.
|
||||
* http.c (send_request): Use macros for the env-var name.
|
||||
* logger.c [__riscos__]: Do an fflush at the end of each log
|
||||
function.
|
||||
function.
|
||||
* memory.c [__riscos__]: Minor patches
|
||||
* riscos.c (set_filetype): New.
|
||||
|
||||
* secmem.c (lock_pool): Under HPUX mlock is broken but we might
|
||||
have plock, so we use this to lock the entire process. By Albert
|
||||
Chin.
|
||||
|
||||
|
||||
2001-07-03 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* strgutil.c (utf8_to_native): Fixed printing of invalid utf-8
|
||||
|
@ -1189,11 +1195,11 @@
|
|||
|
||||
* strgutil.c (vasprintf) [__MINGW32__]: New. Taken from libiberty.
|
||||
* ttyio.c (tty_printf) [__MINGW32__]: Replaced the sprintf with
|
||||
the new vasprintf.
|
||||
the new vasprintf.
|
||||
|
||||
2001-06-05 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* dotlock.c (make_dotlock): Typo fixes.
|
||||
* dotlock.c (make_dotlock): Typo fixes.
|
||||
|
||||
2001-05-25 Werner Koch <wk@gnupg.org>
|
||||
|
||||
|
@ -1252,7 +1258,7 @@
|
|||
everywhere in this file.
|
||||
(iobuf_translate_file_handle): Always use the osfhandle stuff here
|
||||
because callers don't know the implementation details of iobuf and
|
||||
they expect that the handles are translated.
|
||||
they expect that the handles are translated.
|
||||
|
||||
2001-03-29 Werner Koch <wk@gnupg.org>
|
||||
|
||||
|
@ -1288,7 +1294,7 @@
|
|||
* argparse.c (default_strusage): Changed year of printed copyright
|
||||
to 2001.
|
||||
|
||||
* iobuf.c (fd_cache_invalidate, fd_cache_close, fd_cache_open): New.
|
||||
* iobuf.c (fd_cache_invalidate, fd_cache_close, fd_cache_open): New.
|
||||
(direct_open): Invalidate the fd_cache for read access.
|
||||
(file_filter): Cache the close here.
|
||||
(iobuf_open): Use new my_fopen_ro macro to try the cache first.
|
||||
|
@ -1330,7 +1336,7 @@
|
|||
the right thing in an implementation-independent way.
|
||||
(fopen, fstat): Remove macros.
|
||||
|
||||
* iobuf.c (iobuf_set_limit, iobuf_tell, iobuf_seek):
|
||||
* iobuf.c (iobuf_set_limit, iobuf_tell, iobuf_seek):
|
||||
Use off_t, not ulong, for file offsets.
|
||||
(<limits.h>): Include if needed.
|
||||
(LONG_MAX, LONG_MIN): Define a substitute if needed.
|
||||
|
|
32
util/pka.c
32
util/pka.c
|
@ -51,7 +51,7 @@
|
|||
/* Parse the TXT resource record. Format is:
|
||||
|
||||
v=pka1;fpr=a4d94e92b0986ab5ee9dcd755de249965b0358a2;uri=string
|
||||
|
||||
|
||||
For simplicity white spaces are not allowed. Because we expect to
|
||||
use a new RRTYPE for this in the future we define the TXT really
|
||||
strict for simplicity: No white spaces, case sensitivity of the
|
||||
|
@ -74,7 +74,7 @@ parse_txt_record (char *buffer, unsigned char *fpr)
|
|||
*pend++ = 0;
|
||||
if (strcmp (p, "v=pka1"))
|
||||
return -1; /* Wrong or missing version. */
|
||||
|
||||
|
||||
p = pend;
|
||||
pend = strchr (p, ';');
|
||||
if (pend)
|
||||
|
@ -86,11 +86,11 @@ parse_txt_record (char *buffer, unsigned char *fpr)
|
|||
fpr[i] = xtoi_2 (p);
|
||||
if (i != 20)
|
||||
return -1; /* Fingerprint consists not of exactly 40 hexbytes. */
|
||||
|
||||
|
||||
p = pend;
|
||||
if (!p || !*p)
|
||||
{
|
||||
*buffer = 0;
|
||||
*buffer = 0;
|
||||
return 0; /* Success (no URI given). */
|
||||
}
|
||||
if (strncmp (p, "uri=", 4))
|
||||
|
@ -116,7 +116,11 @@ parse_txt_record (char *buffer, unsigned char *fpr)
|
|||
char *
|
||||
get_pka_info (const char *address, unsigned char *fpr)
|
||||
{
|
||||
unsigned char answer[PACKETSZ];
|
||||
union
|
||||
{
|
||||
signed char p[PACKETSZ];
|
||||
HEADER h;
|
||||
} answer;
|
||||
int anslen;
|
||||
int qdcount, ancount, nscount, arcount;
|
||||
int rc;
|
||||
|
@ -133,11 +137,11 @@ get_pka_info (const char *address, unsigned char *fpr)
|
|||
memcpy (name, address, domain - address);
|
||||
strcpy (stpcpy (name + (domain-address), "._pka."), domain+1);
|
||||
|
||||
anslen = res_query (name, C_IN, T_TXT, answer, PACKETSZ);
|
||||
anslen = res_query (name, C_IN, T_TXT, answer.p, PACKETSZ);
|
||||
xfree (name);
|
||||
if (anslen < sizeof(HEADER))
|
||||
return NULL; /* DNS resolver returned a too short answer. */
|
||||
if ( (rc=((HEADER*)answer)->rcode) != NOERROR )
|
||||
if ( (rc=answer.h.rcode) != NOERROR )
|
||||
return NULL; /* DNS resolver returned an error. */
|
||||
|
||||
/* We assume that PACKETSZ is large enough and don't do dynmically
|
||||
|
@ -145,23 +149,23 @@ get_pka_info (const char *address, unsigned char *fpr)
|
|||
if (anslen > PACKETSZ)
|
||||
return NULL; /* DNS resolver returned a too long answer */
|
||||
|
||||
qdcount = ntohs (((HEADER*)answer)->qdcount);
|
||||
ancount = ntohs (((HEADER*)answer)->ancount);
|
||||
nscount = ntohs (((HEADER*)answer)->nscount);
|
||||
arcount = ntohs (((HEADER*)answer)->arcount);
|
||||
qdcount = ntohs (answer.h.qdcount);
|
||||
ancount = ntohs (answer.h.ancount);
|
||||
nscount = ntohs (answer.h.nscount);
|
||||
arcount = ntohs (answer.h.arcount);
|
||||
|
||||
if (!ancount)
|
||||
return NULL; /* Got no answer. */
|
||||
|
||||
p = answer + sizeof (HEADER);
|
||||
pend = answer + anslen; /* Actually points directly behind the buffer. */
|
||||
p = answer.p + sizeof (HEADER);
|
||||
pend = answer.p + anslen; /* Actually points directly behind the buffer. */
|
||||
|
||||
while (qdcount-- && p < pend)
|
||||
{
|
||||
rc = dn_skipname (p, pend);
|
||||
if (rc == -1)
|
||||
return NULL;
|
||||
p += rc + QFIXEDSZ;
|
||||
p += rc + QFIXEDSZ;
|
||||
}
|
||||
|
||||
if (ancount > 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue