Authenticate an SMTP connection.
More...
Authenticate an SMTP connection.
- Parameters
-
adata | Smtp Account data |
method | Use this named method, or any available method if NULL |
- Return values
-
◆ smtp_auth_oauth()
static int smtp_auth_oauth |
( |
struct SmtpAccountData * |
adata, |
|
|
const char * |
method |
|
) |
| |
|
static |
Authenticate an SMTP connection using OAUTHBEARER - Implements SmtpAuth::authenticate() -.
- Parameters
-
adata | SMTP Account data |
method | Authentication method (not used) |
- Return values
-
Definition at line 770 of file smtp.c.
771{
773}
static int smtp_auth_oauth_xoauth2(struct SmtpAccountData *adata, const char *method, bool xoauth2)
Authenticate an SMTP connection using OAUTHBEARER/XOAUTH2.
◆ smtp_auth_xoauth2()
static int smtp_auth_xoauth2 |
( |
struct SmtpAccountData * |
adata, |
|
|
const char * |
method |
|
) |
| |
|
static |
Authenticate an SMTP connection using XOAUTH2 - Implements SmtpAuth::authenticate() -.
- Parameters
-
adata | SMTP Account data |
method | Authentication method (not used) |
- Return values
-
Definition at line 781 of file smtp.c.
◆ smtp_auth_plain()
static int smtp_auth_plain |
( |
struct SmtpAccountData * |
adata, |
|
|
const char * |
method |
|
) |
| |
|
static |
Authenticate using plain text - Implements SmtpAuth::authenticate() -.
- Parameters
-
adata | SMTP Account data |
method | Authentication method (not used) |
- Return values
-
- Note
- method is "PLAIN"
Definition at line 795 of file smtp.c.
796{
797 struct Buffer *buf = NULL;
799 int rc = -1;
800
801
803 goto error;
804
805
809
810
812 goto error;
813
814 rc = 0;
815
816error:
817 if (rc != 0)
818 {
819
821 }
823 return rc;
824}
int buf_add_printf(struct Buffer *buf, const char *fmt,...)
Format a string appending a Buffer.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
int mutt_account_getpass(struct ConnAccount *cac)
Fetch password into ConnAccount, if necessary.
int mutt_account_getuser(struct ConnAccount *cac)
Retrieve username into ConnAccount, if necessary.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
size_t mutt_sasl_plain_msg(struct Buffer *buf, const char *cmd, const char *authz, const char *user, const char *pass)
Construct a base64 encoded SASL PLAIN message.
static int smtp_get_resp(struct SmtpAccountData *adata)
Read a command response from the SMTP server.
#define mutt_socket_send(conn, buf)
String manipulation buffer.
Login details for a remote server.
struct ConnAccount account
Account details: username, password, etc.
struct Connection * conn
Server Connection.
◆ smtp_auth_login()
static int smtp_auth_login |
( |
struct SmtpAccountData * |
adata, |
|
|
const char * |
method |
|
) |
| |
|
static |
Authenticate using plain text - Implements SmtpAuth::authenticate() -.
- Parameters
-
adata | SMTP Account data |
method | Authentication method (not used) |
- Return values
-
- Note
- method is "LOGIN"
Definition at line 835 of file smtp.c.
836{
837 char b64[1024] = { 0 };
838 char buf[1026] = { 0 };
839
840
843 {
844 goto error;
845 }
846
847
849 {
850 goto error;
851 }
852
853
856 {
857 goto error;
858 }
859
860
861 size_t len = snprintf(buf,
sizeof(buf),
"%s", adata->
conn->
account.
user);
863 snprintf(buf, sizeof(buf), "%s\r\n", b64);
865 {
866 goto error;
867 }
868
869
872 {
873 goto error;
874 }
875
876
879 snprintf(buf, sizeof(buf), "%s\r\n", b64);
881 {
882 goto error;
883 }
884
885
887 {
888 goto error;
889 }
890
891
892 return 0;
893
894error:
895
896 mutt_error(
_(
"%s authentication failed"),
"LOGIN");
897 return -1;
898}
size_t mutt_b64_encode(const char *in, size_t inlen, char *out, size_t outlen)
Convert raw bytes to null-terminated base64 string.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
int mutt_socket_readln_d(char *buf, size_t buflen, struct Connection *conn, int dbg)
Read a line from a socket.
#define MUTT_SOCK_LOG_FULL