aboutsummaryrefslogtreecommitdiff
path: root/lib/ftp.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ftp.c')
-rw-r--r--lib/ftp.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index c27030504..c17d9fbaa 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -699,6 +699,7 @@ static CURLcode ftp_state_user(struct connectdata *conn)
NBFTPSENDF(conn, "USER %s", ftp->user?ftp->user:"");
state(conn, FTP_USER);
+ conn->data->state.ftp_trying_alternative = FALSE;
return CURLE_OK;
}
@@ -2302,8 +2303,19 @@ static CURLcode ftp_state_user_resp(struct connectdata *conn,
530 User ... access denied
(the server denies to log the specified user) */
- failf(data, "Access denied: %03d", ftpcode);
- result = CURLE_LOGIN_DENIED;
+
+ if (conn->data->set.ftp_alternative_to_user &&
+ !conn->data->state.ftp_trying_alternative) {
+ /* Ok, USER failed. Let's try the supplied command. */
+ NBFTPSENDF(conn, "%s", conn->data->set.ftp_alternative_to_user);
+ conn->data->state.ftp_trying_alternative = TRUE;
+ state(conn, FTP_USER);
+ result = CURLE_OK;
+ }
+ else {
+ failf(data, "Access denied: %03d", ftpcode);
+ result = CURLE_LOGIN_DENIED;
+ }
}
return result;
}