mail-storage-service.h revision 47e9fdee55c2074425cf0316f4f64fbbb790301c
02c335c23bf5fa225a467c19f2c063fb0dc7b8c3Timo Sirainen#ifndef MAIL_STORAGE_SERVICE_H
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen#define MAIL_STORAGE_SERVICE_H
08d6658a4e2ec8104cd1307f6baa75fdb07a24f8Mark Washenberger
b44650b0f48a4b5f0dc240ed836833a00b643b9fTimo Sirainenstruct master_service;
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen
bdd36cfdba3ff66d25570a9ff568d69e1eb543cfTimo Sirainenenum mail_storage_service_flags {
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen /* Fail if we don't drop root privileges */
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen MAIL_STORAGE_SERVICE_FLAG_DISALLOW_ROOT = 0x01,
be5c76fabc7439fd33bc799bc3ab3f570799977bTimo Sirainen /* Lookup user from userdb */
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP = 0x02,
b0e9375a1ff97c9c7d40655922af5ccc73ecaa76Timo Sirainen /* Force mail_debug=yes */
f93c833d644ecff0b0f80bee4f1cdde3e697b5c8Timo Sirainen MAIL_STORAGE_SERVICE_FLAG_DEBUG = 0x04,
d176f84ce5ca2073f4dfbafb457b9c74f6bf0d76Timo Sirainen /* Keep the current process permissions */
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen MAIL_STORAGE_SERVICE_FLAG_NO_RESTRICT_ACCESS = 0x08
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen};
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainenstruct setting_parser_info;
c0757c70cfd2c9b44de3504b753a4d2f38690ef0Timo Sirainenstruct mail_storage_service_multi_user;
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainenstruct mail_user *
b624773984e35dd894db8dff976c1a2114c70782Timo Sirainenmail_storage_service_init_user(struct master_service *service, const char *user,
5afc76d0215c5f7631dec06ef864d59f0686a0a8Timo Sirainen const struct setting_parser_info *set_roots[],
b624773984e35dd894db8dff976c1a2114c70782Timo Sirainen enum mail_storage_service_flags flags);
12d38e76ba7f70d6219c89ec7416fea0d5de7e02Timo Sirainenvoid mail_storage_service_deinit_user(void);
b624773984e35dd894db8dff976c1a2114c70782Timo Sirainen
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainenstruct mail_storage_service_multi_ctx *
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainenmail_storage_service_multi_init(struct master_service *service,
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen const struct setting_parser_info *set_roots[],
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen enum mail_storage_service_flags flags);
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen/* Returns 1 if ok, 0 if user wasn't found, -1 if error. */
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainenint mail_storage_service_multi_lookup(struct mail_storage_service_multi_ctx *ctx,
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen const char *username, pool_t pool,
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen struct mail_storage_service_multi_user **user_r,
3a7113e3e2dac0e333e1a3f62af7d682896f59c6Timo Sirainen const char **error_r);
c0757c70cfd2c9b44de3504b753a4d2f38690ef0Timo Sirainenint mail_storage_service_multi_next(struct mail_storage_service_multi_ctx *ctx,
be5c76fabc7439fd33bc799bc3ab3f570799977bTimo Sirainen struct mail_storage_service_multi_user *user,
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen struct mail_user **mail_user_r,
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen const char **error_r);
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainenvoid mail_storage_service_multi_deinit(struct mail_storage_service_multi_ctx **ctx);
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen/* Return the settings pointed to by set_root parameter in _init().
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen The settings contain all the changes done by userdb lookups. */
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainenvoid *mail_storage_service_multi_user_get_set(struct mail_storage_service_multi_user *user);
e9371f899a3d4207a0ffd3923ea5ec7250cf5e75Timo Sirainen
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen/* Return the settings pointed to by set_root parameter in _init() */
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainenvoid *mail_storage_service_get_settings(struct master_service *service);
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen#endif
788a0754cfd38dcfec1902844b085e4e84cfe7e6Timo Sirainen