client-common.h revision decb23442f9e6cd5c4845a9cb162029b8c6d5f0f
#ifndef CLIENT_COMMON_H
#define CLIENT_COMMON_H
#include "network.h"
#include "login-proxy.h"
#include "sasl-server.h"
#define LOGIN_MAX_MASTER_PREFIX_LEN 128
/* max. size of input buffer. this means:
IMAP: Max. length of command's all parameters. SASL-IR is read into
a separate larger buffer.
POP3: Max. length of a command line (spec says 512 would be enough)
*/
#define LOGIN_MAX_INBUF_SIZE \
/* max. size of output buffer. if it gets full, the client is disconnected.
SASL authentication gives the largest output. */
#define LOGIN_MAX_OUTBUF_SIZE 4096
/* Disconnect client after this many milliseconds if it hasn't managed
to log in yet. */
#define AUTH_SERVER_WAITING_MSG \
"Waiting for authentication process to respond.."
#define AUTH_MASTER_WAITING_MSG \
"Waiting for authentication master process to respond.."
enum client_cmd_reply {
};
struct client_auth_reply {
const char *master_user, *reason;
/* for proxying */
unsigned int port;
unsigned int proxy_timeout_msecs;
unsigned int proxy_refresh_secs;
unsigned int proxy:1;
unsigned int temp:1;
unsigned int nologin:1;
unsigned int authz_failure:1;
};
struct client_vfuncs {
const char *text);
const struct client_auth_reply *reply);
};
struct client {
struct client_vfuncs v;
int refcount;
unsigned int local_port, remote_port;
const struct login_settings *set;
int fd;
struct timeout *to_auth_waiting;
struct timeout *to_disconnect;
unsigned char *master_data_prefix;
unsigned int master_data_prefix_len;
struct login_proxy *login_proxy;
unsigned int proxy_state;
char *auth_mech_name;
struct auth_client_request *auth_request;
const char *sasl_final_resp;
unsigned int master_auth_id;
unsigned int master_tag;
unsigned int bad_counter;
unsigned int auth_attempts, auth_successes;
char *virtual_user;
unsigned int destroyed:1;
unsigned int input_blocked:1;
unsigned int login_success:1;
unsigned int greeting_sent:1;
unsigned int starttls:1;
unsigned int tls:1;
unsigned int secured:1;
unsigned int trusted:1;
unsigned int ssl_servername_settings_read:1;
unsigned int authenticating:1;
unsigned int auth_tried_disabled_plaintext:1;
unsigned int auth_tried_unsupported_mech:1;
unsigned int auth_try_aborted:1;
unsigned int auth_initializing:1;
unsigned int auth_process_comm_fail:1;
unsigned int auth_waiting:1;
/* ... */
};
struct client *
unsigned int clients_get_count(void) ATTR_PURE;
const char *text);
const char *init_resp);
void clients_notify_auth_connected(void);
void client_destroy_oldest(void);
void clients_destroy_all(void);
#endif