diff options
author | Daniel Stenberg <daniel@haxx.se> | 2006-07-25 22:45:21 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2006-07-25 22:45:21 +0000 |
commit | 2527b5301946539363754a390974cdd3a3d34485 (patch) | |
tree | cb3118d3490244ef1ed0e9ca624501ec60e3fe24 /lib/ftp.c | |
parent | 78a47826b26d666586dc98028f38b5a0d6f59ad2 (diff) |
Dan Nelson added the CURLOPT_FTP_ALTERNATIVE_TO_USER libcurl option and curl
tool option named --ftp-alternative-to-user. It provides a mean to send a
particular command if the normal USER/PASS approach fails.
Diffstat (limited to 'lib/ftp.c')
-rw-r--r-- | lib/ftp.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -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; } |