summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2022-08-04 23:41:26 +0300
committerDaniel Stenberg <daniel@haxx.se>2022-08-29 17:24:59 +0200
commit943fb2b26af62c47156e9ac331adf2d70be69f91 (patch)
treede1d060223d1a2bc25929eb4d7881e902a1cc4d4
parent8bd03516d62ab08972190e2ccdaa06ab1d692125 (diff)
downloadcurl-943fb2b26af62c47156e9ac331adf2d70be69f91.tar.gz
netrc: Use the password from lines without login
If netrc entry has password with empty login, use it for any username. Example: .netrc: machine example.com password 123456 curl -vn http://user@example.com/ Fix it by initializing state_our_login to TRUE, and reset it only when finding an entry with the same host and different login. Closes #9248
-rw-r--r--lib/netrc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/netrc.c b/lib/netrc.c
index 83fe6a7e0..62a6a10df 100644
--- a/lib/netrc.c
+++ b/lib/netrc.c
@@ -73,8 +73,8 @@ static int parsenetrc(const char *host,
char state_login = 0; /* Found a login keyword */
char state_password = 0; /* Found a password keyword */
- int state_our_login = FALSE; /* With specific_login, found *our* login
- name */
+ int state_our_login = TRUE; /* With specific_login, found *our* login
+ name (or login-less line) */
DEBUGASSERT(netrcfile);