diff options
author | Daniel Stenberg <daniel@haxx.se> | 2009-12-30 22:50:42 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2009-12-30 22:50:42 +0000 |
commit | 6c6dc3f879718492c4902113815aac95cbbebfd8 (patch) | |
tree | f09e3e8e76b7ac5c7b9b3f748231df4840cb78b9 /lib | |
parent | a1311e5a24e8163876d2d52a422b90d6ba037dd8 (diff) |
modified to get the EHLO domain from the path part of the URL instead of the
user name
Diffstat (limited to 'lib')
-rw-r--r-- | lib/smtp.c | 16 | ||||
-rw-r--r-- | lib/smtp.h | 6 |
2 files changed, 16 insertions, 6 deletions
diff --git a/lib/smtp.c b/lib/smtp.c index e95a2576e..5dd90298b 100644 --- a/lib/smtp.c +++ b/lib/smtp.c @@ -248,11 +248,10 @@ static void state(struct connectdata *conn, static CURLcode smtp_state_ehlo(struct connectdata *conn) { CURLcode result; - struct FTP *smtp = conn->data->state.proto.smtp; + struct smtp_conn *smtpc = &conn->proto.smtpc; /* send EHLO */ - result = Curl_pp_sendf(&conn->proto.smtpc.pp, "EHLO %s", - smtp->user?smtp->user:""); + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "EHLO %s", smtpc->domain); if(result) return result; @@ -545,6 +544,8 @@ static CURLcode smtp_connect(struct connectdata *conn, struct smtp_conn *smtpc = &conn->proto.smtpc; struct SessionHandle *data=conn->data; struct pingpong *pp=&smtpc->pp; + const char *path = conn->data->state.path; + int len; *done = FALSE; /* default to not done yet */ @@ -609,6 +610,12 @@ static CURLcode smtp_connect(struct connectdata *conn, pp->endofresp = smtp_endofresp; pp->conn = conn; + if(!*path) + path = "localhost"; + + /* url decode the path and use it as domain with EHLO */ + smtpc->domain = curl_easy_unescape(conn->data, path, 0, &len); + /* When we connect, we start in the state where we await the server greeting */ state(conn, SMTP_SERVERGREET); @@ -801,12 +808,15 @@ static CURLcode smtp_dophase_done(struct connectdata *conn, { CURLcode result = CURLE_OK; struct FTP *smtp = conn->data->state.proto.smtp; + struct smtp_conn *smtpc= &conn->proto.smtpc; (void)connected; if(smtp->transfer != FTPTRANSFER_BODY) /* no data to transfer */ result=Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + free(smtpc->domain); + return result; } diff --git a/lib/smtp.h b/lib/smtp.h index 31de99e23..a1115e23a 100644 --- a/lib/smtp.h +++ b/lib/smtp.h @@ -45,9 +45,9 @@ typedef enum { struct */ struct smtp_conn { struct pingpong pp; - char *domain; /* what to send in the EHLO */ - int eob; /* number of bytes of the EOB (End Of Body) that has been - received thus far */ + char *domain; /* what to send in the EHLO */ + int eob; /* number of bytes of the EOB (End Of Body) that has been + received thus far */ smtpstate state; /* always use smtp.c:state() to change state! */ }; |