-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
also check %USERPROFILE% variable to find .netrc file on Windows #8855
Conversation
de3fc35
to
5e2af16
Compare
It is already done/attempted here: Line 55 in bda0d5f
So why isn't that working already? |
correct me if I am wrong, but it doesn't look like the Should we change the code to something like: int Curl_parsenetrc(const char *host,
char **loginp,
char **passwordp,
bool *login_changed,
bool *password_changed,
char *netrcfile)
{
int retcode = 1;
if(!netrcfile) {
netrcfile = findfile("netrc", TRUE);
if(!netrcfile)
return retcode; /* no home directory found (or possibly out of
memory) */
retcode = parsenetrc(host, loginp, passwordp, login_changed,
password_changed, netrcfile);
free(netrcfile);
}
else
retcode = parsenetrc(host, loginp, passwordp, login_changed,
password_changed, netrcfile);
return retcode;
} |
blah, but of course... 😕 |
@bagder not sure I understand your preferred fix for this. I guess it wouldn't be fine to depend on Please let me know what you think. Happy to attempt an implementation & fix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also needs a documentation update!
lib/netrc.c
Outdated
@@ -256,6 +256,13 @@ int Curl_parsenetrc(const char *host, | |||
if(pw) { | |||
home = pw->pw_dir; | |||
} | |||
#elif defined(CURL_WIN32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this rather check for plain WIN32
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed that! thanks
Thanks! |
It seems that
%HOME%
isn't always set on Windows.However,
%USERPROFILE%
seems to be a standard variable on Windows. So I just added another branch of the if condition to look in there for the.netrc
file if%HOME%
is not set.Ref: mamba-org/mamba#870