upgrade to Dovecot 1.0alpha1

This commit is contained in:
brad 2005-09-04 18:22:30 +00:00
parent f34c18fca1
commit 904707f8ba
29 changed files with 126 additions and 643 deletions

View File

@ -1,9 +1,8 @@
# $OpenBSD: Makefile,v 1.19 2005/07/23 20:41:30 brad Exp $
# $OpenBSD: Makefile,v 1.20 2005/09/04 18:22:30 brad Exp $
COMMENT= "compact IMAP/POP3 server"
DISTNAME= dovecot-0.99.14
PKGNAME= ${DISTNAME}p1
DISTNAME= dovecot-1.0.alpha1
CATEGORIES= mail
MASTER_SITES= ${HOMEPAGE}releases/
@ -27,33 +26,33 @@ FLAVOR?=
CONFIGURE_ARGS+= --with-mysql
LIB_DEPENDS+= lib/mysql/mysqlclient.10::databases/mysql
WANTLIB+= m z
CONF_FILE+= dovecot-mysql.conf
.endif
.if ${FLAVOR:L:Mpostgresql}
CONFIGURE_ARGS+= --with-pgsql
LIB_DEPENDS+= pq.4::databases/postgresql
CONF_FILE+= dovecot-pgsql.conf
.endif
CONFIGURE_STYLE= autoconf
AUTOCONF_VERSION= 2.59
CONFIGURE_ARGS+=--without-pam --without-shadow --without-vpopmail \
--localstatedir=/var --with-ssldir=/etc/ssl --with-ssl=openssl
CONFIGURE_ENV= LDFLAGS="-L${LOCALBASE}/lib" \
CFLAGS="${CFLAGS} -I${LOCALBASE}/include"
CONFIGURE_ARGS+=--localstatedir=/var \
--with-ssl=openssl \
--with-ssldir=/etc/ssl \
--without-pam \
--without-shadow \
--without-vpopmail
CONFIGURE_ENV= CFLAGS="${CFLAGS} -I${LOCALBASE}/include" \
LDFLAGS="-L${LOCALBASE}/lib"
post-configure:
@perl -pi -e 's|_PREFIX_|${PREFIX}|g' ${WRKSRC}/dovecot-example.conf
pre-build:
@perl -pi -e s#_PREFIX_#\${PREFIX}#g ${WRKSRC}/dovecot-example.conf
post-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/examples/dovecot
${INSTALL_DATA} ${WRKSRC}/doc/dovecot-openssl.cnf \
${WRKSRC}/dovecot-example.conf ${PREFIX}/share/examples/dovecot
.if defined(CONF_FILE) && !empty(CONF_FILE)
cd ${WRKSRC}/doc; ${INSTALL_DATA} ${CONF_FILE} \
${WRKSRC}/doc/dovecot-sql.conf \
${WRKSRC}/dovecot-example.conf \
${PREFIX}/share/examples/dovecot
.endif
${INSTALL_SCRIPT} ${WRKSRC}/doc/mkcert.sh \
${PREFIX}/sbin/dovecot-mkcert.sh

View File

@ -1,4 +1,4 @@
MD5 (dovecot-0.99.14.tar.gz) = a12e26fd378a46c31ec3a81ab7b55b5b
RMD160 (dovecot-0.99.14.tar.gz) = 5c6f370f2e81472c5d1d8a639b1edc63df362e6b
SHA1 (dovecot-0.99.14.tar.gz) = b93569c3ca8849ced7ab0580e95d83771c4686fa
SIZE (dovecot-0.99.14.tar.gz) = 871285
MD5 (dovecot-1.0.alpha1.tar.gz) = c1b99fc0b7d9cad210ab247c182cec6f
RMD160 (dovecot-1.0.alpha1.tar.gz) = b010e59fc637a2c2f3ecea2aaf0ada0fb937c1fd
SHA1 (dovecot-1.0.alpha1.tar.gz) = f1ceb0ce6ec44c3add03605c8570a4936fb786b8
SIZE (dovecot-1.0.alpha1.tar.gz) = 1187972

View File

@ -1,12 +1,12 @@
$OpenBSD: patch-Makefile_in,v 1.3 2004/05/27 16:38:30 brad Exp $
--- Makefile.in.orig 2004-05-26 22:33:16.000000000 -0400
+++ Makefile.in 2004-05-27 01:24:16.000000000 -0400
@@ -354,7 +354,7 @@ install-data-am: install-confDATA
install-data: install-data-recursive
$OpenBSD: patch-Makefile_in,v 1.4 2005/09/04 18:22:30 brad Exp $
--- Makefile.in.orig Thu Aug 18 12:45:08 2005
+++ Makefile.in Thu Aug 18 15:26:48 2005
@@ -589,7 +589,7 @@ install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am
install: install-recursive
uninstall-am: uninstall-confDATA
uninstall: uninstall-recursive
installcheck: installcheck-recursive
install-strip:

View File

