mail-storage-service.h revision 95dcc0f8e80cc8c9278c904c3cd06dcc4a6d2d33
#ifndef MAIL_STORAGE_SERVICE_H
#define MAIL_STORAGE_SERVICE_H
#include "net.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 *session_id;
const char *const *userdb_fields;
/* Override specified global flags */
/* 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[],
struct auth_master_connection *
/* Set auth connection (instead of creating a new one automatically). */
struct auth_master_connection *conn);
const struct mail_storage_service_input *input,
const struct setting_parser_info **user_info_r,
const struct setting_parser_context **parser_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)
ATTR_NULL(2);
/* 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);
/* The next mail_storage_service_lookup() will save the userdb fields into the
given pointer, allocated from the given pool. */
/* 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. */
/* Iterate through all usernames. Returns 1 if username was returned, 0 if
there are no more users, -1 if error. */
const char **username_r);
/* Activate user context. Normally this is called automatically by the ioloop,
but e.g. during loops at deinit where all users are being destroyed, it's
useful to call this to set the correct user-specific log prefix. */
/* Deactivate user context. This only switches back to non-user-specific
log prefix. */
/* 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_settings *
const struct mail_storage_service_input *
struct setting_parser_context *
struct mail_storage_service_ctx *
const struct var_expand_table *
struct mail_storage_service_input *input);
/* Return the settings pointed to by set_root parameter in _init() */
#endif