sasl-server.c revision 3609e0b9b8fcd1a183a785af690cdcad33c345aa
/* Copyright (c) 2002-2017 Dovecot authors, see the included COPYING file */
#include "login-common.h"
#include "str.h"
#include "base64.h"
#include "buffer.h"
#include "hex-binary.h"
#include "ioloop.h"
#include "istream.h"
#include "write-full.h"
#include "strescape.h"
#include "str-sanitize.h"
#include "anvil-client.h"
#include "auth-client.h"
#include "iostream-ssl.h"
#include "master-service.h"
#include "master-service-ssl-settings.h"
#include "master-interface.h"
#include "master-auth.h"
#include "client-common.h"
#include <unistd.h>
#define ERR_TOO_MANY_USERIP_CONNECTIONS \
"Maximum number of connections from user+IP exceeded " \
"(mail_max_userip_connections=%u)"
struct anvil_request {
unsigned char cookie[MASTER_AUTH_COOKIE_SIZE];
};
const struct auth_mech_desc *
{
const struct auth_mech_desc *mech;
struct auth_mech_desc *ret_mech;
unsigned int i, j, count;
*count_r = 0;
return NULL;
}
for (i = j = 0; i < count; i++) {
/* a) transport is secured
b) auth mechanism isn't plaintext
c) we allow insecure authentication
*/
}
*count_r = j;
return ret_mech;
}
static enum auth_request_flags
{
enum auth_request_flags auth_flags = 0;
return auth_flags;
}
{
/* NOTE: client may be destroyed now */
}
static void
{
client->master_tag = 0;
case MASTER_AUTH_STATUS_OK:
break;
break;
}
} else {
}
}
{
struct master_auth_request_params params;
struct master_auth_request req;
const unsigned char *data;
int fd;
bool close_fd;
return -1;
if (client->ssl_secured)
/* session ID */
/* protocol specific data (e.g. IMAP tag) */
/* buffered client input */
if (close_fd)
i_close_fd(&fd);
return 0;
}
static void ATTR_NULL(1)
{
const char *errmsg;
unsigned int conn_count;
int ret;
conn_count = 0;
/* reply=NULL if we didn't need to do anvil lookup,
or if the anvil lookup failed. allow failed anvil lookups in. */
} else {
ret = -1;
}
if (ret < 0) {
}
}
static void
struct auth_client_request *request)
{
struct anvil_request *req;
return;
}
}
static void
{
unsigned int i;
bool nologin;
if (!client->authenticating) {
/* client aborted */
return;
}
switch (status) {
/* continue */
data_base64, NULL);
break;
case AUTH_REQUEST_STATUS_OK:
client->auth_successes++;
/* user can't login */
}
}
if (nologin) {
} else {
}
break;
/* fall through */
case AUTH_REQUEST_STATUS_FAIL:
/* parse our username if it's there */
}
}
}
break;
}
}
const char *initial_resp_base64,
{
struct auth_request_info info;
const struct auth_mech_desc *mech;
client->auth_attempts++;
if (client->auth_first_started == 0)
"Unsupported authentication mechanism.",
return;
}
"Plaintext authentication disabled.",
return;
}
}
{
const char *auth_name =
}
const char *args[2];
return;
}
}
const char *code)
{
}
{
}