/* Copyright (c) 2005-2018 Dovecot authors, see the included COPYING file */
#include "auth-common.h"
#include "array.h"
#include "settings-parser.h"
#include "master-service-settings.h"
#include "mech.h"
#include "userdb.h"
#include "passdb.h"
#include "passdb-template.h"
#include "userdb-template.h"
#include "auth.h"
.name = "",
.driver = "static",
.args = "",
.default_fields = "",
.override_fields = "",
.skip = "never",
.result_success = "return-ok",
.result_failure = "continue",
.result_internalfail = "continue"
};
{
return AUTH_PASSDB_SKIP_NEVER;
return AUTH_PASSDB_SKIP_AUTHENTICATED;
return AUTH_PASSDB_SKIP_UNAUTHENTICATED;
i_unreached();
}
{
return AUTH_USERDB_SKIP_NEVER;
return AUTH_USERDB_SKIP_FOUND;
return AUTH_USERDB_SKIP_NOTFOUND;
i_unreached();
}
{
return AUTH_DB_RULE_RETURN;
return AUTH_DB_RULE_RETURN_OK;
return AUTH_DB_RULE_RETURN_FAIL;
return AUTH_DB_RULE_CONTINUE;
return AUTH_DB_RULE_CONTINUE_OK;
return AUTH_DB_RULE_CONTINUE_FAIL;
i_unreached();
}
static void
struct auth_passdb **passdbs)
{
/* for backwards compatibility: */
*dest = auth_passdb;
/* make sure any %variables in default_fields exist in cache_key */
}
else {
}
}
static void
{
*dest = auth_userdb;
/* make sure any %variables in default_fields exist in cache_key */
}
else {
}
}
{
return TRUE;
}
return FALSE;
}
{
return TRUE;
}
return FALSE;
}
{
return TRUE;
}
return TRUE;
}
return FALSE;
}
static bool
{
case MECH_PASSDB_NEED_NOTHING:
break;
return FALSE;
break;
return FALSE;
break;
return FALSE;
return FALSE;
break;
}
return TRUE;
}
{
break;
}
i_fatal("No passdbs specified in configuration file. "
"%s mechanism needs one",
}
i_fatal("%s mechanism can't be supported with given passdbs",
}
}
const struct mechanisms_register *reg)
{
else {
db_count = 0;
}
/* initialize passdbs first and count them */
for (passdb_count = 0, i = 0; i < db_count; i++) {
continue;
/* passdb { skip=unauthenticated } as the first passdb doesn't
make sense, since user is never authenticated at that point.
skip over them silently. */
continue;
passdb_count++;
last_passdb = i;
}
i_fatal("Last passdb can't have pass=yes");
for (i = 0; i < db_count; i++) {
continue;
/* skip skip=unauthenticated, as explained above */
continue;
i_fatal("Master passdb can't have deny=yes");
i_fatal("Master passdb can't have pass=yes "
"if there are no passdbs");
}
}
for (i = 0; i < count; i++)
}
/* use a dummy userdb static. */
}
return auth;
}
{
}
{
}
{
}
{
struct auth *const *a;
unsigned int i, count;
for (i = 1; i < count; i++) {
return a[i];
}
/* not found. maybe we can instead find a !service */
for (i = 1; i < count; i++) {
if (a[i]->service[0] == '!' &&
return a[i];
}
}
return a[0];
}
{
struct auth *const *a;
unsigned int count;
return a[0];
}
const struct mechanisms_register *reg,
const char *const *services)
{
unsigned int i;
if (services[i][0] == '!') {
if (not_service != NULL) {
i_fatal("Can't have multiple protocol "
"!services (seen %s and %s)",
not_service, services[i]);
}
not_service = services[i];
}
&set_output);
}
}
}
void auths_init(void)
{
/* sanity checks */
}
void auths_deinit(void)
{
auth_deinit(*auth);
}
void auths_free(void)
{
unsigned int i, count;
/* deinit in reverse order, because modules have been allocated by
the first auth pool that used them */
for (i = count; i > 0; i--)
array_free(&auths);
}