@ -1,56 +1,11 @@
$OpenBSD: patch-configure_in,v 1.5 2005/02/13 18:37:32 alek Exp $
--- configure.in.orig Wed Jan 19 16:15:45 2005
+++ configure.in Sun Feb 13 18:31:22 2005
@@ -12,6 +12,7 @@ AC_STDC_HEADERS
$OpenBSD: patch-configure_in,v 1.6 2005/09/04 18:22:30 brad Exp $
--- configure.in.orig Sat Mar 5 15:02:47 2005
+++ configure.in Sun Mar 6 16:46:00 2005
@@ -12,6 +12,7 @@ AC_PROG_CPP
AC_HEADER_STDC
AC_C_INLINE
AC_ARG_PROGRAM
AM_PROG_LIBTOOL
+LIBS="${LIBS} -liconv"
AM_ICONV
AC_CHECK_HEADERS(string.h stdlib.h stdint.h unistd.h dirent.h)
@@ -681,6 +682,44 @@ AC_TRY_COMPILE([
], [
AC_MSG_RESULT(no)
])
+
+dnl * If mmap() plays nicely with write()
+AC_MSG_CHECKING([whether we need to use MS_INVALIDATE with mmaps])
+AC_TRY_RUN([
+ #include <stdio.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <sys/mman.h>
+ int main() {
+ /* return 0 if we're signed */
+ int f = open("conftest.mmap", O_RDWR|O_CREAT|O_TRUNC);
+ void *mem;
+ if (f == -1) {
+ perror("open()");
+ return 1;
+ }
+ write(f, "1", 2);
+ mem = mmap(NULL, 2, PROT_READ|PROT_WRITE, MAP_SHARED, f, 0);
+ if (mem == MAP_FAILED) {
+ perror("mmap()");
+ return 1;
+ }
+ strcpy(mem, "2");
+ msync(mem, 2, MS_SYNC);
+ lseek(f, 0, SEEK_SET);
+ write(f, "3", 2);
+
+ return strcmp(mem, "3") == 0 ? 0 : 1;
+ }
+], [
+ AC_MSG_RESULT(no)
+], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(NEED_MS_INVALIDATE,, Define if your mmap() implementation requires use of MS_INVALIDATE to work with write())
+])
+
dnl * Solaris compatible sendfilev()
AC_CHECK_LIB(sendfile, sendfilev, [
AC_CHECK_HEADERS(strings.h stdint.h unistd.h dirent.h \

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-doc_mkcert_sh,v 1.2 2004/05/10 00:06:47 brad Exp $
--- doc/mkcert.sh.orig 2003-11-08 09:46:57.000000000 -0500
+++ doc/mkcert.sh 2004-05-07 21:19:54.000000000 -0400
$OpenBSD: patch-doc_mkcert_sh,v 1.3 2005/09/04 18:22:30 brad Exp $
--- doc/mkcert.sh.orig Thu Jul 22 20:05:00 2004
+++ doc/mkcert.sh Wed Nov 3 21:59:54 2004
@@ -5,14 +5,14 @@
OPENSSL=${OPENSSL-openssl}
@ -8,10 +8,9 @@ $OpenBSD: patch-doc_mkcert_sh,v 1.2 2004/05/10 00:06:47 brad Exp $
-OPENSSLCONFIG=${OPENSSLCONFIG-dovecot-openssl.cnf}
+OPENSSLCONFIG=${OPENSSLCONFIG-${SSLDIR}/dovecot-openssl.cnf}
-CERTFILE=$SSLDIR/certs/imapd.pem
-KEYFILE=$SSLDIR/private/imapd.pem
-CERTFILE=$SSLDIR/certs/dovecot.pem
+CERTFILE=$SSLDIR/dovecotcert.pem
+KEYFILE=$SSLDIR/private/dovecot.pem
KEYFILE=$SSLDIR/private/dovecot.pem
-if [ ! -d $SSLDIR/certs ]; then
- echo "$SSLDIR/certs directory doesn't exist"

View File

@ -1,8 +1,8 @@
$OpenBSD: patch-dovecot-example_conf,v 1.9 2005/02/12 12:17:07 brad Exp $
--- dovecot-example.conf.orig Wed Dec 29 13:00:24 2004
+++ dovecot-example.conf Fri Feb 4 20:58:07 2005
@@ -1,13 +1,12 @@
## Dovecot 1.0 configuration file
$OpenBSD: patch-dovecot-example_conf,v 1.10 2005/09/04 18:22:30 brad Exp $
--- dovecot-example.conf.orig Fri Jul 22 13:49:52 2005
+++ dovecot-example.conf Fri Jul 22 13:58:29 2005
@@ -5,13 +5,12 @@
# value inside quotes, eg.: key = "# char and trailing whitespace "
# Default values are shown after each value, it's not required to uncomment
-# any of the lines. Exception to this are paths, they're just examples
@ -19,7 +19,7 @@ $OpenBSD: patch-dovecot-example_conf,v 1.9 2005/02/12 12:17:07 brad Exp $
# Protocols we want to be serving:
# imap imaps pop3 pop3s
@@ -33,12 +32,12 @@
@@ -37,7 +36,7 @@
# dropping root privileges, so keep the key file unreadable by anyone but
# root. Included doc/mkcert.sh can be used to easily generate self-signed
# certificate, just make sure to update the domains in dovecot-openssl.cnf
@ -27,6 +27,9 @@ $OpenBSD: patch-dovecot-example_conf,v 1.9 2005/02/12 12:17:07 brad Exp $
+ssl_cert_file = /etc/ssl/dovecotcert.pem
#ssl_key_file = /etc/ssl/private/dovecot.pem
# File containing trusted SSL certificate authorities. Usually not needed.
@@ -48,7 +47,7 @@
# SSL parameter file. Master process generates this file for login processes.
# It contains Diffie Hellman and RSA parameters.
-#ssl_parameters_file = /var/run/dovecot/ssl-parameters.dat
@ -34,7 +37,16 @@ $OpenBSD: patch-dovecot-example_conf,v 1.9 2005/02/12 12:17:07 brad Exp $
# How often to regenerate the SSL parameters file. Generation is quite CPU
# intensive operation. The value is in hours, 0 disables regeneration
@@ -70,7 +69,7 @@
@@ -62,7 +61,7 @@
# SSL/TLS is used (LOGINDISABLED capability). Note that 127.*.*.* and
# IPv6 ::1 addresses are considered secure, this setting has no effect if
# you connect from those addresses.
-#disable_plaintext_auth = yes
+disable_plaintext_auth = yes
# Use this logfile instead of syslog(). /dev/stderr can be used if you want to
# use stderr for logging (ONLY /dev/stderr - otherwise it is closed).
@@ -83,7 +82,7 @@
# which login needs to be able to connect to. The sockets are created when
# running as root, so you don't have to worry about permissions. Note that
# everything in this directory is deleted when Dovecot is started.
@ -43,15 +55,7 @@ $OpenBSD: patch-dovecot-example_conf,v 1.9 2005/02/12 12:17:07 brad Exp $
# chroot login process to the login_dir. Only reason not to do this is if you
# wish to run the whole Dovecot without roots.
@@ -85,14 +84,14 @@
login = imap
# Executable location.
-#login_executable = /usr/libexec/dovecot/imap-login
+#login_executable = _PREFIX_/libexec/dovecot/imap-login
# User to use for the login process. Create a completely new user for this,
# and don't use it anywhere else. The user must also belong to a group where
@@ -95,7 +94,7 @@
# only it has access, it's used to control access for authentication process.
# Note that this user is NOT used to access mails.
# http://wiki.dovecot.org/UserIds
@ -60,87 +64,76 @@ $OpenBSD: patch-dovecot-example_conf,v 1.9 2005/02/12 12:17:07 brad Exp $
# Set max. process size in megabytes. If you don't use
# login_process_per_connection you might need to grow this.
@@ -132,7 +131,7 @@ login = imap
login = pop3
@@ -301,7 +300,7 @@
# Exception to above rule being the executable location.
-#login_executable = /usr/libexec/dovecot/pop3-login
+#login_executable = _PREFIX_/libexec/dovecot/pop3-login
# Don't write() to mmaped files. This is required for some operating systems
# which use separate caches for them, such as OpenBSD.
-#mmap_no_write = no
+mmap_no_write = yes
##
## Mail processes
@@ -274,6 +273,8 @@ login = pop3
# Locking method for index files. Alternatives are fcntl, flock and dotlock.
# Dotlocking uses some tricks which may create more disk I/O than other locking
@@ -389,12 +388,12 @@
# Use mmap() instead of read() to read mail files. read() seems to be a bit
# faster with my Linux/x86 and it's better with NFS, so that's the default.
+# Note that this option doesn't work correctly on OpenBSD as msync() needs
+# the MS_INVALIDATE to operate properly. Enable at your own risk.
#mail_read_mmaped = no
protocol imap {
# Login executable location.
- #login_executable = /usr/libexec/dovecot/imap-login
+ #login_executable = /usr/local/libexec/dovecot/imap-login
# By default LIST command returns all entries in maildir beginning with dot.
@@ -291,6 +292,12 @@ login = pop3
# If you care about performance, enable it.
#maildir_copy_with_hardlinks = no
# IMAP executable location
- #mail_executable = /usr/libexec/dovecot/imap
+ #mail_executable = /usr/local/libexec/dovecot/imap
# This would write rawlogs into ~/dovecot.rawlog/ directory:
- #mail_executable = /usr/libexec/dovecot/rawlog /usr/libexec/dovecot/imap
+ #mail_executable = /usr/local/libexec/dovecot/rawlog /usr/local/libexec/dovecot/imap
+# Call mmap() with MS_INVALIDATE flag each time before accessing message
+# indexes. This option is recommended on OpenBSD 3.4 and older versions
+# to negate the risk of corruption when rebuilding indexes.
+# It's also required if you insist on saving index files over NFS.
+index_mmap_invalidate = yes
+
# Check if mails' content has been changed by external programs. This slows
# down things as extra stat() needs to be called for each file. If changes are
# noticed, the message is treated as a new message, since IMAP protocol
@@ -308,7 +315,7 @@ login = pop3
# with is important to avoid deadlocks if other MTAs/MUAs are using both fcntl
# and flock. Some operating systems don't allow using both of them
# simultaneously, eg. BSDs. If dotlock is used, it's always created first.
-#mbox_locks = dotlock fcntl
+mbox_locks = fcntl
# Maximum IMAP command line length in bytes. Some clients generate very long
# command lines with huge mailboxes, so you may need to raise this if you get
@@ -442,10 +441,10 @@ protocol imap {
# Should we create dotlock file even when we want only a read-lock? Setting
# this to yes hurts the performance when the mailbox is accessed simultaneously
@@ -338,7 +345,7 @@ login = pop3
protocol pop3 {
# Login executable location.
- #login_executable = /usr/libexec/dovecot/pop3-login
+ #login_executable = /usr/local/libexec/dovecot/pop3-login
# POP3 executable location
- #mail_executable = /usr/libexec/dovecot/pop3
+ #mail_executable = /usr/local/libexec/dovecot/pop3
# Don't try to set mails non-recent or seen with POP3 sessions. This is
# mostly intended to reduce disk I/O. With maildir it doesn't move files
@@ -506,7 +505,7 @@ protocol pop3 {
##
# Executable location
-#imap_executable = /usr/libexec/dovecot/imap
+#imap_executable = _PREFIX_/libexec/dovecot/imap
-#auth_executable = /usr/libexec/dovecot/dovecot-auth
+#auth_executable = /usr/local/libexec/dovecot/dovecot-auth
# Set max. process size in megabytes. Most of the memory goes to mmap()ing
# files, so it shouldn't harm much even if this limit is set pretty high.
@@ -346,14 +353,14 @@ login = pop3
# Set max. process size in megabytes.
#auth_process_size = 256
@@ -573,7 +572,7 @@ auth default {
# Note that PAM can only be used to verify if user's password is correct,
# so it can't be used as userdb. If you don't want to use a separate user
# database (passwd usually), you can use static userdb.
- passdb pam {
+ #passdb pam {
# [-session] [<service name>]
#
# -session makes Dovecot open and immediately close PAM session. Some
@@ -582,13 +581,13 @@ auth default {
# If service name is "*", it means the authenticating service name
# is used, eg. pop3 or imap.
#args = dovecot
- }
+ #}
# Support for dynamically loadable modules.
#imap_use_modules = no
-#imap_modules = /usr/lib/dovecot/imap
+#imap_modules = _PREFIX_/lib/dovecot/imap
##
## POP3 process
##
# Executable location
-#pop3_executable = /usr/libexec/dovecot/pop3
+#pop3_executable = _PREFIX_/libexec/dovecot/pop3
# Set max. process size in megabytes. Most of the memory goes to mmap()ing
# files, so it shouldn't harm much even if this limit is set pretty high.
@@ -361,7 +368,7 @@ login = pop3
# Support for dynamically loadable modules.
#pop3_use_modules = no
-#pop3_modules = /usr/lib/dovecot/pop3
+#pop3_modules = _PREFIX_/lib/dovecot/pop3
##
## Authentication processes
@@ -438,7 +445,7 @@ auth_userdb = passwd
# vpopmail: vpopmail authentication
# ldap <config path>: LDAP, see doc/dovecot-ldap.conf
# pgsql <config path>: a PostgreSQL database, see doc/dovecot-pgsql.conf
-auth_passdb = pam
+auth_passdb = passwd
#auth_executable = /usr/libexec/dovecot/dovecot-auth
# /etc/passwd or similar, using getpwnam()
# In many systems nowadays this uses Name Service Switch, which is
# configured in /etc/nsswitch.conf.
- #passdb passwd {
- #}
+ passdb passwd {
+ }
# /etc/shadow or similiar, using getspnam(). Deprecated by PAM nowadays.
#passdb shadow {

View File

@ -1,13 +0,0 @@
$OpenBSD: patch-src_imap_cmd-append_c,v 1.1 2003/07/23 06:03:01 jolan Exp $
--- src/imap/cmd-append.c.orig Sat Jun 14 22:43:04 2003
+++ src/imap/cmd-append.c Tue Jul 15 15:16:56 2003
@@ -67,7 +67,8 @@ int cmd_append(struct client *client)
return TRUE;
box = client->storage->open_mailbox(client->storage,
- mailbox, FALSE, TRUE);
+ mailbox, mailbox_open_flags |
+ MAILBOX_OPEN_FAST);
if (box == NULL) {
client_send_storage_error(client);
return TRUE;

View File

@ -1,13 +0,0 @@
$OpenBSD: patch-src_imap_cmd-copy_c,v 1.2 2005/02/12 12:17:07 brad Exp $
--- src/imap/cmd-copy.c.orig Thu Sep 2 06:56:32 2004
+++ src/imap/cmd-copy.c Fri Oct 1 02:39:58 2004
@@ -18,7 +18,8 @@ int cmd_copy(struct client *client)
return TRUE;
destbox = client->storage->open_mailbox(client->storage,
- mailbox, FALSE, TRUE);
+ mailbox, mailbox_open_flags |
+ MAILBOX_OPEN_FAST);
if (destbox == NULL) {
client_send_storage_error(client);
return TRUE;

View File

@ -1,24 +0,0 @@
$OpenBSD: patch-src_imap_cmd-select_c,v 1.1 2003/07/23 06:03:01 jolan Exp $
--- src/imap/cmd-select.c.orig Sun Apr 6 09:58:14 2003
+++ src/imap/cmd-select.c Tue Jul 15 15:17:10 2003
@@ -7,6 +7,7 @@ int _cmd_select_full(struct client *clie
{
struct mailbox *box;
struct mailbox_status status;
+ enum mailbox_open_flags flags;
const char *mailbox;
/* <mailbox> */
@@ -20,8 +21,10 @@ int _cmd_select_full(struct client *clie
client_send_untagged_storage_error(client);
}
- box = client->storage->open_mailbox(client->storage, mailbox,
- readonly, FALSE);
+ flags = mailbox_open_flags;
+ if (readonly)
+ flags |= MAILBOX_OPEN_READONLY;
+ box = client->storage->open_mailbox(client->storage, mailbox, flags);
if (box == NULL) {
client_send_storage_error(client);
return TRUE;

View File

@ -1,15 +0,0 @@
$OpenBSD: patch-src_imap_cmd-status_c,v 1.2 2005/02/12 12:17:07 brad Exp $
--- src/imap/cmd-status.c.orig Thu Sep 2 11:00:10 2004
+++ src/imap/cmd-status.c Fri Oct 1 02:39:59 2004
@@ -57,7 +57,10 @@ static int get_mailbox_status(struct cli
} else {
/* open the mailbox */
box = client->storage->open_mailbox(client->storage,
- mailbox, TRUE, TRUE);
+ mailbox,
+ mailbox_open_flags |
+ MAILBOX_OPEN_FAST |
+ MAILBOX_OPEN_READONLY);
if (box == NULL)
return FALSE;
}

View File

@ -1,10 +0,0 @@
$OpenBSD: patch-src_imap_common_h,v 1.1 2003/07/23 06:03:01 jolan Exp $
--- src/imap/common.h.orig Wed Feb 19 18:46:51 2003
+++ src/imap/common.h Tue Jul 15 15:17:19 2003
@@ -15,5 +15,6 @@
extern struct ioloop *ioloop;
extern unsigned int max_custom_flag_length, mailbox_check_interval;
+extern enum mailbox_open_flags mailbox_open_flags;
#endif

View File

@ -1,21 +0,0 @@
$OpenBSD: patch-src_imap_main_c,v 1.3 2004/06/25 17:41:59 brad Exp $
--- src/imap/main.c.orig Mon May 26 11:27:13 2003
+++ src/imap/main.c Fri Jun 25 13:35:47 2004
@@ -21,6 +21,7 @@
struct ioloop *ioloop;
unsigned int max_custom_flag_length, mailbox_check_interval;
+enum mailbox_open_flags mailbox_open_flags;
static struct module *modules;
static char log_prefix[128]; /* syslog() needs this to be permanent */
@@ -129,6 +130,9 @@ static void main_init(void)
str = getenv("MAILBOX_CHECK_INTERVAL");
mailbox_check_interval = str == NULL ? 0 :
(unsigned int)strtoul(str, NULL, 10);
+
+ mailbox_open_flags = getenv("MMAP_INVALIDATE") != NULL ?
+ MAILBOX_OPEN_MMAP_INVALIDATE : 0;
client = client_create(hin, hout, storage);

View File

@ -1,16 +0,0 @@
$OpenBSD: patch-src_lib-index_mail-index-data_c,v 1.1 2003/07/23 06:03:01 jolan Exp $
--- src/lib-index/mail-index-data.c.orig Thu May 29 16:55:58 2003
+++ src/lib-index/mail-index-data.c Tue Jul 15 15:17:26 2003
@@ -133,6 +133,12 @@ static int mmap_update(struct mail_index
{
struct mail_index_data_header *hdr;
+ if (data->index->mmap_invalidate && data->mmap_base != NULL) {
+ if (msync(data->mmap_base, data->mmap_used_length,
+ MS_SYNC | MS_INVALIDATE) < 0)
+ return index_data_set_syscall_error(data, "msync()");
+ }
+
if (data->header != NULL &&
data->header->indexid != data->index->indexid) {
if (data->header->indexid != 0) {

View File

@ -1,36 +0,0 @@
$OpenBSD: patch-src_lib-index_mail-index_c,v 1.1 2003/07/23 06:03:01 jolan Exp $
--- src/lib-index/mail-index.c.orig Sun May 18 07:26:28 2003
+++ src/lib-index/mail-index.c Tue Jul 15 15:17:29 2003
@@ -89,6 +89,15 @@ int mail_index_mmap_update(struct mail_i
if (index->mmap_base != NULL) {
index->header = (struct mail_index_header *) index->mmap_base;
+ if (index->mmap_invalidate) {
+ if (msync(index->mmap_base,
+ index->mmap_used_length,
+ MS_SYNC | MS_INVALIDATE) < 0) {
+ index_set_syscall_error(index, "msync()");
+ return FALSE;
+ }
+ }
+
/* make sure file size hasn't changed */
if (index->header->sync_id == index->sync_id) {
index->mmap_used_length = index->header->used_file_size;
@@ -99,9 +108,13 @@ int mail_index_mmap_update(struct mail_i
return TRUE;
}
- if (msync(index->mmap_base,
- index->mmap_used_length, MS_SYNC) < 0)
- return index_set_syscall_error(index, "msync()");
+ if (!index->mmap_invalidate) {
+ if (msync(index->mmap_base,
+ index->mmap_used_length, MS_SYNC) < 0) {
+ index_set_syscall_error(index, "msync()");
+ return FALSE;
+ }
+ }
if (munmap(index->mmap_base, index->mmap_full_length) < 0)
return index_set_syscall_error(index, "munmap()");

View File

@ -1,33 +0,0 @@
$OpenBSD: patch-src_lib-index_mail-index_h,v 1.1 2003/07/23 06:03:01 jolan Exp $
--- src/lib-index/mail-index.h.orig Sat Jun 14 22:43:05 2003
+++ src/lib-index/mail-index.h Tue Jul 15 15:17:34 2003
@@ -16,9 +16,11 @@ enum mail_index_open_flags {
MAIL_INDEX_OPEN_FLAG_UPDATE_RECENT = 0x02,
/* Compressing and cache updates are not performed */
MAIL_INDEX_OPEN_FLAG_FAST = 0x04,
+ /* Invalidate memory maps before accessing them */
+ MAIL_INDEX_OPEN_FLAG_MMAP_INVALIDATE = 0x08,
/* internal: we're creating the index */
- _MAIL_INDEX_OPEN_FLAG_CREATING = 0x10
+ _MAIL_INDEX_OPEN_FLAG_CREATING = 0x100
};
enum mail_index_header_compat {
@@ -433,6 +435,7 @@ struct mail_index {
enum mail_data_field set_cache_fields;
unsigned int anon_mmap:1;
+ unsigned int mmap_invalidate:1;
unsigned int opened:1;
unsigned int rebuilding:1;
unsigned int mail_read_mmaped:1;
@@ -460,7 +463,7 @@ struct mail_index {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0
+ 0, 0, 0, 0, 0, 0
#endif
/* defaults - same as above but prefixed with mail_index_. */

View File

@ -1,16 +0,0 @@
$OpenBSD: patch-src_lib-index_mail-modifylog_c,v 1.1 2003/07/23 06:03:01 jolan Exp $
--- src/lib-index/mail-modifylog.c.orig Sun May 18 07:26:28 2003
+++ src/lib-index/mail-modifylog.c Tue Jul 15 15:17:41 2003
@@ -176,6 +176,12 @@ static int mmap_update(struct modify_log
struct modify_log_header *hdr;
unsigned int extra;
+ if (file->log->index->mmap_invalidate && file->mmap_base != NULL) {
+ if (msync(file->mmap_base, file->mmap_used_length,
+ MS_SYNC | MS_INVALIDATE) < 0)
+ return modifylog_set_syscall_error(file, "msync()");
+ }
+
if (!forced && file->header != NULL &&
file->mmap_full_length >= file->header->used_file_size) {
file->mmap_used_length = file->header->used_file_size;

View File

@ -1,16 +0,0 @@
$OpenBSD: patch-src_lib-index_mail-tree_c,v 1.1 2003/07/23 06:03:01 jolan Exp $
--- src/lib-index/mail-tree.c.orig Wed Apr 23 12:07:51 2003
+++ src/lib-index/mail-tree.c Tue Jul 15 15:17:57 2003
@@ -131,6 +131,12 @@ static int mmap_verify(struct mail_tree
int _mail_tree_mmap_update(struct mail_tree *tree, int forced)
{
+ if (tree->index->mmap_invalidate && tree->mmap_base != NULL) {
+ if (msync(tree->mmap_base, tree->mmap_used_length,
+ MS_SYNC | MS_INVALIDATE) < 0)
+ return tree_set_syscall_error(tree, "msync()");
+ }
+
debug_mprotect(tree->mmap_base, tree->mmap_full_length,
tree->index);

View File

@ -1,50 +0,0 @@
$OpenBSD: patch-src_lib-storage_index_index-storage_c,v 1.2 2004/05/10 00:06:47 brad Exp $
--- src/lib-storage/index/index-storage.c.orig 2003-11-08 09:55:19.000000000 -0500
+++ src/lib-storage/index/index-storage.c 2004-05-07 21:29:40.000000000 -0400
@@ -302,20 +302,28 @@ int index_storage_lock(struct index_mail
struct index_mailbox *
index_storage_mailbox_init(struct mail_storage *storage, struct mailbox *box,
struct mail_index *index, const char *name,
- int readonly, int fast)
+ enum mailbox_open_flags flags)
{
struct index_mailbox *ibox;
- enum mail_index_open_flags flags;
+ enum mail_index_open_flags index_flags;
i_assert(name != NULL);
+ index_flags = MAIL_INDEX_OPEN_FLAG_CREATE;
+ if ((flags & MAILBOX_OPEN_FAST) != 0)
+ index_flags |= MAIL_INDEX_OPEN_FLAG_FAST;
+ if ((flags & MAILBOX_OPEN_READONLY) != 0)
+ index_flags |= MAIL_INDEX_OPEN_FLAG_UPDATE_RECENT;
+ if ((flags & MAILBOX_OPEN_MMAP_INVALIDATE) != 0)
+ index_flags |= MAIL_INDEX_OPEN_FLAG_MMAP_INVALIDATE;
+
do {
ibox = i_new(struct index_mailbox, 1);
ibox->box = *box;
ibox->box.storage = storage;
ibox->box.name = i_strdup(name);
- ibox->box.readonly = readonly;
+ ibox->box.readonly = (flags & MAILBOX_OPEN_READONLY) != 0;
ibox->index = index;
@@ -329,13 +337,7 @@ index_storage_mailbox_init(struct mail_s
index->never_cache_fields =
get_never_cache_fields();
- flags = MAIL_INDEX_OPEN_FLAG_CREATE;
- if (fast)
- flags |= MAIL_INDEX_OPEN_FLAG_FAST;
- if (!readonly)
- flags |= MAIL_INDEX_OPEN_FLAG_UPDATE_RECENT;
-
- if (!index->open(index, flags))
+ if (!index->open(index, index_flags))
break;
if (INDEX_IS_IN_MEMORY(index) &&

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-src_lib-storage_index_index-storage_h,v 1.2 2004/05/10 00:06:47 brad Exp $
--- src/lib-storage/index/index-storage.h.orig 2003-11-08 09:52:09.000000000 -0500
+++ src/lib-storage/index/index-storage.h 2004-05-07 21:32:34.000000000 -0400
@@ -53,7 +53,7 @@ void index_storage_deinit(struct mail_st
struct index_mailbox *
index_storage_mailbox_init(struct mail_storage *storage, struct mailbox *box,
struct mail_index *index, const char *name,
- int readonly, int fast);
+ enum mailbox_open_flags flags);
int index_storage_mailbox_free(struct mailbox *box);
int index_storage_sync_and_lock(struct index_mailbox *ibox,

View File

@ -1,48 +0,0 @@
$OpenBSD: patch-src_lib-storage_index_maildir_maildir-storage_c,v 1.3 2004/06/22 21:05:20 brad Exp $
--- src/lib-storage/index/maildir/maildir-storage.c.orig 2004-06-17 20:50:09.000000000 -0400
+++ src/lib-storage/index/maildir/maildir-storage.c 2004-06-17 21:13:52.000000000 -0400
@@ -298,7 +298,7 @@ static int verify_inbox(struct mail_stor
static struct mailbox *
maildir_open(struct mail_storage *storage, const char *name,
- int readonly, int fast)
+ enum mailbox_open_flags flags)
{
struct index_mailbox *ibox;
struct mail_index *index;
@@ -315,7 +315,7 @@ maildir_open(struct mail_storage *storag
}
ibox = index_storage_mailbox_init(storage, &maildir_mailbox,
- index, name, readonly, fast);
+ index, name, flags);
if (ibox != NULL)
ibox->expunge_locked = maildir_expunge_locked;
return (struct mailbox *) ibox;
@@ -336,7 +336,7 @@ static const char *inbox_fix_case(struct
static struct mailbox *
maildir_open_mailbox(struct mail_storage *storage,
- const char *name, int readonly, int fast)
+ const char *name, enum mailbox_open_flags flags)
{
const char *path;
struct stat st;
@@ -347,7 +347,7 @@ maildir_open_mailbox(struct mail_storage
if (strcmp(name, "INBOX") == 0) {
if (!verify_inbox(storage))
return NULL;
- return maildir_open(storage, "INBOX", readonly, fast);
+ return maildir_open(storage, "INBOX", flags);
}
if (!maildir_is_valid_existing_name(name)) {
@@ -363,7 +363,7 @@ maildir_open_mailbox(struct mail_storage
!create_control_dir(storage, name))
return FALSE;
- return maildir_open(storage, name, readonly, fast);
+ return maildir_open(storage, name, flags);
} else if (errno == ENOENT) {
mail_storage_set_error(storage, "Mailbox doesn't exist: %s",
name);

View File

@ -1,48 +0,0 @@
$OpenBSD: patch-src_lib-storage_index_mbox_mbox-storage_c,v 1.3 2004/07/21 14:19:19 brad Exp $
--- src/lib-storage/index/mbox/mbox-storage.c.orig Tue Jul 13 06:48:36 2004
+++ src/lib-storage/index/mbox/mbox-storage.c Thu Jul 15 00:12:05 2004
@@ -324,7 +324,7 @@ static const char *mbox_get_path(struct
}
static struct mailbox *mbox_open(struct mail_storage *storage, const char *name,
- int readonly, int fast)
+ enum mailbox_open_flags flags)
{
struct index_mailbox *ibox;
struct mail_index *index;
@@ -351,7 +351,7 @@ static struct mailbox *mbox_open(struct
}
ibox = index_storage_mailbox_init(storage, &mbox_mailbox, index,
- name, readonly, fast);
+ name, flags);
if (ibox != NULL)
ibox->expunge_locked = mbox_expunge_locked;
return (struct mailbox *) ibox;
@@ -359,7 +359,7 @@ static struct mailbox *mbox_open(struct
static struct mailbox *
mbox_open_mailbox(struct mail_storage *storage,
- const char *name, int readonly, int fast)
+ const char *name, enum mailbox_open_flags flags)
{
const char *path;
struct stat st;
@@ -371,7 +371,7 @@ mbox_open_mailbox(struct mail_storage *s
/* make sure inbox exists */
if (!verify_inbox(storage))
return FALSE;
- return mbox_open(storage, "INBOX", readonly, fast);
+ return mbox_open(storage, "INBOX", flags);
}
if (!mbox_is_valid_existing_name(name)) {
@@ -391,7 +391,7 @@ mbox_open_mailbox(struct mail_storage *s
if (!create_mbox_index_dirs(storage, name))
return NULL;
- return mbox_open(storage, name, readonly, fast);
+ return mbox_open(storage, name, flags);
}
if (ENOTFOUND(errno)) {

View File

@ -1,25 +0,0 @@
$OpenBSD: patch-src_lib-storage_mail-storage_h,v 1.2 2004/07/21 14:19:19 brad Exp $
--- src/lib-storage/mail-storage.h.orig Tue Jul 13 06:57:22 2004
+++ src/lib-storage/mail-storage.h Thu Jul 15 00:12:05 2004
@@ -5,6 +5,12 @@ struct message_size;
#include "imap-util.h"
+enum mailbox_open_flags {
+ MAILBOX_OPEN_READONLY = 0x01,
+ MAILBOX_OPEN_FAST = 0x02,
+ MAILBOX_OPEN_MMAP_INVALIDATE = 0x04
+};
+
enum mailbox_list_flags {
MAILBOX_LIST_SUBSCRIBED = 0x01,
MAILBOX_LIST_FAST_FLAGS = 0x02,
@@ -149,7 +155,7 @@ struct mail_storage {
with possibly different readonly-state. */
struct mailbox *(*open_mailbox)(struct mail_storage *storage,
const char *name,
- int readonly, int fast);
+ enum mailbox_open_flags flags);
/* name is allowed to contain multiple new hierarchy levels.
If only_hierarchy is TRUE, the mailbox itself isn't created, just

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-src_master_mail-process_c,v 1.3 2004/06/22 21:05:20 brad Exp $
--- src/master/mail-process.c.orig 2004-06-18 15:33:48.000000000 -0400
+++ src/master/mail-process.c 2004-06-22 16:36:28.000000000 -0400
@@ -217,6 +217,8 @@ int create_mail_process(int socket, stru
env_put("MAILDIR_CHECK_CONTENT_CHANGES=1");
if (set->mail_full_filesystem_access)
env_put("FULL_FILESYSTEM_ACCESS=1");
+ if (set->index_mmap_invalidate)
+ env_put("MMAP_INVALIDATE=1");
(void)umask(set->umask);
env_put(t_strconcat("MBOX_LOCKS=", set->mbox_locks, NULL));

View File

@ -1,23 +0,0 @@
$OpenBSD: patch-src_master_master-settings_c,v 1.4 2005/02/12 12:17:07 brad Exp $
--- src/master/master-settings.c.orig Mon Aug 9 16:10:08 2004
+++ src/master/master-settings.c Fri Oct 1 02:40:01 2004
@@ -72,6 +72,7 @@ static struct setting_def setting_defs[]
DEF(SET_INT, mbox_dotlock_change_timeout),
DEF(SET_INT, umask),
DEF(SET_BOOL, mail_drop_priv_before_exec),
+ DEF(SET_BOOL, index_mmap_invalidate),
/* imap */
DEF(SET_STR, imap_executable),
@@ -189,6 +190,11 @@ struct settings default_settings = {
MEMBER(mbox_dotlock_change_timeout) 30,
MEMBER(umask) 0077,
MEMBER(mail_drop_priv_before_exec) FALSE,
+#ifdef NEED_MS_INVALIDATE
+ MEMBER(index_mmap_invalidate) TRUE,
+#else
+ MEMBER(index_mmap_invalidate) FALSE,
+#endif
/* imap */
MEMBER(imap_executable) PKG_LIBEXECDIR"/imap",

View File

@ -1,11 +0,0 @@
$OpenBSD: patch-src_master_master-settings_h,v 1.3 2004/06/22 21:05:20 brad Exp $
--- src/master/master-settings.h.orig 2004-06-17 20:53:06.000000000 -0400
+++ src/master/master-settings.h 2004-06-17 21:13:53.000000000 -0400
@@ -56,6 +56,7 @@ struct settings {
unsigned int mbox_dotlock_change_timeout;
unsigned int umask;
int mail_drop_priv_before_exec;
+ int index_mmap_invalidate;
/* imap */
const char *imap_executable;

View File

@ -1,22 +0,0 @@
$OpenBSD: patch-src_pop3_client_c,v 1.3 2005/02/12 12:17:07 brad Exp $
--- src/pop3/client.c.orig Wed Sep 1 10:28:02 2004
+++ src/pop3/client.c Fri Oct 1 02:40:01 2004
@@ -108,6 +108,7 @@ static int init_mailbox(struct client *c
struct client *client_create(int hin, int hout, struct mail_storage *storage)
{
struct client *client;
+ enum mailbox_open_flags flags;
client = i_new(struct client, 1);
client->input = i_stream_create_file(hin, default_pool,
@@ -124,7 +125,9 @@ struct client *client_create(int hin, in
storage->set_callbacks(storage, &mail_storage_callbacks, client);
- client->mailbox = storage->open_mailbox(storage, "INBOX", FALSE, FALSE);
+ flags = getenv("MMAP_INVALIDATE") != NULL ?
+ MAILBOX_OPEN_MMAP_INVALIDATE : 0;
+ client->mailbox = storage->open_mailbox(storage, "INBOX", flags);
if (client->mailbox == NULL) {
i_error("Couldn't open INBOX: %s",
storage->get_last_error(storage, NULL));

View File

@ -1,2 +0,0 @@
@comment $OpenBSD: PFRAG.mysql,v 1.1 2005/07/23 20:38:17 brad Exp $
share/examples/dovecot/dovecot-mysql.conf

View File

@ -1,2 +0,0 @@
@comment $OpenBSD: PFRAG.postgresql,v 1.1 2005/07/23 20:38:17 brad Exp $
share/examples/dovecot/dovecot-pgsql.conf

View File

@ -1,16 +1,21 @@
@comment $OpenBSD: PLIST,v 1.9 2005/07/23 20:38:17 brad Exp $
@comment $OpenBSD: PLIST,v 1.10 2005/09/04 18:22:30 brad Exp $
@newgroup _dovecot:518
@newuser _dovecot:518:_dovecot:daemon:Dovecot Account:/nonexistent:/sbin/nologin
libexec/dovecot/
libexec/dovecot/checkpassword-reply
libexec/dovecot/deliver
libexec/dovecot/dovecot-auth
libexec/dovecot/imap
libexec/dovecot/imap-login
libexec/dovecot/pop3
libexec/dovecot/pop3-login
libexec/dovecot/rawlog
sbin/dovecot
sbin/dovecot-mkcert.sh
sbin/dovecotpw
share/doc/dovecot/
share/doc/dovecot/USE-WIKI-INSTEAD
share/doc/dovecot/auth-protocol.txt
share/doc/dovecot/auth.txt
share/doc/dovecot/configuration.txt
share/doc/dovecot/design.txt
@ -19,11 +24,11 @@ share/doc/dovecot/mail-storages.txt
share/doc/dovecot/multiaccess.txt
share/doc/dovecot/nfs.txt
share/doc/dovecot/securecoding.txt
share/doc/dovecot/variables.txt
share/examples/dovecot/
share/examples/dovecot/dovecot-example.conf
%%mysql%%
%%postgresql%%
@sample ${SYSCONFDIR}/dovecot.conf
share/examples/dovecot/dovecot-sql.conf
share/examples/dovecot/dovecot-openssl.cnf
@sample ${SYSCONFDIR}/ssl/dovecot-openssl.cnf
@mode 700