dovecot-2.2: auth: passwd-file now stat()s the file max once per...

dovecot at dovecot.org dovecot at dovecot.org
Tue Oct 13 10:46:30 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/dce5ee506cc8
changeset: 19296:dce5ee506cc8
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Oct 13 13:44:48 2015 +0300
description:
auth: passwd-file now stat()s the file max once per second.
It's quite unnecessary to do it more often.

diffstat:

 src/auth/db-passwd-file.c |  5 +++++
 src/auth/db-passwd-file.h |  1 +
 2 files changed, 6 insertions(+), 0 deletions(-)

diffs (33 lines):

diff -r 719e7f8fd70b -r dce5ee506cc8 src/auth/db-passwd-file.c
--- a/src/auth/db-passwd-file.c	Mon Oct 12 17:12:17 2015 +0300
+++ b/src/auth/db-passwd-file.c	Tue Oct 13 13:44:48 2015 +0300
@@ -13,6 +13,7 @@
 #include "hash.h"
 #include "str.h"
 #include "eacces-error.h"
+#include "ioloop.h"
 
 #include <unistd.h>
 #include <fcntl.h>
@@ -261,6 +262,10 @@
 	struct stat st;
 	const char *error;
 
+	if (pw->last_sync_time == ioloop_time)
+		return 0;
+	pw->last_sync_time = ioloop_time;
+
 	if (stat(pw->path, &st) < 0) {
 		/* with variables don't give hard errors, or errors about
 		   nonexistent files */
diff -r 719e7f8fd70b -r dce5ee506cc8 src/auth/db-passwd-file.h
--- a/src/auth/db-passwd-file.h	Mon Oct 12 17:12:17 2015 +0300
+++ b/src/auth/db-passwd-file.h	Tue Oct 13 13:44:48 2015 +0300
@@ -20,6 +20,7 @@
 	pool_t pool;
 	int refcount;
 
+	time_t last_sync_time;
 	char *path;
 	time_t stamp;
 	off_t size;


More information about the dovecot-cvs mailing list