Add fix from upstream repo, "mbox: If INBOX creation fails because

of EACCES, try with privileged group enabled."

http://hg.dovecot.org/dovecot-1.0/rev/932768a879c6
From Brad.
This commit is contained in:
sthen 2008-05-28 23:08:03 +00:00
parent d0768598fe
commit a059f2473f
3 changed files with 37 additions and 4 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.94 2008/05/22 07:55:08 sthen Exp $
# $OpenBSD: Makefile,v 1.95 2008/05/28 23:08:03 sthen Exp $
SHARED_ONLY= Yes
@ -10,7 +10,7 @@ V_DOVECOT= 1.0.13
V_SIEVE= 1.0.2
PKGNAME= dovecot-${V_DOVECOT}
PKGNAME-server= dovecot-${V_DOVECOT}p2
PKGNAME-server= dovecot-${V_DOVECOT}p3
PKGNAME-sieve= dovecot-sieve-${V_SIEVE}p8
DISTNAME= dovecot-${V_DOVECOT}

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-dovecot-example_conf,v 1.39 2008/03/16 18:46:14 brad Exp $
$OpenBSD: patch-dovecot-example_conf,v 1.40 2008/05/28 23:08:03 sthen Exp $
--- dovecot-example.conf.orig Tue Mar 4 00:48:12 2008
+++ dovecot-example.conf Tue Mar 4 01:43:48 2008
+++ dovecot-example.conf Tue May 27 19:46:09 2008
@@ -10,13 +10,12 @@
# value inside quotes, eg.: key = "# char and trailing whitespace "
@ -55,6 +55,15 @@ $OpenBSD: patch-dovecot-example_conf,v 1.39 2008/03/16 18:46:14 brad Exp $
# Set max. process size in megabytes. If you don't use
# login_process_per_connection you might need to grow this.
@@ -253,7 +252,7 @@
#}
# Group to enable temporarily for privileged operations. Currently this is
-# used only for creating mbox dotlock files when creation fails for INBOX.
+# used only with INBOX when either its initial creation or dotlocking fails.
# Typically this is set to "mail" to give access to /var/mail.
#mail_privileged_group =
@@ -293,7 +292,7 @@
# Don't write() to mmaped files. This is required for some operating systems

View File

@ -0,0 +1,24 @@
$OpenBSD: patch-src_lib-storage_index_mbox_mbox-storage_c,v 1.5 2008/05/28 23:08:03 sthen Exp $
--- src/lib-storage/index/mbox/mbox-storage.c.orig Tue May 27 19:46:44 2008
+++ src/lib-storage/index/mbox/mbox-storage.c Tue May 27 19:47:39 2008
@@ -4,6 +4,7 @@
#include "ioloop.h"
#include "buffer.h"
#include "istream.h"
+#include "restrict-access.h"
#include "home-expand.h"
#include "mkdir-parents.h"
#include "unlink-directory.h"
@@ -537,6 +538,12 @@ static int verify_inbox(struct index_storage *storage)
/* make sure inbox file itself exists */
fd = open(storage->inbox_path, O_RDWR | O_CREAT | O_EXCL, 0660);
+ if (fd == -1 && errno == EACCES) {
+ /* try again with increased privileges */
+ (void)restrict_access_use_priv_gid();
+ fd = open(storage->inbox_path, O_RDWR | O_CREAT | O_EXCL, 0660);
+ restrict_access_drop_priv_gid();
+ }
if (fd != -1)
(void)close(fd);
else if (errno == ENOTDIR &&