summaryrefslogtreecommitdiffstats
path: root/lib/netrc.c
diff options
context:
space:
mode:
authorCurl Upstream <curl-library@cool.haxx.se>2015-08-11 18:13:01 (GMT)
committerBrad King <brad.king@kitware.com>2015-08-12 18:18:06 (GMT)
commit706542615828488a5ad197d0ef3dd5e42eb739c4 (patch)
tree66bac7b097b4502a0e41eaba51c6b82312bc7f16 /lib/netrc.c
parent3fe5d9bff98b4716e219516c30d71462495324f4 (diff)
downloadCMake-706542615828488a5ad197d0ef3dd5e42eb739c4.zip
CMake-706542615828488a5ad197d0ef3dd5e42eb739c4.tar.gz
CMake-706542615828488a5ad197d0ef3dd5e42eb739c4.tar.bz2
curl 7.44.0 (reduced)
Extract upstream curl using the following shell code. url=git://github.com/bagder/curl.git && v=7.44.0 && r=1a7f66a3 && paths=" CMake/* CMakeLists.txt COPYING include/curl/*.h include/curl/curlbuild.h.cmake lib/*.c lib/*.h lib/CMakeLists.txt lib/Makefile.inc lib/curl_config.h.cmake lib/libcurl.rc lib/vtls/*.c lib/vtls/*.h " && mkdir curl-$v-g$r-reduced && git clone $url curl-git && date=$(cd curl-git && git log -n 1 --format='%cd' $r) && (cd curl-git && git checkout $r && git archive --format=tar $r -- $paths) | (cd curl-$v-g$r-reduced && tar xv && rm lib/config-*.h) && echo "g$r date: $date"
Diffstat (limited to 'lib/netrc.c')
-rw-r--r--lib/netrc.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/netrc.c b/lib/netrc.c
index 7435d94..06f8ea1 100644
--- a/lib/netrc.c
+++ b/lib/netrc.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -31,13 +31,11 @@
#include "strequal.h"
#include "strtok.h"
-#include "curl_memory.h"
#include "rawstr.h"
+#include "curl_printf.h"
-#define _MPRINTF_REPLACE /* use our functions only */
-#include <curl/mprintf.h>
-
-/* The last #include file should be: */
+/* The last #include files should be: */
+#include "curl_memory.h"
#include "memdebug.h"
/* Get user and password from .netrc when given a machine name */
@@ -104,16 +102,16 @@ int Curl_parsenetrc(const char *host,
netrcfile = curl_maprintf("%s%s%s", home, DIR_CHAR, NETRC);
if(home_alloc)
- Curl_safefree(home);
+ free(home);
if(!netrcfile) {
return -1;
}
netrc_alloc = TRUE;
}
- file = fopen(netrcfile, "r");
+ file = fopen(netrcfile, FOPEN_READTEXT);
if(netrc_alloc)
- Curl_safefree(netrcfile);
+ free(netrcfile);
if(file) {
char *tok;
char *tok_buf;
@@ -139,6 +137,10 @@ int Curl_parsenetrc(const char *host,
'password'. */
state=HOSTFOUND;
}
+ else if(Curl_raw_equal("default", tok)) {
+ state=HOSTVALID;
+ retcode=0; /* we did find our host */
+ }
break;
case HOSTFOUND:
if(Curl_raw_equal(host, tok)) {