/* Copyright (c) 2002-2018 Dovecot authors, see the included COPYING file */
#include "login-common.h"
#include "base64.h"
#include "buffer.h"
#include "ioloop.h"
#include "istream.h"
#include "ostream.h"
#include "safe-memset.h"
#include "str.h"
#include "str-sanitize.h"
#include "net.h"
#include "imap-resp-code.h"
#include "imap-parser.h"
#include "imap-url.h"
#include "auth-client.h"
#include "imap-login-client.h"
#include "client-authenticate.h"
#include "imap-proxy.h"
{
unsigned int i, count;
for (i = 0; i < count; i++) {
}
}
enum client_auth_result result,
const struct client_auth_reply *reply,
const char *text)
{
switch (result) {
/* nothing to be done for IMAP */
break;
/* IMAP referral
[nologin] referral host=.. [port=..] [destuser=..]
[reason=..]
NO [REFERRAL imap://destuser;AUTH=..@host:port/] Can't login.
OK [...] Logged in, but you should use this server instead.
.. [REFERRAL ..] (Reason from auth server)
*/
if (result == CLIENT_AUTH_RESULT_REFERRAL_SUCCESS) {
} else {
}
break;
break;
if (text[0] == '[')
else {
"ALERT", text);
}
break;
break;
break;
break;
break;
break;
break;
}
}
static int
const char *init_resp)
{
char *prefix;
if (*init_resp == '\0')
init_resp = "";
}
{
/* NOTE: This command's input is handled specially because the
SASL-IR can be large. */
const unsigned char *data;
int ret;
/* <auth mechanism name> [<initial SASL response>] */
if (!imap_client->auth_mech_name_parsed) {
for (i = 0; i < size; i++) {
if (data[i] == ' ' ||
break;
}
if (i == size)
return 0;
if (i == 0) {
/* empty mechanism name */
return -1;
}
if (data[i] == ' ')
i++;
}
/* get SASL-IR, if any */
return ret;
return imap_client_auth_begin(imap_client,
}
{
/* two arguments: username and password */
return -1;
return 1;
}
/* authorization ID \0 authentication ID \0 pass */
}