curl-library
Re: Issue in url.c (Dan Fandrich)
Date: Thu, 10 Jul 2014 10:17:42 -0400
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
Dan,
The patch you suggest would allow the code I'm working on to function
however if you consider the case where use_netrc is set to
CURL_NETRC_REQUIRED this would lead to a successful return from
override_login if home is not found in netrc.c. I'm not sure if anyone is
counting on it returning a failure in this case but you can see the logic.
Glen Johnson
Phone: 321-696-3122
Email: glenajohnsonjr_at_msn.com
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-07-10