Ticket #3869 (closed defect: fixed)

Opened 6 years ago

Last modified 5 years ago

ftp: fail to retrieve password from .netrc when user is in URL

Reported by: cri Owned by: andrew_b
Priority: major Milestone: 4.8.20
Component: mc-vfs Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: merged Votes for changeset: committed-master

Description (last modified by andrew_b) (diff)

I have a proper entry in ~/.netrc for USERNAME, PASSWORD and HOST.

If I try to access the URL ftp://HOST/PATH, mc correctly retrieves USERNAME and PASSWORD from .netrc and I can log into the FTP host.

If I try to access the URL ftp://USERNAME@HOST/PATH, mc displays a popup window, asking for the password. Shouldn't it retrieve the password from .netrc?

I had a look at https://midnight-commander.org/browser/src/vfs/ftpfs/ftpfs.c#L371

shouldn't it be

...`&& path_element->password == NULL`

instead of

...`&& path_element->password != NULL`

?

Or am I missing something?

Change History

comment:1 Changed 6 years ago by andrew_b

  • Status changed from new to accepted
  • Description modified (diff)
  • Component changed from mc-core to mc-vfs
  • Branch state changed from no branch to on review
  • Milestone changed from Future Releases to 4.8.20
  • Owner set to andrew_b

Please test the
branch: 3869_netrc_password
Initial changeset:54171970084732fe808e0cc200ffc112ee4f8ee1

comment:2 Changed 6 years ago by andrew_b

  • Votes for changeset set to andrew_b
  • Branch state changed from on review to approved

comment:3 Changed 6 years ago by andrew_b

  • Status changed from accepted to testing
  • Votes for changeset changed from andrew_b to committed-master
  • Resolution set to fixed
  • Branch state changed from approved to merged

Merged to master: [cde8e194aa070299df175df94e43bff898a27698].

git log --pretty=oneline 0d17cf7..cde8e19

comment:4 Changed 6 years ago by andrew_b

  • Status changed from testing to closed

comment:5 Changed 5 years ago by cri

It seems to me this bug has re-surfaced on 4.8.22 (Debian buster): i.e. mc keeps asking me for the user's password even when there's a proper password in .netrc.
Moreover, if I don't provide neither user nor password (​ftp://HOST/PATH), mc tries anonymous FTP, whereas before it used the credentials from .netrc.

Sorry I can't test 4.8.23 at the moment, but it worked fine at least until 4.8.18 (Debian stretch), so maybe some regression has happened somewhere in between 4.8.18 and 4.8.22?

Note: See TracTickets for help on using tickets.