mail-storage-service.h revision 7e95ba7f38b9b421287d36c6152f8a9e6b9f225b
#ifndef MAIL_STORAGE_SERVICE_H
#define MAIL_STORAGE_SERVICE_H
#include "network.h"
struct master_service;
struct mail_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) */
/* Don't initialize logging or change log prefixes */
};
struct mail_storage_service_input {
const char *module;
const char *service;
const char *username;
const char *const *userdb_fields;
};
struct setting_parser_info;
struct mail_storage_service_user;
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 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 error. */
const struct mail_storage_service_input *input,
struct mail_storage_service_user **user_r,
const char **error_r);
struct mail_storage_service_user *user,
struct mail_user **mail_user_r,
const char **error_r);
/* 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 *
/* Return the settings pointed to by set_root parameter in _init() */
#endif