NeoMutt  2020-04-24
Teaching an old dog new tricks
DOXYGEN
pop_auth.c File Reference

POP authentication. More...

#include "config.h"
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include "pop_private.h"
#include "mutt/lib.h"
#include "address/lib.h"
#include "conn/lib.h"
#include "lib.h"
#include "mutt_logging.h"
#include "mutt_socket.h"
#include <sasl/sasl.h>
#include <sasl/saslutil.h>
+ Include dependency graph for pop_auth.c:

Go to the source code of this file.

Functions

static enum PopAuthRes pop_auth_sasl (struct PopAccountData *adata, const char *method)
 POP SASL authenticator. More...
 
void pop_apop_timestamp (struct PopAccountData *adata, char *buf)
 Get the server timestamp for APOP authentication. More...
 
static enum PopAuthRes pop_auth_apop (struct PopAccountData *adata, const char *method)
 APOP authenticator. More...
 
static enum PopAuthRes pop_auth_user (struct PopAccountData *adata, const char *method)
 USER authenticator. More...
 
static enum PopAuthRes pop_auth_oauth (struct PopAccountData *adata, const char *method)
 Authenticate a POP connection using OAUTHBEARER. More...
 
int pop_authenticate (struct PopAccountData *adata)
 Authenticate with a POP server. More...
 

Variables

struct SlistC_PopAuthenticators
 Config: (pop) List of allowed authentication methods. More...
 
bool C_PopAuthTryAll
 Config: (pop) Try all available authentication methods. More...
 
static const struct PopAuth pop_authenticators []
 

Detailed Description

POP authentication.

Authors
  • Vsevolod Volkov
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file pop_auth.c.

Function Documentation

◆ pop_auth_sasl()

static enum PopAuthRes pop_auth_sasl ( struct PopAccountData adata,
const char *  method 
)
static

POP SASL authenticator.

Parameters
adataPOP Account data
methodAuthentication method
Return values
numResult, e.g. POP_A_SUCCESS

Definition at line 57 of file pop_auth.c.

