client-authenticate.c revision 858ab3c731f91cc5bb0a1454fd8deb86b0271b52
/* Copyright (C) 2002 Timo Sirainen */
#include "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 "imap-parser.h"
#include "auth-connection.h"
#include "../auth/auth-mech-desc.h"
#include "client.h"
#include "client-authenticate.h"
#include "auth-common.h"
#include "master.h"
static enum auth_mech auth_mechs = 0;
static char *auth_mechs_capability = NULL;
const char *client_authenticate_get_capabilities(int tls)
{
int i;
if (auth_mechs == available_auth_mechs)
return auth_mechs_capability;
for (i = 0; i < AUTH_MECH_COUNT; i++) {
}
}
return auth_mechs_capability;
}
{
int i;
for (i = 0; i < AUTH_MECH_COUNT; i++) {
return &auth_mech_desc[i];
}
return NULL;
}
{
}
"NO Authentication failed.");
/* get back to normal client input */
}
{
if (success) {
NULL);
} else {
}
}
{
t_push();
t_pop();
}
struct auth_login_reply *reply,
{
const char *error;
const void *ptr;
master_callback, &error)) {
case -1:
/* login failed */
break;
case 0:
/* continue */
break;
default:
/* success, we should be able to log in. if we fail, just
disconnect the client. */
}
}
{
/* two arguments: username and password */
return FALSE;
return FALSE;
return FALSE;
"* BAD [ALERT] Plaintext authentication is disabled, "
"but your client sent password in plaintext anyway."
"If anyone was listening, the password was exposed.");
"NO Plaintext authentication disabled.");
return TRUE;
}
/* authorization ID \0 authentication ID \0 pass */
/* don't read any input from client until login is finished */
}
return TRUE;
} else {
return TRUE;
}
}
struct auth_login_reply *reply,
const unsigned char *data,
{
const char *error;
master_callback, &error)) {
case -1:
/* login failed */
break;
case 0:
/* continue */
break;
default:
/* success, we should be able to log in. if we fail, just
disconnect the client. */
}
}
static void client_auth_input(void *context)
{
char *line;
if (!client_read(client))
return;
return;
}
/* @UNSAFE */
return;
return;
}
/* failed */
} else {
}
/* clear sensitive data */
}
{
struct auth_mech_desc *mech;
/* we want only one argument: authentication mechanism name */
return FALSE;
return FALSE;
if (*mech_name == '\0')
return FALSE;
"NO Unsupported authentication mechanism.");
return TRUE;
}
"NO Plaintext authentication disabled.");
return TRUE;
}
/* following input data will go to authentication */
} else {
}
return TRUE;
}