mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
* ftpfs.c (ftp_split_url): Implement looking up password in
.netrc for known user.
This commit is contained in:
parent
e88191dd7c
commit
afd132617d
@ -1,5 +1,8 @@
|
||||
2002-07-12 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* ftpfs.c (ftp_split_url): Implement looking up password in
|
||||
.netrc for known user.
|
||||
|
||||
* ftpfs.c (ftp_split_url): Don't expect lookup_netrc() to always
|
||||
return a username.
|
||||
(netrc_has_incorrect_mode): Don't free anything, it can result
|
||||
|
16
vfs/ftpfs.c
16
vfs/ftpfs.c
@ -226,12 +226,28 @@ ftp_split_url(char *path, char **host, char **user, int *port, char **pass)
|
||||
URL_ALLOW_ANON);
|
||||
|
||||
if (!*user) {
|
||||
/* Look up user and password in netrc */
|
||||
if (use_netrc)
|
||||
lookup_netrc (*host, user, pass);
|
||||
if (!*user)
|
||||
*user = g_strdup ("anonymous");
|
||||
}
|
||||
|
||||
/* Look up password in netrc for known user */
|
||||
if (use_netrc && *user && pass && !*pass) {
|
||||
char *new_user;
|
||||
|
||||
lookup_netrc (*host, &new_user, pass);
|
||||
|
||||
/* If user is different, remove password */
|
||||
if (new_user && strcmp (*user, new_user)) {
|
||||
g_free (*pass);
|
||||
*pass = NULL;
|
||||
}
|
||||
|
||||
g_free (new_user);
|
||||
}
|
||||
|
||||
if (p)
|
||||
g_free (p);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user