58 {
59  sasl_conn_t *saslconn = NULL;
60  sasl_interact_t *interaction = NULL;
61  int rc;
62  char inbuf[1024];
63  const char *mech = NULL;
64  const char *pc = NULL;
65  unsigned int len = 0, olen = 0;
66 
67  if (mutt_account_getpass(&adata->conn->account) || !adata->conn->account.pass[0])
68  return POP_A_FAILURE;
69 
70  if (mutt_sasl_client_new(adata->conn, &saslconn) < 0)
71  {
72  mutt_debug(LL_DEBUG1, "Error allocating SASL connection\n");
73  return POP_A_FAILURE;
74  }
75 
76  if (!method)
77  method = adata->auth_list.data;
78 
79  while (true)
80  {
81  rc = sasl_client_start(saslconn, method, &interaction, &pc, &olen, &mech);
82  if (rc != SASL_INTERACT)
83  break;
84  mutt_sasl_interact(interaction);
85  }
86 
87  if ((rc != SASL_OK) && (rc != SASL_CONTINUE))
88  {
89  mutt_debug(
90  LL_DEBUG1,
91  "Failure starting authentication exchange. No shared mechanisms?\n");
92 
93  /* SASL doesn't support suggested mechanisms, so fall back */
94  sasl_dispose(&saslconn);
95  return POP_A_UNAVAIL;
96  }
97 
98  /* About client_start: If sasl_client_start() returns data via pc/olen,
99  * the client is expected to send this first (after the AUTH string is sent).
100  * sasl_client_start() may in fact return SASL_OK in this case. */
101  unsigned int client_start = olen;
102 
103  mutt_message(_("Authenticating (SASL)..."));
104 
105  size_t bufsize = MAX((olen * 2), 1024);
106  char *buf = mutt_mem_malloc(bufsize);
107 
108  snprintf(buf, bufsize, "AUTH %s", mech);
109  olen = strlen(buf);
110 
111  /* looping protocol */
112  while (true)
113  {
114  mutt_str_strfcpy(buf + olen, "\r\n", bufsize - olen);
115  mutt_socket_send(adata->conn, buf);
116  if (mutt_socket_readln_d(inbuf, sizeof(inbuf), adata->conn, MUTT_SOCK_LOG_FULL) < 0)
117  {
118  sasl_dispose(&saslconn);
119  adata->status = POP_DISCONNECTED;
120  FREE(&buf);
121  return POP_A_SOCKET;
122  }
123 
124  /* Note we don't exit if rc==SASL_OK when client_start is true.
125  * This is because the first loop has only sent the AUTH string, we
126  * need to loop at least once more to send the pc/olen returned
127  * by sasl_client_start(). */
128  if (!client_start && (rc != SASL_CONTINUE))
129  break;
130 
131  if (mutt_str_startswith(inbuf, "+ ", CASE_MATCH) &&
132  (sasl_decode64(inbuf + 2, strlen(inbuf + 2), buf, bufsize - 1, &len) != SASL_OK))
133  {
134  mutt_debug(LL_DEBUG1, "error base64-decoding server response\n");
135  goto bail;
136  }
137 
138  if (!client_start)
139  {
140  while (true)
141  {
142  rc = sasl_client_step(saslconn, buf, len, &interaction, &pc, &olen);
143  if (rc != SASL_INTERACT)
144  break;
145  mutt_sasl_interact(interaction);
146  }
147  }
148  else
149  {
150  olen = client_start;
151  client_start = 0;
152  }
153 
154  /* Even if sasl_client_step() returns SASL_OK, we should send at
155  * least one more line to the server. */
156  if ((rc != SASL_CONTINUE) && (rc != SASL_OK))
157  break;
158 
159  /* send out response, or line break if none needed */
160  if (pc)
161  {
162  if ((olen * 2) > bufsize)
163  {
164  bufsize = olen * 2;
165  mutt_mem_realloc(&buf, bufsize);
166  }
167  if (sasl_encode64(pc, olen, buf, bufsize, &olen) != SASL_OK)
168  {
169  mutt_debug(LL_DEBUG1, "error base64-encoding client response\n");
170  goto bail;
171  }
172  }
173  }
174 
175  if (rc != SASL_OK)
176  goto bail;
177 
178  if (mutt_str_startswith(inbuf, "+OK", CASE_MATCH))
179  {
180  mutt_sasl_setup_conn(adata->conn, saslconn);
181  FREE(&buf);
182  return POP_A_SUCCESS;
183  }
184 
185 bail:
186  sasl_dispose(&saslconn);
187 
188  /* terminate SASL session if the last response is not +OK nor -ERR */
189  if (mutt_str_startswith(inbuf, "+ ", CASE_MATCH))
190  {
191  snprintf(buf, bufsize, "*\r\n");
192  if (pop_query(adata, buf, bufsize) == -1)
193  {
194  FREE(&buf);
195  return POP_A_SOCKET;
196  }
197  }
198 
199  FREE(&buf);
200  mutt_error(_("SASL authentication failed"));
201 
202  return POP_A_FAILURE;
203 }
Connection lost.
Definition: pop_private.h:61
struct ConnAccount account
Account details: username, password, etc.
Definition: connection.h:36
#define mutt_socket_send(conn, buf)
Definition: mutt_socket.h:37
#define pop_query(adata, buf, buflen)
Definition: pop_private.h:142
Authentication failed.
Definition: pop_private.h:62
#define mutt_message(...)
Definition: logging.h:83
#define _(a)
Definition: message.h:28
struct Connection * conn
Definition: pop_private.h:80
int mutt_sasl_client_new(struct Connection *conn, sasl_conn_t **saslconn)
Wrapper for sasl_client_new()
Definition: sasl.c:574
void mutt_sasl_setup_conn(struct Connection *conn, sasl_conn_t *saslconn)
Set up an SASL connection.
Definition: sasl.c:702
Match case when comparing strings.
Definition: string2.h:67
#define MUTT_SOCK_LOG_FULL
Definition: mutt_socket.h:31
struct Buffer auth_list
list of auth mechanisms
Definition: pop_private.h:95
#define MAX(a, b)
Definition: memory.h:30
char pass[256]
Password.
Definition: connaccount.h:56
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
Definition: memory.c:114
void * mutt_mem_malloc(size_t size)
Allocate memory on the heap.
Definition: memory.c:90
Authenticated successfully.
Definition: pop_private.h:60
char * data
Pointer to data.
Definition: buffer.h:35
size_t mutt_str_strfcpy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:776
Disconnected from server.
Definition: pop_private.h:52
unsigned int status
Definition: pop_private.h:81
size_t mutt_str_startswith(const char *str, const char *prefix, enum CaseSensitivity cs)
Check whether a string starts with a prefix.
Definition: string.c:168
Log at debug level 1.
Definition: logging.h:40
#define mutt_error(...)
Definition: logging.h:84
#define FREE(x)
Definition: memory.h:40
int mutt_socket_readln_d(char *buf, size_t buflen, struct Connection *conn, int dbg)
Read a line from a socket.
Definition: socket.c:244
#define mutt_debug(LEVEL,...)
Definition: logging.h:81
No valid authentication method.
Definition: pop_private.h:63
int mutt_account_getpass(struct ConnAccount *cac)
Fetch password into ConnAccount, if necessary.
Definition: connaccount.c:110
int mutt_sasl_interact(sasl_interact_t *interaction)
Perform an SASL interaction with the user.
Definition: sasl.c:669
+ Here is the call graph for this function:

