mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:31:41 +03:00
netrc: fix password-only entries
When a specific hostname matched, and only a password is set before
another machine is specified in the netrc file, the parser would not be
happy and stop there and return the password-only state. It instead
continued and did not return a match.
Add test 2005 to verify this case
Regression from e9b9bba, shipped in 8.11.1.
Reported-by: Ben Zanin
Fixes #15767
Closes #15768
This commit is contained in:
parent
a787442e5d
commit
9fce2c55d4
3 changed files with 62 additions and 2 deletions
|
|
@ -267,7 +267,8 @@ static int parsenetrc(struct store_netrc *store,
|
|||
retcode = NETRC_FAILED; /* allocation failed */
|
||||
goto out;
|
||||
}
|
||||
found |= FOUND_PASSWORD;
|
||||
if(!specific_login || our_login)
|
||||
found |= FOUND_PASSWORD;
|
||||
keyword = NONE;
|
||||
}
|
||||
else if(strcasecompare("login", tok))
|
||||
|
|
@ -276,6 +277,10 @@ static int parsenetrc(struct store_netrc *store,
|
|||
keyword = PASSWORD;
|
||||
else if(strcasecompare("machine", tok)) {
|
||||
/* a new machine here */
|
||||
if(found & FOUND_PASSWORD) {
|
||||
done = TRUE;
|
||||
break;
|
||||
}
|
||||
state = HOSTFOUND;
|
||||
keyword = NONE;
|
||||
found = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue