* 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>
Этот коммит содержится в:
родитель
20b89d5436
Коммит
ffb686bfa9
@ -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()
|
||||||
|
53
vfs/ftpfs.c
53
vfs/ftpfs.c
@ -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)
|
|
||||||
op = g_strdup (netrcpass);
|
|
||||||
else {
|
|
||||||
if (!strcmp (SUP.user, "anonymous") || !strcmp (SUP.user, "ftp")) {
|
|
||||||
if (!ftpfs_anonymous_passwd)
|
|
||||||
ftpfs_init_passwd ();
|
|
||||||
op = g_strdup (ftpfs_anonymous_passwd);
|
|
||||||
anon = 1;
|
|
||||||
} else {
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
if (!SUP.password) {
|
if (SUP.password) /* explicit password */
|
||||||
p = g_strconcat (_(" FTP: Password required for "),
|
op = g_strdup (SUP.password);
|
||||||
SUP.user, " ", NULL);
|
else if (netrcpass) /* password from netrc */
|
||||||
op = vfs_get_password (p);
|
op = g_strdup (netrcpass);
|
||||||
g_free (p);
|
else if (!strcmp (SUP.user, "anonymous") || !strcmp (SUP.user, "ftp")) {
|
||||||
if (op == NULL)
|
if (!ftpfs_anonymous_passwd) /* default anonymous password */
|
||||||
ERRNOR (EPERM, 0);
|
ftpfs_init_passwd ();
|
||||||
SUP.password = g_strdup (op);
|
op = g_strdup (ftpfs_anonymous_passwd);
|
||||||
} else
|
anon = 1;
|
||||||
op = g_strdup (SUP.password);
|
} else { /* ask user */
|
||||||
}
|
char *p;
|
||||||
|
|
||||||
|
p = g_strconcat (_(" FTP: Password required for "), SUP.user, " ",
|
||||||
|
NULL);
|
||||||
|
op = vfs_get_password (p);
|
||||||
|
g_free (p);
|
||||||
|
if (op == NULL)
|
||||||
|
ERRNOR (EPERM, 0);
|
||||||
|
SUP.password = g_strdup (op);
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
@ -506,7 +507,7 @@ ftpfs_login_server (struct vfs_class *me, struct vfs_s_super *super, const char
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
message (1, MSG_ERROR, _("ftpfs: Login incorrect for user %s "),
|
message (1, MSG_ERROR, _("ftpfs: Login incorrect for user %s "),
|
||||||
SUP.user);
|
SUP.user);
|
||||||
login_fail:
|
login_fail:
|
||||||
wipe_password (pass);
|
wipe_password (pass);
|
||||||
g_free (name);
|
g_free (name);
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user