This file is indexed.

/usr/include/dovecot/maildir-uidlist.h is in dovecot-dev 1:2.2.9-1ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#ifndef MAILDIR_UIDLIST_H
#define MAILDIR_UIDLIST_H

#include "mail-storage.h"

#define MAILDIR_UIDLIST_NAME "dovecot-uidlist"
/* how many seconds to wait before overriding uidlist.lock */
#define MAILDIR_UIDLIST_LOCK_STALE_TIMEOUT (60*2)

struct maildir_mailbox;
struct maildir_uidlist;
struct maildir_uidlist_sync_ctx;
struct maildir_uidlist_rec;

enum maildir_uidlist_sync_flags {
	MAILDIR_UIDLIST_SYNC_PARTIAL	= 0x01,
	MAILDIR_UIDLIST_SYNC_KEEP_STATE	= 0x02,
	MAILDIR_UIDLIST_SYNC_FORCE	= 0x04,
	MAILDIR_UIDLIST_SYNC_TRYLOCK	= 0x08,
	MAILDIR_UIDLIST_SYNC_NOREFRESH	= 0x10,
	MAILDIR_UIDLIST_SYNC_NOLOCK	= 0x20
};

enum maildir_uidlist_rec_flag {
	MAILDIR_UIDLIST_REC_FLAG_NEW_DIR	= 0x01,
	MAILDIR_UIDLIST_REC_FLAG_MOVED		= 0x02,
	MAILDIR_UIDLIST_REC_FLAG_RECENT		= 0x04,
	MAILDIR_UIDLIST_REC_FLAG_NONSYNCED	= 0x08,
	MAILDIR_UIDLIST_REC_FLAG_RACING		= 0x10
};

enum maildir_uidlist_hdr_ext_key {
	MAILDIR_UIDLIST_HDR_EXT_UID_VALIDITY		= 'V',
	MAILDIR_UIDLIST_HDR_EXT_NEXT_UID		= 'N',
	MAILDIR_UIDLIST_HDR_EXT_GUID			= 'G',
	/* POP3 UIDL format unless overridden by records */
	MAILDIR_UIDLIST_HDR_EXT_POP3_UIDL_FORMAT	= 'P'
};

#define MAILDIR_UIDLIST_REC_EXT_KEY_IS_VALID(c) \
	((c) >= 'A' && (c) <= 'Z')
enum maildir_uidlist_rec_ext_key {
	/* Physical message size. If filename also contains ,S=<vsize> this
	   isn't written to uidlist. */
	MAILDIR_UIDLIST_REC_EXT_PSIZE		= 'S',
	/* Virtual message size. If filename also contains ,W=<vsize> this
	   isn't written to uidlist. */
	MAILDIR_UIDLIST_REC_EXT_VSIZE		= 'W',
	/* POP3 UIDL overriding the default format */
	MAILDIR_UIDLIST_REC_EXT_POP3_UIDL	= 'P',
	/* POP3 message ordering number. Lower numbered messages are listed
	   first. Messages without ordering number are listed after them.
	   The idea is to be able to preserve POP3 UIDL list and IMAP UIDs
	   perfectly when migrating from other servers. */
	MAILDIR_UIDLIST_REC_EXT_POP3_ORDER	= 'O',
	/* Message GUID (default is the base filename) */
	MAILDIR_UIDLIST_REC_EXT_GUID		= 'G'
};

int maildir_uidlist_lock(struct maildir_uidlist *uidlist);
int maildir_uidlist_try_lock(struct maildir_uidlist *uidlist);
int maildir_uidlist_lock_touch(struct maildir_uidlist *uidlist);
void maildir_uidlist_unlock(struct maildir_uidlist *uidlist);
bool maildir_uidlist_is_locked(struct maildir_uidlist *uidlist);
bool maildir_uidlist_is_read(struct maildir_uidlist *uidlist);
/* Returns TRUE if uidlist file is currently open */
bool maildir_uidlist_is_open(struct maildir_uidlist *uidlist);

struct maildir_uidlist *maildir_uidlist_init(struct maildir_mailbox *mbox);
void maildir_uidlist_deinit(struct maildir_uidlist **uidlist);

/* Returns -1 if error, 0 if file is broken or lost, 1 if ok. If nfs_flush=TRUE
   and storage has NFS_FLUSH flag set, the NFS attribute cache is flushed to
   make sure that we see the latest uidlist file. */
int maildir_uidlist_refresh(struct maildir_uidlist *uidlist);
/* Like maildir_uidlist_refresh(), but if uidlist isn't opened yet, try to
   fill in the uidvalidity/nextuid from index file instead. */
int maildir_uidlist_refresh_fast_init(struct maildir_uidlist *uidlist);

/* Look up uidlist record for given filename. Returns 1 if found,
   0 if not found, -1 if error */
int maildir_uidlist_lookup(struct maildir_uidlist *uidlist, uint32_t uid,
			   enum maildir_uidlist_rec_flag *flags_r,
			   const char **fname_r);
/* Returns extension's value or NULL if it doesn't exist. */
const char *
maildir_uidlist_lookup_ext(struct maildir_uidlist *uidlist, uint32_t uid,
			   enum maildir_uidlist_rec_ext_key key);

uint32_t maildir_uidlist_get_uid_validity(struct maildir_uidlist *uidlist);
uint32_t maildir_uidlist_get_next_uid(struct maildir_uidlist *uidlist);
int maildir_uidlist_get_mailbox_guid(struct maildir_uidlist *uidlist,
				     guid_128_t mailbox_guid);
void maildir_uidlist_set_mailbox_guid(struct maildir_uidlist *uidlist,
				      const guid_128_t mailbox_guid);

void maildir_uidlist_set_uid_validity(struct maildir_uidlist *uidlist,
				      uint32_t uid_validity);
void maildir_uidlist_set_next_uid(struct maildir_uidlist *uidlist,
				  uint32_t next_uid, bool force);

/* Update extended record. */
void maildir_uidlist_set_ext(struct maildir_uidlist *uidlist, uint32_t uid,
			     enum maildir_uidlist_rec_ext_key key,
			     const char *value);
void maildir_uidlist_unset_ext(struct maildir_uidlist *uidlist, uint32_t uid,
			       enum maildir_uidlist_rec_ext_key key);

/* If uidlist has changed, update it. This is mostly meant to be used with
   maildir_uidlist_set_ext() */
int maildir_uidlist_update(struct maildir_uidlist *uidlist);

void maildir_uidlist_set_all_nonsynced(struct maildir_uidlist *uidlist);
/* Sync uidlist with what's actually on maildir. Returns same as
   maildir_uidlist_lock(). */
int maildir_uidlist_sync_init(struct maildir_uidlist *uidlist,
			      enum maildir_uidlist_sync_flags sync_flags,
			      struct maildir_uidlist_sync_ctx **sync_ctx_r);
int maildir_uidlist_sync_next(struct maildir_uidlist_sync_ctx *ctx,
			      const char *filename,
			      enum maildir_uidlist_rec_flag flags);
int maildir_uidlist_sync_next_uid(struct maildir_uidlist_sync_ctx *ctx,
				  const char *filename, uint32_t uid,
				  enum maildir_uidlist_rec_flag flags,
				  struct maildir_uidlist_rec **rec_r);
void maildir_uidlist_sync_remove(struct maildir_uidlist_sync_ctx *ctx,
				 const char *filename);
void maildir_uidlist_sync_set_ext(struct maildir_uidlist_sync_ctx *ctx,
				  struct maildir_uidlist_rec *rec,
				  enum maildir_uidlist_rec_ext_key key,
				  const char *value);
void maildir_uidlist_update_fname(struct maildir_uidlist *uidlist,
				  const char *filename);
const char *
maildir_uidlist_sync_get_full_filename(struct maildir_uidlist_sync_ctx *ctx,
				       const char *filename);
void maildir_uidlist_sync_recreate(struct maildir_uidlist_sync_ctx *ctx);
void maildir_uidlist_sync_finish(struct maildir_uidlist_sync_ctx *ctx);
int maildir_uidlist_sync_deinit(struct maildir_uidlist_sync_ctx **ctx,
				bool success);

bool maildir_uidlist_get_uid(struct maildir_uidlist *uidlist,
			     const char *filename, uint32_t *uid_r);
const char *
maildir_uidlist_get_full_filename(struct maildir_uidlist *uidlist,
				  const char *filename);

void maildir_uidlist_add_flags(struct maildir_uidlist *uidlist,
			       const char *filename,
			       enum maildir_uidlist_rec_flag flags);

/* List all maildir files. */
struct maildir_uidlist_iter_ctx *
maildir_uidlist_iter_init(struct maildir_uidlist *uidlist);
bool maildir_uidlist_iter_next(struct maildir_uidlist_iter_ctx *ctx,
			       uint32_t *uid_r,
			       enum maildir_uidlist_rec_flag *flags_r,
			       const char **filename_r);
void maildir_uidlist_iter_deinit(struct maildir_uidlist_iter_ctx **ctx);

#endif