apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1478911 - in /apr/apr/branches/1.4.x: ./ CHANGES network_io/unix/sockaddr.c
Date Fri, 03 May 2013 18:39:45 GMT
Author: sf
Date: Fri May  3 18:39:44 2013
New Revision: 1478911

URL: http://svn.apache.org/r1478911
Log:
Merge r1478905, add CHANGES entry:

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.4.x/   (props changed)
    apr/apr/branches/1.4.x/CHANGES
    apr/apr/branches/1.4.x/network_io/unix/sockaddr.c

Propchange: apr/apr/branches/1.4.x/
------------------------------------------------------------------------------
  Merged /apr/apr/trunk:r1478905

Modified: apr/apr/branches/1.4.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/CHANGES?rev=1478911&r1=1478910&r2=1478911&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/CHANGES [utf-8] (original)
+++ apr/apr/branches/1.4.x/CHANGES [utf-8] Fri May  3 18:39:44 2013
@@ -1,6 +1,9 @@
                                                      -*- coding: utf-8 -*-
 Changes for APR 1.4.7
 
+  *) Fix apr_sockaddr_info_get() not returning an error in some cases.
+     [Jan Kaluža <jkaluza redhat com>]
+
   *) Fix amd64 assembler version of apr_atomic_xchgptr(). PR 51851. [Mattias
      Engdegård <mattiase acm org>]
 

Modified: apr/apr/branches/1.4.x/network_io/unix/sockaddr.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/network_io/unix/sockaddr.c?rev=1478911&r1=1478910&r2=1478911&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/network_io/unix/sockaddr.c (original)
+++ apr/apr/branches/1.4.x/network_io/unix/sockaddr.c Fri May  3 18:39:44 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;
 }
 



Mime
View raw message