51 int rc = GSASL_NO_CALLBACK;
53 struct Connection *conn = gsasl_session_hook_get(sctx);
65 gsasl_property_set(sctx, GSASL_PASSWORD, conn->
account.
pass);
73 gsasl_property_set(sctx, GSASL_AUTHID, conn->
account.
login);
81 gsasl_property_set(sctx, GSASL_AUTHZID, conn->
account.
user);
85 case GSASL_ANONYMOUS_TOKEN:
86 gsasl_property_set(sctx, GSASL_ANONYMOUS_TOKEN,
"dummy");
92 const char *service = NULL;
107 gsasl_property_set(sctx, GSASL_SERVICE, service);
113 gsasl_property_set(sctx, GSASL_HOSTNAME, conn->
account.
host);
171 char *uc_server_mechlist =
mutt_str_dup(server_mechlist);
172 if (uc_server_mechlist)
176 if (uc_requested_mech)
179 const char *sel_mech = NULL;
180 if (uc_requested_mech)
181 sel_mech = gsasl_client_suggest_mechanism(
MuttGsaslCtx, uc_requested_mech);
183 sel_mech = gsasl_client_suggest_mechanism(
MuttGsaslCtx, uc_server_mechlist);
185 FREE(&uc_requested_mech);
186 FREE(&uc_server_mechlist);
212 gsasl_session_hook_set(*sctx, conn);
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.
int mutt_account_getlogin(struct ConnAccount *cac)
Retrieve login info into ConnAccount, if necessary.
An open network connection (socket)
#define mutt_debug(LEVEL,...)
GNU SASL authentication support.
static int mutt_gsasl_callback(Gsasl *ctx, Gsasl_session *sctx, Gsasl_property prop)
Callback to retrieve authname or user from ConnAccount.
static Gsasl * MuttGsaslCtx
Global GNU SASL handle.
const char * mutt_gsasl_get_mech(const char *requested_mech, const char *server_mechlist)
Pick a connection mechanism.
int mutt_gsasl_client_new(struct Connection *conn, const char *mech, Gsasl_session **sctx)
Create a new GNU SASL client.
void mutt_gsasl_cleanup(void)
Shutdown GNU SASL library.
void mutt_gsasl_client_finish(Gsasl_session **sctx)
Free a GNU SASL client.
static bool mutt_gsasl_init(void)
Initialise GNU SASL library.
@ LL_DEBUG1
Log at debug level 1.
Convenience wrapper for the library headers.
char * mutt_str_dup(const char *str)
Copy a string, safely.
char * mutt_str_upper(char *str)
Convert all characters in the string to uppercase.
ConnAccount object used by POP and IMAP.
@ MUTT_ACCT_TYPE_SMTP
Smtp Account.
@ MUTT_ACCT_TYPE_POP
Pop Account.
@ MUTT_ACCT_TYPE_IMAP
Imap Account.
char login[128]
Login name.
char host[128]
Server to login to.
unsigned char type
Connection type, e.g. MUTT_ACCT_TYPE_IMAP.
struct ConnAccount account
Account details: username, password, etc.