client-authenticate.c revision 35029c417d7992a62b3b7e5af38126b141ca7722
/* Copyright (C) 2002-2004 Timo Sirainen */
#include "common.h"
#include "base64.h"
#include "buffer.h"
#include "hex-binary.h"
#include "ioloop.h"
#include "istream.h"
#include "ostream.h"
#include "safe-memset.h"
#include "str.h"
#include "str-sanitize.h"
#include "auth-client.h"
#include "../pop3/capability.h"
#include "ssl-proxy.h"
#include "master.h"
#include "auth-common.h"
#include "client.h"
#include "client-authenticate.h"
#include "ssl-proxy.h"
/* Used only for string sanitization while verbose_auth is set. */
#define MAX_MECH_NAME 64
{
const struct auth_mech_desc *mech;
unsigned int i, count;
for (i = 0; i < count; i++) {
/* a) transport is secured
b) auth mechanism isn't plaintext
c) we allow insecure authentication
- but don't advertise AUTH=PLAIN, as RFC 2595 requires
*/
}
}
"STLS\r\n" : "",
"\r\n.", NULL));
return TRUE;
}
{
}
"-ERR Authentication failed.");
/* get back to normal client input */
}
{
if (success) {
NULL);
} else {
"Error report written to server log.");
}
}
{
const void *buf_data;
t_push();
t_pop();
}
struct auth_client_request_reply *reply,
{
const char *error;
master_callback, &error)) {
case -1:
case 0:
/* login failed */
break;
default:
/* success, we should be able to log in. if we fail, just
disconnect the client. */
}
}
static enum auth_client_request_new_flags
{
enum auth_client_request_new_flags auth_flags = 0;
return auth_flags;
}
{
if (verbose_auth) {
"Plaintext authentication disabled");
}
"-ERR Plaintext authentication disabled.");
return TRUE;
}
return TRUE;
}
{
const char *error;
struct auth_request_info info;
return TRUE;
}
/* authorization ID \0 authentication ID \0 pass */
if (verbose_auth)
return TRUE;
}
/* don't read any input from client until login is finished */
}
return TRUE;
}
struct auth_client_request_reply *reply,
{
const char *error;
if (!client->authenticating) {
/* client aborted */
return;
}
master_callback, &error)) {
case -1:
/* login failed */
break;
case 0:
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;
/* @UNSAFE */
return;
return;
}
/* failed */
} else {
}
/* clear sensitive data */
}
{
struct auth_request_info info;
const struct auth_mech_desc *mech;
if (*args == '\0') {
/* Old-style SASL discovery, used by MS Outlook */
int i, count;
for (i = 0; i < count; i++) {
}
}
return TRUE;
}
/* <mechanism name> <initial response> */
if (p == NULL) {
args = "";
} else {
args = p+1;
}
if (verbose_auth) {
"Unsupported mechanism",
}
"-ERR Unsupported authentication mechanism.");
return TRUE;
}
if (verbose_auth) {
"Plaintext authentication disabled",
}
"-ERR Plaintext authentication disabled.");
return TRUE;
}
/* failed */
return TRUE;
}
/* following input data will go to authentication */
} else {
if (verbose_auth) {
error);
}
}
return TRUE;
}
{
struct auth_request_info info;
const char *error, *p;
if (verbose_auth)
return TRUE;
}
/* <username> <md5 sum in hex> */
if (verbose_auth) {
"Invalid parameters");
}
return TRUE;
}
/* APOP challenge \0 username \0 APOP response */
if (verbose_auth) {
"Invalid characters in MD5 response");
}
"-ERR Invalid characters in MD5 response.");
return TRUE;
}
/* don't read any input from client until login is finished */
}
/* the auth connection was lost. we have no choice
but to fail the APOP logins completely since the
challenge is auth connection-specific. disconnect. */
} else {
if (verbose_auth)
}
return TRUE;
}