/* Copyright (c) 2013-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "mail-storage.h"
#include "imap-metadata.h"
struct imap_metadata_transaction {
char *error_string;
};
{
unsigned int i;
bool ok;
if (name[0] != '/') {
*error_r = "Entry name must begin with '/'";
return FALSE;
}
for (i = 0; name[i] != '\0'; i++) {
switch (name[i]) {
case '/':
*error_r = "Entry name can't contain consecutive '/'";
return FALSE;
}
*error_r = "Entry name can't end with '/'";
return FALSE;
}
break;
case '*':
*error_r = "Entry name can't contain '*'";
return FALSE;
case '%':
*error_r = "Entry name can't contain '%'";
return FALSE;
default:
if (name[i] <= 0x19) {
*error_r = "Entry name can't contain control chars";
return FALSE;
}
break;
}
}
T_BEGIN {
} T_END;
if (!ok) {
*error_r = "Entry name must begin with /private or /shared";
return FALSE;
}
return TRUE;
}
static void
{
}
static bool
const char **key_r)
{
/* names are case-insensitive so we'll always lowercase them */
strlen(IMAP_METADATA_PRIVATE_PREFIX)) == 0) {
} else {
strlen(IMAP_METADATA_SHARED_PREFIX)) == 0);
}
if ((*key_r)[0] == '\0') {
/* /private or /shared prefix has no value itself */
} else {
*key_r += 1;
}
strlen(MAILBOX_ATTRIBUTE_PREFIX_DOVECOT_PVT)) == 0) {
/* Dovecot's internal attribute (mailbox or server).
don't allow accessing this. */
return FALSE;
}
/* Add the server-prefix (after checking for the above internal
attribute). */
if (key_prefix != NULL)
return TRUE;
}
static int
{
return 0;
return -1;
return 0;
}
{
const char *key;
"Internal mailbox attributes cannot be accessed");
return -1;
}
if (imap_metadata_get_mailbox_transaction(imtrans) < 0)
return -1;
}
const char *entry)
{
}
{
const char *key;
return 0;
}
{
const char *key;
return 0;
}
struct imap_metadata_iter {
};
struct imap_metadata_iter *
const char *entry)
{
const char *key;
const char *prefix =
prefix);
}
return iter;
}
{
return NULL;
}
{
int ret;
ret = 0;
else
return ret;
}
struct imap_metadata_transaction *
{
return imtrans;
}
struct imap_metadata_transaction *
{
return imtrans;
}
static void
{
}
struct imap_metadata_transaction **_imtrans,
{
int ret = 0;
if (ret < 0)
}
return ret;
}
struct imap_metadata_transaction **_imtrans)
{
}
const char *
struct imap_metadata_transaction *imtrans,
enum mail_error *error_code_r)
{
if (error_code_r != NULL)
return imtrans->error_string;
}
}