curl-library
SMTP with TLS -> Problems after upgrading from 7.29 to 7.34
Date: Mon, 30 Dec 2013 13:00:53 -0500
Hello all,
I've been using libcurl for just a little while now, using password
authentication to send mail from gmail's smtp servers. Recently I added
support for OAuth 2.0 to my application, and so I upgraded libcurl to
7.34.0 (from 7.29.0) in order to make use of the OAuth2 bearer token
support.
I'm using Windows 7 x64, and I built both version from source using "nmake
/f Makefile.vc mode=static DEBUG=yes" and MSVC++ 2010.
Without changing my code, the switch from 7.29.0 to 7.34.0 changed the
response quite a bit. The latter now fails to send an e-mail, although the
output suggests that is is "trying." I did check the changelog, but
nothing jumped out at me. Did I miss something? Maybe the example works
only because of a bug that's been fixed since 7.29?
My code is based on the SMTP with TLS example here:
http://curl.haxx.se/libcurl/c/smtp-tls.html. The output below was
generated by using almost exactly this example - the only changes I made
were to use my e-mail account info for the login, sender and recipient
information, and I removed the line specifying the path to the security
certificates (I've never had a problem with libcurl verifying certs without
explicitly specifying this path).
This is the dialog between libcurl 7.29.0 and the server (message was
successfully sent):
* About to connect() to smtp.gmail.com port 587 (#0)
* Trying 173.194.68.108...
* Connected to smtp.gmail.com (173.194.68.108) port 587 (#0)
< 220 mx.google.com ESMTP ni10sm59654617qeb.23 - gsmtp
> EHLO user
< 250-mx.google.com at your service, [my ip]
< 250-SIZE 35882577
< 250-8BITMIME
< 250-STARTTLS
< 250-ENHANCEDSTATUSCODES
< 250 CHUNKING
> STARTTLS
< 220 2.0.0 Ready to start TLS
* schannel: SSL/TLS connection with smtp.gmail.com port 587 (step 1/3)
* schannel: checking server certificate revocation
* schannel: sending initial handshake data: sending 127 bytes...
* schannel: sent initial handshake data: sent 127 bytes
* schannel: SSL/TLS connection with smtp.gmail.com port 587 (step 2/3)
* schannel: failed to receive handshake, need more data
* schannel: SSL/TLS connection with smtp.gmail.com port 587 (step 2/3)
* schannel: encrypted data buffer: offset 3539 length 4096
* schannel: sending next handshake data: sending 134 bytes...
* schannel: SSL/TLS connection with smtp.gmail.com port 587 (step 2/3)
* schannel: encrypted data buffer: offset 59 length 4096
* schannel: SSL/TLS handshake complete
* schannel: SSL/TLS connection with smtp.gmail.com port 587 (step 3/3)
* schannel: incremented credential handle refcount = 1
* schannel: stored credential handle in session cache
> EHLO user
* schannel: client wants to read 16384 bytes
* schannel: encrypted data buffer: offset 0 length 16384
* schannel: encrypted data got 213
* schannel: encrypted data buffer: offset 213 length 16384
* schannel: decrypted data length: 179
* schannel: decrypted data added: 179
* schannel: decrypted data cached: offset 179 length 16384
* schannel: decrypted data buffer: offset 179 length 16384
* schannel: decrypted data returned 179
* schannel: decrypted data buffer: offset 0 length 16384
< 250-mx.google.com at your service, [my ip]
< 250-SIZE 35882577
< 250-8BITMIME
< 250-AUTH LOGIN PLAIN XOAUTH XOAUTH2 PLAIN-CLIENTTOKEN
< 250-ENHANCEDSTATUSCODES
< 250 CHUNKING
> AUTH LOGIN bG91eGhvdXNlQGdtYWlsLmNvbQ==
* schannel: client wants to read 16384 bytes
* schannel: encrypted data buffer: offset 0 length 16384
* schannel: encrypted data got 53
* schannel: encrypted data buffer: offset 53 length 16384
* schannel: decrypted data length: 18
* schannel: decrypted data added: 18
* schannel: decrypted data cached: offset 18 length 16384
* schannel: decrypted data buffer: offset 18 length 16384
* schannel: decrypted data returned 18
* schannel: decrypted data buffer: offset 0 length 16384
< 334 UGFzc3dvcmQ6
> QnVybmluZ0pldEZ1ZWw=
* schannel: client wants to read 16384 bytes
* schannel: encrypted data buffer: offset 0 length 16384
* schannel: encrypted data got 53
* schannel: encrypted data buffer: offset 53 length 16384
* schannel: decrypted data length: 20
* schannel: decrypted data added: 20
* schannel: decrypted data cached: offset 20 length 16384
* schannel: decrypted data buffer: offset 20 length 16384
* schannel: decrypted data returned 20
* schannel: decrypted data buffer: offset 0 length 16384
< 235 2.7.0 Accepted
> MAIL FROM:<user1_at_gmail.com>
* schannel: client wants to read 16384 bytes
* schannel: encrypted data buffer: offset 0 length 16384
* schannel: encrypted data got 69
* schannel: encrypted data buffer: offset 69 length 16384
* schannel: decrypted data length: 43
* schannel: decrypted data added: 43
* schannel: decrypted data cached: offset 43 length 16384
* schannel: decrypted data buffer: offset 43 length 16384
* schannel: decrypted data returned 43
* schannel: decrypted data buffer: offset 0 length 16384
< 250 2.1.0 OK ni10sm59654617qeb.23 - gsmtp
> RCPT TO:<user2_at_gmail.com>
* schannel: client wants to read 16384 bytes
* schannel: encrypted data buffer: offset 0 length 16384
* schannel: encrypted data got 69
* schannel: encrypted data buffer: offset 69 length 16384
* schannel: decrypted data length: 43
* schannel: decrypted data added: 43
* schannel: decrypted data cached: offset 43 length 16384
* schannel: decrypted data buffer: offset 43 length 16384
* schannel: decrypted data returned 43
* schannel: decrypted data buffer: offset 0 length 16384
< 250 2.1.5 OK ni10sm59654617qeb.23 - gsmtp
> RCPT TO:<user3_at_gmail.com>
* schannel: client wants to read 16384 bytes
* schannel: encrypted data buffer: offset 0 length 16384
* schannel: encrypted data got 69
* schannel: encrypted data buffer: offset 69 length 16384
* schannel: decrypted data length: 43
* schannel: decrypted data added: 43
* schannel: decrypted data cached: offset 43 length 16384
* schannel: decrypted data buffer: offset 43 length 16384
* schannel: decrypted data returned 43
* schannel: decrypted data buffer: offset 0 length 16384
< 250 2.1.5 OK ni10sm59654617qeb.23 - gsmtp
> DATA
* schannel: client wants to read 16384 bytes
* schannel: encrypted data buffer: offset 0 length 16384
* schannel: encrypted data got 85
* schannel: encrypted data buffer: offset 85 length 16384
* schannel: decrypted data length: 44
* schannel: decrypted data added: 44
* schannel: decrypted data cached: offset 44 length 16384
* schannel: decrypted data buffer: offset 44 length 16384
* schannel: decrypted data returned 44
* schannel: decrypted data buffer: offset 0 length 16384
< 354 Go ahead ni10sm59654617qeb.23 - gsmtp
* schannel: client wants to read 16384 bytes
* schannel: encrypted data buffer: offset 0 length 16384
* schannel: encrypted data got 85
* schannel: encrypted data buffer: offset 85 length 16384
* schannel: decrypted data length: 54
* schannel: decrypted data added: 54
* schannel: decrypted data cached: offset 54 length 16384
* schannel: decrypted data buffer: offset 54 length 16384
* schannel: decrypted data returned 54
* schannel: decrypted data buffer: offset 0 length 16384
< 250 2.0.0 OK 1388425743 ni10sm59654617qeb.23 - gsmtp
* Connection #0 to host smtp.gmail.com left intact
And the dialog between libcurl 7.34.0 and the server (and it fails to send
the message):
* Rebuilt URL to: smtp://smtp.gmail.com:587/
* Hostname was NOT found in DNS cache
* Adding handle: conn: 0x8d8588
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x8d8588) send_pipe: 1, recv_pipe: 0
* Trying 173.194.68.108...
* Connected to smtp.gmail.com (173.194.68.108) port 587 (#0)
< 220 mx.google.com ESMTP e2sm57495043qas.21 - gsmtp
> EHLO user
< 250-mx.google.com at your service, [my ip]
< 250-SIZE 35882577
< 250-8BITMIME
< 250-STARTTLS
< 250-ENHANCEDSTATUSCODES
< 250 CHUNKING
> STARTTLS
< 220 2.0.0 Ready to start TLS
* schannel: SSL/TLS connection with smtp.gmail.com port 587 (step 1/3)
* schannel: checking server certificate revocation
* schannel: sending initial handshake data: sending 127 bytes...
* schannel: sent initial handshake data: sent 127 bytes
* schannel: SSL/TLS connection with smtp.gmail.com port 587 (step 2/3)
* schannel: failed to receive handshake, need more data
* schannel: SSL/TLS connection with smtp.gmail.com port 587 (step 2/3)
* schannel: encrypted data buffer: offset 3539 length 4096
* schannel: sending next handshake data: sending 134 bytes...
* schannel: SSL/TLS connection with smtp.gmail.com port 587 (step 2/3)
* schannel: encrypted data buffer: offset 59 length 4096
* schannel: SSL/TLS handshake complete
* schannel: SSL/TLS connection with smtp.gmail.com port 587 (step 3/3)
* schannel: incremented credential handle refcount = 1
* schannel: stored credential handle in session cache
> EHLO user
* schannel: client wants to read 16384 bytes
* schannel: encrypted data buffer: offset 0 length 16384
* schannel: encrypted data got 213
* schannel: encrypted data buffer: offset 213 length 16384
* schannel: decrypted data length: 179
* schannel: decrypted data added: 179
* schannel: decrypted data cached: offset 179 length 16384
* schannel: decrypted data buffer: offset 179 length 16384
* schannel: decrypted data returned 179
* schannel: decrypted data buffer: offset 0 length 16384
< 250-mx.google.com at your service, [my ip]
< 250-SIZE 35882577
< 250-8BITMIME
< 250-AUTH LOGIN PLAIN XOAUTH XOAUTH2 PLAIN-CLIENTTOKEN
< 250-ENHANCEDSTATUSCODES
< 250 CHUNKING
> AUTH LOGIN
* schannel: client wants to read 16384 bytes
* schannel: encrypted data buffer: offset 0 length 16384
* schannel: encrypted data got 53
* schannel: encrypted data buffer: offset 53 length 16384
* schannel: decrypted data length: 18
* schannel: decrypted data added: 18
* schannel: decrypted data cached: offset 18 length 16384
* schannel: decrypted data buffer: offset 18 length 16384
* schannel: decrypted data returned 18
* schannel: decrypted data buffer: offset 0 length 16384
< 334 VXNlcm5hbWU6
> bG91eGhvdXNlQGdtYWlsLmNvbQ==
* schannel: client wants to read 16384 bytes
* schannel: encrypted data buffer: offset 0 length 16384
* schannel: encrypted data got 53
* schannel: encrypted data buffer: offset 53 length 16384
* schannel: decrypted data length: 18
* schannel: decrypted data added: 18
* schannel: decrypted data cached: offset 18 length 16384
* schannel: decrypted data buffer: offset 18 length 16384
* schannel: decrypted data returned 18
* schannel: decrypted data buffer: offset 0 length 16384
< 334 UGFzc3dvcmQ6
> QnVybmluZ0pldEZ1ZWw=
* schannel: client wants to read 16384 bytes
* schannel: encrypted data buffer: offset 0 length 16384
* schannel: encrypted data got 53
* schannel: encrypted data buffer: offset 53 length 16384
* schannel: decrypted data length: 20
* schannel: decrypted data added: 20
* schannel: decrypted data cached: offset 20 length 16384
* schannel: decrypted data buffer: offset 20 length 16384
* schannel: decrypted data returned 20
* schannel: decrypted data buffer: offset 0 length 16384
< 235 2.7.0 Accepted
> VRFY <user2_at_gmail.com>
* schannel: client wants to read 16384 bytes
* schannel: encrypted data buffer: offset 0 length 16384
* schannel: encrypted data got 101
* schannel: encrypted data buffer: offset 101 length 16384
* schannel: decrypted data length: 71
* schannel: decrypted data added: 71
* schannel: decrypted data cached: offset 71 length 16384
* schannel: decrypted data buffer: offset 71 length 16384
* schannel: decrypted data returned 71
* schannel: decrypted data buffer: offset 0 length 16384
< 252 2.1.5 Send some mail, I'll try my best e2sm57495043qas.21 - gsmtp
252 2.1.5 Send some mail, I'll try my best e2sm57495043qas.21 - gsmtp
> VRFY <user3_at_gmail.com>
* schannel: client wants to read 16384 bytes
* schannel: encrypted data buffer: offset 0 length 16384
* schannel: encrypted data got 101
* schannel: encrypted data buffer: offset 101 length 16384
* schannel: decrypted data length: 71
* schannel: decrypted data added: 71
* schannel: decrypted data cached: offset 71 length 16384
* schannel: decrypted data buffer: offset 71 length 16384
* schannel: decrypted data returned 71
* schannel: decrypted data buffer: offset 0 length 16384
< 252 2.1.5 Send some mail, I'll try my best e2sm57495043qas.21 - gsmtp
252 2.1.5 Send some mail, I'll try my best e2sm57495043qas.21 - gsmtp
* Connection #0 to host smtp.gmail.com left intact
Any thoughts?
Thanks,
Kerry
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-12-30