[dovecot-cvs] dovecot/src/auth auth-client-connection.c, 1.44, 1.45 auth-master-connection.c, 1.45, 1.46 auth-master-listener.c, 1.10, 1.11 auth-worker-client.c, 1.28, 1.29 auth-worker-server.c, 1.10, 1.11 db-ldap.c, 1.57, 1.58 db-sql.c, 1.10, 1.11 passdb-checkpassword.c, 1.29, 1.30 passdb-pam.c, 1.44, 1.45 passdb-sql.c, 1.30, 1.31 userdb-sql.c, 1.16, 1.17

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


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

Modified Files:
	auth-client-connection.c auth-master-connection.c 
	auth-master-listener.c auth-worker-client.c 
	auth-worker-server.c db-ldap.c db-sql.c passdb-checkpassword.c 
	passdb-pam.c passdb-sql.c userdb-sql.c 
Log Message:
Replaced void *context from a lot of callbacks with the actual context
type. Also added/fixed some context type checks.



Index: auth-client-connection.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-client-connection.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- auth-client-connection.c	1 Jul 2006 18:40:34 -0000	1.44
+++ auth-client-connection.c	15 Dec 2006 18:38:08 -0000	1.45
@@ -20,7 +20,7 @@
 
 static void auth_client_connection_unref(struct auth_client_connection **_conn);
 
-static void auth_client_input(void *context);
+static void auth_client_input(struct auth_client_connection *conn);
 
 static const char *reply_line_hide_pass(const char *line)
 {
@@ -64,10 +64,9 @@
 	t_pop();
 }
 
-static void auth_callback(const char *reply, void *context)
+static void auth_callback(const char *reply,
+			  struct auth_client_connection *conn)
 {
-	struct auth_client_connection *conn = context;
-
 	if (reply == NULL) {
 		/* handler destroyed */
 		auth_client_connection_unref(&conn);
@@ -121,10 +120,8 @@
 	return TRUE;
 }
 
-static int auth_client_output(void *context)
+static int auth_client_output(struct auth_client_connection *conn)
 {
-	struct auth_client_connection *conn = context;
-
 	if (o_stream_flush(conn->output) < 0) {
 		auth_client_connection_destroy(&conn);
 		return 1;
@@ -191,9 +188,8 @@
 	return TRUE;
 }
 
-static void auth_client_input(void *context)
+static void auth_client_input(struct auth_client_connection *conn)
 {
-	struct auth_client_connection *conn = context;
 	char *line;
 	bool ret;
 
@@ -361,9 +357,8 @@
 	return NULL;
 }
 
-static void request_timeout(void *context)
+static void request_timeout(struct auth_master_listener *listener)
 {
-        struct auth_master_listener *listener = context;
 	struct auth_client_connection *const *clients;
 	unsigned int i, count;
 

Index: auth-master-connection.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-master-connection.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- auth-master-connection.c	9 Dec 2006 15:11:48 -0000	1.45
+++ auth-master-connection.c	15 Dec 2006 18:38:08 -0000	1.46
@@ -28,8 +28,6 @@
 	struct auth_request *auth_request;
 };
 
-static int master_output(void *context);
-
 void auth_master_request_callback(const char *reply, void *context)
 {
 	struct auth_master_connection *conn = context;
@@ -148,9 +146,8 @@
 	return TRUE;
 }
 
-static void master_input(void *context)
+static void master_input(struct auth_master_connection *conn)
 {
-	struct auth_master_connection *conn = context;
  	char *line;
 	bool ret;
 
@@ -208,9 +205,8 @@
 	}
 }
 
-static int master_output(void *context)
+static int master_output(struct auth_master_connection *conn)
 {
-	struct auth_master_connection *conn = context;
 	int ret;
 
 	if ((ret = o_stream_flush(conn->output)) < 0) {

Index: auth-master-listener.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-master-listener.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- auth-master-listener.c	10 Sep 2006 12:48:12 -0000	1.10
+++ auth-master-listener.c	15 Dec 2006 18:38:08 -0000	1.11
@@ -87,9 +87,8 @@
 	i_free(listener);
 }
 
-static void auth_master_listener_accept(void *context)
+static void auth_master_listener_accept(struct auth_master_listener_socket *s)
 {
-	struct auth_master_listener_socket *s = context;
 	struct auth_master_connection *master;
 	int fd;
 

Index: auth-worker-client.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-worker-client.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- auth-worker-client.c	9 Dec 2006 15:11:48 -0000	1.28
+++ auth-worker-client.c	15 Dec 2006 18:38:08 -0000	1.29
@@ -386,9 +386,8 @@
         return TRUE;
 }
 
-static void auth_worker_input(void *context)
+static void auth_worker_input(struct auth_worker_client *client)
 {
-	struct auth_worker_client *client = context;
 	char *line;
 	bool ret;
 
@@ -423,10 +422,8 @@
 	auth_worker_client_unref(&client);
 }
 
-static int auth_worker_output(void *context)
+static int auth_worker_output(struct auth_worker_client *client)
 {
-	struct auth_worker_client *client = context;
-
 	if (o_stream_flush(client->output) < 0) {
 		auth_worker_client_destroy(&client);
 		return 1;
@@ -441,10 +438,8 @@
 	return 1;
 }
 
-static void auth_worker_client_timeout(void *context)
+static void auth_worker_client_timeout(struct auth_worker_client *client)
 {
-	struct auth_worker_client *client = context;
-
 	if (client->last_request + AUTH_WORKER_MAX_IDLE <= ioloop_time)
                 auth_worker_client_destroy(&client);
 }

Index: auth-worker-server.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-worker-server.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- auth-worker-server.c	28 Jun 2006 13:10:25 -0000	1.10
+++ auth-worker-server.c	15 Dec 2006 18:38:08 -0000	1.11
@@ -43,7 +43,7 @@
 static char *worker_socket_path;
 static struct timeout *to;
 
-static void worker_input(void *context);
+static void worker_input(struct auth_worker_connection *conn);
 
 static struct auth_worker_connection *auth_worker_create(void)
 {
@@ -201,9 +201,8 @@
 		idle_count++;
 }
 
-static void worker_input(void *context)
+static void worker_input(struct auth_worker_connection *conn)
 {
-	struct auth_worker_connection *conn = context;
 	struct auth_worker_request *request;
 	const char *line, *id_str;
 	unsigned int id;

Index: db-ldap.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/db-ldap.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- db-ldap.c	15 Dec 2006 16:55:29 -0000	1.57
+++ db-ldap.c	15 Dec 2006 18:38:08 -0000	1.58
@@ -276,9 +276,8 @@
 	}
 }
 
-static void ldap_input(void *context)
+static void ldap_input(struct ldap_connection *conn)
 {
-	struct ldap_connection *conn = context;
         struct ldap_request *request;
 	struct timeval timeout;
 	LDAPMessage *res;
@@ -639,10 +638,8 @@
 }
 
 static const char *parse_setting(const char *key, const char *value,
-				 void *context)
+				 struct ldap_connection *conn)
 {
-	struct ldap_connection *conn = context;
-
 	return parse_setting_from_defs(conn->pool, setting_defs,
 				       &conn->set, key, value);
 }

Index: db-sql.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/db-sql.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- db-sql.c	15 Dec 2006 16:55:29 -0000	1.10
+++ db-sql.c	15 Dec 2006 18:38:08 -0000	1.11
@@ -48,10 +48,8 @@
 }
 
 static const char *parse_setting(const char *key, const char *value,
-				 void *context)
+				 struct sql_connection *conn)
 {
-	struct sql_connection *conn = context;
-
 	return parse_setting_from_defs(conn->pool, setting_defs,
 				       &conn->set, key, value);
 }

Index: passdb-checkpassword.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/passdb-checkpassword.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- passdb-checkpassword.c	18 Nov 2006 22:17:26 -0000	1.29
+++ passdb-checkpassword.c	15 Dec 2006 18:38:08 -0000	1.30
@@ -275,9 +275,8 @@
 	exit(2);
 }
 
-static void checkpassword_child_input(void *context)
+static void checkpassword_child_input(struct chkpw_auth_request *request)
 {
-	struct chkpw_auth_request *request = context;
 	unsigned char buf[1024];
 	ssize_t ret;
 
@@ -302,13 +301,12 @@
 	}
 }
 
-static void checkpassword_child_output(void *context)
+static void checkpassword_child_output(struct chkpw_auth_request *request)
 {
 	/* Send: username \0 password \0 timestamp \0.
 	   Must be 512 bytes or less. The "timestamp" parameter is actually
 	   useful only for APOP authentication. We don't support it, so
 	   keep it empty */
-	struct chkpw_auth_request *request = context;
 	struct auth_request *auth_request = request->request;
 	buffer_t *buf;
 	const unsigned char *data;

Index: passdb-pam.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/passdb-pam.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- passdb-pam.c	3 Dec 2006 16:59:44 -0000	1.44
+++ passdb-pam.c	15 Dec 2006 18:38:08 -0000	1.45
@@ -309,9 +309,8 @@
 	}
 }
 
-static void pam_child_input(void *context)
+static void pam_child_input(struct pam_auth_request *request)
 {
-	struct pam_auth_request *request = context;
 	struct auth_request *auth_request = request->request;
 	enum passdb_result result;
 	char buf[PIPE_BUF + 1];

Index: passdb-sql.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/passdb-sql.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- passdb-sql.c	8 Nov 2006 20:22:08 -0000	1.30
+++ passdb-sql.c	15 Dec 2006 18:38:08 -0000	1.31
@@ -52,9 +52,9 @@
 	}
 }
 
-static void sql_query_callback(struct sql_result *result, void *context)
+static void sql_query_callback(struct sql_result *result,
+			       struct passdb_sql_request *sql_request)
 {
-	struct passdb_sql_request *sql_request = context;
 	struct auth_request *auth_request = sql_request->auth_request;
 	enum passdb_result passdb_result;
 	const char *user, *password, *scheme;
@@ -179,9 +179,9 @@
         sql_lookup_pass(sql_request);
 }
 
-static void sql_set_credentials_callback(const char *error, void *context)
+static void sql_set_credentials_callback(const char *error,
+					 struct passdb_sql_request *sql_request)
 {
-	struct passdb_sql_request *sql_request = context;
 	enum passdb_result result;
 
 	if (error == NULL)

Index: userdb-sql.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/userdb-sql.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- userdb-sql.c	9 Dec 2006 15:11:48 -0000	1.16
+++ userdb-sql.c	15 Dec 2006 18:38:08 -0000	1.17
@@ -78,9 +78,9 @@
 	return reply;
 }
 
-static void sql_query_callback(struct sql_result *sql_result, void *context)
+static void sql_query_callback(struct sql_result *sql_result,
+			       struct userdb_sql_request *sql_request)
 {
-	struct userdb_sql_request *sql_request = context;
 	struct auth_request *auth_request = sql_request->auth_request;
 	struct auth_stream_reply *reply = NULL;
 	enum userdb_result result = USERDB_RESULT_INTERNAL_FAILURE;



More information about the dovecot-cvs mailing list