/* Copyright (c) 2006-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "hash.h"
#include "acl-cache.h"
#include "acl-api-private.h"
/* Give more than enough so that the arrays should never have to be grown.
IMAP ACLs define only 10 standard rights and 10 user-defined rights. */
struct acl_object_cache {
char *name;
};
struct acl_cache {
/* name => object */
/* Right names mapping is used for faster rights checking. Note that
acl_mask bitmask relies on the order to never change, so only new
rights can be added to the mapping. */
/* idx => right name. */
/* name => idx+1 */
};
{
return cache;
}
{
}
{
}
static struct acl_mask *
const char *const *rights)
{
unsigned char *p;
for (i = 0; i < rights_count; i++) {
}
/* @UNSAFE */
return mask;
}
const char *const *rights)
{
T_BEGIN {
} T_END;
return mask;
}
static struct acl_mask *
{
return mask;
}
{
}
{
unsigned int idx;
void *idx_p;
char *name;
const char *const_name;
/* use +1 for right_name_idx_map values because we can't add NULL
values. */
/* new right name, add it */
} else {
}
return idx;
}
{
}
}
{
char *key;
}
static void
struct acl_object_cache *obj_cache,
enum acl_modify_mode modify_mode,
const char *const *rights,
{
unsigned int i, size;
switch (modify_mode) {
case ACL_MODIFY_MODE_ADD:
break;
}
if (change_mask == NULL) {
/* no changes */
break;
}
/* merge the masks */
/* keep using the old mask */
for (i = 0; i < change_mask->size; i++)
} else {
/* use the new mask, put old changes into it */
}
break;
case ACL_MODIFY_MODE_REMOVE:
break;
}
/* remove changed bits from old mask */
for (i = 0; i < size; i++)
break;
case ACL_MODIFY_MODE_REPLACE:
break;
case ACL_MODIFY_MODE_CLEAR:
i_unreached();
}
}
/* current rights need to be recalculated */
else
}
}
static struct acl_object_cache *
bool *created_r)
{
} else {
}
return obj_cache;
}
const struct acl_rights_update *update)
{
bool created;
/* since the rights aren't being replaced, start with our
default rights */
}
}
const void *validity)
{
bool created;
/* @UNSAFE: validity is stored after the cache record */
if (created) {
/* negative cache entry */
}
}
{
}
unsigned int *count_r)
{
}
static void
{
unsigned int i, size;
/* @UNSAFE */
/* apply the positive rights */
/* apply the negative rights. they override positive rights. */
for (i = 0; i < size; i++)
}
}
const struct acl_mask *
{
return NULL;
T_BEGIN {
} T_END;
}
return obj_cache->my_current_rights;
}
{
unsigned int mask_idx;
}