/* Copyright (c) 2007-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "str.h"
#include "hex-binary.h"
#include "file-lock.h"
#include "message-parser.h"
#include "message-part-serialize.h"
#include "mail-index-private.h"
#include "mail-cache-private.h"
#include "mail-index-modseq.h"
#include "doveadm-dump.h"
#include <stdio.h>
#include <time.h>
struct index_vsize_header {
};
struct maildir_index_header {
};
struct mbox_index_header {
};
struct sdbox_index_header {
};
struct mdbox_index_header {
};
struct mdbox_mail_index_record {
};
struct obox_mail_index_record {
};
struct mobox_mail_index_header {
};
struct mobox_mail_index_record {
};
struct mobox_map_mail_index_header {
};
struct mobox_map_mail_index_record {
};
struct mailbox_list_index_header {
/* array of { uint32_t id; char name[]; } */
};
struct mailbox_list_index_record {
};
struct mailbox_list_index_msgs_record {
};
struct mailbox_index_vsize {
};
struct fts_index_header {
};
struct virtual_mail_index_header {
};
struct virtual_mail_index_mailbox_record {
};
struct virtual_mail_index_record {
};
struct mdbox_mail_index_map_record {
};
{
unsigned int i;
printf("uid validity ............. = %u (%s)\n", hdr->uid_validity, unixdate2str(hdr->uid_validity));
if (hdr->minor_version == 0) {
} else {
}
printf("log2 rotate time ......... = %u (%s)\n", hdr->log2_rotate_time, unixdate2str(hdr->log2_rotate_time));
printf("last temp file scan ...... = %u (%s)\n", hdr->last_temp_file_scan, unixdate2str(hdr->last_temp_file_scan));
}
}
{
const void *name_start, *p;
/* get id */
printf(" - corrupted\n");
break;
}
i += sizeof(id);
if (id == 0)
break;
/* get name */
if (p == NULL) {
printf(" - corrupted\n");
break;
}
len = (const char *)p - (const char *)name_start;
i += len + 1;
}
}
{
if (dest[i] == '\0')
dest[i] = '\n';
}
}
const struct mail_index_ext *ext)
{
const void *data;
void *buf;
return;
/* add some padding, since we don't bother to handle undersized
headers correctly */
printf("header\n");
printf("header\n");
printf("header\n");
printf(" - mailbox_guid = %s\n",
printf("header\n");
printf(" - mailbox_guid ...... = %s\n",
printf("header\n");
printf(" - mailbox_guid .. = %s\n",
printf("header\n");
printf(" - mailbox_guid ...... = %s\n",
printf("header\n");
printf("header\n");
printf("header\n");
printf(" - last_indexed_uid ..... = %u\n",
printf(" - settings_checksum .... = %u\n",
const unsigned char *name;
unsigned int i;
printf("header\n");
}
printf("header ........ = %s\n",
printf("header ........ = %s\n",
} else {
printf("header ........ = %s\n",
}
}
{
unsigned int i, count;
else
count = 0;
if (count == 0) {
printf("no extensions\n");
return;
}
for (i = 0; i < count; i++) {
printf("-- Extension %u --\n", i);
} T_END;
}
}
{
const unsigned int *kw_indexes;
const char *const *keywords;
unsigned int i, count;
printf("-- Keywords --\n");
return;
if (count == 0)
return;
for (i = 0; i < count; i++)
}
{
const char *str;
switch (type & ~MAIL_CACHE_DECISION_FORCED) {
case MAIL_CACHE_DECISION_NO:
str = "no";
break;
case MAIL_CACHE_DECISION_TEMP:
str = "tmp";
break;
case MAIL_CACHE_DECISION_YES:
str = "yes";
break;
default:
}
if ((type & MAIL_CACHE_DECISION_FORCED) != 0)
return str;
}
((type) == MAIL_CACHE_FIELD_FIXED_SIZE || \
(type) == MAIL_CACHE_FIELD_BITMASK)
{
switch (type) {
return "fix";
return "var";
case MAIL_CACHE_FIELD_STRING:
return "str";
case MAIL_CACHE_FIELD_BITMASK:
return "bit";
case MAIL_CACHE_FIELD_HEADER:
return "hdr";
default:
}
}
{
(void)mail_cache_open_and_verify(cache);
if (MAIL_CACHE_IS_UNUSABLE(cache)) {
printf("cache is unusable\n");
return;
}
printf("file_seq ............. = %u (%s) (%d compressions)\n",
printf("field_header_offset .. = %u (0x%08x nontranslated)\n",
printf("-- Cache fields --\n");
&count);
" # Name Type Size Dec Last used\n");
for (i = 0; i < cache->file_fields_count; i++) {
else
printf(" - ");
printf("%-4s %.16s\n",
}
}
{
}
}
}
static void
{
const char *error;
return;
}
}
static void
{
if (size == 0)
return;
}
{
const void *data;
unsigned int size;
int ret;
printf(" - cache offset=%u size=%u, prev_offset = %u\n",
}
str_truncate(str, 0);
}
/* fall through */
case MAIL_CACHE_FIELD_BITMASK:
break;
case MAIL_CACHE_FIELD_STRING:
if (size > 0)
break;
case MAIL_CACHE_FIELD_HEADER: {
int i;
for (i = 0;; i++) {
if (i == 0 && size == 0) {
/* header doesn't exist */
break;
}
size = 0;
break;
}
if (lines[i] == 0)
break;
if (i > 0)
}
if (i == 1 && size > 0 &&
size--;
if (size > 0)
break;
}
case MAIL_CACHE_FIELD_COUNT:
i_unreached();
break;
}
}
if (ret < 0)
printf(" - broken cache\n");
}
{
if ((flags & MAIL_ANSWERED) != 0)
if ((flags & MAIL_FLAGGED) != 0)
if ((flags & MAIL_DELETED) != 0)
if ((flags & MAIL_DRAFT) != 0)
return "";
}
{
const void *data;
unsigned int i, ext_count;
bool expunged;
printf("RECORD: seq=%u, uid=%u, flags=0x%02x %s\n",
for (i = 0; i < ext_count; i++) {
continue;
str_truncate(str, 0);
} else {
}
}
}
}
{
}
{
const char *p;
else
return NULL;
else
}
{
}
if (uid == 0) {
}
T_BEGIN {
printf("\n");
} T_END;
}
}
}
{
bool ret;
return FALSE;
if (ret)
return ret;
}
"index",
};