/* Copyright (c) 2005-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "ioloop.h"
#include "istream.h"
#include "ostream.h"
#include "home-expand.h"
#include "file-dotlock.h"
#include "hash.h"
#include "mail-user.h"
#include "mail-storage-settings.h"
#include "mail-duplicate.h"
#include <fcntl.h>
#include <unistd.h>
struct mail_duplicate {
const void *id;
unsigned int id_size;
const char *user;
};
struct mail_duplicate_file_header {
};
struct mail_duplicate_record_header {
};
struct mail_duplicate_file {
const char *path;
int new_fd;
};
struct mail_duplicate_db {
char *path;
};
.timeout = 20,
.stale_timeout = 10,
};
static int
const struct mail_duplicate *d2)
{
}
{
/* a char* hash function from ASU -- from glib */
unsigned int g, h = 0;
while (s != end) {
h = (h << 4) + *s;
if ((g = h & 0xf0000000UL) != 0) {
h = h ^ (g >> 24);
h = h ^ g;
}
s++;
}
return h ^ strcase_hash(d->user);
}
static int
unsigned int record_size)
{
const unsigned char *data;
unsigned int change_count;
change_count = 0;
if (record_size == sizeof(hdr))
else {
/* FIXME: backwards compatibility with v1.0 */
}
return -1;
}
return -1;
}
/* still valid, save it */
struct mail_duplicate *d;
void *new_id;
} else {
change_count++;
}
}
return 0;
}
{
const unsigned char *data;
int fd;
unsigned int record_size = 0;
if (fd == -1) {
return 0;
return -1;
}
/* <timestamp> <id_size> <user_size> <id> <user> */
/* FIXME: backwards compatibility with v1.0 */
record_size = sizeof(struct mail_duplicate_record_header);
}
}
if (record_size == 0 ||
return 0;
}
static struct mail_duplicate_file *
{
;
else {
i_error("Creating lock file for %s timed out in %u secs",
}
(void)mail_duplicate_read(file);
return file;
}
{
}
{
struct mail_duplicate d;
/* mail_duplicate database disabled */
return FALSE;
}
}
}
{
struct mail_duplicate *d;
void *new_id;
/* mail_duplicate database disabled */
return;
}
}
}
{
struct mail_duplicate *d;
return;
/* unlock the mail_duplicate database */
return;
}
}
if (o_stream_finish(output) < 0) {
return;
}
}
struct mail_duplicate_db *
{
i_error("User %s doesn't have home dir set, "
}
return db;
}
{
}
}