aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-01-25 22:13:12 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-01-25 22:13:12 +0000
commit177dbc7be07125582ddb7416dba7140b88ab9f62 (patch)
tree427fa08bfdea3642ac8ecd19776b43b888b2bc24 /lib
parentf2e71edcbd479345678bb03e76fad17157fc318e (diff)
Ian Ford asked about support for the FTP command ACCT, and I discovered it is
present in RFC959... so now (lib)curl supports it as well. --ftp-account and CURLOPT_FTP_ACCOUNT set the account string. (The server may ask for an account string after PASS have been sent away. The client responds with "ACCT [account string]".) Added test case 228 and 229 to verify the functionality. Updated the test FTP server to support ACCT somewhat.
Diffstat (limited to 'lib')
-rw-r--r--lib/ftp.c17
-rw-r--r--lib/url.c4
-rw-r--r--lib/urldata.h1
3 files changed, 22 insertions, 0 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 3f4b23fe7..caca95e95 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -621,6 +621,23 @@ CURLcode Curl_ftp_connect(struct connectdata *conn)
infof(data, "We have successfully logged in\n");
}
+ else if(ftpcode == 332) {
+ /* 332 Please provide account info */
+ if(data->set.ftp_account) {
+ FTPSENDF(conn, "ACCT %s", data->set.ftp_account);
+ result = Curl_GetFTPResponse(&nread, conn, &ftpcode);
+ if(!result && (ftpcode != 230)) {
+ failf(data, "ACCT rejected by server: %03d", ftpcode);
+ result = CURLE_FTP_WEIRD_PASS_REPLY; /* FIX */
+ }
+ }
+ else {
+ failf(data, "ACCT requested by none available");
+ result = CURLE_FTP_WEIRD_PASS_REPLY;
+ }
+ if(result)
+ return result;
+ }
else {
failf(data, "Odd return code after PASS");
return CURLE_FTP_WEIRD_PASS_REPLY;
diff --git a/lib/url.c b/lib/url.c
index 8b433f606..f5fc82be4 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -1396,6 +1396,10 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
data->set.source_postquote = va_arg(param, struct curl_slist *);
break;
+ case CURLOPT_FTP_ACCOUNT:
+ data->set.ftp_account = va_arg(param, char *);
+ break;
+
default:
/* unknown tag and its companion, just ignore: */
result = CURLE_FAILED_INIT; /* correct this */
diff --git a/lib/urldata.h b/lib/urldata.h
index 70045de79..76de45757 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -862,6 +862,7 @@ struct UserDefined {
char *cookiejar; /* dump all cookies to this file */
bool cookiesession; /* new cookie session? */
bool crlf; /* convert crlf on ftp upload(?) */
+ char *ftp_account; /* ftp account data */
struct curl_slist *quote; /* after connection is established */
struct curl_slist *postquote; /* after the transfer */
struct curl_slist *prequote; /* before the transfer, after type */