1
1

* ftpfs.c (ftpfs_login_server): Explicit password should have

priority over the netrc password and the anonymous password.
Reported by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>
Этот коммит содержится в:
Pavel Roskin 2003-11-21 06:57:37 +00:00
родитель 20b89d5436
Коммит ffb686bfa9
2 изменённых файлов: 33 добавлений и 26 удалений

Просмотреть файл

@ -1,3 +1,9 @@
2003-11-21 Pavel Roskin <proski@gnu.org>
* ftpfs.c (ftpfs_login_server): Explicit password should have
priority over the netrc password and the anonymous password.
Reported by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>
2003-11-14 Andrew V. Samoilov <sav@bcs.zp.ua> 2003-11-14 Andrew V. Samoilov <sav@bcs.zp.ua>
* undelfs.c (undelfs_loaddel): Use g_try_malloc()/g_try_relloc() * undelfs.c (undelfs_loaddel): Use g_try_malloc()/g_try_relloc()

Просмотреть файл

@ -407,7 +407,8 @@ ftpfs_changetype (struct vfs_class *me, struct vfs_s_super *super, int binary)
/* This routine logs the user in */ /* This routine logs the user in */
static int static int
ftpfs_login_server (struct vfs_class *me, struct vfs_s_super *super, const char *netrcpass) ftpfs_login_server (struct vfs_class *me, struct vfs_s_super *super,
const char *netrcpass)
{ {
char *pass; char *pass;
char *op; char *op;
@ -416,28 +417,26 @@ ftpfs_login_server (struct vfs_class *me, struct vfs_s_super *super, const char
char reply_string[BUF_MEDIUM]; char reply_string[BUF_MEDIUM];
SUP.isbinary = TYPE_UNKNOWN; SUP.isbinary = TYPE_UNKNOWN;
if (netrcpass)
if (SUP.password) /* explicit password */
op = g_strdup (SUP.password);
else if (netrcpass) /* password from netrc */
op = g_strdup (netrcpass); op = g_strdup (netrcpass);
else { else if (!strcmp (SUP.user, "anonymous") || !strcmp (SUP.user, "ftp")) {
if (!strcmp (SUP.user, "anonymous") || !strcmp (SUP.user, "ftp")) { if (!ftpfs_anonymous_passwd) /* default anonymous password */
if (!ftpfs_anonymous_passwd)
ftpfs_init_passwd (); ftpfs_init_passwd ();
op = g_strdup (ftpfs_anonymous_passwd); op = g_strdup (ftpfs_anonymous_passwd);
anon = 1; anon = 1;
} else { } else { /* ask user */
char *p; char *p;
if (!SUP.password) { p = g_strconcat (_(" FTP: Password required for "), SUP.user, " ",
p = g_strconcat (_(" FTP: Password required for "), NULL);
SUP.user, " ", NULL);
op = vfs_get_password (p); op = vfs_get_password (p);
g_free (p); g_free (p);
if (op == NULL) if (op == NULL)
ERRNOR (EPERM, 0); ERRNOR (EPERM, 0);
SUP.password = g_strdup (op); SUP.password = g_strdup (op);
} else
op = g_strdup (SUP.password);
}
} }
if (!anon || MEDATA->logfile) if (!anon || MEDATA->logfile)
@ -456,8 +455,9 @@ ftpfs_login_server (struct vfs_class *me, struct vfs_s_super *super, const char
} else } else
name = g_strdup (SUP.user); name = g_strdup (SUP.user);
if (ftpfs_get_reply (me, SUP.sock, reply_string, sizeof (reply_string) - 1) if (ftpfs_get_reply
== COMPLETE) { (me, SUP.sock, reply_string,
sizeof (reply_string) - 1) == COMPLETE) {
g_strup (reply_string); g_strup (reply_string);
SUP.remote_is_amiga = strstr (reply_string, "AMIGA") != 0; SUP.remote_is_amiga = strstr (reply_string, "AMIGA") != 0;
if (MEDATA->logfile) { if (MEDATA->logfile) {
@ -483,7 +483,8 @@ ftpfs_login_server (struct vfs_class *me, struct vfs_s_super *super, const char
if (op == NULL) if (op == NULL)
ERRNOR (EPERM, 0); ERRNOR (EPERM, 0);
print_vfs_message (_("ftpfs: sending user account")); print_vfs_message (_("ftpfs: sending user account"));
code = ftpfs_command (me, super, WAIT_REPLY, "ACCT %s", op); code =
ftpfs_command (me, super, WAIT_REPLY, "ACCT %s", op);
g_free (op); g_free (op);
} }
if (code != COMPLETE) if (code != COMPLETE)