cf0ad1a0bddb0787f3d7b408a96d721a8b2a98a3Timo Sirainen/* Major version changes are not backwards compatible,
cf0ad1a0bddb0787f3d7b408a96d721a8b2a98a3Timo Sirainen minor version numbers can be ignored. */
cf0ad1a0bddb0787f3d7b408a96d721a8b2a98a3Timo Sirainen/* Authentication client process's cookie size */
27712ff41adb9564e946a3f392c90da918c8a2e1Timo Sirainen/* LOGIN_MAX_INBUF_SIZE should be based on this. Keep this large enough so that
27712ff41adb9564e946a3f392c90da918c8a2e1Timo Sirainen LOGIN_MAX_INBUF_SIZE will be 1024+2 bytes. This is because IMAP ID command's
27712ff41adb9564e946a3f392c90da918c8a2e1Timo Sirainen values may be max. 1024 bytes plus 2 for "" quotes. (Although it could be
27712ff41adb9564e946a3f392c90da918c8a2e1Timo Sirainen even double of that when value is full of \" quotes, but for now lets not
27712ff41adb9564e946a3f392c90da918c8a2e1Timo Sirainen make it too easy to waste memory..) */
84e4f27dd10c56cd63d75a04af5f5eb2a1b70d22Timo Sirainen#define MASTER_AUTH_MAX_DATA_SIZE (1024 + 128 + 64 + 2)
3b22894b8805b186c73d8b754001e8d7e944be85Timo Sirainen "Internal error occurred. Refer to server log for more information."
7b1bdf60531f8d511e9983e2bd6375938d711cffTimo Sirainen /* Connection has TLS compression enabled */
e213fe0f4040bb6001e76edd51131ccf18129a3fStephan Bosch MAIL_AUTH_REQUEST_FLAG_TLS_COMPRESSION = BIT(0),
e213fe0f4040bb6001e76edd51131ccf18129a3fStephan Bosch /* Connection is secure (SSL or just trusted) */
e213fe0f4040bb6001e76edd51131ccf18129a3fStephan Bosch /* Connection is secured using SSL specifically */
e213fe0f4040bb6001e76edd51131ccf18129a3fStephan Bosch MAIL_AUTH_REQUEST_FLAG_CONN_SSL_SECURED = BIT(2),
cf0ad1a0bddb0787f3d7b408a96d721a8b2a98a3Timo Sirainen/* Authentication request. File descriptor may be sent along with the
cf0ad1a0bddb0787f3d7b408a96d721a8b2a98a3Timo Sirainen /* Request tag. Reply is sent back using same tag. */
cf0ad1a0bddb0787f3d7b408a96d721a8b2a98a3Timo Sirainen /* Authentication process, authentication ID and auth cookie. */
e213fe0f4040bb6001e76edd51131ccf18129a3fStephan Bosch /* Properties of the connection. The file descriptor
cf0ad1a0bddb0787f3d7b408a96d721a8b2a98a3Timo Sirainen itself may be a local socketpair. */
cf0ad1a0bddb0787f3d7b408a96d721a8b2a98a3Timo Sirainen /* request follows this many bytes of client input */
cf0ad1a0bddb0787f3d7b408a96d721a8b2a98a3Timo Sirainen /* inode of the transferred fd. verified just to be sure that the
cf0ad1a0bddb0787f3d7b408a96d721a8b2a98a3Timo Sirainen correct fd is mapped to the correct struct. */
cf0ad1a0bddb0787f3d7b408a96d721a8b2a98a3Timo Sirainen /* tag=0 are notifications from master */
cf0ad1a0bddb0787f3d7b408a96d721a8b2a98a3Timo Sirainen /* PID of the post-login mail process handling this connection */
2d8e25bef14245b078868a64396da025f547ad27Timo Sirainen /* Client fd to transfer to post-login process or -1 if no fd is
2d8e25bef14245b078868a64396da025f547ad27Timo Sirainen wanted to be transferred. */
9498baa8f374be5b878c0571d07e8ad060a1fdecTimo Sirainen /* Override master_auth->default_path if non-NULL */
2d8e25bef14245b078868a64396da025f547ad27Timo Sirainen /* Authentication request that is sent to post-login process.
2d8e25bef14245b078868a64396da025f547ad27Timo Sirainen tag is ignored. */
2d8e25bef14245b078868a64396da025f547ad27Timo Sirainen /* Client input of size request.data_size */
3b22894b8805b186c73d8b754001e8d7e944be85Timo Sirainen/* reply=NULL if the auth lookup was cancelled due to some error */
d176f84ce5ca2073f4dfbafb457b9c74f6bf0d76Timo Sirainentypedef void master_auth_callback_t(const struct master_auth_reply *reply,
cf0ad1a0bddb0787f3d7b408a96d721a8b2a98a3Timo Sirainenmaster_auth_init(struct master_service *service, const char *path);
cf0ad1a0bddb0787f3d7b408a96d721a8b2a98a3Timo Sirainenvoid master_auth_deinit(struct master_auth **auth);
2d8e25bef14245b078868a64396da025f547ad27Timo Sirainen/* Send an authentication request. Returns tag which can be used to abort the
2d8e25bef14245b078868a64396da025f547ad27Timo Sirainen request (ie. ignore the reply from master). */
2d8e25bef14245b078868a64396da025f547ad27Timo Sirainenvoid master_auth_request_full(struct master_auth *auth,
2d8e25bef14245b078868a64396da025f547ad27Timo Sirainen const struct master_auth_request_params *params,
2d8e25bef14245b078868a64396da025f547ad27Timo Sirainen master_auth_callback_t *callback, void *context,
2d8e25bef14245b078868a64396da025f547ad27Timo Sirainen unsigned int *tag_r);
2d8e25bef14245b078868a64396da025f547ad27Timo Sirainen/* For backwards compatibility: */
cf0ad1a0bddb0787f3d7b408a96d721a8b2a98a3Timo Sirainenvoid master_auth_request(struct master_auth *auth, int fd,
cf0ad1a0bddb0787f3d7b408a96d721a8b2a98a3Timo Sirainen const unsigned char *data,
cf0ad1a0bddb0787f3d7b408a96d721a8b2a98a3Timo Sirainenvoid master_auth_request_abort(struct master_auth *auth, unsigned int tag);