dovecot-1.3: Renamed deliver to dovecot-lda and moved most of it...

dovecot at dovecot.org dovecot at dovecot.org
Mon Apr 13 22:45:57 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.3/rev/e4832f128738
changeset: 9092:e4832f128738
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Apr 13 15:45:17 2009 -0400
description:
Renamed deliver to dovecot-lda and moved most of its code to lib-lda.

diffstat:

27 files changed, 1562 insertions(+), 1523 deletions(-)
.hgignore                      |    2 
configure.in                   |    3 
src/Makefile.am                |    2 
src/deliver/Makefile.am        |   46 --
src/deliver/deliver-settings.c |   75 ----
src/deliver/deliver-settings.h |   20 -
src/deliver/deliver.c          |  663 ----------------------------------------
src/deliver/deliver.h          |   38 --
src/deliver/duplicate.c        |  322 -------------------
src/deliver/duplicate.h        |   17 -
src/deliver/mail-send.c        |  203 ------------
src/deliver/mail-send.h        |   10 
src/deliver/smtp-client.c      |  115 ------
src/deliver/smtp-client.h      |   11 
src/lda/Makefile.am            |   30 +
src/lda/main.c                 |  425 +++++++++++++++++++++++++
src/lib-lda/Makefile.am        |   29 +
src/lib-lda/duplicate.c        |  323 +++++++++++++++++++
src/lib-lda/duplicate.h        |   17 +
src/lib-lda/lda-settings.c     |   74 ++++
src/lib-lda/lda-settings.h     |   22 +
src/lib-lda/mail-deliver.c     |  244 ++++++++++++++
src/lib-lda/mail-deliver.h     |   48 ++
src/lib-lda/mail-send.c        |  204 ++++++++++++
src/lib-lda/mail-send.h        |   11 
src/lib-lda/smtp-client.c      |  119 +++++++
src/lib-lda/smtp-client.h      |   12 

diffs (truncated from 3218 to 300 lines):

diff -r e7dc0fb735ff -r e4832f128738 .hgignore
--- a/.hgignore	Mon Apr 13 15:39:35 2009 -0400
+++ b/.hgignore	Mon Apr 13 15:45:17 2009 -0400
@@ -55,7 +55,7 @@ src/auth/dovecot-auth
 src/auth/dovecot-auth
 src/config/all-settings.c
 src/config/doveconf
-src/deliver/deliver
+src/lda/dovecot-lda
 src/dict/dict
 src/imap-login/imap-login
 src/imap/imap
diff -r e7dc0fb735ff -r e4832f128738 configure.in
--- a/configure.in	Mon Apr 13 15:39:35 2009 -0400
+++ b/configure.in	Mon Apr 13 15:45:17 2009 -0400
@@ -2360,6 +2360,7 @@ src/lib-dict/Makefile
 src/lib-dict/Makefile
 src/lib-imap/Makefile
 src/lib-index/Makefile
+src/lib-lda/Makefile
 src/lib-mail/Makefile
 src/lib-master/Makefile
 src/lib-ntlm/Makefile
@@ -2378,7 +2379,7 @@ src/lib-storage/register/Makefile
 src/lib-storage/register/Makefile
 src/auth/Makefile
 src/config/Makefile
-src/deliver/Makefile
+src/lda/Makefile
 src/dict/Makefile
 src/imap/Makefile
 src/imap-login/Makefile
diff -r e7dc0fb735ff -r e4832f128738 src/Makefile.am
--- a/src/Makefile.am	Mon Apr 13 15:39:35 2009 -0400
+++ b/src/Makefile.am	Mon Apr 13 15:45:17 2009 -0400
@@ -24,7 +24,7 @@ SUBDIRS = \
 	imap \
 	pop3-login \
 	pop3 \
-	deliver \
+	lda \
 	config \
 	tests \
 	util \
