[dovecot-cvs] dovecot/src/login auth-connection.c,1.12,1.13 client-authenticate.c,1.18,1.19 client.c,1.15,1.16 client.h,1.6,1.7

cras at procontrol.fi cras at procontrol.fi
Fri Dec 6 03:09:25 EET 2002


Update of /home/cvs/dovecot/src/login
In directory danu:/tmp/cvs-serv6082/login

Modified Files:
	auth-connection.c client-authenticate.c client.c client.h 
Log Message:
Renamed IBuffer and OBuffer to IStream and OStream which describes their
functionality better. I tried to keep the variable names and comments also
sensible.



Index: auth-connection.c
===================================================================
RCS file: /home/cvs/dovecot/src/login/auth-connection.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- auth-connection.c	28 Oct 2002 04:18:26 -0000	1.12
+++ auth-connection.c	6 Dec 2002 01:09:23 -0000	1.13
@@ -4,8 +4,8 @@
 #include "hash.h"
 #include "ioloop.h"
 #include "network.h"
-#include "ibuffer.h"
-#include "obuffer.h"
+#include "istream.h"
+#include "ostream.h"
 #include "auth-connection.h"
 
 #include <unistd.h>
@@ -22,8 +22,8 @@
 	char *path;
 	int fd;
 	IO io;
-	IBuffer *inbuf;
-	OBuffer *outbuf;
+	IStream *input;
+	OStream *output;
 
 	int auth_process;
 	AuthMethod available_auth_methods;
@@ -73,9 +73,9 @@
 	conn->path = i_strdup(path);
 	conn->fd = fd;
 	conn->io = io_add(fd, IO_READ, auth_input, conn);
