Skip to content
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

multiple users per host in ~/.netrc not working #8241

Closed
manfredsc opened this issue Jan 7, 2022 · 0 comments
Closed

multiple users per host in ~/.netrc not working #8241

manfredsc opened this issue Jan 7, 2022 · 0 comments
Assignees

Comments

@manfredsc
Copy link

@manfredsc manfredsc commented Jan 7, 2022

Curl does not use different credentials on this:

  curl -n ftp://foouser@example.com
  curl -n ftp://baruser@example.com

Almost all clients (wget, lftp, ftp, ...) pick the matching entry out of ~/.netrc,
but curl just takes the first ~/.netrc entry for "example.com".

Or, as a standalone example, using http:

cat > curl.netrc <<EOF
machine example.com
login foouser
password foouser

machine example.com
login baruser
password baruser
EOF

#> curl -qsS --netrc-file curl.netrc --trace-ascii - http://baruser@example.com | grep "user"
== Info: Server auth using Basic with user 'foouser'
#> curl -qsS --netrc-file curl.netrc --trace-ascii - http://foouser@example.com | grep "user"
== Info: Server auth using Basic with user 'foouser'

curl/libcurl version

curl 7.79.1

bagder added a commit that referenced this issue Jan 7, 2022
Add test 380 to verify

Reported-by: Manfred Schwarb
Fixes #8241
bagder added a commit that referenced this issue Jan 8, 2022
Add test 380 and 381 to verify, edited test 133

Reported-by: Manfred Schwarb
Fixes #8241
Closes #8243
@bagder bagder self-assigned this Jan 8, 2022
@bagder bagder closed this in d1237ac Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants