[dovecot-cvs] dovecot/src/login auth-connection.c,1.15,1.16 auth-connection.h,1.4,1.5 client-authenticate.c,1.26,1.27 client-authenticate.h,1.1.1.1,1.2 client.c,1.23,1.24 client.h,1.8,1.9 main.c,1.13,1.14 master.c,1.9,1.10 master.h,1.5,1.6 ssl-proxy-gnutls.c,1.3,1.4 Message-Id: <20030105130956.32CE223993@danu.procontrol.fi>
cras at procontrol.fi
cras at procontrol.fi
Sun Jan 5 15:09:56 EET 2003
- Previous message: [dovecot-cvs] dovecot/src/master auth-process.c,1.21,1.22 auth-process.h,1.5,1.6 common.h,1.8,1.9 imap-process.c,1.22,1.23 login-process.c,1.24,1.25 main.c,1.23,1.24 master-interface.h,1.3,1.4 settings.c,1.39,1.40 settings.h,1.20,1.21 ssl-init.c,1.6,1.7
- Next message: [dovecot-cvs] dovecot/src/lib-index mail-custom-flags.c,1.16,1.17 mail-custom-flags.h,1.5,1.6 mail-index-compress.c,1.22,1.23 mail-index-data.c,1.32,1.33 mail-index-data.h,1.12,1.13 mail-index-fsck.c,1.11,1.12 mail-index-open.c,1.22,1.23 Message-Id: <20030105130956.04620238E1@danu.procontrol.fi>
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/dovecot/src/login
In directory danu:/tmp/cvs-serv25916/src/login
Modified Files:
auth-connection.c auth-connection.h client-authenticate.c
client-authenticate.h client.c client.h main.c master.c
master.h ssl-proxy-gnutls.c ssl-proxy-openssl.c
Log Message:
Naming style changes, finally got tired of most of the typedefs. Also the
previous enum -> macro change reverted so that we don't use the highest bit
anymore, that's incompatible with old indexes so they will be rebuilt.
Index: auth-connection.c
===================================================================
RCS file: /home/cvs/dovecot/src/login/auth-connection.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- auth-connection.c 19 Dec 2002 23:56:24 -0000 1.15
+++ auth-connection.c 5 Jan 2003 13:09:53 -0000 1.16
@@ -12,43 +12,44 @@
#include <dirent.h>
#include <sys/stat.h>
-#define MAX_INBUF_SIZE (AUTH_MAX_REQUEST_DATA_SIZE)
+#define MAX_INBUF_SIZE AUTH_MAX_REQUEST_DATA_SIZE
#define MAX_OUTBUF_SIZE \
- (sizeof(AuthContinuedRequestData) + AUTH_MAX_REQUEST_DATA_SIZE)
+ (sizeof(struct auth_continued_request_data) + \
+ AUTH_MAX_REQUEST_DATA_SIZE)
-struct _AuthConnection {
- AuthConnection *next;
+struct auth_connection {
+ struct auth_connection *next;
char *path;
int fd;
- IO io;
- IStream *input;
- OStream *output;
+ struct io *io;
+ struct istream *input;
+ struct ostream *output;
unsigned int auth_process;
- AuthMethod available_auth_methods;
- AuthReplyData in_reply;
+ enum auth_method available_auth_methods;
+ struct auth_reply_data in_reply;
- HashTable *requests;
+ struct hash_table *requests;
unsigned int init_received:1;
unsigned int in_reply_received:1;
};
-AuthMethod available_auth_methods;
+enum auth_method available_auth_methods;
static int auth_reconnect;
static unsigned int request_id_counter;
-static AuthConnection *auth_connections;
-static Timeout to;
+static struct auth_connection *auth_connections;
+static struct timeout *to;
-static void auth_connection_destroy(AuthConnection *conn);
-static void auth_input(void *context, int fd, IO io);
+static void auth_connection_destroy(struct auth_connection *conn);
+static void auth_input(void *context, int fd, struct io *io);
static void auth_connect_missing(void);
-static AuthConnection *auth_connection_find(const char *path)
+static struct auth_connection *auth_connection_find(const char *path)
{
- AuthConnection *conn;
+ struct auth_connection *conn;
for (conn = auth_connections; conn != NULL; conn = conn->next) {
if (strcmp(conn->path, path) == 0)
@@ -58,10 +59,10 @@
return NULL;
}
-static AuthConnection *auth_connection_new(const char *path)
+static struct auth_connection *auth_connection_new(const char *path)
{
- AuthConnection *conn;
- ClientAuthInitData init_data;
+ struct auth_connection *conn;
+ struct client_auth_init_data init_data;
int fd;
fd = net_connect_unix(path);
@@ -71,7 +72,7 @@
return NULL;
}
- conn = i_new(AuthConnection, 1);
+ conn = i_new(struct auth_connection, 1);
conn->path = i_strdup(path);
conn->fd = fd;
conn->io = io_add(fd, IO_READ, auth_input, conn);
@@ -94,13 +95,13 @@
return conn;
}
-static void request_destroy(AuthRequest *request)
+static void request_destroy(struct auth_request *request)
{
hash_remove(request->conn->requests, POINTER_CAST(request->id));
i_free(request);
}
-static void request_abort(AuthRequest *request)
+static void request_abort(struct auth_request *request)
{
request->callback(request, request->conn->auth_process,
AUTH_RESULT_INTERNAL_FAILURE,
@@ -115,9 +116,9 @@
request_abort(value);
}
-static void auth_connection_destroy(AuthConnection *conn)
+static void auth_connection_destroy(struct auth_connection *conn)
{
- AuthConnection **pos;
+ struct auth_connection **pos;
for (pos = &auth_connections; *pos != NULL; pos = &(*pos)->next) {
if (*pos == conn) {
@@ -138,10 +139,10 @@
i_free(conn);
}
-static AuthConnection *auth_connection_get(AuthMethod method, size_t size,
- const char **error)
+static struct auth_connection *
+auth_connection_get(enum auth_method method, size_t size, const char **error)
{
- AuthConnection *conn;
+ struct auth_connection *conn;
int found;
found = FALSE;
@@ -172,14 +173,15 @@
static void update_available_auth_methods(void)
{
- AuthConnection *conn;
+ struct auth_connection *conn;
available_auth_methods = 0;
for (conn = auth_connections; conn != NULL; conn = conn->next)
available_auth_methods |= conn->available_auth_methods;
}
-static void auth_handle_init(AuthConnection *conn, AuthInitData *init_data)
+static void auth_handle_init(struct auth_connection *conn,
+ struct auth_init_data *init_data)
{
conn->auth_process = init_data->auth_process;
conn->available_auth_methods = init_data->auth_methods;
@@ -188,10 +190,11 @@
update_available_auth_methods();
}
-static void auth_handle_reply(AuthConnection *conn, AuthReplyData *reply_data,
+static void auth_handle_reply(struct auth_connection *conn,
+ struct auth_reply_data *reply_data,
const unsigned char *data)
{
- AuthRequest *request;
+ struct auth_request *request;
request = hash_lookup(conn->requests, POINTER_CAST(reply_data->id));
if (request == NULL) {
@@ -214,10 +217,10 @@
}
static void auth_input(void *context, int fd __attr_unused__,
- IO io __attr_unused__)
+ struct io *io __attr_unused__)
{
- AuthConnection *conn = context;
- AuthInitData init_data;
+ struct auth_connection *conn = context;
+ struct auth_init_data init_data;
const unsigned char *data;
size_t size;
@@ -240,15 +243,17 @@
data = i_stream_get_data(conn->input, &size);
if (!conn->init_received) {
- if (size == sizeof(AuthInitData)) {
- memcpy(&init_data, data, sizeof(AuthInitData));
- i_stream_skip(conn->input, sizeof(AuthInitData));
+ if (size == sizeof(struct auth_init_data)) {
+ memcpy(&init_data, data, sizeof(struct auth_init_data));
+ i_stream_skip(conn->input,
+ sizeof(struct auth_init_data));
auth_handle_init(conn, &init_data);
- } else if (size > sizeof(AuthInitData)) {
+ } else if (size > sizeof(struct auth_init_data)) {
i_error("BUG: imap-auth sent us too much "
"initialization data (%"PRIuSIZE_T " vs %"
- PRIuSIZE_T")", size, sizeof(AuthInitData));
+ PRIuSIZE_T")", size,
+ sizeof(struct auth_init_data));
auth_connection_destroy(conn);
}
@@ -257,13 +262,13 @@
if (!conn->in_reply_received) {
data = i_stream_get_data(conn->input, &size);
- if (size < sizeof(AuthReplyData))
+ if (size < sizeof(struct auth_reply_data))
return;
- memcpy(&conn->in_reply, data, sizeof(AuthReplyData));
- data += sizeof(AuthReplyData);
- size -= sizeof(AuthReplyData);
- i_stream_skip(conn->input, sizeof(AuthReplyData));
+ memcpy(&conn->in_reply, data, sizeof(struct auth_reply_data));
+ data += sizeof(struct auth_reply_data);
+ size -= sizeof(struct auth_reply_data);
+ i_stream_skip(conn->input, sizeof(struct auth_reply_data));
conn->in_reply_received = TRUE;
}
@@ -276,22 +281,22 @@
i_stream_skip(conn->input, conn->in_reply.data_size);
}
-int auth_init_request(AuthMethod method, AuthCallback callback,
+int auth_init_request(enum auth_method method, AuthCallback callback,
void *context, const char **error)
{
- AuthConnection *conn;
- AuthRequest *request;
- AuthInitRequestData request_data;
+ struct auth_connection *conn;
+ struct auth_request *request;
+ struct auth_init_request_data request_data;
if (auth_reconnect)
auth_connect_missing();
- conn = auth_connection_get(method, sizeof(AuthInitRequestData), error);
+ conn = auth_connection_get(method, sizeof(request_data), error);
if (conn == NULL)
return FALSE;
/* create internal request structure */
- request = i_new(AuthRequest, 1);
+ request = i_new(struct auth_request, 1);
request->method = method;
request->conn = conn;
request->id = ++request_id_counter;
@@ -310,10 +315,10 @@
return TRUE;
}
-void auth_continue_request(AuthRequest *request, const unsigned char *data,
- size_t data_size)
+void auth_continue_request(struct auth_request *request,
+ const unsigned char *data, size_t data_size)
{
- AuthContinuedRequestData request_data;
+ struct auth_continued_request_data request_data;
/* send continued request to auth */
memcpy(request_data.cookie, request->cookie, AUTH_COOKIE_SIZE);
@@ -362,8 +367,9 @@
(void)closedir(dirp);
}
-static void auth_connect_missing_timeout(void *context __attr_unused__,
- Timeout timeout __attr_unused__)
+static void
+auth_connect_missing_timeout(void *context __attr_unused__,
+ struct timeout *timeout __attr_unused__)
{
if (auth_reconnect)
auth_connect_missing();
@@ -381,7 +387,7 @@
void auth_connection_deinit(void)
{
- AuthConnection *next;
+ struct auth_connection *next;
while (auth_connections != NULL) {
next = auth_connections->next;
Index: auth-connection.h
===================================================================
RCS file: /home/cvs/dovecot/src/login/auth-connection.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- auth-connection.h 19 Dec 2002 23:56:24 -0000 1.4
+++ auth-connection.h 5 Jan 2003 13:09:53 -0000 1.5
@@ -1,17 +1,18 @@
#ifndef __AUTH_CONNECTION_H
#define __AUTH_CONNECTION_H
-typedef struct _AuthConnection AuthConnection;
+struct auth_request;
/* If result == AUTH_RESULT_INTERNAL_FAILURE, request may be NULL and
reply_data_size contains the error message. */
-typedef void (*AuthCallback)(AuthRequest *request, unsigned int auth_process,
- AuthResult result, const unsigned char *reply_data,
+typedef void (*AuthCallback)(struct auth_request *request,
+ unsigned int auth_process, enum auth_result result,
+ const unsigned char *reply_data,
size_t reply_data_size, void *context);
-struct _AuthRequest {
- AuthMethod method;
- AuthConnection *conn;
+struct auth_request {
+ enum auth_method method;
+ struct auth_connection *conn;
unsigned int id;
unsigned char cookie[AUTH_COOKIE_SIZE];
@@ -22,13 +23,13 @@
unsigned int init_sent:1;
};
-extern AuthMethod available_auth_methods;
+extern enum auth_method available_auth_methods;
-int auth_init_request(AuthMethod method, AuthCallback callback,
+int auth_init_request(enum auth_method method, AuthCallback callback,
void *context, const char **error);
-void auth_continue_request(AuthRequest *request, const unsigned char *data,
- size_t data_size);
+void auth_continue_request(struct auth_request *request,
+ const unsigned char *data, size_t data_size);
void auth_connection_init(void);
void auth_connection_deinit(void);
Index: client-authenticate.c
===================================================================
RCS file: /home/cvs/dovecot/src/login/client-authenticate.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- client-authenticate.c 4 Jan 2003 17:26:30 -0000 1.26
+++ client-authenticate.c 5 Jan 2003 13:09:53 -0000 1.27
@@ -13,23 +13,23 @@
#include "client-authenticate.h"
#include "master.h"
-typedef struct {
+struct auth_method_desc {
int method;
const char *name;
int plaintext;
-} AuthMethodDesc;
+};
-static AuthMethod auth_methods = 0;
+static enum auth_method auth_methods = 0;
static char *auth_methods_capability = NULL;
-static AuthMethodDesc auth_method_desc[AUTH_METHODS_COUNT] = {
+static struct auth_method_desc auth_method_desc[AUTH_METHODS_COUNT] = {
{ AUTH_METHOD_PLAIN, NULL, TRUE },
{ AUTH_METHOD_DIGEST_MD5, "DIGEST-MD5", FALSE }
};
const char *client_authenticate_get_capabilities(void)
{
- String *str;
+ string_t *str;
int i;
if (auth_methods == available_auth_methods)
@@ -53,7 +53,7 @@
return auth_methods_capability;
}
-static AuthMethodDesc *auth_method_find(const char *name)
+static struct auth_method_desc *auth_method_find(const char *name)
{
int i;
@@ -66,7 +66,7 @@
return NULL;
}
-static void client_auth_abort(Client *client, const char *msg)
+static void client_auth_abort(struct client *client, const char *msg)
{
client->auth_request = NULL;
@@ -83,9 +83,9 @@
client_unref(client);
}
-static void master_callback(MasterReplyResult result, void *context)
+static void master_callback(enum master_reply_result result, void *context)
{
- Client *client = context;
+ struct client *client = context;
switch (result) {
case MASTER_RESULT_SUCCESS:
@@ -101,10 +101,10 @@
}
}
-static void client_send_auth_data(Client *client, const unsigned char *data,
- size_t size)
+static void client_send_auth_data(struct client *client,
+ const unsigned char *data, size_t size)
{
- Buffer *buf;
+ buffer_t *buf;
t_push();
@@ -120,11 +120,12 @@
t_pop();
}
-static int auth_callback(AuthRequest *request, unsigned int auth_process,
- AuthResult result, const unsigned char *reply_data,
+static int auth_callback(struct auth_request *request,
+ unsigned int auth_process, enum auth_result result,
+ const unsigned char *reply_data,
size_t reply_data_size, void *context)
{
- Client *client = context;
+ struct client *client = context;
switch (result) {
case AUTH_RESULT_CONTINUE:
@@ -164,11 +165,12 @@
}
}
-static void login_callback(AuthRequest *request, unsigned int auth_process,
- AuthResult result, const unsigned char *reply_data,
+static void login_callback(struct auth_request *request,
+ unsigned int auth_process, enum auth_result result,
+ const unsigned char *reply_data,
size_t reply_data_size, void *context)
{
- Client *client = context;
+ struct client *client = context;
const void *ptr;
size_t size;
@@ -181,7 +183,7 @@
}
}
-int cmd_login(Client *client, const char *user, const char *pass)
+int cmd_login(struct client *client, const char *user, const char *pass)
{
const char *error;
@@ -216,12 +218,13 @@
}
}
-static void authenticate_callback(AuthRequest *request,
- unsigned int auth_process, AuthResult result,
+static void authenticate_callback(struct auth_request *request,
+ unsigned int auth_process,
+ enum auth_result result,
const unsigned char *reply_data,
size_t reply_data_size, void *context)
{
- Client *client = context;
+ struct client *client = context;
if (auth_callback(request, auth_process, result,
reply_data, reply_data_size, context))
@@ -229,10 +232,10 @@
}
static void client_auth_input(void *context, int fd __attr_unused__,
- IO io __attr_unused__)
+ struct io *io __attr_unused__)
{
- Client *client = context;
- Buffer *buf;
+ struct client *client = context;
+ buffer_t *buf;
char *line;
size_t linelen, bufsize;
@@ -270,9 +273,9 @@
safe_memset(buffer_free_without_data(buf), 0, bufsize);
}
-int cmd_authenticate(Client *client, const char *method_name)
+int cmd_authenticate(struct client *client, const char *method_name)
{
- AuthMethodDesc *method;
+ struct auth_method_desc *method;
const char *error;
if (*method_name == '\0')
Index: client-authenticate.h
===================================================================
RCS file: /home/cvs/dovecot/src/login/client-authenticate.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- client-authenticate.h 9 Aug 2002 09:15:55 -0000 1.1.1.1
+++ client-authenticate.h 5 Jan 2003 13:09:53 -0000 1.2
@@ -3,7 +3,7 @@
const char *client_authenticate_get_capabilities(void);
-int cmd_login(Client *client, const char *user, const char *pass);
-int cmd_authenticate(Client *client, const char *method_name);
+int cmd_login(struct client *client, const char *user, const char *pass);
+int cmd_authenticate(struct client *client, const char *method_name);
#endif
Index: client.c
===================================================================
RCS file: /home/cvs/dovecot/src/login/client.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- client.c 3 Jan 2003 15:57:12 -0000 1.23
+++ client.c 5 Jan 2003 13:09:53 -0000 1.24
@@ -23,10 +23,10 @@
client hash, it's faster if we disconnect multiple clients. */
#define CLIENT_DESTROY_OLDEST_COUNT 16
-static HashTable *clients;
-static Timeout to_idle;
+static struct hash_table *clients;
+static struct timeout *to_idle;
-static void client_set_title(Client *client)
+static void client_set_title(struct client *client)
{
const char *host;
@@ -41,7 +41,7 @@
host));
}
-static int cmd_capability(Client *client)
+static int cmd_capability(struct client *client)
{
const char *capability;
@@ -56,7 +56,7 @@
return TRUE;
}
-static int cmd_starttls(Client *client)
+static int cmd_starttls(struct client *client)
{
int fd_ssl;
@@ -104,13 +104,13 @@
return TRUE;
}
-static int cmd_noop(Client *client)
+static int cmd_noop(struct client *client)
{
client_send_tagline(client, "OK NOOP completed.");
return TRUE;
}
-static int cmd_logout(Client *client)
+static int cmd_logout(struct client *client)
{
client_send_line(client, "* BYE Logging out");
client_send_tagline(client, "OK Logout completed.");
@@ -118,7 +118,7 @@
return TRUE;
}
-int client_read(Client *client)
+int client_read(struct client *client)
{
switch (i_stream_read(client->input)) {
case -2:
@@ -172,7 +172,7 @@
return start;
}
-static int client_command_execute(Client *client, char *line)
+static int client_command_execute(struct client *client, char *line)
{
char *cmd;
int ret;
@@ -205,9 +205,9 @@
}
void client_input(void *context, int fd __attr_unused__,
- IO io __attr_unused__)
+ struct io *io __attr_unused__)
{
- Client *client = context;
+ struct client *client = context;
char *line;
client->last_input = ioloop_time;
@@ -242,18 +242,18 @@
static void client_hash_destroy_oldest(void *key, void *value __attr_unused__,
void *context)
{
- Client *client = key;
- Buffer *destroy_buf = context;
- Client *const *destroy_clients;
+ struct client *client = key;
+ struct client *const *destroy_clients;
+ buffer_t *destroy_buf = context;
size_t i, count;
destroy_clients = buffer_get_data(destroy_buf, &count);
- count /= sizeof(Client *);
+ count /= sizeof(struct client *);
for (i = 0; i < count; i++) {
if (destroy_clients[i]->created > client->created) {
- buffer_insert(destroy_buf, i * sizeof(Client *),
- &client, sizeof(client));
+ buffer_insert(destroy_buf, i * sizeof(struct client *),
+ &client, sizeof(struct client *));
break;
}
}
@@ -261,19 +261,19 @@
static void client_destroy_oldest(void)
{
- Buffer *destroy_buf;
- Client *const *destroy_clients;
+ struct client *const *destroy_clients;
+ buffer_t *destroy_buf;
size_t i, count;
/* find the oldest clients and put them to destroy-buffer */
destroy_buf = buffer_create_static_hard(data_stack_pool,
- sizeof(Client *) *
+ sizeof(struct client *) *
CLIENT_DESTROY_OLDEST_COUNT);
hash_foreach(clients, client_hash_destroy_oldest, destroy_buf);
/* then kill them */
destroy_clients = buffer_get_data(destroy_buf, &count);
- count /= sizeof(Client *);
+ count /= sizeof(struct client *);
for (i = 0; i < count; i++) {
client_destroy(destroy_clients[i],
@@ -281,9 +281,9 @@
}
}
-Client *client_create(int fd, IPADDR *ip, int imaps)
+struct client *client_create(int fd, struct ip_addr *ip, int imaps)
{
- Client *client;
+ struct client *client;
if (max_logging_users > CLIENT_DESTROY_OLDEST_COUNT &&
hash_size(clients) >= max_logging_users) {
@@ -295,12 +295,12 @@
/* always use nonblocking I/O */
net_set_nonblock(fd, TRUE);
- client = i_new(Client, 1);
+ client = i_new(struct client, 1);
client->created = ioloop_time;
client->refcount = 1;
client->tls = imaps;
- memcpy(&client->ip, ip, sizeof(IPADDR));
+ memcpy(&client->ip, ip, sizeof(struct ip_addr));
client->fd = fd;
client->io = io_add(fd, IO_READ, client_input, client);
client->input = i_stream_create_file(fd, default_pool, 8192, FALSE);
@@ -317,7 +317,7 @@
return client;
}
-void client_destroy(Client *client, const char *reason)
+void client_destroy(struct client *client, const char *reason)
{
if (reason != NULL)
client_syslog(client, reason);
@@ -338,12 +338,12 @@
client_unref(client);
}
-void client_ref(Client *client)
+void client_ref(struct client *client)
{
client->refcount++;
}
-int client_unref(Client *client)
+int client_unref(struct client *client)
{
if (--client->refcount > 0)
return TRUE;
@@ -359,18 +359,18 @@
return FALSE;
}
-void client_send_line(Client *client, const char *line)
+void client_send_line(struct client *client, const char *line)
{
o_stream_send_str(client->output, line);
o_stream_send(client->output, "\r\n", 2);
}
-void client_send_tagline(Client *client, const char *line)
+void client_send_tagline(struct client *client, const char *line)
{
client_send_line(client, t_strconcat(client->tag, " ", line, NULL));
}
-void client_syslog(Client *client, const char *text)
+void client_syslog(struct client *client, const char *text)
{
const char *host;
@@ -384,7 +384,7 @@
static void client_hash_check_idle(void *key, void *value __attr_unused__,
void *context __attr_unused__)
{
- Client *client = key;
+ struct client *client = key;
if (ioloop_time - client->last_input >= CLIENT_LOGIN_IDLE_TIMEOUT) {
client_send_line(client, "* BYE Disconnected for inactivity.");
@@ -393,7 +393,7 @@
}
static void idle_timeout(void *context __attr_unused__,
- Timeout timeout __attr_unused__)
+ struct timeout *timeout __attr_unused__)
{
hash_foreach(clients, client_hash_check_idle, NULL);
}
Index: client.h
===================================================================
RCS file: /home/cvs/dovecot/src/login/client.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- client.h 8 Dec 2002 05:23:08 -0000 1.8
+++ client.h 5 Jan 2003 13:09:53 -0000 1.9
@@ -3,37 +3,37 @@
#include "network.h"
-struct _Client {
+struct client {
time_t created;
int refcount;
- IPADDR ip;
+ struct ip_addr ip;
int fd;
- IO io;
- IStream *input;
- OStream *output;
+ struct io *io;
+ struct istream *input;
+ struct ostream *output;
time_t last_input;
char *tag;
- Buffer *plain_login;
- AuthRequest *auth_request;
+ buffer_t *plain_login;
+ struct auth_request *auth_request;
unsigned int tls:1;
};
-Client *client_create(int fd, IPADDR *ip, int imaps);
-void client_destroy(Client *client, const char *reason);
+struct client *client_create(int fd, struct ip_addr *ip, int imaps);
+void client_destroy(struct client *client, const char *reason);
-void client_ref(Client *client);
-int client_unref(Client *client);
+void client_ref(struct client *client);
+int client_unref(struct client *client);
-void client_send_line(Client *client, const char *line);
-void client_send_tagline(Client *client, const char *line);
-void client_syslog(Client *client, const char *text);
+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(Client *client);
-void client_input(void *context, int fd, IO io);
+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);
Index: main.c
===================================================================
RCS file: /home/cvs/dovecot/src/login/main.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- main.c 20 Dec 2002 01:47:11 -0000 1.13
+++ main.c 5 Jan 2003 13:09:53 -0000 1.14
@@ -19,8 +19,8 @@
unsigned int max_logging_users;
unsigned int login_process_uid;
-static IOLoop ioloop;
-static IO io_imap, io_imaps;
+static struct ioloop *ioloop;
+static struct io *io_imap, *io_imaps;
static int main_refcount;
static int closing_down;
@@ -72,9 +72,9 @@
}
static void login_accept(void *context __attr_unused__, int listen_fd,
- IO io __attr_unused__)
+ struct io *io __attr_unused__)
{
- IPADDR ip;
+ struct ip_addr ip;
int fd;
fd = net_accept(listen_fd, &ip, NULL);
@@ -91,10 +91,10 @@
}
static void login_accept_ssl(void *context __attr_unused__, int listen_fd,
- IO io __attr_unused__)
+ struct io *io __attr_unused__)
{
- Client *client;
- IPADDR addr;
+ struct client *client;
+ struct ip_addr addr;
int fd, fd_ssl;
fd = net_accept(listen_fd, &addr, NULL);
Index: master.c
===================================================================
RCS file: /home/cvs/dovecot/src/login/master.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- master.c 19 Dec 2002 23:56:24 -0000 1.9
+++ master.c 5 Jan 2003 13:09:53 -0000 1.10
@@ -9,28 +9,26 @@
#include <unistd.h>
-typedef struct _WaitingRequest WaitingRequest;
-
-struct _WaitingRequest {
- WaitingRequest *next;
+struct waiting_request {
+ struct waiting_request *next;
unsigned int id;
MasterCallback callback;
void *context;
};
-static IO io_master;
-static WaitingRequest *requests, **next_request;
+static struct io *io_master;
+static struct waiting_request *requests, **next_request;
static unsigned int master_pos;
-static char master_buf[sizeof(MasterReply)];
+static char master_buf[sizeof(struct master_reply)];
static void push_request(unsigned int id, MasterCallback callback,
void *context)
{
- WaitingRequest *req;
+ struct waiting_request *req;
- req = i_new(WaitingRequest, 1);
+ req = i_new(struct waiting_request, 1);
req->id = id;
req->callback = callback;
req->context = context;
@@ -39,9 +37,9 @@
next_request = &req->next;
}
-static void pop_request(MasterReply *reply)
+static void pop_request(struct master_reply *reply)
{
- WaitingRequest *req;
+ struct waiting_request *req;
req = requests;
if (req == NULL) {
@@ -66,17 +64,18 @@
void master_request_imap(int fd, unsigned int auth_process,
const char *login_tag,
- unsigned char cookie[AUTH_COOKIE_SIZE], IPADDR *ip,
+ unsigned char cookie[AUTH_COOKIE_SIZE],
+ struct ip_addr *ip,
MasterCallback callback, void *context)
{
- MasterRequest req;
+ struct master_request req;
i_assert(fd > 1);
memset(&req, 0, sizeof(req));
req.id = fd;
req.auth_process = auth_process;
- memcpy(&req.ip, ip, sizeof(IPADDR));
+ memcpy(&req.ip, ip, sizeof(struct ip_addr));
memcpy(req.cookie, cookie, AUTH_COOKIE_SIZE);
if (strocpy(req.login_tag, login_tag, sizeof(req.login_tag)) < 0)
@@ -91,7 +90,7 @@
void master_notify_finished(void)
{
- MasterRequest req;
+ struct master_request req;
if (io_master == NULL)
return;
@@ -122,7 +121,7 @@
}
static void master_input(void *context __attr_unused__, int fd,
- IO io __attr_unused__)
+ struct io *io __attr_unused__)
{
int ret;
@@ -139,7 +138,7 @@
return;
/* reply is now read */
- pop_request((MasterReply *) master_buf);
+ pop_request((struct master_reply *) master_buf);
master_pos = 0;
}
@@ -156,7 +155,7 @@
void master_deinit(void)
{
- WaitingRequest *next;
+ struct waiting_request *next;
while (requests != NULL) {
next = requests->next;
Index: master.h
===================================================================
RCS file: /home/cvs/dovecot/src/login/master.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- master.h 19 Dec 2002 23:56:24 -0000 1.5
+++ master.h 5 Jan 2003 13:09:53 -0000 1.6
@@ -3,12 +3,13 @@
#include "../master/master-interface.h"
-typedef void (*MasterCallback)(MasterReplyResult result, void *context);
+typedef void (*MasterCallback)(enum master_reply_result result, void *context);
/* Request IMAP process for given cookie. */
void master_request_imap(int fd, unsigned int auth_process,
const char *login_tag,
- unsigned char cookie[AUTH_COOKIE_SIZE], IPADDR *ip,
+ unsigned char cookie[AUTH_COOKIE_SIZE],
+ struct ip_addr *ip,
MasterCallback callback, void *context);
/* Notify master that we're not listening for new connections anymore. */
Index: ssl-proxy-gnutls.c
===================================================================
RCS file: /home/cvs/dovecot/src/login/ssl-proxy-gnutls.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ssl-proxy-gnutls.c 4 Jan 2003 17:26:30 -0000 1.3
+++ ssl-proxy-gnutls.c 5 Jan 2003 13:09:53 -0000 1.4
@@ -14,19 +14,19 @@
#include <gcrypt.h>
#include <gnutls/gnutls.h>
-typedef struct {
+struct ssl_proxy {
int refcount;
gnutls_session session;
int fd_ssl, fd_plain;
- IO io_ssl, io_plain;
+ struct io *io_ssl, *io_plain;
int io_ssl_dir;
unsigned char outbuf_plain[1024];
unsigned int outbuf_pos_plain;
size_t send_left_ssl, send_left_plain;
-} SSLProxy;
+};
const int protocol_priority[] =
{ GNUTLS_TLS1, GNUTLS_SSL3, 0 };
@@ -46,16 +46,16 @@
static gnutls_dh_params dh_params;
static gnutls_rsa_params rsa_params;
-static void ssl_input(void *context, int handle, IO io);
-static void plain_input(void *context, int handle, IO io);
-static int ssl_proxy_destroy(SSLProxy *proxy);
+static void ssl_input(void *context, int handle, struct io *io);
+static void plain_input(void *context, int handle, struct io *io);
+static int ssl_proxy_destroy(struct ssl_proxy *proxy);
-static const char *get_alert_text(SSLProxy *proxy)
+static const char *get_alert_text(struct ssl_proxy *proxy)
{
return gnutls_alert_get_name(gnutls_alert_get(proxy->session));
}
-static int handle_ssl_error(SSLProxy *proxy, int error)
+static int handle_ssl_error(struct ssl_proxy *proxy, int error)
{
if (!gnutls_error_is_fatal(error)) {
if (error == GNUTLS_E_WARNING_ALERT_RECEIVED) {
@@ -79,7 +79,7 @@
return -1;
}
-static int proxy_recv_ssl(SSLProxy *proxy, void *data, size_t size)
+static int proxy_recv_ssl(struct ssl_proxy *proxy, void *data, size_t size)
{
int rcvd;
@@ -98,7 +98,8 @@
return handle_ssl_error(proxy, rcvd);
}
-static int proxy_send_ssl(SSLProxy *proxy, const void *data, size_t size)
+static int proxy_send_ssl(struct ssl_proxy *proxy,
+ const void *data, size_t size)
{
int sent;
@@ -107,7 +108,8 @@
return sent;
if (sent == GNUTLS_E_PUSH_ERROR || sent == GNUTLS_E_INVALID_SESSION) {
- /* don't warn about errors related to unexpected disconnection */
+ /* don't warn about errors related to unexpected
+ disconnection */
ssl_proxy_destroy(proxy);
return -1;
}
@@ -115,7 +117,7 @@
return handle_ssl_error(proxy, sent);
}
-static int ssl_proxy_destroy(SSLProxy *proxy)
+static int ssl_proxy_destroy(struct ssl_proxy *proxy)
{
if (--proxy->refcount > 0)
return TRUE;
@@ -137,9 +139,9 @@
}
static void ssl_output(void *context, int fd __attr_unused__,
- IO io __attr_unused__)
+ struct io *io __attr_unused__)
{
- SSLProxy *proxy = context;
+ struct ssl_proxy *proxy = context;
int sent;
sent = net_transmit(proxy->fd_plain,
@@ -163,9 +165,9 @@
}
static void ssl_input(void *context, int fd __attr_unused__,
- IO io __attr_unused__)
+ struct io *io __attr_unused__)
{
- SSLProxy *proxy = context;
+ struct ssl_proxy *proxy = context;
int rcvd, sent;
rcvd = proxy_recv_ssl(proxy, proxy->outbuf_plain,
@@ -193,9 +195,9 @@
}
static void plain_output(void *context, int fd __attr_unused__,
- IO io __attr_unused__)
+ struct io *io __attr_unused__)
{
- SSLProxy *proxy = context;
+ struct ssl_proxy *proxy = context;
int sent;
sent = proxy_send_ssl(proxy, NULL, proxy->send_left_ssl);
@@ -212,9 +214,9 @@
}
static void plain_input(void *context, int fd __attr_unused__,
- IO io __attr_unused__)
+ struct io *io __attr_unused__)
{
- SSLProxy *proxy = context;
+ struct ssl_proxy *proxy = context;
char buf[1024];
ssize_t rcvd, sent;
@@ -239,9 +241,9 @@
}
static void ssl_handshake(void *context, int fd __attr_unused__,
- IO io __attr_unused__)
+ struct io *io __attr_unused__)
{
- SSLProxy *proxy = context;
+ struct ssl_proxy *proxy = context;
int ret, dir;
ret = gnutls_handshake(proxy->session);
@@ -291,7 +293,7 @@
int ssl_proxy_new(int fd)
{
- SSLProxy *proxy;
+ struct ssl_proxy *proxy;
gnutls_session session;
int sfd[2];
@@ -310,7 +312,7 @@
net_set_nonblock(sfd[0], TRUE);
net_set_nonblock(sfd[1], TRUE);
- proxy = i_new(SSLProxy, 1);
+ proxy = i_new(struct ssl_proxy, 1);
proxy->refcount = 1;
proxy->session = session;
proxy->fd_ssl = fd;
Index: ssl-proxy-openssl.c
===================================================================
RCS file: /home/cvs/dovecot/src/login/ssl-proxy-openssl.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ssl-proxy-openssl.c 18 Dec 2002 15:15:42 -0000 1.7
+++ ssl-proxy-openssl.c 5 Jan 2003 13:09:53 -0000 1.8
@@ -13,17 +13,17 @@
#include <openssl/ssl.h>
#include <openssl/err.h>
-typedef enum {
+enum ssl_state {
SSL_STATE_HANDSHAKE,
SSL_STATE_READ,
SSL_STATE_WRITE
-} SSLState;
+};
-typedef struct {
+struct ssl_proxy {
int refcount;
SSL *ssl;
- SSLState state;
+ enum ssl_state state;
int fd_ssl, fd_plain;
IO io_ssl, io_plain_read, io_plain_write;
@@ -34,17 +34,17 @@
unsigned char sslout_buf[1024];
unsigned int sslout_pos, sslout_size;
-} SSLProxy;
+};
static SSL_CTX *ssl_ctx;
-static void plain_read(SSLProxy *proxy);
-static void plain_write(SSLProxy *proxy);
+static void plain_read(struct ssl_proxy *proxy);
+static void plain_write(struct ssl_proxy *proxy);
-static int ssl_proxy_destroy(SSLProxy *proxy);
-static void ssl_set_direction(SSLProxy *proxy, int dir);
+static int ssl_proxy_destroy(struct ssl_proxy *proxy);
+static void ssl_set_direction(struct ssl_proxy *proxy, int dir);
-static void plain_block_input(SSLProxy *proxy, int block)
+static void plain_block_input(struct ssl_proxy *proxy, int block)
{
if (block) {
if (proxy->io_plain_read != NULL) {
@@ -60,7 +60,7 @@
}
}
-static void ssl_block(SSLProxy *proxy, int block)
+static void ssl_block(struct ssl_proxy *proxy, int block)
{
i_assert(proxy->state == SSL_STATE_READ);
@@ -77,7 +77,7 @@
}
}
-static void plain_read(SSLProxy *proxy)
+static void plain_read(struct ssl_proxy *proxy)
{
ssize_t ret;
@@ -98,7 +98,7 @@
}
}
-static void plain_write(SSLProxy *proxy)
+static void plain_write(struct ssl_proxy *proxy)
{
ssize_t ret;
@@ -147,7 +147,7 @@
return buf;
}
-static void ssl_handle_error(SSLProxy *proxy, int err, const char *func)
+static void ssl_handle_error(struct ssl_proxy *proxy, int err, const char *func)
{
err = SSL_get_error(proxy->ssl, err);
@@ -179,7 +179,7 @@
}
}
-static void ssl_handshake_step(SSLProxy *proxy)
+static void ssl_handshake_step(struct ssl_proxy *proxy)
{
int ret;
@@ -194,7 +194,7 @@
}
}
-static void ssl_read_step(SSLProxy *proxy)
+static void ssl_read_step(struct ssl_proxy *proxy)
{
int ret;
@@ -215,7 +215,7 @@
}
}
-static void ssl_write_step(SSLProxy *proxy)
+static void ssl_write_step(struct ssl_proxy *proxy)
{
int ret;
@@ -244,7 +244,7 @@
static void ssl_step(void *context, int fd __attr_unused__,
IO io __attr_unused__)
{
- SSLProxy *proxy = context;
+ struct ssl_proxy *proxy = context;
switch (proxy->state) {
case SSL_STATE_HANDSHAKE:
@@ -259,7 +259,7 @@
}
}
-static void ssl_set_direction(SSLProxy *proxy, int dir)
+static void ssl_set_direction(struct ssl_proxy *proxy, int dir)
{
i_assert(proxy->io_ssl_dir != -2);
@@ -273,7 +273,7 @@
int ssl_proxy_new(int fd)
{
- SSLProxy *proxy;
+ struct ssl_proxy *proxy;
SSL *ssl;
int sfd[2];
@@ -301,7 +301,7 @@
net_set_nonblock(sfd[0], TRUE);
net_set_nonblock(sfd[1], TRUE);
- proxy = i_new(SSLProxy, 1);
+ proxy = i_new(struct ssl_proxy, 1);
proxy->refcount = 1;
proxy->ssl = ssl;
proxy->fd_ssl = fd;
@@ -319,7 +319,7 @@
return sfd[1];
}
-static int ssl_proxy_destroy(SSLProxy *proxy)
+static int ssl_proxy_destroy(struct ssl_proxy *proxy)
{
if (--proxy->refcount > 0)
return TRUE;
- Previous message: [dovecot-cvs] dovecot/src/master auth-process.c,1.21,1.22 auth-process.h,1.5,1.6 common.h,1.8,1.9 imap-process.c,1.22,1.23 login-process.c,1.24,1.25 main.c,1.23,1.24 master-interface.h,1.3,1.4 settings.c,1.39,1.40 settings.h,1.20,1.21 ssl-init.c,1.6,1.7
- Next message: [dovecot-cvs] dovecot/src/lib-index mail-custom-flags.c,1.16,1.17 mail-custom-flags.h,1.5,1.6 mail-index-compress.c,1.22,1.23 mail-index-data.c,1.32,1.33 mail-index-data.h,1.12,1.13 mail-index-fsck.c,1.11,1.12 mail-index-open.c,1.22,1.23 Message-Id: <20030105130956.04620238E1@danu.procontrol.fi>
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list