diff -r e7dc0fb735ff -r e4832f128738 src/deliver/Makefile.am
--- a/src/deliver/Makefile.am	Mon Apr 13 15:39:35 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-pkglibexecdir = $(libexecdir)/dovecot
-
-pkglibexec_PROGRAMS = deliver
-
-AM_CPPFLAGS = \
-	-I$(top_srcdir)/src/lib \
-	-I$(top_srcdir)/src/lib-settings \
-	-I$(top_srcdir)/src/lib-mail \
-	-I$(top_srcdir)/src/lib-imap \
-	-I$(top_srcdir)/src/lib-index \
-	-I$(top_srcdir)/src/lib-master \
-	-I$(top_srcdir)/src/lib-storage \
-	-I$(top_srcdir)/src/lib-storage/index \
-	-I$(top_srcdir)/src/lib-storage/index/raw \
-	-DPKG_RUNDIR=\""$(rundir)"\"
-
-deliver_LDFLAGS = -export-dynamic
-
-libs = \
-	../lib-storage/libdovecot-storage.la \
-	../lib-dovecot/libdovecot.la
-
-deliver_LDADD = $(libs)
-
-deliver_DEPENDENCIES = $(libs)
-
-deliver_SOURCES = \
-	deliver.c \
-	deliver-settings.c \
-	duplicate.c \
-	mail-send.c \
-	smtp-client.c
-
-headers = \
-	deliver.h \
-	deliver-settings.h \
-	duplicate.h \
-	mail-send.h \
-	smtp-client.h
-
-if INSTALL_HEADERS
-  pkginc_libdir=$(pkgincludedir)/src/deliver
-  pkginc_lib_HEADERS = $(headers)
-else
-  noinst_HEADERS = $(headers)
-endif
diff -r e7dc0fb735ff -r e4832f128738 src/deliver/deliver-settings.c
--- a/src/deliver/deliver-settings.c	Mon Apr 13 15:39:35 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/* Copyright (c) 2005-2009 Dovecot authors, see the included COPYING file */
-
-#include "deliver.h"
-#include "array.h"
-#include "hostpid.h"
-#include "istream.h"
-#include "settings-parser.h"
-#include "mail-storage-settings.h"
-#include "deliver-settings.h"
-
-#include <stddef.h>
-#include <stdlib.h>
-
-static bool deliver_settings_check(void *_set, pool_t pool, const char **error_r);
-
-#undef DEF
-#undef DEFLIST
-#define DEF(type, name) \
-	{ type, #name, offsetof(struct deliver_settings, name), NULL }
-#define DEFLIST(field, name, defines) \
-	{ SET_DEFLIST, name, offsetof(struct deliver_settings, field), defines }
-
-static struct setting_define deliver_setting_defines[] = {
-	DEF(SET_STR, postmaster_address),
-	DEF(SET_STR, hostname),
-	DEF(SET_STR, sendmail_path),
-	DEF(SET_STR, rejection_subject),
-	DEF(SET_STR, rejection_reason),
-	DEF(SET_STR, deliver_log_format),
-	DEF(SET_BOOL, quota_full_tempfail),
-
-	{ SET_STRLIST, "plugin", offsetof(struct deliver_settings, plugin_envs), NULL },
-
-	SETTING_DEFINE_LIST_END
-};
-
-static struct deliver_settings deliver_default_settings = {
-	MEMBER(postmaster_address) "",
-	MEMBER(hostname) "",
-	MEMBER(sendmail_path) "/usr/lib/sendmail",
-	MEMBER(rejection_subject) "Rejected: %s",
-	MEMBER(rejection_reason)
-		"Your message to <%t> was automatically rejected:%n%r",
-	MEMBER(deliver_log_format) "msgid=%m: %$",
-	MEMBER(quota_full_tempfail) FALSE
-};
-
-struct setting_parser_info deliver_setting_parser_info = {
-	MEMBER(defines) deliver_setting_defines,
-	MEMBER(defaults) &deliver_default_settings,
-
-	MEMBER(parent) NULL,
-	MEMBER(dynamic_parsers) NULL,
-
-	MEMBER(parent_offset) (size_t)-1,
-	MEMBER(type_offset) (size_t)-1,
-	MEMBER(struct_size) sizeof(struct deliver_settings),
-#ifdef CONFIG_BINARY
-	MEMBER(check_func) NULL
-#else
-	MEMBER(check_func) deliver_settings_check
-#endif
-};
-
-static bool deliver_settings_check(void *_set, pool_t pool ATTR_UNUSED,
-				   const char **error_r)
-{
-	struct deliver_settings *set = _set;
-
-	if (*set->postmaster_address == '\0') {
-		*error_r = "postmaster_address setting not given";
-		return FALSE;
-	}
-	return TRUE;
-}
diff -r e7dc0fb735ff -r e4832f128738 src/deliver/deliver-settings.h
--- a/src/deliver/deliver-settings.h	Mon Apr 13 15:39:35 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-#ifndef DELIVER_SETTINGS_H
-#define DELIVER_SETTINGS_H
-
-struct mail_user_settings;
-
-struct deliver_settings {
-	const char *postmaster_address;
-	const char *hostname;
-	const char *sendmail_path;
-	const char *rejection_subject;
-	const char *rejection_reason;
-	const char *deliver_log_format;
-	bool quota_full_tempfail;
-
-	ARRAY_DEFINE(plugin_envs, const char *);
-};
-
-extern struct setting_parser_info deliver_setting_parser_info;
-
-#endif
diff -r e7dc0fb735ff -r e4832f128738 src/deliver/deliver.c
--- a/src/deliver/deliver.c	Mon Apr 13 15:39:35 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,663 +0,0 @@
-/* Copyright (c) 2005-2009 Dovecot authors, see the included COPYING file */
-
-#include "lib.h"
-#include "lib-signals.h"
-#include "ioloop.h"
-#include "env-util.h"
-#include "fd-set-nonblock.h"
-#include "istream.h"
-#include "istream-seekable.h"
-#include "str.h"
-#include "str-sanitize.h"
-#include "strescape.h"
-#include "var-expand.h"
-#include "rfc822-parser.h"
-#include "message-address.h"
-#include "imap-utf7.h"
-#include "settings-parser.h"
-#include "master-service.h"
-#include "master-service-settings.h"
-#include "mail-storage-service.h"
-#include "mail-namespace.h"
-#include "raw-storage.h"
-#include "mail-send.h"
-#include "duplicate.h"
-#include "mbox-from.h"
-#include "deliver.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <pwd.h>
-
-#define DEFAULT_ENVELOPE_SENDER "MAILER-DAEMON"
-
-/* After buffer grows larger than this, create a temporary file to /tmp
-   where to read the mail. */
-#define MAIL_MAX_MEMORY_BUFFER (1024*128)
-
-static const char *wanted_headers[] = {
-	"From", "Message-ID", "Subject", "Return-Path",
-	NULL
-};
-
-const struct deliver_settings *deliver_set;
-deliver_mail_func_t *deliver_mail = NULL;
-bool mailbox_autosubscribe;
-bool mailbox_autocreate;
-bool tried_default_save = FALSE;
-
-/* FIXME: these two should be in some context struct instead of as globals.. */
-static const char *default_mailbox_name = NULL;
-static bool saved_mail = FALSE;
-static char *explicit_envelope_sender = NULL;
-
-static struct master_service *service;
-
-static const char *deliver_get_address(struct mail *mail, const char *header)
-{
-	struct message_address *addr;
-	const char *str;
-
-	if (mail_get_first_header(mail, header, &str) <= 0)
-		return NULL;
-	addr = message_address_parse(pool_datastack_create(),
-				     (const unsigned char *)str,
-				     strlen(str), 1, FALSE);
-	return addr == NULL || addr->mailbox == NULL || addr->domain == NULL ||
-		*addr->mailbox == '\0' || *addr->domain == '\0' ?
-		NULL : t_strconcat(addr->mailbox, "@", addr->domain, NULL);
-}
-
-static const struct var_expand_table *
-get_log_var_expand_table(struct mail *mail, const char *message)
-{
-	static struct var_expand_table static_tab[] = {
-		{ '$', NULL, NULL },
-		{ 'm', NULL, "msgid" },
-		{ 's', NULL, "subject" },
-		{ 'f', NULL, "from" },
-		{ '\0', NULL, NULL }
-	};
-	struct var_expand_table *tab;
-	unsigned int i;
-
-	tab = t_malloc(sizeof(static_tab));
-	memcpy(tab, static_tab, sizeof(static_tab));
-
-	tab[0].value = message;
-	(void)mail_get_first_header(mail, "Message-ID", &tab[1].value);
-	(void)mail_get_first_header(mail, "Subject", &tab[2].value);
-	tab[3].value = deliver_get_address(mail, "From");
-	for (i = 1; tab[i].key != '\0'; i++)
-		tab[i].value = str_sanitize(tab[i].value, 80);
-	return tab;
-}
-
-static void
-deliver_log(struct mail *mail, const char *fmt, ...) ATTR_FORMAT(2, 3);
-
-static void deliver_log(struct mail *mail, const char *fmt, ...)


More information about the dovecot-cvs mailing list