mail-storage-service.h revision 303e375b7e76278f4ec541f49af0476d3e4ee710
#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 {
/* Fail if we don't drop root privileges */
/* Lookup user from userdb */
/* Force mail_debug=yes */
MAIL_STORAGE_SERVICE_FLAG_DEBUG = 0x04,
/* Keep the current process permissions */
/* Don't chdir() to user's home */
/* Drop privileges only temporarily (keep running as setuid-root) */
/* Enable core dumps even when dropping privileges temporarily */
/* Don't initialize logging or change log prefixes */
/* Don't load plugins in _service_lookup() */
MAIL_STORAGE_SERVICE_FLAG_NO_PLUGINS = 0x100,
/* Don't close auth connections because of idling. */
/* When executing doveconf, tell it to use sysexits codes */
/* Don't create namespaces, only the user. */
};
struct mail_storage_service_input {
const char *module;
const char *service;
const char *username;
const char *const *userdb_fields;
/* override MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP for this lookup */
unsigned int no_userdb_lookup:1;
};
extern struct module *mail_storage_service_modules;
struct mail_storage_service_ctx *
const struct setting_parser_info *set_roots[],
enum mail_storage_service_flags flags);
struct auth_master_connection *
const struct mail_storage_service_input *input,
const struct setting_parser_info **user_info_r,
const struct setting_parser_context **parser_r,
const char **error_r);
/* Read settings and initialize context to use them. Do nothing if service is
already initialized. This is mainly necessary when calling _get_auth_conn()
or _all_init(). */
const struct mail_storage_service_input *input);
/* Returns 1 if ok, 0 if user wasn't found, -1 if fatal error,
-2 if error is user-specific (e.g. invalid settings).
Error can be safely shown to untrusted users. */
const struct mail_storage_service_input *input,
struct mail_storage_service_user **user_r,
const char **error_r);
/* Returns 0 if ok, -1 if fatal error, -2 if error is user-specific. */
struct mail_storage_service_user *user,
struct mail_user **mail_user_r);
struct mail_storage_service_user *user);
/* Combine lookup() and next() into one call. */
const struct mail_storage_service_input *input,
struct mail_storage_service_user **user_r,
struct mail_user **mail_user_r,
const char **error_r);
/* Initialize iterating through all users. Return the number of users. */
unsigned int
/* Iterate through all usernames. Returns 1 if username was returned, 0 if
there are no more users, -1 if error. */
const char **username_r);
/* Return the settings pointed to by set_root parameter in _init().
The settings contain all the changes done by userdb lookups. */
const struct mail_storage_service_input *
struct setting_parser_context *
/* Return the settings pointed to by set_root parameter in _init() */
#endif