◆ pop_apop_timestamp()

void pop_apop_timestamp ( struct PopAccountData adata,
char *  buf 
)

Get the server timestamp for APOP authentication.

Parameters
adataPOP Account data
bufTimestamp string

Definition at line 211 of file pop_auth.c.

212 {
213  char *p1 = NULL, *p2 = NULL;
214 
215  FREE(&adata->timestamp);
216 
217  if ((p1 = strchr(buf, '<')) && (p2 = strchr(p1, '>')))
218  {
219  p2[1] = '\0';
220  adata->timestamp = mutt_str_strdup(p1);
221  }
222 }
char * timestamp
Definition: pop_private.h:96
char * mutt_str_strdup(const char *str)
Copy a string, safely.
Definition: string.c:380
#define FREE(x)
Definition: memory.h:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pop_auth_apop()

static enum PopAuthRes pop_auth_apop ( struct PopAccountData adata,
const char *  method 
)
static

APOP authenticator.

Parameters
adataPOP Account data
methodAuthentication method
Return values
numResult, e.g. POP_A_SUCCESS

Definition at line 230 of file pop_auth.c.

231 {
232  struct Md5Ctx md5ctx;
233  unsigned char digest[16];
234  char hash[33];
235  char buf[1024];
236 
237  if (mutt_account_getpass(&adata->conn->account) || !adata->conn->account.pass[0])
238  return POP_A_FAILURE;
239 
240  if (!adata->timestamp)
241  return POP_A_UNAVAIL;
242 
243  if (!mutt_addr_valid_msgid(adata->timestamp))
244  {
245  mutt_error(_("POP timestamp is invalid"));
246  return POP_A_UNAVAIL;
247  }
248 
249  mutt_message(_("Authenticating (APOP)..."));
250 
251  /* Compute the authentication hash to send to the server */
252  mutt_md5_init_ctx(&md5ctx);
253  mutt_md5_process(adata->timestamp, &md5ctx);
254  mutt_md5_process(adata->conn->account.pass, &md5ctx);
255  mutt_md5_finish_ctx(&md5ctx, digest);
256  mutt_md5_toascii(digest, hash);
257 
258  /* Send APOP command to server */
259  snprintf(buf, sizeof(buf), "APOP %s %s\r\n", adata->conn->account.user, hash);
260 
261  switch (pop_query(adata, buf, sizeof(buf)))
262  {
263  case 0:
264  return POP_A_SUCCESS;
265  case -1:
266  return POP_A_SOCKET;
267  }
268 
269  mutt_error(_("APOP authentication failed"));
270 
271  return POP_A_FAILURE;
272 }
Connection lost.
Definition: pop_private.h:61
Cursor for the MD5 hashing.
Definition: md5.h:36
struct ConnAccount account
Account details: username, password, etc.
Definition: connection.h:36
#define pop_query(adata, buf, buflen)
Definition: pop_private.h:142
Authentication failed.
Definition: pop_private.h:62
#define mutt_message(...)
Definition: logging.h:83
void mutt_md5_process(const char *str, struct Md5Ctx *md5ctx)
Process a NULL-terminated string.
Definition: md5.c:355
char user[128]
Username.
Definition: connaccount.h:55
#define _(a)
Definition: message.h:28
struct Connection * conn
Definition: pop_private.h:80
void mutt_md5_init_ctx(struct Md5Ctx *md5ctx)
Initialise the MD5 computation.
Definition: md5.c:262
void mutt_md5_toascii(const void *digest, char *resbuf)
Convert a binary MD5 digest into ASCII Hexadecimal.
Definition: md5.c:456
void * mutt_md5_finish_ctx(struct Md5Ctx *md5ctx, void *resbuf)
Process the remaining bytes in the buffer.
Definition: md5.c:286
char pass[256]
Password.
Definition: connaccount.h:56
char * timestamp
Definition: pop_private.h:96
Authenticated successfully.
Definition: pop_private.h:60
#define mutt_error(...)
Definition: logging.h:84
bool mutt_addr_valid_msgid(const char *msgid)
Is this a valid Message ID?
Definition: address.c:761
No valid authentication method.
Definition: pop_private.h:63
int mutt_account_getpass(struct ConnAccount *cac)
Fetch password into ConnAccount, if necessary.
Definition: connaccount.c:110
+ Here is the call graph for this function:

