You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by sf...@apache.org on 2013/05/03 20:37:00 UTC
svn commit: r1478909 - in /apr/apr/branches/1.5.x: ./
network_io/unix/sockaddr.c
Author: sf
Date: Fri May 3 18:37:00 2013
New Revision: 1478909
URL: http://svn.apache.org/r1478909
Log:
Merge r1478905:
Make sure apr_sockaddr_info_get() returns an error if
- getaddrinfo() returned only useless entries
- getaddrinfo() returned EAI_SYSTEM but errno == 0
- gethostbyname() returns no error but an empty address list
Submitted by: Jan Kaluža <jkaluza redhat com>, Stefan Fritsch
Modified:
apr/apr/branches/1.5.x/ (props changed)
apr/apr/branches/1.5.x/network_io/unix/sockaddr.c
Propchange: apr/apr/branches/1.5.x/
------------------------------------------------------------------------------
Merged /apr/apr/trunk:r1478905
Modified: apr/apr/branches/1.5.x/network_io/unix/sockaddr.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/network_io/unix/sockaddr.c?rev=1478909&r1=1478908&r2=1478909&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/network_io/unix/sockaddr.c (original)
+++ apr/apr/branches/1.5.x/network_io/unix/sockaddr.c Fri May 3 18:37:00 2013
@@ -385,7 +385,7 @@ static apr_status_t call_resolver(apr_so
return apr_get_netos_error();
#else
if (error == EAI_SYSTEM) {
- return errno;
+ return errno ? errno : APR_EGENERAL;
}
else
{
@@ -440,6 +440,15 @@ static apr_status_t call_resolver(apr_so
ai = ai->ai_next;
}
freeaddrinfo(ai_list);
+
+ if (prev_sa == NULL) {
+ /*
+ * getaddrinfo returned only useless entries and *sa is still empty.
+ * This should be treated as an error.
+ */
+ return APR_EGENERAL;
+ }
+
return APR_SUCCESS;
}
@@ -573,6 +582,11 @@ static apr_status_t find_addresses(apr_s
++curaddr;
}
+ if (prev_sa == NULL) {
+ /* this should not happen but no result should be treated as error */
+ return APR_EGENERAL;
+ }
+
return APR_SUCCESS;
}