client-authenticate.c revision 48fc20cea83c68d4484af70bf88b85ed133f444d
/* 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-client.h"
#include "../auth/auth-mech-desc.h"
#include "client.h"
#include "client-authenticate.h"
#include "auth-common.h"
#include "master.h"
const char *client_authenticate_get_capabilities(int secured)
{
static enum auth_mech cached_auth_mechs = 0;
static char *cached_capability = NULL;
enum auth_mech auth_mechs;
int i;
if (auth_mechs == cached_auth_mechs)
return cached_capability;
for (i = 0; i < AUTH_MECH_COUNT; i++) {
}
}
return cached_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_client_request_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 */
return TRUE;
}
/* don't read any input from client until login is finished */
}
return TRUE;
}
struct auth_client_request_reply *reply,
{
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;
}