◆ pop_auth_user()

static enum PopAuthRes pop_auth_user ( struct PopAccountData adata,
const char *  method 
)
static

USER authenticator.

Parameters
adataPOP Account data
methodAuthentication method
Return values
numResult, e.g. POP_A_SUCCESS

Definition at line 280 of file pop_auth.c.

281 {
282  if (!adata->cmd_user)
283  return POP_A_UNAVAIL;
284 
285  if (mutt_account_getpass(&adata->conn->account) || !adata->conn->account.pass[0])
286  return POP_A_FAILURE;
287 
288  mutt_message(_("Logging in..."));
289 
290  char buf[1024];
291  snprintf(buf, sizeof(buf), "USER %s\r\n", adata->conn->account.user);
292  int ret = pop_query(adata, buf, sizeof(buf));
293 
294  if (adata->cmd_user == 2)
295  {
296  if (ret == 0)
297  {
298  adata->cmd_user = 1;
299 
300  mutt_debug(LL_DEBUG1, "set USER capability\n");
301  }
302 
303  if (ret == -2)
304  {
305  adata->cmd_user = 0;
306 
307  mutt_debug(LL_DEBUG1, "unset USER capability\n");
308  snprintf(adata->err_msg, sizeof(adata->err_msg), "%s",
309  _("Command USER is not supported by server"));
310  }
311  }
312 
313  if (ret == 0)
314  {
315  snprintf(buf, sizeof(buf), "PASS %s\r\n", adata->conn->account.pass);
316  ret = pop_query_d(adata, buf, sizeof(buf),
317  /* don't print the password unless we're at the ungodly debugging level */
318  (C_DebugLevel < MUTT_SOCK_LOG_FULL) ? "PASS *\r\n" : NULL);
319  }
320 
321  switch (ret)
322  {
323  case 0:
324  return POP_A_SUCCESS;
325  case -1:
326  return POP_A_SOCKET;
327  }
328 
329  mutt_error("%s %s", _("Login failed"), adata->err_msg);
330 
331  return POP_A_FAILURE;
332 }
Connection lost.
Definition: pop_private.h:61
int pop_query_d(struct PopAccountData *adata, char *buf, size_t buflen, char *msg)
Send data from buffer and receive answer to the same buffer.
Definition: pop_lib.c:473
char err_msg[POP_CMD_RESPONSE]
Definition: pop_private.h:98
struct ConnAccount account
Account details: username, password, etc.
Definition: connection.h:36
#define pop_query(adata, buf, buflen)
Definition: pop_private.h:142
Authentication failed.
Definition: pop_private.h:62
#define mutt_message(...)
Definition: logging.h:83
char user[128]
Username.
Definition: connaccount.h:55
#define _(a)
Definition: message.h:28
struct Connection * conn
Definition: pop_private.h:80
#define MUTT_SOCK_LOG_FULL
Definition: mutt_socket.h:31
unsigned int cmd_user
optional command USER
Definition: pop_private.h:86
char pass[256]
Password.
Definition: connaccount.h:56
short C_DebugLevel
Config: Logging level for debug logs.
Definition: mutt_logging.c:48
Authenticated successfully.
Definition: pop_private.h:60
Log at debug level 1.
Definition: logging.h:40
#define mutt_error(...)
Definition: logging.h:84
#define mutt_debug(LEVEL,...)
Definition: logging.h:81
No valid authentication method.
Definition: pop_private.h:63
int mutt_account_getpass(struct ConnAccount *cac)
Fetch password into ConnAccount, if necessary.
Definition: connaccount.c:110
+ Here is the call graph for this function:

