client-common.h revision 2f7c73483ff5474a74a83a646f82e1b60f687680
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch#include "master-login.h" /* for LOGIN_MAX_SESSION_ID_LEN */
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch/* max. size of input buffer. this means:
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch IMAP: Max. length of command's all parameters. SASL-IR is read into
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch a separate larger buffer.
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch POP3: Max. length of a command line (spec says 512 would be enough)
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch (MASTER_AUTH_MAX_DATA_SIZE - LOGIN_MAX_MASTER_PREFIX_LEN - \
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch/* max. size of output buffer. if it gets full, the client is disconnected.
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch SASL authentication gives the largest output. */
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch/* Max. length of SASL authentication buffer. */
1e9296de32c9ddda40f33c06556cd568ddadf71fTimo Sirainen/* Disconnect client after this many milliseconds if it hasn't managed
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch to log in yet. */
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch#define CLIENT_LOGIN_TIMEOUT_MSECS (MASTER_LOGIN_TIMEOUT_SECS*1000)
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "Waiting for authentication process to respond.."
1e9296de32c9ddda40f33c06556cd568ddadf71fTimo Sirainen "Waiting for authentication master process to respond.."
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch /* for proxying */
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch /* all the key=value fields returned by passdb */
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch const char *const *all_fields;
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch void (*create)(struct client *client, void **other_sets);
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch void (*notify_auth_ready)(struct client *client);
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch void (*notify_disconnect)(struct client *client,
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch const char *text);
85f3bd5926fff0e70b6d259a5c8074bd8cdeb9adTimo Sirainen void (*notify_starttls)(struct client *client,
85f3bd5926fff0e70b6d259a5c8074bd8cdeb9adTimo Sirainen void (*auth_send_challenge)(struct client *client, const char *data);
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch void (*auth_parse_response)(struct client *client);
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch const char *text);
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch int (*proxy_parse_line)(struct client *client, const char *line);
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch void (*proxy_error)(struct client *client, const char *text);
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch const char *(*proxy_get_state)(struct client *client);
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch /* this pool gets free'd once proxying starts */
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch const struct master_service_ssl_settings *ssl_set;
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch const char *session_id, *listener_name, *postlogin_socket_path;
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch char *proxy_user, *proxy_master_user, *proxy_password;
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch const char *const *auth_passdb_args;
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch /* Module-specific contexts. */
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch ARRAY(union login_client_module_context *) module_contexts;
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch char *virtual_user, *virtual_user_orig, *virtual_auth_user;
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch /* passdb user_* fields are set here after a successful auth.
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch This is a NULL-terminated array where fields are in the same order
faa8995f1d300e7a8917407a52bbd1b98e10bf25Timo Sirainen as in global_alt_usernames. If some field doesn't exist, it's "".
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch Can also be NULL if there are no user_* fields. */
95e0b82fdff1bb511067d703bb8b67c22f242c38Timo Sirainen void (*client_allocated)(struct client *client);
95e0b82fdff1bb511067d703bb8b67c22f242c38Timo Sirainentypedef void login_client_allocated_func_t(struct client *client);
95e0b82fdff1bb511067d703bb8b67c22f242c38Timo Sirainenvoid login_client_hooks_add(struct module *module,
95e0b82fdff1bb511067d703bb8b67c22f242c38Timo Sirainenvoid login_client_hooks_remove(const struct login_client_hooks *hooks);
struct client *
void **other_sets);
const char *text);
const char *init_resp);
void clients_notify_auth_connected(void);
void client_destroy_oldest(void);
void clients_destroy_all(void);
void client_common_init(void);
void client_common_deinit(void);