Brad House provided a fix for ares_save_options(): Apparently I overlooked
[platform/upstream/c-ares.git] / CHANGES
1   Changelog for the c-ares project
2
3 * September 22 2007 (Daniel Stenberg)
4
5 - Brad House provided a fix for ares_save_options():
6
7   Apparently I overlooked something with the ares_save_options() where it
8   would try to do a malloc(0) when no options of that type needed to be saved.
9   On most platforms, this was fine because malloc(0) doesn't actually return
10   NULL, but on AIX it does, so ares_save_options would return ARES_ENOMEM.
11
12 * July 14 2007 (Daniel Stenberg)
13
14 - Vlad Dinulescu fixed two outstanding valgrind reports:
15  
16   1. In ares_query.c , in find_query_by_id we compare q->qid (which is a short
17   int variable) with qid, which is declared as an int variable.  Moreover,
18   DNS_HEADER_SET_QID is used to set the value of qid, but DNS_HEADER_SET_QID
19   sets only the first two bytes of qid. I think that qid should be declared as
20   "unsigned short" in this function.
21
22   2. The same problem occurs in ares_process.c, process_answer() .  query->qid
23   (an unsigned short integer variable) is compared with id, which is an
24   integer variable. Moreover, id is initialized from DNS_HEADER_QID which sets
25   only the first two bytes of id. I think that the id variable should be
26   declared as "unsigned short" in this function.
27
28   Even after declaring these variables as "unsigned short", the valgrind
29   errors are still there. Which brings us to the third problem.
30
31   3. The third problem is that Valgrind assumes that query->qid is not
32   initialised correctly. And it does that because query->qid is set from
33   DNS_HEADER_QID(qbuf); Valgrind says that qbuf has unitialised bytes. And
34   qbuf has uninitialised bytes because of channel->next_id . And next_id is
35   set by ares_init.c:ares__generate_new_id() . I found that putting short r=0
36   in this function (instead of short r) makes all Valgrind warnings go away.
37   I have studied ares__rc4() too, and this is the offending line:
38
39         buffer_ptr[counter] ^= state[xorIndex];   (ares_query.c:62)
40
41   This is what triggers Valgrind.. buffer_ptr is unitialised in this function,
42   and by applying ^= on it, it remains unitialised.
43
44 Version 1.4.0 (June 8, 2007)
45
46 * June 4 2007 (Daniel Stenberg)
47
48 - James Bursa reported a major memory problem when resolving multi-IP names
49   and I found and fixed the problem. It was added by Ashish Sharma's patch
50   two days ago.
51
52   When I then tried to verify multiple entries in /etc/hosts after my fix, I
53   got another segfault and decided this code was not ripe for inclusion and I
54   reverted the patch.
55
56 * June 2 2007
57
58 - Brad Spencer found and fixed three flaws in the code, found with the new
59   gcc 4.2.0 warning: -Waddress
60
61 - Brad House fixed VS2005 compiler warnings due to time_t being 64bit.
62   He also made recent Microsoft compilers use _strdup() instead of strdup().
63
64 - Brad House's man pages for ares_save_options() and ares_destroy_options()
65   were added.
66
67 - Ashish Sharma provided a patch for supporting multiple entries in the
68   /etc/hosts file. Patch edited for coding style and functionality by me
69   (Daniel).
70
71 * May 30 2007
72
73 - Shmulik Regev brought cryptographically secure transaction IDs:
74
75   The c-ares library implementation uses a DNS "Transaction ID" field that is
76   seeded with a pseudo random number (based on gettimeofday) which is
77   incremented (++) between consecutive calls and is therefore rather
78   predictable. In general, predictability of DNS Transaction ID is a well
79   known security problem (e.g.
80   http://bak.spc.org/dms/archive/dns_id_attack.txt) and makes a c-ares based
81   implementation vulnerable to DNS poisoning. Credit goes to Amit Klein
82   (Trusteer) for identifying this problem.
83
84   The patch I wrote changes the implementation to use a more secure way of
85   generating unique IDs. It starts by obtaining a key with reasonable entropy
86   which is used with an RC4 stream to generate the cryptographically secure
87   transaction IDs.
88
89   Note that the key generation code (in ares_init:randomize_key) has two
90   versions, the Windows specific one uses a cryptographically safe function
91   provided (but undocumented :) by the operating system (described at
92   http://blogs.msdn.com/michael_howard/archive/2005/01/14/353379.aspx).  The
93   default implementation is a bit naive and uses the standard 'rand'
94   function. Surely a better way to generate random keys exists for other
95   platforms.
96
97   The patch can be tested by using the adig utility and using the '-s' option.
98
99 - Brad House added ares_save_options() and ares_destroy_options() that can be
100   used to keep options for later re-usal when ares_init_options() is used.
101   
102   Problem: Calling ares_init() for each lookup can be unnecessarily resource
103          intensive.  On windows, it must LoadLibrary() or search the registry
104          on each call to ares_init().  On unix, it must read and parse
105          multiple files to obtain the necessary configuration information.  In
106          a single-threaded environment, it would make sense to only
107          ares_init() once, but in a heavily multi-threaded environment, it is
108          undesirable to ares_init() and ares_destroy() for each thread created
109          and track that.
110
111   Solution: Create ares_save_options() and ares_destroy_options() functions to
112          retrieve and free options obtained from an initialized channel.  The
113          options populated can be used to pass back into ares_init_options(),
114          it should populate all needed fields and not retrieve any information
115          from the system.  Probably wise to destroy the cache every minute or
116          so to prevent the data from becoming stale.
117
118 - Daniel S added ares_process_fd() to allow applications to ask for processing
119   on specific sockets and thus avoiding select() and associated
120   functions/macros.  This function will be used by upcoming libcurl releases
121   for this very reason. It also made me export the ares_socket_t type in the
122   public ares.h header file, since ares_process_fd() uses that type for two of
123   the arguments.
124
125 * May 25 2007
126
127 - Ravi Pratap fixed a flaw in the init_by_resolv_conf() function for windows
128   that could cause it to return a bad return code.
129
130 * April 16 2007
131
132 - Yang Tse: Provide ares_getopt() command-line parser function as a source
133   code helper function, not belonging to the actual c-ares library.
134
135 * February 19 2007
136
137 - Vlad Dinulescu added ares_parse_ns_reply().
138
139 * February 13 2007
140
141 - Yang Tse: Fix failure to get the search sequence of /etc/hosts and
142   DNS from /etc/nsswitch.conf, /etc/host.conf or /etc/svc.conf when
143   /etc/resolv.conf did not exist or was unable to read it.
144
145 * November 22 2006
146
147 - Install ares_dns.h too
148
149 - Michael Wallner fixed this problem: When I set domains in the options
150   struct, and there are domain/search entries in /etc/resolv.conf, the domains
151   of the options struct will be overridden.
152
153 * November 6 2006
154
155 - Yang Tse removed a couple of potential zero size memory allocations.
156
157 - Andreas Rieke fixed the line endings in the areslib.dsp file that I (Daniel)
158   broke in the 1.3.2 release. We should switch to a system where that file is
159   auto-generated. We could rip some code for that from curl...
160
161 Version 1.3.2 (November 3, 2006)
162
163 * October 12 2006
164
165 - Prevent ares_getsock() to overflow if more than 16 sockets are used.
166
167 * September 11 2006
168
169 - Guilherme Balena Versiani: I noted a strange BUG in Win32 port
170   (ares_init.c/get_iphlpapi_dns_info() function): when I disable the network
171   by hand or disconnect the network cable in Windows 2000 or Windows XP, my
172   application gets 127.0.0.1 as the only name server. The problem comes from
173   'GetNetworkParams' function, that returns the empty string "" as the only
174   name server in that case. Moreover, the Windows implementation of
175   inet_addr() returns INADDR_LOOPBACK instead of INADDR_NONE.
176
177 * August 29 2006
178
179 - Brad Spencer did
180
181   o made ares_version.h use extern "C" for c++ compilers
182   o fixed compiler warnings in ares_getnameinfo.c
183   o fixed a buffer position init for TCP reads
184
185 * August 3 2006
186
187 - Ravi Pratap fixed ares_getsock() to actually return the proper bitmap and
188   not always zero!
189
190 Version 1.3.1 (June 24, 2006)
191
192 * July 23, 2006
193
194 - Gisle Vanem added getopt() to the ahost program. Currently accepts
195   only [-t {a|aaaa}] to specify address family in ares_gethostbyname().
196
197 * June 19, 2006
198
199 - (wahern) Removed "big endian" DNS section and RR data integer parser
200   macros from ares_dns.h, which break c-ares on my Sparc64. Bit-wise
201   operations in C operate on logical values. And in any event the octets are
202   already in big-endian (aka network) byte order so they're being reversed
203   (thus the source of the breakage).
204
205 * June 18, 2006
206
207 - William Ahern handles EAGAIN/EWOULDBLOCK errors in most of the I/O calls
208   from area_process.c.
209
210   TODO: Handle one last EAGAIN for a UDP socket send(2) in
211   ares__send_query().
212
213 * May 10, 2006
214
215 - Bram Matthys brought my attention to a libtool peculiarity where detecting
216   things such as C++ compiler actually is a bad thing and since we don't need
217   that detection I added a work-around, much inspired by a previous patch by
218   Paolo Bonzini. This also shortens the configure script quite a lot.
219
220 * May 3, 2006
221
222 - Nick Mathewson added the ARES_OPT_SOCK_STATE_CB option that when set makes
223   c-ares call a callback on socket state changes. A better way than the
224   ares_getsock() to get full control over the socket state.
225
226 * January 9, 2006
227
228 - Alexander Lazic improved the getservbyport_r() configure check.
229
230 * January 6, 2006
231
232 - Alexander Lazic pointed out that the buildconf should use the ACLOCAL_FLAGS
233   variable for easier controlling what it does and how it runs.
234
235 * January 5, 2006
236
237 - James Bursa fixed c-ares to find the hosts file on RISC OS, and made it
238   build with newer gcc versions that no longer defines "riscos".
239
240 * December 22
241
242 - Daniel Stenberg added ares_getsock() that extracts the set of sockets to
243   wait for action on. Similar to ares_fds() but not restricted to using
244   select() for the waiting.
245
246 * November 25
247
248 - Yang Tse fixed some send() / recv() compiler warnings
249
250 * September 18
251
252 - Added constants that will be used by ares_getaddrinfo
253
254 - Made ares_getnameinfo use the reentrant getservbyport (getservbyport_r) if it
255   is available to ensure it works properly in a threaded environment.
256
257 * September 10
258
259 - configure fix for detecting a member in the sockaddr_in6 struct which failed
260   on ipv6-enabled HP-UX 11.00
261
262 Version 1.3.0 (August 29, 2005)
263
264 * August 21
265
266 - Alfredo Tupone provided a fix for the Windows code in get_iphlpapi_dns_info()
267   when getting the DNS server etc.
268
269 * June 19
270
271 - Added some checks for the addrinfo structure.
272
273 * June 2
274
275 - William Ahern:
276
277   Make UDP sockets non-blocking. I've confirmed that at least on Linux 2.4 a
278   read event can come back from poll() on a valid SOCK_DGRAM socket but
279   recv(2) will still block. This patch doesn't ignore EAGAIN in
280   read_udp_packets(), though maybe it should. (This patch was edited by Daniel
281   Stenberg and a new configure test was added (imported from curl's configure)
282   to properly detect what non-blocking socket approach to use.)
283
284   I'm not quite sure how this was happening, but I've been seeing PTR queries
285   which seem to return empty responses. At least, they were empty when calling
286   ares_expand_name() on the record. Here's a patch which guarantees to
287   NUL-terminate the expanded name. The old behavior failed to NUL-terminate if
288   len was 0, and this was causing strlen() to run past the end of the buffer
289   after calling ares_expand_name() and getting ARES_SUCCESS as the return
290   value. If q is not greater than *s then it's equal and *s is always
291   allocated with at least one byte.
292
293 * May 16
294
295 - Added ares_getnameinfo which mimics the getnameinfo API (another feature
296   that could use testing).
297
298 * May 14
299
300 - Added an inet_ntop function from BIND for systems that do not have it.
301
302 * April 9
303
304 - Made sortlist support IPv6 (this can probably use some testing).
305
306 - Made sortlist support CIDR matching for IPv4.
307
308 * April 8
309
310 - Added preliminary IPv6 support to ares_gethostbyname. Currently, sortlist
311   does not work with IPv6. Also provided an implementation of bitncmp from
312   BIND for systems that do not supply this function. This will be used to add
313   IPv6 support to sortlist.
314
315 - Made ares_gethostbyaddr support IPv6 by specifying AF_INET6 as the family.
316   The function can lookup IPv6 addresses both from files (/etc/hosts) and
317   DNS lookups.
318
319 * April 7
320
321 - Tupone Alfredo fixed includes of arpa/nameser_compat.h to build fine on Mac
322   OS X.
323
324 * April 5
325
326 - Dominick Meglio: Provided implementations of inet_net_pton and inet_pton
327   from BIND for systems that do not include these functions.
328
329 * March 11, 2005
330
331 - Dominick Meglio added ares_parse_aaaa_reply.c and did various
332   adjustments. The first little steps towards IPv6 support!
333
334 * November 7
335
336 - Fixed the VC project and makefile to use ares_cancel and ares_version
337
338 * October 24
339
340 - The released ares_version.h from 1.2.1 says 1.2.0 due to a maketgz flaw.
341   This is now fixed.
342
343 Version 1.2.1 (October 20, 2004)
344
345 * September 29
346
347 - Henrik Stoerner fix: got a report that Tru64 Unix (the unix from Digital
348   when they made Alpha's) uses /etc/svc.conf for the purpose fixed below for
349   other OSes. He made c-ares check for and understand it if present.
350
351 - Now c-ares will use local host name lookup _before_ DNS resolving by default
352   if nothing else is told.
353
354 * September 26
355
356 - Henrik Stoerner: found out that c-ares does not look at the /etc/host.conf
357   file to determine the sequence in which to search /etc/hosts and DNS.  So on
358   systems where this order is defined by /etc/host.conf instead of a "lookup"
359   entry in /etc/resolv.conf, c-ares will always default to looking in DNS
360   first, and /etc/hosts second.
361
362   c-ares now looks at
363
364   1) resolv.conf (for the "lookup" line);
365   2) nsswitch.fon (for the "hosts:" line);
366   3) host.conf (for the "order" line).
367
368   First match wins.
369
370 - Dominick Meglio patched: C-ares on Windows assumed that the HOSTS file is
371   located in a static location. It assumed
372   C:\Windows\System32\Drivers\Etc. This is a poor assumption to make. In fact,
373   the location of the HOSTS file can be changed via a registry setting.
374
375   There is a key called DatabasePath which specifies the path to the HOSTS
376   file:
377   http://www.microsoft.com/technet/itsolutions/network/deploy/depovg/tcpip2k.mspx
378
379   The patch will make c-ares correctly consult the registry for the location
380   of this file.
381
382 * August 29
383
384 - Gisle Vanem fixed the MSVC build files.
385
386 * August 20
387
388 - Gisle Vanem made c-ares build and work with his Watt-32 TCP/IP stack.
389
390 * August 13
391
392 - Harshal Pradhan made a minor syntax change in ares_init.c to make it build
393   fine with MSVC 7.1
394
395 * July 24
396
397 - Made the lib get built static only if --enable-debug is used.
398
399 - Gisle Vanem fixed:
400
401   Basically in loops like handle_errors(), 'query->next' was assigned a local
402   variable and then query was referenced after the memory was freed by
403   next_server(). I've changed that so next_server() and end_query() returns
404   the next query. So callers should use this ret-value.
405
406   The next problem was that 'server->tcp_buffer_pos' had a random value at
407   entry to 1st recv() (luckily causing Winsock to return ENOBUFS).
408
409   I've also added a ares_writev() for Windows to streamline the code a bit
410   more.
411
412 * July 20
413 - Fixed a few variable return types for some system calls. Made configure
414   check for ssize_t to make it possible to use that when receiving the send()
415   error code. This is necessary to prevent compiler warnings on some systems.
416
417 - Made configure create config.h, and all source files now include setup.h that
418   might include the proper config.h (or a handicrafted alternative).
419
420 - Switched to 'ares_socket_t' type for sockets in ares, since Windows don't
421   use 'int' for that.
422
423 - automake-ified and libool-ified c-ares. Now it builds libcares as a shared
424   lib on most platforms if wanted. (This bloated the size of the release
425   archive with another 200K!)
426
427 - Makefile.am now uses Makefile.inc for the c sources, h headers and man
428   pages, to make it easier for other makefiles to use the exact same set of
429   files.
430
431 - Adjusted 'maketgz' to use the new automake magic when building distribution
432   archives.
433
434 - Anyone desires HTML and/or PDF versions of the man pages in the release
435   archives?
436
437 * July 3
438 - Günter Knauf made c-ares build and run on Novell Netware.
439
440 * July 1
441 - Gisle Vanem provided Makefile.dj to build with djgpp, added a few more djgpp
442   fixes and made ares not use 'errno' to provide further info on Windows.
443
444 * June 30
445 - Gisle Vanem made it build with djgpp and run fine with the Watt-32 stack.
446
447 * June 10
448 - Gisle Vanem's init patch for Windows:
449
450   The init_by_resolv_conf() function fetches the DNS-server(s)
451   from a series of registry branches.
452
453   This can be wrong in the case where DHCP has assigned nameservers, but the
454   user has overridden these servers with other prefered settings. Then it's
455   wrong to use the DHCPNAMESERVER setting in registry.
456
457   In the case of no global DHCP-assigned or fixed servers, but DNS server(s)
458   per adapter, one has to query the adapter branches.  But how can c-ares know
459   which adapter is valid for use? AFAICS it can't. There could be one adapter
460   that is down (e.g. a VPN adapter).
461
462   So it's better to leave this to the IP Helper API (iphlapi) available in
463   Win-98/2000 and later. My patch falls-back to the old way if not available.
464
465 * June 8
466 - James Bursa fixed an init issue for RISC OS.
467
468 * May 11
469 - Nico Stappenbelt reported that when processing domain and search lines in
470   the resolv.conf file, the first entry encountered is processed and used as
471   the search list. According to the manual pages for both Linux, Solaris and
472   Tru64, the last entry of either a domain or a search field is used.
473
474   This is now adjusted in the code
475
476 Version 1.2.0 (April 13, 2004)
477
478 * April 2, 2004
479 - Updated various man pages to look nicer when converted to HTML on the web
480   site.
481
482 * April 1, 2004
483 - Dirk Manske provided a new function that is now named ares_cancel(). It is
484   used to cancel/cleanup a resolve/request made using ares functions on the
485   given ares channel. It does not destroy/kill the ares channel itself.
486
487 - Dominick Meglio cleaned up the formatting in several man pages.
488
489 * March 30, 2004
490 - Dominick Meglio's new ares_expand_string. A helper function when decoding
491   incoming DNS packages.
492
493 - Daniel Stenberg modified the Makefile.in to use a for loop for the man page
494   installation to improve overview and make it easier to add man pages.
495
496 Version 1.1.0 (March 11, 2004)
497
498 * March 9, 2004
499 - Gisle Vanem improved build on Windows.
500
501 * February 25, 2004
502 - Dan Fandrich found a flaw in the Feb 22 fix.
503
504 - Added better configure --enable-debug logic (taken from the curl configure
505   script). Added acinclude.m4 to the tarball.
506
507 * February 23, 2004
508 - Removed ares_free_errmem(), the function, the file and the man page. It was
509   not used and it did nothing.
510
511 - Fixed a lot of code that wasn't "64bit clean" and thus caused a lot of
512   compiler warnings on picky compilers.
513
514 * February 22, 2004
515 - Dominick Meglio made ares init support multiple name servers in the
516   NameServer key on Windows.
517
518 * February 16, 2004
519 - Modified ares_private.h to include libcurl's memory debug header if
520   CURLDEBUG is set. This makes all the ares-functions supervised properly by
521   the curl test suite. This also forced me to add inclusion of the
522   ares_private.h header in a few more files that are using some kind of
523   memory-related resources.
524
525 - Made the makefile only build ahost and adig if 'make demos' is used.
526
527 * February 10, 2004
528 - Dirk Manske made ares_version.h installed with 'make install'
529
530 * February 4, 2004
531 - ares_free_errmem() is subject for removal, it is simply present for future
532   purposes, and since we removed the extra parameter in strerror() it won't
533   be used by c-ares!
534 - configure --enable-debug now enables picky compiler options if gcc is used
535 - fixed several compiler warnings --enable-debug showed and Joerg Mueller-Tolk
536   reported
537
538 Version 1.0.0 (February 3, 2004)
539
540 * February 3, 2004
541 - now we produce the libcares.a library instead of the previous libares.a
542   since we are no longer compatible
543
544 * February 2, 2004
545
546 - ares_strerror() has one argument less. This is the first official
547   modification of the existing provided ares API.
548
549 * January 29, 2004
550
551 - Dirk Manske fixed how the socket is set non-blocking.
552
553 * January 4, 2004
554
555 - Dominick Meglio made the private gettimeofday() become ares_gettimeofday()
556   instead in order to not pollute the name space and risk colliding with
557   other libraries' versions of this function.
558
559 * October 24, 2003. Daniel Stenberg
560
561   Added ares_version().
562
563 Version 1.0-pre1 (8 October 2003)
564
565 - James Bursa made it run on RISC OS
566
567 - Dominick Meglio made it run fine on NT4
568
569 - Duncan Wilcox made it work fine on Mac OS X
570
571 - Daniel Stenberg adjusted the windows port
572
573 - liren at vivisimo.com made the initial windows port
574
575 * Imported the sources from ares 1.1.1