[dovecot-cvs] dovecot/src/plugins/acl acl-backend-vfile.c, 1.5.2.1,
1.5.2.2 acl-cache.c, 1.2, 1.2.2.1 acl-cache.h, 1.2, 1.2.2.1
cras at dovecot.org
cras at dovecot.org
Tue May 30 15:20:41 EEST 2006
Update of /var/lib/cvs/dovecot/src/plugins/acl
In directory talvi:/tmp/cvs-serv15459
Modified Files:
Tag: branch_1_0
acl-backend-vfile.c acl-cache.c acl-cache.h
Log Message:
Don't check ACL file's timestamp changes more often than once in a second.
Index: acl-backend-vfile.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/acl/acl-backend-vfile.c,v
retrieving revision 1.5.2.1
retrieving revision 1.5.2.2
diff -u -d -r1.5.2.1 -r1.5.2.2
--- acl-backend-vfile.c 30 May 2006 12:18:25 -0000 1.5.2.1
+++ acl-backend-vfile.c 30 May 2006 12:20:37 -0000 1.5.2.2
@@ -15,10 +15,17 @@
#define ACL_FILENAME "dovecot-acl"
+/* Minimum time between stat()ing the ACL file to see if its timestamp has
+ changed. */
+#define ACL_VALIDITY_SECS 1
+/* Time difference to allow between this system's time and file server's time */
#define ACL_SYNC_SECS 1
+
#define ACL_ESTALE_RETRY_COUNT NFS_ESTALE_RETRY_COUNT
struct acl_vfile_validity {
+ time_t last_check;
+
time_t last_read_time;
time_t last_mtime;
off_t last_size;
@@ -341,15 +348,17 @@
static int
acl_backend_vfile_refresh(struct acl_object *aclobj, const char *path,
- const struct acl_vfile_validity *validity)
+ struct acl_vfile_validity *validity)
{
struct stat st;
if (validity == NULL)
return 1;
- if (path == NULL)
+ if (path == NULL ||
+ validity->last_check + ACL_VALIDITY_SECS > ioloop_time)
return 0;
+ validity->last_check = ioloop_time;
if (stat(path, &st) < 0) {
if (errno == ENOENT) {
/* if the file used to exist, we have to re-read it */
@@ -378,7 +387,7 @@
static int acl_backend_vfile_object_refresh_cache(struct acl_object *_aclobj)
{
struct acl_object_vfile *aclobj = (struct acl_object_vfile *)_aclobj;
- const struct acl_backend_vfile_validity *old_validity;
+ struct acl_backend_vfile_validity *old_validity;
struct acl_backend_vfile_validity validity;
int ret;
Index: acl-cache.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/acl/acl-cache.c,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -d -r1.2 -r1.2.2.1
--- acl-cache.c 28 Feb 2006 12:38:20 -0000 1.2
+++ acl-cache.c 30 May 2006 12:20:37 -0000 1.2.2.1
@@ -329,8 +329,7 @@
}
}
-const void *acl_cache_get_validity(struct acl_cache *cache,
- const char *objname)
+void *acl_cache_get_validity(struct acl_cache *cache, const char *objname)
{
struct acl_object_cache *obj_cache;
Index: acl-cache.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/acl/acl-cache.h,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -d -r1.2 -r1.2.2.1
--- acl-cache.h 28 Feb 2006 12:38:20 -0000 1.2
+++ acl-cache.h 30 May 2006 12:20:37 -0000 1.2.2.1
@@ -35,12 +35,11 @@
/* Update object ACLs. */
void acl_cache_update(struct acl_cache *cache, const char *objname,
const struct acl_rights *rights);
-/* Update ACL object validity. */
+/* Return ACL object validity, or NULL if object doesn't exit. */
+void *acl_cache_get_validity(struct acl_cache *cache, const char *objname);
+/* Update ACL object validity, creating the object if needed. */
void acl_cache_set_validity(struct acl_cache *cache, const char *objname,
const void *validity);
-/* Return ACL object validity. */
-const void *acl_cache_get_validity(struct acl_cache *cache,
- const char *objname);
/* Returns all the right names currently created. The returned pointer may
change after calling acl_cache_update(). */
More information about the dovecot-cvs
mailing list