From: Seonah Moon Date: Wed, 23 Dec 2020 04:49:24 +0000 (+0900) Subject: Upgrade to 1.17.1 X-Git-Tag: submit/tizen_base/20201224.050427~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=14960bfff614547ff397e455217e26d0e3419d57;p=platform%2Fupstream%2Fc-ares.git Upgrade to 1.17.1 Change-Id: I9c889de812fe62ff3a408efb6adfd98e1bb77bf0 --- 14960bfff614547ff397e455217e26d0e3419d57 diff --cc docs/ares_set_servers_csv.3 index 0000000,638d269..9679d58 mode 000000,100644..100644 --- a/docs/ares_set_servers_csv.3 +++ b/docs/ares_set_servers_csv.3 @@@ -1,0 -1,67 +1,80 @@@ + .\" + .\" Copyright 2010 by Ben Greear + .\" + .\" Permission to use, copy, modify, and distribute this + .\" software and its documentation for any purpose and without + .\" fee is hereby granted, provided that the above copyright + .\" notice appear in all copies and that both that copyright + .\" notice and this permission notice appear in supporting + .\" documentation, and that the name of M.I.T. not be used in + .\" advertising or publicity pertaining to distribution of the + .\" software without specific, written prior permission. + .\" M.I.T. makes no representations about the suitability of + .\" this software for any purpose. It is provided "as is" + .\" without express or implied warranty. + .\" + .TH ARES_SET_SERVERS_CSV 3 "30 June 2010" + .SH NAME + ares_set_servers_csv, ares_set_servers_ports_csv \- Set list of DNS servers to be used. + .SH SYNOPSIS + .nf + .B #include + .PP ++.B void ares_set_servers_csv(ares_channel \fIchannel\fP, const char* \fIservers\fP) ++.fi ++.SH DESCRIPTION ++The \fBares_set_servers_csv\fP function sets the list of DNS servers ++that ARES will query. The format of the servers option is: + .B int ares_set_servers_csv(ares_channel \fIchannel\fP, const char* \fIservers\fP) + .B int ares_set_servers_ports_csv(ares_channel \fIchannel\fP, const char* \fIservers\fP) + .fi + .SH DESCRIPTION + The \fBares_set_servers_csv\fP and \fBares_set_servers_ports_csv\fPfunctions set + the list of DNS servers that ARES will query. The format of the servers option is: + + host[:port][,host[:port]]... + + For example: + + 192.168.1.100,192.168.1.101,3.4.5.6 ++ ++.SH SEE ALSO ++.BR ares_set_servers (3) ++.SH NOTES ++The port option is currently ignored by c-ares internals ++and the standard port is always used. ++ ++This function was added in c-ares 1.7.2 + .PP + The \fBares_set_servers_csv\fP function will ignore any port values specified in + the input string, whereare the \fBares_set_servers_ports_csv\fP function will + apply any specified port values as the UDP and TCP port to be used for that + particular nameserver. + + .SH RETURN VALUES + .B ares_set_servers_csv(3) + This function may return any of the following values: + .TP 15 + .B ARES_SUCCESS + The name servers configuration was successfully initialized. + .TP 15 + .B ARES_ENOMEM + The process's available memory was exhausted. + .TP 15 + .B ARES_ENODATA + The channel data identified by + .IR channel + was invalid. + .TP 15 + .B ARES_ENOTINITIALIZED + c-ares library initialization not yet performed. + .TP 15 + .B ARES_ENOTIMP + Changing name servers configuration while queries are outstanding is not implemented. + .SH SEE ALSO + .BR ares_set_servers (3) + .SH AVAILABILITY + \fBares_set_servers_csv\fP was added in c-ares 1.7.2; + \fBares_set_servers_ports_csv\fP was added in c-ares 1.11.0. + .SH AUTHOR + Ben Greear diff --cc packaging/c-ares.spec index 6a2e2fd,0000000..59b2535 mode 100644,000000..100644 --- a/packaging/c-ares.spec +++ b/packaging/c-ares.spec @@@ -1,71 -1,0 +1,71 @@@ +Name: c-ares - Version: 1.12.0 ++Version: 1.17.1 +Release: 0 +License: MIT +Summary: Library for asynchronous name resolves +Group: Development/Libraries/C and C++ +Source: http://daniel.haxx.se/projects/c-ares/%{name}-%{version}.tar.bz2 +Source2: baselibs.conf +Source1001: c-ares.manifest +Source1002: LICENSE +BuildRequires: pkg-config +BuildRequires: libtool +Url: http://daniel.haxx.se/projects/c-ares + +%description +c-ares is a C library that performs DNS requests and name resolves +asynchronously. c-ares is a fork of the library named 'ares', written +by Greg Hudson at MIT. + +%package -n libcares +Summary: Library for asynchronous name resolves +Group: Development/Libraries/C and C++ + +%description -n libcares +c-ares is a C library that performs DNS requests and name resolves +asynchronously. c-ares is a fork of the library named 'ares', written +by Greg Hudson at MIT. + +%package -n libcares-devel +Summary: Library for asynchronous name resolves +Group: Development/Libraries/C and C++ +Requires: libcares = %{version} +Requires: glibc-devel + +%description -n libcares-devel +c-ares is a C library that performs DNS requests and name resolves +asynchronously. c-ares is a fork of the library named 'ares', written +by Greg Hudson at MIT. + +%prep +%setup -q -n %{name}-%{version} +cp %{SOURCE1001} . +cp %{SOURCE1002} . + +%build +autoreconf -fiv +%configure --enable-symbol-hiding --enable-nonblocking --enable-shared --disable-static --with-pic --disable-tests +sed -i -e 's@-g0@-g@g' Makefile +make %{?_smp_mflags} + +%install +%make_install + +%post -p /sbin/ldconfig -n libcares + +%postun -p /sbin/ldconfig -n libcares + +%files -n libcares +%license LICENSE +%manifest %{name}.manifest +%defattr(-,root,root) +%{_libdir}/libcares.so.2* + +%files -n libcares-devel +%license LICENSE +%manifest %{name}.manifest +%defattr(-,root,root) +%{_libdir}/libcares.so +%{_includedir}/*.h +%{_mandir}/man3/ares_* +%{_libdir}/pkgconfig/libcares.pc diff --cc src/lib/ares_parse_naptr_reply.c index 0000000,a14c226..6216ca7 mode 000000,100644..100644 --- a/src/lib/ares_parse_naptr_reply.c +++ b/src/lib/ares_parse_naptr_reply.c @@@ -1,0 -1,194 +1,200 @@@ + + /* Copyright 1998 by the Massachusetts Institute of Technology. + * Copyright (C) 2009 by Jakub Hrozek + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + + #include "ares_setup.h" + + #ifdef HAVE_NETINET_IN_H + # include + #endif + #ifdef HAVE_NETDB_H + # include + #endif + #ifdef HAVE_ARPA_INET_H + # include + #endif + #ifdef HAVE_ARPA_NAMESER_H + # include + #else + # include "nameser.h" + #endif + #ifdef HAVE_ARPA_NAMESER_COMPAT_H + # include + #endif + + #include "ares.h" + #include "ares_dns.h" + #include "ares_data.h" + #include "ares_private.h" + + /* AIX portability check */ + #ifndef T_NAPTR + #define T_NAPTR 35 /* naming authority pointer */ + #endif + + int + ares_parse_naptr_reply (const unsigned char *abuf, int alen, + struct ares_naptr_reply **naptr_out) + { + unsigned int qdcount, ancount, i; + const unsigned char *aptr, *vptr; + int status, rr_type, rr_class, rr_len; + long len; + char *hostname = NULL, *rr_name = NULL; + struct ares_naptr_reply *naptr_head = NULL; + struct ares_naptr_reply *naptr_last = NULL; + struct ares_naptr_reply *naptr_curr; + + /* Set *naptr_out to NULL for all failure cases. */ + *naptr_out = NULL; + + /* Give up if abuf doesn't have room for a header. */ + if (alen < HFIXEDSZ) + return ARES_EBADRESP; + + /* Fetch the question and answer count from the header. */ + qdcount = DNS_HEADER_QDCOUNT (abuf); + ancount = DNS_HEADER_ANCOUNT (abuf); + if (qdcount != 1) + return ARES_EBADRESP; + if (ancount == 0) + return ARES_ENODATA; + + /* Expand the name from the question, and skip past the question. */ + aptr = abuf + HFIXEDSZ; + status = ares_expand_name (aptr, abuf, alen, &hostname, &len); + if (status != ARES_SUCCESS) + return status; + + if (aptr + len + QFIXEDSZ > abuf + alen) + { + ares_free (hostname); + return ARES_EBADRESP; + } + aptr += len + QFIXEDSZ; + + /* Examine each answer resource record (RR) in turn. */ + for (i = 0; i < ancount; i++) + { + /* Decode the RR up to the data field. */ + status = ares_expand_name (aptr, abuf, alen, &rr_name, &len); + if (status != ARES_SUCCESS) + { + break; + } + aptr += len; + if (aptr + RRFIXEDSZ > abuf + alen) + { + status = ARES_EBADRESP; + break; + } + rr_type = DNS_RR_TYPE (aptr); + rr_class = DNS_RR_CLASS (aptr); + rr_len = DNS_RR_LEN (aptr); + aptr += RRFIXEDSZ; + if (aptr + rr_len > abuf + alen) + { + status = ARES_EBADRESP; + break; + } ++ /* RR must contain at least 7 bytes = 2 x int16 + 3 x name */ ++ if (rr_len < 7) ++ { ++ status = ARES_EBADRESP; ++ break; ++ } + + /* Check if we are really looking at a NAPTR record */ + if (rr_class == C_IN && rr_type == T_NAPTR) + { + /* parse the NAPTR record itself */ + + /* RR must contain at least 7 bytes = 2 x int16 + 3 x name */ + if (rr_len < 7) + { + status = ARES_EBADRESP; + break; + } + + /* Allocate storage for this NAPTR answer appending it to the list */ + naptr_curr = ares_malloc_data(ARES_DATATYPE_NAPTR_REPLY); + if (!naptr_curr) + { + status = ARES_ENOMEM; + break; + } + if (naptr_last) + { + naptr_last->next = naptr_curr; + } + else + { + naptr_head = naptr_curr; + } + naptr_last = naptr_curr; + + vptr = aptr; + naptr_curr->order = DNS__16BIT(vptr); + vptr += sizeof(unsigned short); + naptr_curr->preference = DNS__16BIT(vptr); + vptr += sizeof(unsigned short); + + status = ares_expand_string(vptr, abuf, alen, &naptr_curr->flags, &len); + if (status != ARES_SUCCESS) + break; + vptr += len; + + status = ares_expand_string(vptr, abuf, alen, &naptr_curr->service, &len); + if (status != ARES_SUCCESS) + break; + vptr += len; + + status = ares_expand_string(vptr, abuf, alen, &naptr_curr->regexp, &len); + if (status != ARES_SUCCESS) + break; + vptr += len; + + status = ares_expand_name(vptr, abuf, alen, &naptr_curr->replacement, &len); + if (status != ARES_SUCCESS) + break; + } + + /* Don't lose memory in the next iteration */ + ares_free (rr_name); + rr_name = NULL; + + /* Move on to the next record */ + aptr += rr_len; + } + + if (hostname) + ares_free (hostname); + if (rr_name) + ares_free (rr_name); + + /* clean up on error */ + if (status != ARES_SUCCESS) + { + if (naptr_head) + ares_free_data (naptr_head); + return status; + } + + /* everything looks fine, return the data */ + *naptr_out = naptr_head; + + return ARES_SUCCESS; + }