◆ pop_auth_oauth()

static enum PopAuthRes pop_auth_oauth ( struct PopAccountData adata,
const char *  method 
)
static

Authenticate a POP connection using OAUTHBEARER.

Parameters
adataPOP Account data
methodName of this authentication method (UNUSED)
Return values
numResult, e.g. POP_A_SUCCESS

Definition at line 340 of file pop_auth.c.

341 {
342  /* If they did not explicitly request or configure oauth then fail quietly */
343  if (!method && !C_PopOauthRefreshCommand)
344  return POP_A_UNAVAIL;
345 
346  mutt_message(_("Authenticating (OAUTHBEARER)..."));
347 
348  char *oauthbearer = mutt_account_getoauthbearer(&adata->conn->account);
349  if (!oauthbearer)
350  return POP_A_FAILURE;
351 
352  size_t auth_cmd_len = strlen(oauthbearer) + 30;
353  char *auth_cmd = mutt_mem_malloc(auth_cmd_len);
354  snprintf(auth_cmd, auth_cmd_len, "AUTH OAUTHBEARER %s\r\n", oauthbearer);
355  FREE(&oauthbearer);
356 
357  int ret = pop_query_d(adata, auth_cmd, strlen(auth_cmd),
358 #ifdef DEBUG
359  /* don't print the bearer token unless we're at the ungodly debugging level */
361  "AUTH OAUTHBEARER *\r\n" :
362 #endif
363  NULL);
364  FREE(&auth_cmd);
365 
366  switch (ret)
367  {
368  case 0:
369  return POP_A_SUCCESS;
370  case -1:
371  return POP_A_SOCKET;
372  }
373 
374  /* The error response was a SASL continuation, so "continue" it.
375  * See RFC7628 3.2.3 */
376  mutt_socket_send(adata->conn, "\001");
377 
378  char *err = adata->err_msg;
379  char decoded_err[1024];
380  int len = mutt_b64_decode(adata->err_msg, decoded_err, sizeof(decoded_err) - 1);
381  if (len >= 0)
382  {
383  decoded_err[len] = '\0';
384  err = decoded_err;
385  }
386  mutt_error("%s %s", _("Authentication failed"), err);
387 
388  return POP_A_FAILURE;
389 }
Connection lost.
Definition: pop_private.h:61
int pop_query_d(struct PopAccountData *adata, char *buf, size_t buflen, char *msg)
Send data from buffer and receive answer to the same buffer.
Definition: pop_lib.c:473
char err_msg[POP_CMD_RESPONSE]
Definition: pop_private.h:98
struct ConnAccount account
Account details: username, password, etc.
Definition: connection.h:36
#define mutt_socket_send(conn, buf)
Definition: mutt_socket.h:37
Authentication failed.
Definition: pop_private.h:62
#define mutt_message(...)
Definition: logging.h:83
#define _(a)
Definition: message.h:28
struct Connection * conn
Definition: pop_private.h:80
#define MUTT_SOCK_LOG_FULL
Definition: mutt_socket.h:31
char * C_PopOauthRefreshCommand
Config: (pop) External command to generate OAUTH refresh token.
Definition: pop_lib.c:54
short C_DebugLevel
Config: Logging level for debug logs.
Definition: mutt_logging.c:48
void * mutt_mem_malloc(size_t size)
Allocate memory on the heap.
Definition: memory.c:90
Authenticated successfully.
Definition: pop_private.h:60
#define mutt_error(...)
Definition: logging.h:84
#define FREE(x)
Definition: memory.h:40
No valid authentication method.
Definition: pop_private.h:63
char * mutt_account_getoauthbearer(struct ConnAccount *cac)
Get an OAUTHBEARER token.
Definition: connaccount.c:157
int mutt_b64_decode(const char *in, char *out, size_t olen)
Convert null-terminated base64 string to raw bytes.
Definition: base64.c:136
+ Here is the call graph for this function:

