From ec3bb8f727405642a471b4b1b9eb0118fc003104 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 12 Dec 2009 21:54:01 +0000 Subject: introducing IMAP, POP3 and SMTP support (still lots of polish left to do) --- lib/smtp.h | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 lib/smtp.h (limited to 'lib/smtp.h') diff --git a/lib/smtp.h b/lib/smtp.h new file mode 100644 index 000000000..199481a0b --- /dev/null +++ b/lib/smtp.h @@ -0,0 +1,61 @@ +#ifndef __SMTP_H +#define __SMTP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * $Id$ + ***************************************************************************/ + +#include "pingpong.h" + +/**************************************************************************** + * SMTP unique setup + ***************************************************************************/ +typedef enum { + SMTP_STOP, /* do nothing state, stops the state machine */ + SMTP_SERVERGREET, /* waiting for the initial greeting immediately after + a connect */ + SMTP_EHLO, + SMTP_STARTTLS, + SMTP_MAIL, /* MAIL FROM */ + SMTP_RCPT, /* RCPT TO */ + SMTP_DATA, + SMTP_QUIT, + SMTP_LAST /* never used */ +} smtpstate; + +/* smtp_conn is used for struct connection-oriented data in the connectdata + 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 */ + smtpstate state; /* always use smtp.c:state() to change state! */ +}; + +extern const struct Curl_handler Curl_handler_smtp; +extern const struct Curl_handler Curl_handler_smtps; + +/* this is the 5-bytes End-Of-Body marker for SMTP */ +#define SMTP_EOB "\x0d\x0a\x2e\x0d\x0a" +#define SMTP_EOB_LEN 5 + +#endif /* __SMTP_H */ -- cgit v1.2.1 From 5e6ffe353ab478d67c2964de5a3eb2fd9fcb0528 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 30 Dec 2009 21:52:27 +0000 Subject: (SMTP) support DATA better in the server and make sure to "escape" CRLF.CRLF sequences in uploaded data. The test server doesn't "decode" escaped dot-lines but instead test cases must be written to take them into account. Added test case 803 to verify dot-escaping. --- lib/smtp.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/smtp.h') diff --git a/lib/smtp.h b/lib/smtp.h index 199481a0b..ec0bcfb8b 100644 --- a/lib/smtp.h +++ b/lib/smtp.h @@ -58,4 +58,8 @@ extern const struct Curl_handler Curl_handler_smtps; #define SMTP_EOB "\x0d\x0a\x2e\x0d\x0a" #define SMTP_EOB_LEN 5 +/* if found in data, replace it with this string instead */ +#define SMTP_EOB_REPL "\x0d\x0a\x2e\x2e" +#define SMTP_EOB_REPL_LEN 4 + #endif /* __SMTP_H */ -- cgit v1.2.1 From a1311e5a24e8163876d2d52a422b90d6ba037dd8 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 30 Dec 2009 22:09:43 +0000 Subject: moved the SMTP payload escape function into Curl_smtp_escape_eob and put it in smtp.c --- lib/smtp.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/smtp.h') diff --git a/lib/smtp.h b/lib/smtp.h index ec0bcfb8b..31de99e23 100644 --- a/lib/smtp.h +++ b/lib/smtp.h @@ -62,4 +62,6 @@ extern const struct Curl_handler Curl_handler_smtps; #define SMTP_EOB_REPL "\x0d\x0a\x2e\x2e" #define SMTP_EOB_REPL_LEN 4 +CURLcode Curl_smtp_escape_eob(struct connectdata *conn, int nread); + #endif /* __SMTP_H */ -- cgit v1.2.1 From 6c6dc3f879718492c4902113815aac95cbbebfd8 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 30 Dec 2009 22:50:42 +0000 Subject: modified to get the EHLO domain from the path part of the URL instead of the user name --- lib/smtp.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/smtp.h') 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! */ }; -- cgit v1.2.1 From 975814368a8b567a369ab5174c42dbae5b28b86e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 12 Feb 2010 22:23:46 +0000 Subject: - Jack Zhang reported a problem with SMTP: we wrongly used multiple addresses in the same RCPT TO line, when they should be sent in separate single commands. I updated test case 802 to verify this. - I also fixed a bad use of my_setopt_str() of CURLOPT_MAIL_RCPT in the curl tool which made it try to output it as string for the --libcurl feature which could lead to crashes. --- lib/smtp.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/smtp.h') diff --git a/lib/smtp.h b/lib/smtp.h index a1115e23a..cc581d4d5 100644 --- a/lib/smtp.h +++ b/lib/smtp.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2009, Daniel Stenberg, , et al. + * Copyright (C) 2009 - 2010, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -49,6 +49,7 @@ struct smtp_conn { 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! */ + struct curl_slist *rcpt; }; extern const struct Curl_handler Curl_handler_smtp; -- cgit v1.2.1 From a434cb43e807753730d815096464c9c7cb3f1596 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 20 Feb 2010 21:56:48 +0000 Subject: - I made the SMTP code expect a 250 response back from the server after the full DATA has been sent, and I modified the test SMTP server to also send that response. As usual, the DONE operation that is made after a completed transfer is still not doable in a non-blocking way so this waiting for 250 is unfortunately made blockingly. --- lib/smtp.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/smtp.h') diff --git a/lib/smtp.h b/lib/smtp.h index cc581d4d5..02cd467f5 100644 --- a/lib/smtp.h +++ b/lib/smtp.h @@ -37,6 +37,7 @@ typedef enum { SMTP_MAIL, /* MAIL FROM */ SMTP_RCPT, /* RCPT TO */ SMTP_DATA, + SMTP_POSTDATA, SMTP_QUIT, SMTP_LAST /* never used */ } smtpstate; -- cgit v1.2.1 From 338553eda38a7ed163f935e28461eeda6dde294f Mon Sep 17 00:00:00 2001 From: Patrick Monnerat Date: Mon, 22 Feb 2010 12:41:02 +0000 Subject: - Proper handling of STARTTLS on SMTP, taking CURLUSESSL_TRY into account. - SMTP falls back to RFC821 HELO when EHLO fails (and SSL is not required). - Use of true local host name (i.e.: via gethostname()) when available, as default argument to SMTP HELO/EHLO. - Test case 804 for HELO fallback. --- lib/smtp.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/smtp.h') diff --git a/lib/smtp.h b/lib/smtp.h index 02cd467f5..41efabba4 100644 --- a/lib/smtp.h +++ b/lib/smtp.h @@ -33,6 +33,7 @@ typedef enum { SMTP_SERVERGREET, /* waiting for the initial greeting immediately after a connect */ SMTP_EHLO, + SMTP_HELO, SMTP_STARTTLS, SMTP_MAIL, /* MAIL FROM */ SMTP_RCPT, /* RCPT TO */ -- cgit v1.2.1 From 2309b4e330b96bc2e1f8e36b6184015e59544037 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 24 Mar 2010 11:02:54 +0100 Subject: remove the CVSish $Id$ lines --- lib/smtp.h | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/smtp.h') diff --git a/lib/smtp.h b/lib/smtp.h index 41efabba4..3531a9652 100644 --- a/lib/smtp.h +++ b/lib/smtp.h @@ -20,7 +20,6 @@ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * - * $Id$ ***************************************************************************/ #include "pingpong.h" -- cgit v1.2.1 From 3ec7543007d8f846e77e9e9d23de74be15a2b41f Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Sun, 28 Mar 2010 08:45:16 +0200 Subject: fix smtp compile warning Use ssize_t instead of int for the Curl_smtp_escape_eob nread argument. Signed-off-by: Ben Greear --- lib/smtp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/smtp.h') diff --git a/lib/smtp.h b/lib/smtp.h index 3531a9652..fac43041a 100644 --- a/lib/smtp.h +++ b/lib/smtp.h @@ -64,6 +64,6 @@ extern const struct Curl_handler Curl_handler_smtps; #define SMTP_EOB_REPL "\x0d\x0a\x2e\x2e" #define SMTP_EOB_REPL_LEN 4 -CURLcode Curl_smtp_escape_eob(struct connectdata *conn, int nread); +CURLcode Curl_smtp_escape_eob(struct connectdata *conn, ssize_t nread); #endif /* __SMTP_H */ -- cgit v1.2.1 From e7e37a246a2ebd55b8b507e5a3d27744feff6203 Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Fri, 2 Apr 2010 21:02:35 +0200 Subject: fixed compiler warnings --- lib/smtp.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/smtp.h') diff --git a/lib/smtp.h b/lib/smtp.h index fac43041a..4716338b5 100644 --- a/lib/smtp.h +++ b/lib/smtp.h @@ -47,8 +47,8 @@ typedef enum { 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 */ + size_t 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! */ struct curl_slist *rcpt; }; -- cgit v1.2.1 From 4bfe07640c93f8dfd3af4bb76c8346ef4a129cc8 Mon Sep 17 00:00:00 2001 From: monnerat Date: Mon, 19 Apr 2010 11:16:30 +0200 Subject: Implement SMTP authentication --- lib/smtp.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/smtp.h') diff --git a/lib/smtp.h b/lib/smtp.h index 4716338b5..417fd52e5 100644 --- a/lib/smtp.h +++ b/lib/smtp.h @@ -34,6 +34,11 @@ typedef enum { SMTP_EHLO, SMTP_HELO, SMTP_STARTTLS, + SMTP_AUTHPLAIN, + SMTP_AUTHLOGIN, + SMTP_AUTHPASSWD, + SMTP_AUTHCRAM, + SMTP_AUTH, SMTP_MAIL, /* MAIL FROM */ SMTP_RCPT, /* RCPT TO */ SMTP_DATA, @@ -49,10 +54,19 @@ struct smtp_conn { char *domain; /* what to send in the EHLO */ size_t eob; /* number of bytes of the EOB (End Of Body) that has been received thus far */ + unsigned int authmechs; /* Accepted authentication methods. */ smtpstate state; /* always use smtp.c:state() to change state! */ struct curl_slist *rcpt; }; +/* Authentication mechanism flags. */ +#define SMTP_AUTH_LOGIN 0x0001 +#define SMTP_AUTH_PLAIN 0x0002 +#define SMTP_AUTH_CRAM_MD5 0x0004 +#define SMTP_AUTH_DIGEST_MD5 0x0008 +#define SMTP_AUTH_GSSAPI 0x0010 +#define SMTP_AUTH_EXTERNAL 0x0020 + extern const struct Curl_handler Curl_handler_smtp; extern const struct Curl_handler Curl_handler_smtps; -- cgit v1.2.1 From 88e825de86b8ac95ac72c2b6b0131dded35de5f0 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 16 Feb 2011 22:13:10 +0100 Subject: SMTP in multi mode: use Curl_ssl_connect_nonblocking() when connecting. --- lib/smtp.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/smtp.h') diff --git a/lib/smtp.h b/lib/smtp.h index 417fd52e5..e9050f868 100644 --- a/lib/smtp.h +++ b/lib/smtp.h @@ -57,6 +57,7 @@ struct smtp_conn { unsigned int authmechs; /* Accepted authentication methods. */ smtpstate state; /* always use smtp.c:state() to change state! */ struct curl_slist *rcpt; + bool ssldone; /* is connect() over SSL done? only relevant in multi mode */ }; /* Authentication mechanism flags. */ -- cgit v1.2.1 From 521e88e0094fc6339e33f0a158397da06926dac0 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 16 Feb 2011 22:28:01 +0100 Subject: SMTP-multi: non-blocking connect Use Curl_ssl_connect_nonblocking() when upgrading the connection to TLS/SSL while using the multi interface. --- lib/smtp.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/smtp.h') diff --git a/lib/smtp.h b/lib/smtp.h index e9050f868..0f527142c 100644 --- a/lib/smtp.h +++ b/lib/smtp.h @@ -34,6 +34,7 @@ typedef enum { SMTP_EHLO, SMTP_HELO, SMTP_STARTTLS, + SMTP_UPGRADETLS, /* asynchronously upgrade the connection to SSL/TLS (multi mode only) */ SMTP_AUTHPLAIN, SMTP_AUTHLOGIN, SMTP_AUTHPASSWD, -- cgit v1.2.1 From b903186fa0189ff241d756d25d07fdfe9885ae49 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 20 Apr 2011 15:17:42 +0200 Subject: source cleanup: unify look, style and indent levels By the use of a the new lib/checksrc.pl script that checks that our basic source style rules are followed. --- lib/smtp.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/smtp.h') diff --git a/lib/smtp.h b/lib/smtp.h index 0f527142c..bc4b91eaa 100644 --- a/lib/smtp.h +++ b/lib/smtp.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2009 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 2009 - 2011, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -34,7 +34,8 @@ typedef enum { SMTP_EHLO, SMTP_HELO, SMTP_STARTTLS, - SMTP_UPGRADETLS, /* asynchronously upgrade the connection to SSL/TLS (multi mode only) */ + SMTP_UPGRADETLS, /* asynchronously upgrade the connection to SSL/TLS + (multi mode only) */ SMTP_AUTHPLAIN, SMTP_AUTHLOGIN, SMTP_AUTHPASSWD, -- cgit v1.2.1 From 4d327d20c62d856c45f8ecf84d16fd7804ace0f1 Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Sat, 1 Oct 2011 14:46:14 +0100 Subject: smtp: Added support for NTLM authentication Modified smtp_endofresp() to detect NTLM from the server specified list of supported authentication mechanisms. Modified smtp_authenticate() to start the sending of the NTLM data. Added smtp_auth_ntlm_type1_message() which creates a NTLM type-1 message. This function is used by authenticate() to start the sending of data and by smtp_state_auth_ntlm_resp() when the AUTH command doesn't contain the type-1 message as part of the initial response. This lack of initial response can happen if an OOM error occurs or the type-1 message is longer than 504 characters. As the main AUTH command is limited to 512 character the data has to be transmitted in two parts; one containing the AUTH NTLM and the second containing the type-1 message. Added smtp_state_auth_ntlm_type2msg_resp() which handles the incoming type-2 message and sends an outgoing type-3 message. This type-2 message is sent by the server in response to our type-1 message. Modified smtp_state_auth_resp() to handle the response to: the AUTH NTLM without the initial response and the type-2 response. Modified smtp_disconnect() to cleanup the NTLM SSPI stack. --- lib/smtp.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/smtp.h') diff --git a/lib/smtp.h b/lib/smtp.h index bc4b91eaa..144d49615 100644 --- a/lib/smtp.h +++ b/lib/smtp.h @@ -40,6 +40,8 @@ typedef enum { SMTP_AUTHLOGIN, SMTP_AUTHPASSWD, SMTP_AUTHCRAM, + SMTP_AUTHNTLM, + SMTP_AUTHNTLM_TYPE2MSG, SMTP_AUTH, SMTP_MAIL, /* MAIL FROM */ SMTP_RCPT, /* RCPT TO */ @@ -57,6 +59,7 @@ struct smtp_conn { size_t eob; /* number of bytes of the EOB (End Of Body) that has been received thus far */ unsigned int authmechs; /* Accepted authentication methods. */ + unsigned int authused; /* Authentication method used for the connection */ smtpstate state; /* always use smtp.c:state() to change state! */ struct curl_slist *rcpt; bool ssldone; /* is connect() over SSL done? only relevant in multi mode */ @@ -69,6 +72,7 @@ struct smtp_conn { #define SMTP_AUTH_DIGEST_MD5 0x0008 #define SMTP_AUTH_GSSAPI 0x0010 #define SMTP_AUTH_EXTERNAL 0x0020 +#define SMTP_AUTH_NTLM 0x0040 extern const struct Curl_handler Curl_handler_smtp; extern const struct Curl_handler Curl_handler_smtps; -- cgit v1.2.1 From 5c409d03ec637e3040ab461ab105dd16740b441e Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Thu, 16 Feb 2012 10:43:17 +0000 Subject: SMTP: Code policing and tidy up --- lib/smtp.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/smtp.h') diff --git a/lib/smtp.h b/lib/smtp.h index 144d49615..8164037db 100644 --- a/lib/smtp.h +++ b/lib/smtp.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2009 - 2011, Daniel Stenberg, , et al. + * Copyright (C) 2009 - 2012, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -39,7 +39,7 @@ typedef enum { SMTP_AUTHPLAIN, SMTP_AUTHLOGIN, SMTP_AUTHPASSWD, - SMTP_AUTHCRAM, + SMTP_AUTHCRAMMD5, SMTP_AUTHNTLM, SMTP_AUTHNTLM_TYPE2MSG, SMTP_AUTH, -- cgit v1.2.1 From 7a2647e16237a2771f564d432d96a6f198a0eeb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6khan=20=C5=9Eeng=C3=BCn?= Date: Fri, 30 Mar 2012 23:50:56 +0300 Subject: smtp: Add support for DIGEST-MD5 authentication --- lib/smtp.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/smtp.h') diff --git a/lib/smtp.h b/lib/smtp.h index 8164037db..502f65cbe 100644 --- a/lib/smtp.h +++ b/lib/smtp.h @@ -40,6 +40,8 @@ typedef enum { SMTP_AUTHLOGIN, SMTP_AUTHPASSWD, SMTP_AUTHCRAMMD5, + SMTP_AUTHDIGESTMD5, + SMTP_AUTHDIGESTMD5_RESP, SMTP_AUTHNTLM, SMTP_AUTHNTLM_TYPE2MSG, SMTP_AUTH, -- cgit v1.2.1 From 7ba07c80a16cd4ce711b5ac62d3632ae4145e9a9 Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Thu, 17 May 2012 11:31:06 +0100 Subject: smtp: Fixed non-escaping of dot character at beginning of line A dot character at the beginning of a line would not be escaped to a double dot as required by RFC-2821, instead it would be deleted by the mail server. Please see section 4.5.2 of the RFC for more information. Note: This fix also simplifies the detection of repeated CRLF.CRLF combinations, such as CRLF.CRLF.CRLF, a little rather than having to advance the eob counter to 2. --- lib/smtp.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/smtp.h') diff --git a/lib/smtp.h b/lib/smtp.h index 502f65cbe..55f169e02 100644 --- a/lib/smtp.h +++ b/lib/smtp.h @@ -82,6 +82,7 @@ extern const struct Curl_handler Curl_handler_smtps; /* this is the 5-bytes End-Of-Body marker for SMTP */ #define SMTP_EOB "\x0d\x0a\x2e\x0d\x0a" #define SMTP_EOB_LEN 5 +#define SMTP_EOB_FIND_LEN 3 /* if found in data, replace it with this string instead */ #define SMTP_EOB_REPL "\x0d\x0a\x2e\x2e" -- cgit v1.2.1 From 978b808f7d636aa2540a351fc776287b49dcaa8a Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Fri, 25 May 2012 21:49:25 +0100 Subject: smtp: Moved auth-mechanism constants into a separate header file Move the SMTP_AUTH constants into a separate header file in preparation for adding SASL based authentication to POP3 as the two protocols will need to share them. --- lib/smtp.h | 9 --------- 1 file changed, 9 deletions(-) (limited to 'lib/smtp.h') diff --git a/lib/smtp.h b/lib/smtp.h index 55f169e02..a010494c3 100644 --- a/lib/smtp.h +++ b/lib/smtp.h @@ -67,15 +67,6 @@ struct smtp_conn { bool ssldone; /* is connect() over SSL done? only relevant in multi mode */ }; -/* Authentication mechanism flags. */ -#define SMTP_AUTH_LOGIN 0x0001 -#define SMTP_AUTH_PLAIN 0x0002 -#define SMTP_AUTH_CRAM_MD5 0x0004 -#define SMTP_AUTH_DIGEST_MD5 0x0008 -#define SMTP_AUTH_GSSAPI 0x0010 -#define SMTP_AUTH_EXTERNAL 0x0020 -#define SMTP_AUTH_NTLM 0x0040 - extern const struct Curl_handler Curl_handler_smtp; extern const struct Curl_handler Curl_handler_smtps; -- cgit v1.2.1 From 7157363ab4c11b17ccdcae436b8eb9ffbc16015e Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Tue, 5 Jun 2012 12:23:01 +0100 Subject: smtp: Post authentication code tidy up Corrected lines longer than 78 characters. Removed unnecessary braces in smtp_state_helo_resp(). Introduced some comments in data sending functions. Tidied up comments to match changes made in pop3.c. --- lib/smtp.h | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'lib/smtp.h') diff --git a/lib/smtp.h b/lib/smtp.h index a010494c3..1a454dc48 100644 --- a/lib/smtp.h +++ b/lib/smtp.h @@ -34,8 +34,8 @@ typedef enum { SMTP_EHLO, SMTP_HELO, SMTP_STARTTLS, - SMTP_UPGRADETLS, /* asynchronously upgrade the connection to SSL/TLS - (multi mode only) */ + SMTP_UPGRADETLS, /* asynchronously upgrade the connection to SSL/TLS + (multi mode only) */ SMTP_AUTHPLAIN, SMTP_AUTHLOGIN, SMTP_AUTHPASSWD, @@ -45,26 +45,27 @@ typedef enum { SMTP_AUTHNTLM, SMTP_AUTHNTLM_TYPE2MSG, SMTP_AUTH, - SMTP_MAIL, /* MAIL FROM */ - SMTP_RCPT, /* RCPT TO */ + SMTP_MAIL, /* MAIL FROM */ + SMTP_RCPT, /* RCPT TO */ SMTP_DATA, SMTP_POSTDATA, SMTP_QUIT, - SMTP_LAST /* never used */ + SMTP_LAST /* never used */ } smtpstate; /* smtp_conn is used for struct connection-oriented data in the connectdata struct */ struct smtp_conn { struct pingpong pp; - char *domain; /* what to send in the EHLO */ - size_t eob; /* number of bytes of the EOB (End Of Body) that has been - received thus far */ - unsigned int authmechs; /* Accepted authentication methods. */ - unsigned int authused; /* Authentication method used for the connection */ - smtpstate state; /* always use smtp.c:state() to change state! */ - struct curl_slist *rcpt; - bool ssldone; /* is connect() over SSL done? only relevant in multi mode */ + char *domain; /* Client address/name to send in the EHLO */ + size_t eob; /* Number of bytes of the EOB (End Of Body) that + have been received so far */ + unsigned int authmechs; /* Accepted authentication methods */ + unsigned int authused; /* Authentication method used for the connection */ + smtpstate state; /* Always use smtp.c:state() to change state! */ + struct curl_slist *rcpt; /* Recipient list */ + bool ssldone; /* Is connect() over SSL done? only relevant in + multi mode */ }; extern const struct Curl_handler Curl_handler_smtp; -- cgit v1.2.1 From 00fddba6727c44bbf5f22b2bfaff4ef1d7111b19 Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Wed, 6 Jun 2012 20:14:52 +0100 Subject: smtp: Re-factored the SMTP_AUTH* state machine constants Re-factored the SMTP_AUTH* constants, that are used by the state machine, to be clearer to read. --- lib/smtp.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lib/smtp.h') diff --git a/lib/smtp.h b/lib/smtp.h index 1a454dc48..44d009417 100644 --- a/lib/smtp.h +++ b/lib/smtp.h @@ -36,14 +36,14 @@ typedef enum { SMTP_STARTTLS, SMTP_UPGRADETLS, /* asynchronously upgrade the connection to SSL/TLS (multi mode only) */ - SMTP_AUTHPLAIN, - SMTP_AUTHLOGIN, - SMTP_AUTHPASSWD, - SMTP_AUTHCRAMMD5, - SMTP_AUTHDIGESTMD5, - SMTP_AUTHDIGESTMD5_RESP, - SMTP_AUTHNTLM, - SMTP_AUTHNTLM_TYPE2MSG, + SMTP_AUTH_PLAIN, + SMTP_AUTH_LOGIN, + SMTP_AUTH_PASSWD, + SMTP_AUTH_CRAMMD5, + SMTP_AUTH_DIGESTMD5, + SMTP_AUTH_DIGESTMD5_RESP, + SMTP_AUTH_NTLM, + SMTP_AUTH_NTLM_TYPE2MSG, SMTP_AUTH, SMTP_MAIL, /* MAIL FROM */ SMTP_RCPT, /* RCPT TO */ -- cgit v1.2.1 From 0cd8c287a46420768a5b11406638316f859a4873 Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Fri, 8 Jun 2012 19:52:28 +0100 Subject: sasl: Re-factored mechanism constants in preparation for APOP work --- lib/smtp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/smtp.h') diff --git a/lib/smtp.h b/lib/smtp.h index 44d009417..5235e2b2b 100644 --- a/lib/smtp.h +++ b/lib/smtp.h @@ -60,7 +60,7 @@ struct smtp_conn { char *domain; /* Client address/name to send in the EHLO */ size_t eob; /* Number of bytes of the EOB (End Of Body) that have been received so far */ - unsigned int authmechs; /* Accepted authentication methods */ + unsigned int authmechs; /* Accepted authentication mechanisms */ unsigned int authused; /* Authentication method used for the connection */ smtpstate state; /* Always use smtp.c:state() to change state! */ struct curl_slist *rcpt; /* Recipient list */ -- cgit v1.2.1 From 6188855b67236412724895244322b5b59a6efaaa Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Sat, 9 Jun 2012 19:22:29 +0100 Subject: smtp: Post apop feature code tidy up --- lib/smtp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/smtp.h') diff --git a/lib/smtp.h b/lib/smtp.h index 5235e2b2b..38fd1b70a 100644 --- a/lib/smtp.h +++ b/lib/smtp.h @@ -61,7 +61,7 @@ struct smtp_conn { size_t eob; /* Number of bytes of the EOB (End Of Body) that have been received so far */ unsigned int authmechs; /* Accepted authentication mechanisms */ - unsigned int authused; /* Authentication method used for the connection */ + unsigned int authused; /* Auth mechanism used for the connection */ smtpstate state; /* Always use smtp.c:state() to change state! */ struct curl_slist *rcpt; /* Recipient list */ bool ssldone; /* Is connect() over SSL done? only relevant in -- cgit v1.2.1 From 0a0f3c63a624b719f97147fcc2ff28a9ed643a45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Ku=C4=8Dera?= Date: Sun, 2 Sep 2012 10:53:27 +0200 Subject: SMTP: only send SIZE if supported SMTP client will send SIZE parameter in MAIL FROM command only if server supports it. Without this patch server might say "504 Command parameter not implemented" and reject the message. Bug: http://curl.haxx.se/bug/view.cgi?id=3564114 --- lib/smtp.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/smtp.h') diff --git a/lib/smtp.h b/lib/smtp.h index 38fd1b70a..d68a659b5 100644 --- a/lib/smtp.h +++ b/lib/smtp.h @@ -66,6 +66,8 @@ struct smtp_conn { struct curl_slist *rcpt; /* Recipient list */ bool ssldone; /* Is connect() over SSL done? only relevant in multi mode */ + bool size_supported; /* If server supports SIZE extension according to + RFC 1870 */ }; extern const struct Curl_handler Curl_handler_smtp; -- cgit v1.2.1