Doug Porter's patch that changes the order of preferences on how to find the
default netrc file. We now read and uses HOME _before_ we use getpwuid() to better allow users to move around HOME to use different .netrc files without having to rely on even blacker magic.
This commit is contained in:
parent
e7050f97c4
commit
c6e5b67197
10
lib/netrc.c
10
lib/netrc.c
@ -111,7 +111,12 @@ int Curl_parsenetrc(char *host,
|
|||||||
}
|
}
|
||||||
#endif /* CURLDEBUG */
|
#endif /* CURLDEBUG */
|
||||||
if(!netrcfile) {
|
if(!netrcfile) {
|
||||||
|
home = curl_getenv("HOME"); /* portable environment reader */
|
||||||
|
if(home) {
|
||||||
|
home_alloc = TRUE;
|
||||||
#if defined(HAVE_GETPWUID) && defined(HAVE_GETEUID)
|
#if defined(HAVE_GETPWUID) && defined(HAVE_GETEUID)
|
||||||
|
}
|
||||||
|
else {
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
pw= getpwuid(geteuid());
|
pw= getpwuid(geteuid());
|
||||||
if (pw) {
|
if (pw) {
|
||||||
@ -122,13 +127,10 @@ int Curl_parsenetrc(char *host,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if(!home) {
|
|
||||||
home = curl_getenv("HOME"); /* portable environment reader */
|
|
||||||
if(!home)
|
if(!home)
|
||||||
return -1;
|
return -1;
|
||||||
home_alloc = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
netrcfile = curl_maprintf("%s%s%s", home, DIR_CHAR, NETRC);
|
netrcfile = curl_maprintf("%s%s%s", home, DIR_CHAR, NETRC);
|
||||||
if(!netrcfile) {
|
if(!netrcfile) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user