/* Copyright (c) 2006-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "bsearch-insert-pos.h"
#include "ioloop.h"
#include "str.h"
#include "strescape.h"
#include "file-dotlock.h"
#include "ostream.h"
#include "mail-storage.h"
#include "acl-cache.h"
#include "acl-backend-vfile.h"
#include <utime.h>
.timeout = 30,
.stale_timeout = 120
};
{
int fd;
i_error("Can't update acl object '%s': No local acl file path",
return -1;
}
/* first lock the ACL file */
if (fd == -1) {
return -1;
}
/* locked successfully, re-read the existing file to make sure we
don't lose any changes. */
return -1;
}
return fd;
}
static bool
const struct acl_rights_update *update)
{
/* this identifier no longer exists */
}
}
static bool
const struct acl_rights_update *update)
{
/* nothing to do */
return FALSE;
}
return TRUE;
}
return FALSE;
}
static void
bool neg)
{
/* need to escape it */
str_truncate(dest, 0);
} T_END;
}
static int
{
unsigned int i, count;
int ret = 0;
/* rights are sorted with globals at the end, so we can stop at the
first global */
str_truncate(str, 0);
}
str_truncate(str, 0);
}
}
if (o_stream_finish(output) < 0) {
ret = -1;
}
/* we really don't want to lose ACL files' contents, so fsync() always
before renaming */
ret = -1;
}
return ret;
}
{
/* we'll just recalculate or fail it later */
return;
}
}
const struct acl_rights_update *update)
{
(struct acl_object_vfile *)_aclobj;
const char *path;
unsigned int i;
int fd;
bool changed;
/* global ACLs can't be updated here */
if (fd == -1)
return -1;
acl_rights_cmp, &i))
else
if (!changed) {
return 0;
}
/* ACLs were really changed, write the new ones */
return -1;
}
/* set mtime to last_change, if it's higher than the file's
original mtime. if original mtime is higher, then we're
merging some changes and it's better for the mtime to get
updated. */
}
if (file_dotlock_replace(&dotlock, 0) < 0) {
return -1;
}
/* make sure dovecot-acl-list gets updated if we changed any
lookup rights. */
return 0;
}