Skip to content

Commit 86d0f81

Browse files
committed
Fixing PFA bugs / MAIL-5 Adding configuration
1 parent 1e55778 commit 86d0f81

4 files changed

Lines changed: 36 additions & 2 deletions

File tree

Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
FROM eu.gcr.io/long-grin-186810/rs-php:7.4.4-apache-2.4.38.0
22
LABEL maintainer="Ralph Schuster <github@ralph-schuster.eu>"
33

4+
# PFA has a bug in 3.2 release (see below)
5+
RUN apt-get update && apt-get update && apt-get install -y --no-install-recommends \
6+
patch \
7+
&& rm -rf /var/lib/apt/lists/*
8+
49
#ADD etc/php/ /usr/local/etc/php/conf.d/
510
#ADD etc/conf/ /etc/apache2/conf-enabled/
611
#ADD etc/mods/ /etc/apache2/mods-enabled/
712
#ADD etc/sites/ /etc/apache2/sites-enabled/
8-
ADD src/ /var/www/html/
913
RUN chown -R www-data:www-data /var/www/html
1014

1115
RUN cd /var/www/html \
@@ -15,4 +19,7 @@ RUN cd /var/www/html \
1519
&& mkdir templates_c \
1620
&& chown -R www-data:www-data .
1721

22+
ADD src/ /var/www/html/
1823

24+
# Fix the crucial bug
25+
RUN patch /var/www/html/model/MailboxHandler.php < /var/www/html/MailboxHandler.patch

src/MailboxHandler.patch

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--- /var/www/html/model/MailboxHandler.php.orig 2020-04-16 17:56:52.043852299 +0000
2+
+++ /var/www/html/model/MailboxHandler.php 2020-04-16 17:58:55.600195117 +0000
3+
@@ -216,7 +216,10 @@
4+
5+
6+
protected function beforestore() {
7+
- if (isset($this->values['quota']) && $this->values['quota'] != -1) {
8+
+ if (!isset($this->values['quota']) || (trim($this->values['quota']) == '')) {
9+
+ $this->values['quota'] = -1;
10+
+ }
11+
+ if ($this->values['quota'] != -1) {
12+
$this->values['quota'] = $this->values['quota'] * Config::read('quota_multiplier'); # convert quota from MB to bytes
13+
}
14+
15+

src/config.local.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161
// In order to setup Postfixadmin, you MUST specify a hashed password here.
6262
// To create the hash, visit setup.php in a browser and type a password into the field,
6363
// on submission it will be echoed out to you as a hashed value.
64-
$CONF['setup_password'] = password_hash($_ENV['PFA_SETUP_PASS'] ? $_ENV['PFA_SETUP_PASS'] : $_ENV['PFA_DB_PASS'], PASSWORD_DEFAULT);
64+
$PFA_SALT = md5(time() . '*' . $_SERVER['REMOTE_ADDR'] . '*' . mt_rand(0, 60000));
65+
$CONF['setup_password'] = $PFA_SALT.':'.sha1($PFA_SALT.':'.($_ENV['PFA_SETUP_PASS'] ? $_ENV['PFA_SETUP_PASS'] : $_ENV['PFA_DB_PASS']));
6566

6667
// Language config
6768
// Language files are located in './languages', change as required..

src/index.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<html>
2+
<head>
3+
<title>Postfix Admin</title>
4+
<meta http-equiv="refresh" content= "0; url=public/index.php" />
5+
</head>
6+
<body>
7+
<p>The Postfix Admin directory layout changed.</p>
8+
<p>Please update your webserver config so that the DocumentRoot or Alias points to the directory "public".</p>
9+
</body>
10+
</html>
11+

0 commit comments

Comments
 (0)