[dovecot-cvs] dovecot/src/lib-auth auth-client.c, 1.12, 1.13 auth-client.h, 1.14, 1.15 auth-server-connection.c, 1.17, 1.18 auth-server-connection.h, 1.10, 1.11

tss at dovecot.org tss at dovecot.org
Fri Dec 15 17:16:28 UTC 2006


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

Modified Files:
	auth-client.c auth-client.h auth-server-connection.c 
	auth-server-connection.h 
Log Message:
Removed support for external I/O loop. The point was originally that this
library could be used by external software to talk to dovecot-auth, but
nowadays it's much easier to just implement the authentication protocol.



Index: auth-client.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-auth/auth-client.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- auth-client.c	15 Dec 2006 16:55:35 -0000	1.12
+++ auth-client.c	15 Dec 2006 17:16:26 -0000	1.13
@@ -12,24 +12,12 @@
 
 struct auth_client *auth_client_new(unsigned int client_pid)
 {
-	return auth_client_new_external(client_pid, NULL, NULL, NULL);
-}
-
-struct auth_client *auth_client_new_external(unsigned int client_pid,
-					     const char *socket_paths,
-					     input_func_add_t *add_func,
-					     input_func_remove_t *remove_func)
-{
 	struct auth_client *client;
 
 	client = i_new(struct auth_client, 1);
 	client->pid = client_pid;
-	client->socket_paths = i_strdup(socket_paths);
 	client->available_auth_mechs = buffer_create_dynamic(default_pool, 128);
 
-	client->ext_input_add = add_func;
-	client->ext_input_remove = remove_func;
-
 	auth_client_connect_missing_servers(client);
 	return client;
 }
@@ -57,7 +45,6 @@
 
 	if (client->to_reconnect != NULL)
 		timeout_remove(&client->to_reconnect);
-	i_free(client->socket_paths);
 	i_free(client);
 }
 
@@ -153,47 +140,39 @@
 	struct dirent *dp;
 	struct stat st;
 
-	if (client->socket_paths != NULL) {
-		auth_client_connect_missing_servers_list(client,
-							 client->socket_paths);
-	} else {
-		/* we're chrooted */
-		dirp = opendir(".");
-		if (dirp == NULL) {
-			i_fatal("opendir(.) failed when trying to get list of "
-				"authentication servers: %m");
-		}
-
-		client->reconnect = FALSE;
-		while ((dp = readdir(dirp)) != NULL) {
-			const char *name = dp->d_name;
+	/* we're chrooted */
+	dirp = opendir(".");
+	if (dirp == NULL) {
+		i_fatal("opendir(.) failed when trying to get list of "
+			"authentication servers: %m");
+	}
 
-			if (name[0] == '.')
-				continue;
+	client->reconnect = FALSE;
+	while ((dp = readdir(dirp)) != NULL) {
+		const char *name = dp->d_name;
 
-			if (auth_server_connection_find_path(client,
-							     name) != NULL) {
-				/* already connected */
-				continue;
-			}
+		if (name[0] == '.')
+			continue;
 
-			/* Normally they're sockets, but in UnixWare they're
-			   created as fifos. */
-			if (stat(name, &st) == 0 &&
-			    (S_ISSOCK(st.st_mode) || S_ISFIFO(st.st_mode))) {
-				if (auth_server_connection_new(client,
-							       name) == NULL)
-					client->reconnect = TRUE;
-			}
+		if (auth_server_connection_find_path(client, name) != NULL) {
+			/* already connected */
+			continue;
 		}
 
-		if (closedir(dirp) < 0)
-			i_error("closedir() failed: %m");
+		/* Normally they're sockets, but in UnixWare they're
+		   created as fifos. */
+		if (stat(name, &st) == 0 &&
+		    (S_ISSOCK(st.st_mode) || S_ISFIFO(st.st_mode))) {
+			if (auth_server_connection_new(client, name) == NULL)
+				client->reconnect = TRUE;
+		}
 	}
 
+	if (closedir(dirp) < 0)
+		i_error("closedir() failed: %m");
+
 	if (client->reconnect || client->connections == NULL) {
-		if (client->to_reconnect == NULL &&
-		    client->ext_input_add == NULL) {
+		if (client->to_reconnect == NULL) {
 			client->to_reconnect =
 				timeout_add(5000, reconnect_timeout, client);
 		}

Index: auth-client.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-auth/auth-client.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- auth-client.h	15 Dec 2006 16:55:35 -0000	1.14
+++ auth-client.h	15 Dec 2006 17:16:26 -0000	1.15
@@ -95,16 +95,6 @@
 /* Return the PID of the server that handled this request. */
 unsigned int auth_client_request_get_server_pid(struct auth_request *request);
 
-/* -- Using lib-auth with external I/O loop -- */
-
-typedef void *input_func_add_t(int fd, void (*cb)(void *), void *context);
-typedef void *input_func_remove_t(void *io);
-
-struct auth_client *auth_client_new_external(unsigned int client_pid,
-					     const char *socket_paths,
-					     input_func_add_t *add_func,
-					     input_func_remove_t *remove_func);
-/* Call every few seconds. */
 void auth_client_connect_missing_servers(struct auth_client *client);
 
 #endif

Index: auth-server-connection.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-auth/auth-server-connection.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- auth-server-connection.c	7 Nov 2006 14:55:32 -0000	1.17
+++ auth-server-connection.c	15 Dec 2006 17:16:26 -0000	1.18
@@ -226,12 +226,7 @@
 	conn->client = client;
 	conn->path = p_strdup(pool, path);
 	conn->fd = fd;
-	if (client->ext_input_add == NULL)
-		conn->io = io_add(fd, IO_READ, auth_client_input, conn);
-	else {
-		conn->ext_input_io =
-			client->ext_input_add(fd, auth_client_input, conn);
-	}
+	conn->io = io_add(fd, IO_READ, auth_client_input, conn);
 	conn->input = i_stream_create_file(fd, default_pool,
 					   AUTH_CLIENT_MAX_LINE_LENGTH, FALSE);
 	conn->output = o_stream_create_file(fd, default_pool, (size_t)-1,
@@ -280,10 +275,6 @@
 	if (!conn->handshake_received)
 		client->conn_waiting_handshake_count--;
 
-	if (conn->ext_input_io != NULL) {
-		client->ext_input_remove(conn->ext_input_io);
-		conn->ext_input_io = NULL;
-	}
 	if (conn->io != NULL)
 		io_remove(&conn->io);
 

Index: auth-server-connection.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-auth/auth-server-connection.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- auth-server-connection.h	14 Jan 2006 18:47:23 -0000	1.10
+++ auth-server-connection.h	15 Dec 2006 17:16:26 -0000	1.11
@@ -3,10 +3,6 @@
 
 struct auth_client {
 	unsigned int pid;
-	char *socket_paths;
-
-	input_func_add_t *ext_input_add;
-	input_func_remove_t *ext_input_remove;
 
 	struct auth_server_connection *connections;
 	struct timeout *to_reconnect;
@@ -34,7 +30,6 @@
 	int fd;
 
 	struct io *io;
-	void *ext_input_io;
 	struct istream *input;
 	struct ostream *output;
 



More information about the dovecot-cvs mailing list