cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Issue in url.c

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Thu, 10 Jul 2014 00:47:27 +0200

On Wed, Jul 09, 2014 at 03:25:12PM -0400, Glen A Johnson Jr. wrote:
> I ran into this issue using curl 7.36.0 and also confirmed with curl 7.37.0.
>
> The issue is that when use_netrc is set to CURL_NETRC_OPTIONAL that
> CURLE_OUT_OF_MEMORY is returned from override_login if the netrc file is not
> present.
>
> I ran into this issue when using the GDAL WMS driver in an application. The
> attached diff file is from url.c in the curl 7.37.0 distribution.

The error code in this case is clearly wrong. It seems to be triggered by the
inability to find the home directory in which the netrc file, and in this case
it should be treated like the file was not found. Does this patch work for you?

diff --git a/lib/netrc.c b/lib/netrc.c
index a1b00b2..a7a7101 100644
--- a/lib/netrc.c
+++ b/lib/netrc.c
@@ -88,7 +88,7 @@ int Curl_parsenetrc(const char *host,
     }
 
     if(!home)
- return -1;
+ return retcode; /* no home directory found (or possibly out of memory) */
 
     netrcfile = curl_maprintf("%s%s%s", home, DIR_CHAR, NETRC);
     if(home_alloc)

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-07-10