view src/login/client.h @ 1035:fe49ece0f3ea HEAD

We have now separate "userdb" and "passdb". They aren't tied to each others in any way, so it's possible to use whatever user database with whatever password database. Added "static" userdb, which uses same uid/gid for everyone and generates home directory from given template. This could be useful with PAM, although insecure since everyone uses same uid. Not too well tested, and userdb/passdb API still needs to be changed to asynchronous for sql/ldap/etc lookups.
author Timo Sirainen <tss@iki.fi>
date Mon, 27 Jan 2003 03:33:40 +0200
parents fb9c95a8847f
children f782b3319553
line wrap: on
line source

#ifndef __CLIENT_H
#define __CLIENT_H

#include "network.h"
#include "master.h"

struct client {
	time_t created;
	int refcount;
	struct ip_addr ip;

	int fd;
	struct io *io;
	struct istream *input;
	struct ostream *output;
	struct imap_parser *parser;

	time_t last_input;
	unsigned int bad_counter;

	const char *cmd_tag, *cmd_name;

	buffer_t *plain_login;
	struct auth_request *auth_request;
	char *virtual_user;

	master_callback_t *master_callback;

	unsigned int tls:1;
	unsigned int cmd_finished:1;
	unsigned int skip_line:1;
};

struct client *client_create(int fd, struct ip_addr *ip, int imaps);
void client_destroy(struct client *client, const char *reason);

void client_ref(struct client *client);
int client_unref(struct client *client);

void client_send_line(struct client *client, const char *line);
void client_send_tagline(struct client *client, const char *line);
void client_syslog(struct client *client, const char *text);

int client_read(struct client *client);
void client_input(void *context, int fd, struct io *io);

unsigned int clients_get_count(void);
void clients_destroy_all(void);

void clients_init(void);
void clients_deinit(void);

#endif