mail-storage-service.h [plain text]
#ifndef MAIL_STORAGE_SERVICE_H
#define MAIL_STORAGE_SERVICE_H
#include "network.h"
struct master_service;
struct mail_user;
struct setting_parser_context;
struct setting_parser_info;
struct mail_storage_service_user;
enum mail_storage_service_flags {
MAIL_STORAGE_SERVICE_FLAG_DISALLOW_ROOT = 0x01,
MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP = 0x02,
MAIL_STORAGE_SERVICE_FLAG_DEBUG = 0x04,
MAIL_STORAGE_SERVICE_FLAG_NO_RESTRICT_ACCESS = 0x08,
MAIL_STORAGE_SERVICE_FLAG_NO_CHDIR = 0x10,
MAIL_STORAGE_SERVICE_FLAG_TEMP_PRIV_DROP = 0x20,
MAIL_STORAGE_SERVICE_FLAG_ENABLE_CORE_DUMPS = 0x40,
MAIL_STORAGE_SERVICE_FLAG_NO_LOG_INIT = 0x80,
MAIL_STORAGE_SERVICE_FLAG_NO_PLUGINS = 0x100,
MAIL_STORAGE_SERVICE_FLAG_NO_IDLE_TIMEOUT = 0x200,
MAIL_STORAGE_SERVICE_FLAG_USE_SYSEXITS = 0x400,
MAIL_STORAGE_SERVICE_FLAG_NO_NAMESPACES = 0x800
};
struct mail_storage_service_input {
const char *module;
const char *service;
const char *username;
struct ip_addr local_ip, remote_ip;
unsigned int local_port, remote_port;
const char *const *userdb_fields;
enum mail_storage_service_flags flags_override_add;
enum mail_storage_service_flags flags_override_remove;
unsigned int no_userdb_lookup:1;
};
extern struct module *mail_storage_service_modules;
struct mail_storage_service_ctx *
mail_storage_service_init(struct master_service *service,
const struct setting_parser_info *set_roots[],
enum mail_storage_service_flags flags);
struct auth_master_connection *
mail_storage_service_get_auth_conn(struct mail_storage_service_ctx *ctx);
int mail_storage_service_read_settings(struct mail_storage_service_ctx *ctx,
const struct mail_storage_service_input *input,
pool_t pool,
const struct setting_parser_info **user_info_r,
const struct setting_parser_context **parser_r,
const char **error_r);
void mail_storage_service_init_settings(struct mail_storage_service_ctx *ctx,
const struct mail_storage_service_input *input);
int mail_storage_service_lookup(struct mail_storage_service_ctx *ctx,
const struct mail_storage_service_input *input,
struct mail_storage_service_user **user_r,
const char **error_r);
int mail_storage_service_next(struct mail_storage_service_ctx *ctx,
struct mail_storage_service_user *user,
struct mail_user **mail_user_r);
void mail_storage_service_restrict_setenv(struct mail_storage_service_ctx *ctx,
struct mail_storage_service_user *user);
int mail_storage_service_lookup_next(struct mail_storage_service_ctx *ctx,
const struct mail_storage_service_input *input,
struct mail_storage_service_user **user_r,
struct mail_user **mail_user_r,
const char **error_r);
void mail_storage_service_user_free(struct mail_storage_service_user **user);
unsigned int
mail_storage_service_all_init(struct mail_storage_service_ctx *ctx);
int mail_storage_service_all_next(struct mail_storage_service_ctx *ctx,
const char **username_r);
void mail_storage_service_deinit(struct mail_storage_service_ctx **ctx);
void **mail_storage_service_user_get_set(struct mail_storage_service_user *user);
const struct mail_storage_service_input *
mail_storage_service_user_get_input(struct mail_storage_service_user *user);
struct setting_parser_context *
mail_storage_service_user_get_settings_parser(struct mail_storage_service_user *user);
void *mail_storage_service_get_settings(struct master_service *service);
#endif