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:
Daniel Stenberg 2004-02-19 09:22:00 +00:00
parent e7050f97c4
commit c6e5b67197
1 changed files with 18 additions and 16 deletions

View File

@ -111,24 +111,26 @@ int Curl_parsenetrc(char *host,
}
#endif /* CURLDEBUG */
if(!netrcfile) {
#if defined(HAVE_GETPWUID) && defined(HAVE_GETEUID)
struct passwd *pw;
pw= getpwuid(geteuid());
if (pw) {
#ifdef VMS
home = decc$translate_vms(pw->pw_dir);
#else
home = pw->pw_dir;
#endif
}
#endif
if(!home) {
home = curl_getenv("HOME"); /* portable environment reader */
if(!home)
return -1;
home = curl_getenv("HOME"); /* portable environment reader */
if(home) {
home_alloc = TRUE;
#if defined(HAVE_GETPWUID) && defined(HAVE_GETEUID)
}
else {
struct passwd *pw;
pw= getpwuid(geteuid());
if (pw) {
#ifdef VMS
home = decc$translate_vms(pw->pw_dir);
#else
home = pw->pw_dir;
#endif
}
#endif
}
if(!home)
return -1;
netrcfile = curl_maprintf("%s%s%s", home, DIR_CHAR, NETRC);
if(!netrcfile) {