dovecot-2.0: ssl-params: Several bugfixes.

dovecot at dovecot.org dovecot at dovecot.org
Thu Oct 8 02:06:38 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/96d87de9eba9
changeset: 9989:96d87de9eba9
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Oct 07 19:06:05 2009 -0400
description:
ssl-params: Several bugfixes.

diffstat:

2 files changed, 15 insertions(+), 11 deletions(-)
src/ssl-params/main.c       |    3 ++-
src/ssl-params/ssl-params.c |   23 +++++++++++++----------

diffs (68 lines):

diff -r d44e5ff84614 -r 96d87de9eba9 src/ssl-params/main.c
--- a/src/ssl-params/main.c	Wed Oct 07 18:54:14 2009 -0400
+++ b/src/ssl-params/main.c	Wed Oct 07 19:06:05 2009 -0400
@@ -56,8 +56,9 @@ static void client_connected(const struc
 		if (!array_is_created(&delayed_fds))
 			i_array_init(&delayed_fds, 32);
 		array_append(&delayed_fds, &conn->fd, 1);
+	} else {
+		client_handle(conn->fd);
 	}
-	client_handle(conn->fd);
 }
 
 static void ssl_params_callback(const unsigned char *data, size_t size)
diff -r d44e5ff84614 -r 96d87de9eba9 src/ssl-params/ssl-params
Binary file src/ssl-params/ssl-params has changed
diff -r d44e5ff84614 -r 96d87de9eba9 src/ssl-params/ssl-params.c
--- a/src/ssl-params/ssl-params.c	Wed Oct 07 18:54:14 2009 -0400
+++ b/src/ssl-params/ssl-params.c	Wed Oct 07 19:06:05 2009 -0400
@@ -55,14 +55,16 @@ static void ssl_params_if_unchanged(cons
 		/* someone else is writing this */
 		i_fatal("Timeout while waiting for %s generation to complete",
 			path);
-		return;
 	}
 
 	/* make sure the .tmp file is still the one we created */
 	if (fstat(fd, &st) < 0)
 		i_fatal("fstat(%s) failed: %m", temp_path);
-	if (stat(temp_path, &st2) < 0)
-		i_fatal("stat(%s) failed: %m", temp_path);
+	if (stat(temp_path, &st2) < 0) {
+		if (errno != ENOENT)
+			i_fatal("stat(%s) failed: %m", temp_path);
+		st2.st_ino = st.st_ino+1;
+	}
 	if (st.st_ino != st2.st_ino) {
 		/* nope. so someone else just generated the file. */
 		(void)close(fd);
@@ -70,12 +72,13 @@ static void ssl_params_if_unchanged(cons
 	}
 
 	/* check that the parameters file is still the same */
-	if (stat(path, &st) < 0)
-		i_fatal("stat(%s) failed: %m", temp_path);
-	if (st.st_mtime != mtime) {
-		(void)close(fd);
-		return;
-	}
+	if (stat(path, &st) == 0) {
+		if (st.st_mtime != mtime) {
+			(void)close(fd);
+			return;
+		}
+	} else if (errno != ENOENT)
+		i_fatal("stat(%s) failed: %m", path);
 
 	/* ok, we really want to generate it. */
 	if (ftruncate(fd, 0) < 0)
@@ -148,7 +151,7 @@ static int ssl_params_read(struct ssl_pa
 	}
 
 	if (fstat(fd, &st) < 0) {
-		i_error("stat(%s) failed: %m", param->path);
+		i_error("fstat(%s) failed: %m", param->path);
 		(void)close(fd);
 		return -1;
 	}


More information about the dovecot-cvs mailing list