◆ pop_authenticate()

int pop_authenticate ( struct PopAccountData adata)

Authenticate with a POP server.

Parameters
adataPOP Account data
Return values
numResult, e.g. POP_A_SUCCESS
0Successful
-1Connection lost
-2Login failed
-3Authentication cancelled

Definition at line 408 of file pop_auth.c.

409 {
410  struct ConnAccount *cac = &adata->conn->account;
411  const struct PopAuth *authenticator = NULL;
412  int attempts = 0;
413  int ret = POP_A_UNAVAIL;
414 
415  if ((mutt_account_getuser(cac) < 0) || (cac->user[0] == '\0'))
416  {
417  return -3;
418  }
419 
421  {
422  /* Try user-specified list of authentication methods */
423  struct ListNode *np = NULL;
424  STAILQ_FOREACH(np, &C_PopAuthenticators->head, entries)
425  {
426  mutt_debug(LL_DEBUG2, "Trying method %s\n", np->data);
427  authenticator = pop_authenticators;
428 
429  while (authenticator->authenticate)
430  {
431  if (!authenticator->method ||
432  (mutt_str_strcasecmp(authenticator->method, np->data) == 0))
433  {
434  ret = authenticator->authenticate(adata, np->data);
435  if (ret == POP_A_SOCKET)
436  {
437  switch (pop_connect(adata))
438  {
439  case 0:
440  {
441  ret = authenticator->authenticate(adata, np->data);
442  break;
443  }
444  case -2:
445  ret = POP_A_FAILURE;
446  }
447  }
448 
449  if (ret != POP_A_UNAVAIL)
450  attempts++;
451  if ((ret == POP_A_SUCCESS) || (ret == POP_A_SOCKET) ||
452  ((ret == POP_A_FAILURE) && !C_PopAuthTryAll))
453  {
454  break;
455  }
456  }
457  authenticator++;
458  }
459  }
460  }
461  else
462  {
463  /* Fall back to default: any authenticator */
464  mutt_debug(LL_DEBUG2, "Using any available method\n");
465  authenticator = pop_authenticators;
466 
467  while (authenticator->authenticate)
468  {
469  ret = authenticator->authenticate(adata, NULL);
470  if (ret == POP_A_SOCKET)
471  {
472  switch (pop_connect(adata))
473  {
474  case 0:
475  {
476  ret = authenticator->authenticate(adata, NULL);
477  break;
478  }
479  case -2:
480  ret = POP_A_FAILURE;
481  }
482  }
483 
484  if (ret != POP_A_UNAVAIL)
485  attempts++;
486  if ((ret == POP_A_SUCCESS) || (ret == POP_A_SOCKET) ||
487  ((ret == POP_A_FAILURE) && !C_PopAuthTryAll))
488  {
489  break;
490  }
491 
492  authenticator++;
493  }
494  }
495 
496  switch (ret)
497  {
498  case POP_A_SUCCESS:
499  return 0;
500  case POP_A_SOCKET:
501  return -1;
502  case POP_A_UNAVAIL:
503  if (attempts == 0)
504  mutt_error(_("No authenticators available"));
505  }
506 
507  return -2;
508 }
Connection lost.
Definition: pop_private.h:61
int mutt_account_getuser(struct ConnAccount *cac)
Retrieve username into ConnAccount, if necessary.
Definition: connaccount.c:47
enum PopAuthRes(* authenticate)(struct PopAccountData *adata, const char *method)
Authenticate a POP connection.
Definition: pop_private.h:122
struct Slist * C_PopAuthenticators
Config: (pop) List of allowed authentication methods.
Definition: pop_auth.c:47
struct ConnAccount account
Account details: username, password, etc.
Definition: connection.h:36
Authentication failed.
Definition: pop_private.h:62
char user[128]
Username.
Definition: connaccount.h:55
#define _(a)
Definition: message.h:28
struct Connection * conn
Definition: pop_private.h:80
bool C_PopAuthTryAll
Config: (pop) Try all available authentication methods.
Definition: pop_auth.c:48
Log at debug level 2.
Definition: logging.h:41
struct ListHead head
Definition: slist.h:45
POP authentication multiplexor.
Definition: pop_private.h:114
const char * method
Name of authentication method supported, NULL means variable.
Definition: pop_private.h:124
Authenticated successfully.
Definition: pop_private.h:60
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:349
Login details for a remote server.
Definition: connaccount.h:51
char * data
String.
Definition: list.h:35
static const struct PopAuth pop_authenticators[]
Definition: pop_auth.c:391
#define mutt_error(...)
Definition: logging.h:84
int mutt_str_strcasecmp(const char *a, const char *b)
Compare two strings ignoring case, safely.
Definition: string.c:654
#define mutt_debug(LEVEL,...)
Definition: logging.h:81
No valid authentication method.
Definition: pop_private.h:63
A List node for strings.
Definition: list.h:33
int pop_connect(struct PopAccountData *adata)
Open connection.
Definition: pop_lib.c:292
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ C_PopAuthenticators

