[dovecot-cvs] dovecot/src/login-common login-proxy.c, 1.13, 1.14 ssl-proxy-gnutls.c, 1.13, 1.14 ssl-proxy-openssl.c, 1.51, 1.52

tss at dovecot.org tss at dovecot.org
Fri Dec 15 18:38:25 UTC 2006


Update of /var/lib/cvs/dovecot/src/login-common
In directory talvi:/tmp/cvs-serv3614/login-common

Modified Files:
	login-proxy.c ssl-proxy-gnutls.c ssl-proxy-openssl.c 
Log Message:
Replaced void *context from a lot of callbacks with the actual context
type. Also added/fixed some context type checks.



Index: login-proxy.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/login-common/login-proxy.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- login-proxy.c	15 Dec 2006 16:55:48 -0000	1.13
+++ login-proxy.c	15 Dec 2006 18:38:23 -0000	1.14
@@ -29,9 +29,8 @@
 
 static struct hash_table *login_proxies;
 
-static void server_input(void *context)
+static void server_input(struct login_proxy *proxy)
 {
-	struct login_proxy *proxy = context;
 	unsigned char buf[OUTBUF_THRESHOLD];
 	ssize_t ret;
 
@@ -48,9 +47,8 @@
                 login_proxy_free(proxy);
 }
 
-static void proxy_client_input(void *context)
+static void proxy_client_input(struct login_proxy *proxy)
 {
-	struct login_proxy *proxy = context;
 	unsigned char buf[OUTBUF_THRESHOLD];
 	ssize_t ret;
 
@@ -67,10 +65,8 @@
                 login_proxy_free(proxy);
 }
 
-static int server_output(void *context)
+static int server_output(struct login_proxy *proxy)
 {
-	struct login_proxy *proxy = context;
-
 	if (o_stream_flush(proxy->server_output) < 0) {
                 login_proxy_free(proxy);
 		return 1;
@@ -87,10 +83,8 @@
 	return 1;
 }
 
-static int proxy_client_output(void *context)
+static int proxy_client_output(struct login_proxy *proxy)
 {
-	struct login_proxy *proxy = context;
-
 	if (o_stream_flush(proxy->client_output) < 0) {
                 login_proxy_free(proxy);
 		return 1;
@@ -107,17 +101,14 @@
 	return 1;
 }
 
-static void proxy_prelogin_input(void *context)
+static void proxy_prelogin_input(struct login_proxy *proxy)
 {
-	struct login_proxy *proxy = context;
-
 	proxy->callback(proxy->server_input, proxy->server_output,
 			proxy->context);
 }
 
-static void proxy_wait_connect(void *context)
+static void proxy_wait_connect(struct login_proxy *proxy)
 {
-	struct login_proxy *proxy = context;
 	int err;
 
 	err = net_geterror(proxy->server_fd);

Index: ssl-proxy-gnutls.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/login-common/ssl-proxy-gnutls.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- ssl-proxy-gnutls.c	29 Jan 2006 12:14:49 -0000	1.13
+++ ssl-proxy-gnutls.c	15 Dec 2006 18:38:23 -0000	1.14
@@ -52,8 +52,8 @@
 static gnutls_dh_params dh_params;
 static gnutls_rsa_params rsa_params;
 
-static void ssl_input(void *context);
-static void plain_input(void *context);
+static void ssl_input(struct ssl_proxy *proxy);
+static void plain_input(struct ssl_proxy *proxy);
 static bool ssl_proxy_destroy(struct ssl_proxy *proxy);
 
 static const char *get_alert_text(struct ssl_proxy *proxy)
@@ -158,9 +158,8 @@
 	return FALSE;
 }
 
-static void ssl_output(void *context)
+static void ssl_output(struct ssl_proxy *proxy)
 {
-        struct ssl_proxy *proxy = context;
 	int sent;
 
 	sent = net_transmit(proxy->fd_plain,
@@ -183,9 +182,8 @@
 	proxy->io_ssl = io_add(proxy->fd_ssl, IO_READ, ssl_input, proxy);
 }
 
-static void ssl_input(void *context)
+static void ssl_input(struct ssl_proxy *proxy)
 {
-        struct ssl_proxy *proxy = context;
 	int rcvd, sent;
 
 	rcvd = proxy_recv_ssl(proxy, proxy->outbuf_plain,
@@ -212,9 +210,8 @@
 	proxy->io_ssl = io_add(proxy->fd_ssl, IO_WRITE, ssl_output, proxy);
 }
 
-static void plain_output(void *context)
+static void plain_output(struct ssl_proxy *proxy)
 {
-	struct ssl_proxy *proxy = context;
 	int sent;
 
 	sent = proxy_send_ssl(proxy, NULL, proxy->send_left_ssl);
@@ -230,9 +227,8 @@
 	proxy->io_plain = io_add(proxy->fd_plain, IO_READ, plain_input, proxy);
 }
 
-static void plain_input(void *context)
+static void plain_input(struct ssl_proxy *proxy)
 {
-	struct ssl_proxy *proxy = context;
 	char buf[1024];
 	ssize_t rcvd, sent;
 
@@ -256,9 +252,8 @@
 	proxy->io_plain = io_add(proxy->fd_ssl, IO_WRITE, plain_output, proxy);
 }
 
-static void ssl_handshake(void *context)
+static void ssl_handshake(struct ssl_proxy *proxy)
 {
-	struct ssl_proxy *proxy = context;
 	int ret, dir;
 
         ret = gnutls_handshake(proxy->session);

Index: ssl-proxy-openssl.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/login-common/ssl-proxy-openssl.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- ssl-proxy-openssl.c	18 Nov 2006 20:27:14 -0000	1.51
+++ ssl-proxy-openssl.c	15 Dec 2006 18:38:23 -0000	1.52
@@ -67,10 +67,10 @@
 static struct hash_table *ssl_proxies;
 static struct ssl_parameters ssl_params;
 
-static void plain_read(void *context);
+static void plain_read(struct ssl_proxy *proxy);
 static void ssl_read(struct ssl_proxy *proxy);
 static void ssl_write(struct ssl_proxy *proxy);
-static void ssl_step(void *context);
+static void ssl_step(struct ssl_proxy *proxy);
 static void ssl_proxy_destroy(struct ssl_proxy *proxy);
 static void ssl_proxy_unref(struct ssl_proxy *proxy);
 
@@ -225,9 +225,8 @@
 	}
 }
 
-static void plain_read(void *context)
+static void plain_read(struct ssl_proxy *proxy)
 {
-	struct ssl_proxy *proxy = context;
 	ssize_t ret;
 	bool corked = FALSE;
 
@@ -265,9 +264,8 @@
 	ssl_proxy_unref(proxy);
 }
 
-static void plain_write(void *context)
+static void plain_write(struct ssl_proxy *proxy)
 {
-	struct ssl_proxy *proxy = context;
 	ssize_t ret;
 
 	proxy->refcount++;
@@ -424,10 +422,8 @@
 	}
 }
 
-static void ssl_step(void *context)
+static void ssl_step(struct ssl_proxy *proxy)
 {
-	struct ssl_proxy *proxy = context;
-
 	proxy->refcount++;
 
 	if (!proxy->handshaked)



More information about the dovecot-cvs mailing list