view src/auth/auth-master-connection.h @ 23017:c1d36f2575c7 default tip

lib-imap: Fix "Don't accept strings with NULs" cherry-pick
author Timo Sirainen <timo.sirainen@open-xchange.com>
date Thu, 29 Aug 2019 09:55:25 +0300
parents 9d607779f192
children
line wrap: on
line source

#ifndef AUTH_MASTER_CONNECTION_H
#define AUTH_MASTER_CONNECTION_H

struct stat;
struct auth_stream_reply;

struct auth_master_connection {
	struct auth_master_connection *prev, *next;
	struct auth *auth;
	int refcount;

	struct timeval create_time, handshake_time;

	int fd;
	char *path;
	struct istream *input;
	struct ostream *output;
	struct io *io;

	struct master_list_iter_ctx *iter_ctx;
	/* If non-zero, allow only USER lookups whose returned uid matches
	   this uid. Don't allow LIST/PASS lookups. */
	uid_t userdb_restricted_uid;

	unsigned int version_received:1;
	unsigned int destroyed:1;
	unsigned int userdb_only:1;
};

void auth_master_log_error(struct auth_master_connection *conn,
			   const char *fmt, ...) ATTR_FORMAT(2, 3);

struct auth_master_connection *
auth_master_connection_create(struct auth *auth, int fd,
			      const char *path, const struct stat *socket_st,
			      bool userdb_only) ATTR_NULL(4);
void auth_master_connection_destroy(struct auth_master_connection **conn);

void auth_master_connection_ref(struct auth_master_connection *conn);
void auth_master_connection_unref(struct auth_master_connection **conn);

void auth_master_request_callback(const char *reply, struct auth_master_connection *conn);

void auth_master_connections_destroy_all(void);

#endif