X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib%2Fnetrc.c;h=06f8ea15a41ac6a3f6de29be9fd0f1406c4e3b52;hb=8a08705db260779441360e959b97b6c172f8acb0;hp=7435d94c482811b520197f8688656da8235e2d15;hpb=f7bbc1c9b6a8e2c815d09612b53f453c90d962e0;p=platform%2Fupstream%2Fcurl.git 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, , et al. + * Copyright (C) 1998 - 2015, Daniel Stenberg, , 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 - -/* 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)) {