client-authenticate.c revision c0435c854a0e7246373b9752d163095cc4fbe985
/* 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 "auth-connection.h"
#include "client.h"
#include "client-authenticate.h"
#include "master.h"
struct auth_method_desc {
int method;
const char *name;
int plaintext;
};
static enum auth_method auth_methods = 0;
static char *auth_methods_capability = NULL;
};
const char *client_authenticate_get_capabilities(void)
{
int i;
if (auth_methods == available_auth_methods)
return auth_methods_capability;
for (i = 0; i < AUTH_METHODS_COUNT; i++) {
}
}
return auth_methods_capability;
}
{
int i;
for (i = 0; i < AUTH_METHODS_COUNT; i++) {
return &auth_method_desc[i];
}
return NULL;
}
{
"NO Authentication failed.");
/* get back to normal client input */
}
{
switch (result) {
case MASTER_RESULT_SUCCESS:
break;
break;
default:
break;
}
}
{
t_push();
t_pop();
}
const unsigned char *reply_data,
{
switch (result) {
case AUTH_RESULT_CONTINUE:
return TRUE;
case AUTH_RESULT_SUCCESS:
/* disable IO until we're back from master */
}
return FALSE;
case AUTH_RESULT_FAILURE:
/* see if we have error message */
if (reply_data_size > 0 &&
"NO Authentication failed: ",
(const char *) reply_data, NULL));
} else {
/* default error message */
}
return FALSE;
default:
return FALSE;
}
}
const unsigned char *reply_data,
{
const void *ptr;
}
}
{
const char *error;
"NO Plaintext authentication disabled.");
return TRUE;
}
/* code it into user\0user\0password */
/* don't read any input from client until login is finished */
}
return TRUE;
} else {
return TRUE;
}
}
unsigned int auth_process,
enum auth_result result,
const unsigned char *reply_data,
{
}
{
char *line;
if (!client_read(client))
return;
return;
return;
}
/* failed */
} else {
}
/* clear sensitive data */
}
{
struct auth_method_desc *method;
const char *error;
if (*method_name == '\0')
return FALSE;
"NO Unsupported authentication method.");
return TRUE;
}
"NO Plaintext authentication disabled.");
return TRUE;
}
/* following input data will go to authentication */
} else {
}
return TRUE;
}