[dovecot-cvs] dovecot/src/plugins/acl acl-backend-vfile.c, 1.14, 1.15
tss at dovecot.org
tss at dovecot.org
Wed Apr 11 11:56:22 EEST 2007
Update of /var/lib/cvs/dovecot/src/plugins/acl
In directory talvi:/tmp/cvs-serv22478/src/plugins/acl
Modified Files:
acl-backend-vfile.c
Log Message:
Added cache_secs parameter to vfile backend.
Index: acl-backend-vfile.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/acl/acl-backend-vfile.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- acl-backend-vfile.c 23 Jan 2007 11:41:50 -0000 1.14
+++ acl-backend-vfile.c 11 Apr 2007 08:56:20 -0000 1.15
@@ -9,15 +9,13 @@
#include "acl-cache.h"
#include "acl-api-private.h"
+#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#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
@@ -38,6 +36,7 @@
struct acl_backend_vfile {
struct acl_backend backend;
const char *global_dir;
+ unsigned int cache_secs;
};
struct acl_object_vfile {
@@ -81,14 +80,30 @@
{
struct acl_backend_vfile *backend =
(struct acl_backend_vfile *)_backend;
+ const char *const *tmp;
- if (_backend->debug)
- i_info("acl vfile: Global ACL directory: %s", data);
+ t_push();
+ tmp = t_strsplit(data, ":");
+ backend->global_dir = p_strdup(_backend->pool, *tmp);
+
+ while (*++tmp != NULL) {
+ if (strncmp(*tmp, "cache_secs=", 11) == 0)
+ backend->cache_secs = atoi(*tmp + 11);
+ else {
+ i_error("acl vfile: Unknown parameter: %s", *tmp);
+ t_pop();
+ return -1;
+ }
+ }
+ if (_backend->debug) {
+ i_info("acl vfile: Global ACL directory: %s",
+ backend->global_dir);
+ }
- backend->global_dir = p_strdup(_backend->pool, data);
_backend->cache =
acl_cache_init(_backend,
sizeof(struct acl_backend_vfile_validity));
+ t_pop();
return 0;
}
@@ -388,12 +403,14 @@
acl_backend_vfile_refresh(struct acl_object *aclobj, const char *path,
struct acl_vfile_validity *validity)
{
+ struct acl_backend_vfile *backend =
+ (struct acl_backend_vfile *)aclobj->backend;
struct stat st;
if (validity == NULL)
return 1;
if (path == NULL ||
- validity->last_check + ACL_VALIDITY_SECS > ioloop_time)
+ validity->last_check + backend->cache_secs > ioloop_time)
return 0;
validity->last_check = ioloop_time;
More information about the dovecot-cvs
mailing list