* ftpfs.c (ftp_split_url): Implement looking up password in

.netrc for known user.
This commit is contained in:
Pavel Roskin 2002-07-12 23:41:43 +00:00
parent e88191dd7c
commit afd132617d
2 changed files with 19 additions and 0 deletions

View File

@ -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

View File

@ -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);
}