struct Slist* C_PopAuthenticators

Config: (pop) List of allowed authentication methods.

Definition at line 47 of file pop_auth.c.

◆ C_PopAuthTryAll

bool C_PopAuthTryAll

Config: (pop) Try all available authentication methods.

Definition at line 48 of file pop_auth.c.

◆ pop_authenticators

const struct PopAuth pop_authenticators[]
static
Initial value:
= {
{ pop_auth_oauth, "oauthbearer" },
{ pop_auth_sasl, NULL },
{ pop_auth_apop, "apop" }, { pop_auth_user, "user" }, { NULL, NULL },
}
static enum PopAuthRes pop_auth_apop(struct PopAccountData *adata, const char *method)
APOP authenticator.
Definition: pop_auth.c:230
static enum PopAuthRes pop_auth_oauth(struct PopAccountData *adata, const char *method)
Authenticate a POP connection using OAUTHBEARER.
Definition: pop_auth.c:340
static enum PopAuthRes pop_auth_sasl(struct PopAccountData *adata, const char *method)
POP SASL authenticator.
Definition: pop_auth.c:57
static enum PopAuthRes pop_auth_user(struct PopAccountData *adata, const char *method)
USER authenticator.
Definition: pop_auth.c:280

Definition at line 391 of file pop_auth.c.