passdb-sql.c revision 2454dfa32c93c20a8522c6ed42fe057baaac9f9a
/* Copyright (c) 2004-2017 Dovecot authors, see the included COPYING file */
#include "auth-common.h"
#include "passdb.h"
#ifdef PASSDB_SQL
#include "safe-memset.h"
#include "password-scheme.h"
#include "auth-cache.h"
#include "db-sql.h"
#include <string.h>
struct sql_passdb_module {
struct passdb_module module;
struct sql_connection *conn;
};
struct passdb_sql_request {
struct auth_request *auth_request;
union {
} callback;
};
struct passdb_sql_request *sql_request)
{
unsigned int i, fields_count;
for (i = 0; i < fields_count; i++) {
if (*name == '\0')
;
else {
}
}
}
struct passdb_sql_request *sql_request)
{
enum passdb_result passdb_result;
int ret;
if (ret >= 0)
if (ret < 0) {
"Password query failed: %s",
} else {
"Password query failed: %s "
"(using built-in default password_query: %s)",
}
} else if (ret == 0) {
} else {
/* Note that we really want to check if the password field is
found. Just checking if password is set isn't enough,
because with proxies we might want to return NULL as
password. */
"Password query must return a field named "
"'password'");
} else if (sql_result_next_row(result) > 0) {
"Password query returned multiple matches");
"Empty password returned without nopassword");
} else {
/* passdb_password may change on the way,
so we'll need to strdup. */
}
}
/* auth_request_set_field() sets scheme */
return;
}
/* verify plain */
return;
}
}
static const char *
{
}
{
struct passdb_module *_module =
"Failed to expand password_query=%s: %s",
return;
}
"query: %s", query);
}
const char *password ATTR_UNUSED,
{
struct passdb_sql_request *sql_request;
}
{
struct passdb_sql_request *sql_request;
}
struct passdb_sql_request *sql_request)
{
struct passdb_module *_module =
} else {
"Set credentials query failed: %s"
"(using built-in default update_query: %s)",
}
}
}
const char *new_credentials,
{
struct sql_passdb_module *module =
struct sql_transaction_context *transaction;
struct passdb_sql_request *sql_request;
"Failed to expand update_query=%s: %s",
return;
}
}
static struct passdb_module *
{
struct sql_passdb_module *module;
struct sql_connection *conn;
}
{
struct sql_passdb_module *module =
(struct sql_passdb_module *)_module;
enum sql_db_flags flags;
}
{
struct sql_passdb_module *module =
(struct sql_passdb_module *)_module;
}
struct passdb_module_interface passdb_sql = {
"sql",
};
#else
struct passdb_module_interface passdb_sql = {
.name = "sql"
};
#endif