Skip to content

Commit e5f15aa

Browse files
authored
Merge pull request #4831 from Vrihub/3869_ftp
Ticket #3869: actually use the .netrc password for ftp vfs
2 parents d134804 + e305266 commit e5f15aa

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/vfs/ftpfs/ftpfs.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,12 +371,13 @@ ftpfs_correct_url_parameters (const vfs_path_element_t *velement)
371371

372372
ftpfs_netrc_lookup (path_element->host, &new_user, &new_passwd);
373373

374-
// If user is different, remove password
375-
if (new_user != NULL && strcmp (path_element->user, new_user) != 0)
376-
MC_PTR_FREE (path_element->password);
374+
// Use the password if it matches the user
375+
if (new_user != NULL && strcmp (path_element->user, new_user) == 0)
376+
path_element->password = new_passwd;
377+
else
378+
g_free (new_passwd);
377379

378380
g_free (new_user);
379-
g_free (new_passwd);
380381
}
381382

382383
return path_element;

0 commit comments

Comments
 (0)