-	conn->inbuf = i_buffer_create_file(fd, default_pool, MAX_INBUF_SIZE,
+	conn->input = i_stream_create_file(fd, default_pool, MAX_INBUF_SIZE,
 					   FALSE);
-	conn->outbuf = o_buffer_create_file(fd, default_pool, MAX_OUTBUF_SIZE,
+	conn->output = o_stream_create_file(fd, default_pool, MAX_OUTBUF_SIZE,
 					    IO_PRIORITY_DEFAULT, FALSE);
 	conn->requests = hash_create(default_pool, 100, NULL, NULL);
 
@@ -121,8 +121,8 @@
 
 	(void)close(conn->fd);
 	io_remove(conn->io);
-	i_buffer_unref(conn->inbuf);
-	o_buffer_unref(conn->outbuf);
+	i_stream_unref(conn->input);
+	o_stream_unref(conn->output);
 	i_free(conn->path);
 	i_free(conn);
 }
@@ -136,7 +136,7 @@
 	found = FALSE;
 	for (conn = auth_connections; conn != NULL; conn = conn->next) {
 		if ((conn->available_auth_methods & method)) {
-			if (o_buffer_have_space(conn->outbuf, size) > 0)
+			if (o_stream_have_space(conn->output, size) > 0)
 				return conn;
 
 			found = TRUE;
@@ -210,7 +210,7 @@
 	const unsigned char *data;
 	size_t size;
 
-	switch (i_buffer_read(conn->inbuf)) {
+	switch (i_stream_read(conn->input)) {
 	case 0:
 		return;
 	case -1:
@@ -226,12 +226,12 @@
 		return;
 	}
 
-	data = i_buffer_get_data(conn->inbuf, &size);
+	data = i_stream_get_data(conn->input, &size);
 
 	if (!conn->init_received) {
 		if (size == sizeof(AuthInitData)) {
 			memcpy(&init_data, data, sizeof(AuthInitData));
-			i_buffer_skip(conn->inbuf, sizeof(AuthInitData));
+			i_stream_skip(conn->input, sizeof(AuthInitData));
 
 			auth_handle_init(conn, &init_data);
 		} else if (size > sizeof(AuthInitData)) {
@@ -245,14 +245,14 @@
 	}
 
 	if (!conn->in_reply_received) {
-		data = i_buffer_get_data(conn->inbuf, &size);
+		data = i_stream_get_data(conn->input, &size);
 		if (size < sizeof(AuthReplyData))
 			return;
 
 		memcpy(&conn->in_reply, data, sizeof(AuthReplyData));
 		data += sizeof(AuthReplyData);
 		size -= sizeof(AuthReplyData);
-		i_buffer_skip(conn->inbuf, sizeof(AuthReplyData));
+		i_stream_skip(conn->input, sizeof(AuthReplyData));
 		conn->in_reply_received = TRUE;
 	}
 
@@ -262,7 +262,7 @@
 	/* we've got a full reply */
 	conn->in_reply_received = FALSE;
 	auth_handle_reply(conn, &conn->in_reply, data);
-	i_buffer_skip(conn->inbuf, conn->in_reply.data_size);
+	i_stream_skip(conn->input, conn->in_reply.data_size);
 }
 
 int auth_init_request(AuthMethod method, AuthCallback callback,
@@ -293,7 +293,7 @@
 	request_data.type = AUTH_REQUEST_INIT;
 	request_data.method = request->method;
 	request_data.id = request->id;
-	if (o_buffer_send(request->conn->outbuf, &request_data,
+	if (o_stream_send(request->conn->output, &request_data,
 			  sizeof(request_data)) < 0)
 		auth_connection_destroy(request->conn);
 	return TRUE;
@@ -310,10 +310,10 @@
 	request_data.id = request->id;
 	request_data.data_size = data_size;
 
-	if (o_buffer_send(request->conn->outbuf, &request_data,
+	if (o_stream_send(request->conn->output, &request_data,
 			  sizeof(request_data)) < 0)
 		auth_connection_destroy(request->conn);
-	else if (o_buffer_send(request->conn->outbuf, data, data_size) < 0)
+	else if (o_stream_send(request->conn->output, data, data_size) < 0)
 		auth_connection_destroy(request->conn);
 }
 

Index: client-authenticate.c
===================================================================
RCS file: /home/cvs/dovecot/src/login/client-authenticate.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- client-authenticate.c	26 Nov 2002 10:14:29 -0000	1.18
+++ client-authenticate.c	6 Dec 2002 01:09:23 -0000	1.19
@@ -3,8 +3,8 @@
 #include "common.h"
 #include "base64.h"
 #include "ioloop.h"
-#include "ibuffer.h"
-#include "obuffer.h"
+#include "istream.h"
+#include "ostream.h"
 #include "temp-string.h"
 #include "auth-connection.h"
 #include "client.h"
@@ -73,7 +73,7 @@
 
 	client_send_tagline(client, msg != NULL ? msg :
 			    "NO Authentication failed.");
-	o_buffer_flush(client->outbuf);
+	o_stream_flush(client->output);
 
 	/* get back to normal client input */
 	if (client->io != NULL)
@@ -110,11 +110,11 @@
 	t_push();
 
 	base64_data = base64_encode(data, size);
-	o_buffer_send(client->outbuf, "+ ", 2);
-	o_buffer_send(client->outbuf, base64_data, strlen(base64_data));
-	o_buffer_send(client->outbuf, "\r\n", 2);
+	o_stream_send(client->output, "+ ", 2);
+	o_stream_send(client->output, base64_data, strlen(base64_data));
+	o_stream_send(client->output, "\r\n", 2);
 
-	o_buffer_flush(client->outbuf);
+	o_stream_flush(client->output);
 
 	t_pop();
 }
@@ -244,7 +244,7 @@
 	if (!client_read(client))
 		return;
 
-	line = i_buffer_next_line(client->inbuf);
+	line = i_stream_next_line(client->input);
 	if (line == NULL)
 		return;
 

Index: client.c
===================================================================
RCS file: /home/cvs/dovecot/src/login/client.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- client.c	3 Dec 2002 00:13:17 -0000	1.15
+++ client.c	6 Dec 2002 01:09:23 -0000	1.16
@@ -3,8 +3,8 @@
 #include "common.h"
 #include "hash.h"
 #include "ioloop.h"
-#include "ibuffer.h"
-#include "obuffer.h"
+#include "istream.h"
+#include "ostream.h"
 #include "process-title.h"
 #include "client.h"
 #include "client-authenticate.h"
@@ -66,7 +66,7 @@
 	}
 
 	client_send_tagline(client, "OK Begin TLS negotiation now.");
-	o_buffer_flush(client->outbuf);
+	o_stream_flush(client->output);
 
 	/* must be removed before ssl_proxy_new(), since it may
 	   io_add() the same fd. */
@@ -82,12 +82,12 @@
 
 		client->fd = fd_ssl;
 
-		i_buffer_unref(client->inbuf);
-		o_buffer_unref(client->outbuf);
+		i_stream_unref(client->input);
+		o_stream_unref(client->output);
 
-		client->inbuf = i_buffer_create_file(fd_ssl, default_pool,
+		client->input = i_stream_create_file(fd_ssl, default_pool,
 						     8192, FALSE);
-		client->outbuf = o_buffer_create_file(fd_ssl, default_pool,
+		client->output = o_stream_create_file(fd_ssl, default_pool,
 						      1024, IO_PRIORITY_DEFAULT,
 						      FALSE);
 	} else {
@@ -115,7 +115,7 @@
 
 int client_read(Client *client)
 {
-	switch (i_buffer_read(client->inbuf)) {
+	switch (i_stream_read(client->input)) {
 	case -2:
 		/* buffer full */
 		client_send_line(client, "* BYE Input buffer full, aborting");
@@ -211,9 +211,9 @@
 		return;
 
 	client_ref(client);
-	o_buffer_cork(client->outbuf);
+	o_stream_cork(client->output);
 
-	while ((line = i_buffer_next_line(client->inbuf)) != NULL) {
+	while ((line = i_stream_next_line(client->input)) != NULL) {
 		/* split the arguments, make sure we have at
 		   least tag + command */
 		i_free(client->tag);
@@ -228,7 +228,7 @@
 	}
 
 	if (client_unref(client))
-		o_buffer_flush(client->outbuf);
+		o_stream_flush(client->output);
 }
 
 static void client_hash_destroy_oldest(void *key, void *value __attr_unused__,
@@ -286,8 +286,8 @@
 	memcpy(&client->ip, ip, sizeof(IPADDR));
 	client->fd = fd;
 	client->io = io_add(fd, IO_READ, client_input, client);
-	client->inbuf = i_buffer_create_file(fd, default_pool, 8192, FALSE);
-	client->outbuf = o_buffer_create_file(fd, default_pool, 1024,
+	client->input = i_stream_create_file(fd, default_pool, 8192, FALSE);
+	client->output = o_stream_create_file(fd, default_pool, 1024,
 					      IO_PRIORITY_DEFAULT, FALSE);
         client->last_input = ioloop_time;
 	hash_insert(clients, client, client);
@@ -306,8 +306,8 @@
 
 	hash_remove(clients, client);
 
-	i_buffer_close(client->inbuf);
-	o_buffer_close(client->outbuf);
+	i_stream_close(client->input);
+	o_stream_close(client->output);
 
 	if (client->io != NULL) {
 		io_remove(client->io);
@@ -330,8 +330,8 @@
 	if (--client->refcount > 0)
 		return TRUE;
 
-	i_buffer_unref(client->inbuf);
-	o_buffer_unref(client->outbuf);
+	i_stream_unref(client->input);
+	o_stream_unref(client->output);
 
 	i_free(client->tag);
 	i_free(client->plain_login);
@@ -343,8 +343,8 @@
 
 void client_send_line(Client *client, const char *line)
 {
-	o_buffer_send(client->outbuf, line, strlen(line));
-	o_buffer_send(client->outbuf, "\r\n", 2);
+	o_stream_send(client->output, line, strlen(line));
+	o_stream_send(client->output, "\r\n", 2);
 }
 
 void client_send_tagline(Client *client, const char *line)

Index: client.h
===================================================================
RCS file: /home/cvs/dovecot/src/login/client.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- client.h	3 Dec 2002 00:13:17 -0000	1.6
+++ client.h	6 Dec 2002 01:09:23 -0000	1.7
@@ -10,8 +10,8 @@
 
 	int fd;
 	IO io;
-	IBuffer *inbuf;
-	OBuffer *outbuf;
+	IStream *input;
+	OStream *output;
 
 	time_t last_input;
 	char *tag;




More information about the dovecot-cvs mailing list