mech.c revision 22535a9e685e29214082878e37a267157044618e
/* Copyright (C) 2002 Timo Sirainen */
#include "common.h"
#include "buffer.h"
#include "hash.h"
#include "mech.h"
#include "login-connection.h"
#include <stdlib.h>
struct mech_module_list {
struct mech_module_list *next;
struct mech_module module;
};
enum auth_mech auth_mechanisms;
const char *const *auth_realms;
static int set_use_cyrus_sasl;
static struct mech_module_list *mech_modules;
static struct auth_login_reply failure_reply;
{
struct mech_module_list *list;
mech_modules = list;
}
{
return; /* not registered */
break;
}
}
}
struct auth_login_request_new *request,
{
struct mech_module_list *list;
struct auth_request *auth_request;
/* unsupported mechanism */
i_error("BUG: imap-login requested unsupported "
return;
}
#ifdef USE_CYRUS_SASL2
if (set_use_cyrus_sasl) {
} else
#endif
{
auth_request = NULL;
callback);
break;
}
}
}
if (auth_request != NULL) {
}
}
struct auth_login_request_continue *request,
const unsigned char *data,
{
struct auth_request *auth_request;
if (auth_request == NULL) {
/* timeouted */
} else {
}
}
{
}
{
}
struct auth_request *auth_request,
{
reply->username_idx = 0;
else {
}
if (data_size == 0)
else {
}
}
{
struct auth_login_reply reply;
void *reply_data;
if (success) {
} else {
reply_data = NULL;
}
if (!success) {
auth_request->id);
}
}
extern struct mech_module mech_plain;
extern struct mech_module mech_digest_md5;
void mech_init(void)
{
const char *const *mechanisms;
const char *env;
mech_modules = NULL;
auth_mechanisms = 0;
/* register wanted mechanisms */
i_fatal("MECHANISMS environment is unset");
while (*mechanisms != NULL) {
else {
i_fatal("Unknown authentication mechanism '%s'",
*mechanisms);
}
mechanisms++;
}
if (auth_mechanisms == 0)
i_fatal("No authentication mechanisms configured");
/* get our realm - note that we allocate from data stack so
this function should never be called inside I/O loop or anywhere
else where t_pop() is called */
env = "";
#ifdef USE_CYRUS_SASL2
if (set_use_cyrus_sasl)
#endif
}
void mech_deinit(void)
{
}