Check the return value of SSL_write in g_imap_login().

If SSL_write fails it can return 0 or <0.
https://www.openssl.org/docs/ssl/SSL_write.html

Signed-off-by: Thiago Farina <tfarina@chromium.org>