Skip to content

Failing to use the correct password from netrc #20950

@bagder

Description

@bagder

I did this

Run a curl command with user name in the URL and have a netrc file with the password set for the host, but without specifying the specific user. The netrc file also contains credentials for other users for the same host:

command line

curl --netrc-optional --netrc-file netrc-file http://user@127.0.0.1/

netrc-file contents

machine 127.0.0.1 password firstthis login unknown
machine 127.0.0.1 password 5up3r53cr37
machine 127.0.0.1 password d1ff3r3nt login anotherone

This command line wrongly sends the d1ff3r3nt password to the server.

I expected the following

The 5up3r53cr37 password should have been picked and used.

curl/libcurl version

git master (8.19.1-DEV)

operating system

any

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions