zlib-plugin.c revision 2615df45a8027948a474abe5e817b34b0499c171
/* Copyright (c) 2005-2009 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "istream-zlib.h"
#include "istream.h"
#include "maildir/maildir-storage.h"
#include "maildir/maildir-uidlist.h"
#include "index-mail.h"
#include "zlib-plugin.h"
#include <fcntl.h>
#define ZLIB_CONTEXT(obj) \
#define ZLIB_MAIL_CONTEXT(obj) \
#ifndef HAVE_ZLIB
# define i_stream_create_zlib NULL
#endif
#ifndef HAVE_BZLIB
# define i_stream_create_bzlib NULL
#endif
struct zlib_handler {
const char *ext;
};
const char *zlib_plugin_version = PACKAGE_VERSION;
static void (*zlib_next_hook_mail_storage_created)
(struct mail_storage *storage);
{
const unsigned char *data;
/* Peek in to the stream and see if it looks like it's compressed
(based on its header). This also means that users can try to exploit
security holes in the uncompression library by APPENDing a specially
crafted mail. So let's hope zlib is free of holes. */
return FALSE;
}
{
const unsigned char *data;
return FALSE;
return FALSE;
return FALSE;
return FALSE;
}
static struct zlib_handler zlib_handlers[] = {
};
{
unsigned int i;
for (i = 0; i < N_ELEMENTS(zlib_handlers); i++) {
return &zlib_handlers[i];
}
return NULL;
}
{
for (i = 0; i < N_ELEMENTS(zlib_handlers); i++) {
return &zlib_handlers[i];
}
return NULL;
}
struct message_size *hdr_size,
struct message_size *body_size,
{
struct zlib_handler *handler;
int fd;
stream_r);
}
return -1;
"zlib plugin: Detected %s compression "
fd = -1;
} else {
if (fd == -1) {
"zlib plugin: dup() failed: %m");
}
}
if (fd == -1)
return -1;
}
}
static struct mail *
struct mailbox_header_lookup_ctx *wanted_headers)
{
union mail_module_context *zmail;
struct mail_private *mail;
return _mail;
}
{
union mailbox_module_context *zbox;
}
static struct istream *
const char *name)
{
struct zlib_handler *handler;
const char *path;
int fd;
return NULL;
if (mail_storage_is_mailbox_file(storage)) {
/* looks like a compressed single file mailbox. we should be
able to handle this. */
if (fd != -1)
}
return NULL;
}
static struct mailbox *
enum mailbox_open_flags flags)
{
input = zlib_input =
}
if (zlib_input != NULL)
return box;
}
{
union mail_storage_module_context *qstorage;
}
void zlib_plugin_init(void)
{
}
void zlib_plugin_deinit(void)
{
}