summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Peter Banyard <girgias@php.net>2020-09-17 17:22:01 +0200
committerGeorge Peter Banyard <girgias@php.net>2020-09-18 23:02:01 +0200
commitef9359d30fe3e26de86fd6790d273612c2488dd7 (patch)
tree1b8dd1615a356b2d1438ccb68af78b8462dccd22
parent19314ff8874e7c0a04a97acf342341938c0ffa6c (diff)
downloadphp-git-ef9359d30fe3e26de86fd6790d273612c2488dd7.tar.gz
Set-up IMAP in Azure
Closes GH-6162
-rw-r--r--azure/apt.yml1
-rw-r--r--azure/configure.yml3
-rw-r--r--azure/setup.yml8
-rw-r--r--ext/imap/tests/bug75774.phpt9
-rw-r--r--ext/imap/tests/dovecot.conf33
-rw-r--r--ext/imap/tests/dovecotpass1
-rw-r--r--ext/imap/tests/imap_include.inc2
-rw-r--r--ext/imap/tests/setup.sh6
-rw-r--r--ext/imap/tests/skipif.inc2
9 files changed, 58 insertions, 7 deletions
diff --git a/azure/apt.yml b/azure/apt.yml
index bd3ba3308e..71f58ce8da 100644
--- a/azure/apt.yml
+++ b/azure/apt.yml
@@ -42,5 +42,6 @@ steps:
snmp-mibs-downloader \
unixodbc-dev \
llvm \
+ libc-client-dev libkrb5-dev dovecot-core dovecot-pop3d dovecot-imapd \
${{ parameters.packages }}
displayName: 'APT'
diff --git a/azure/configure.yml b/azure/configure.yml
index dc7f754eae..0bfbf6d92e 100644
--- a/azure/configure.yml
+++ b/azure/configure.yml
@@ -58,6 +58,9 @@ steps:
--enable-dba \
--with-snmp \
--with-unixODBC \
+ --with-imap \
+ --with-kerberos \
+ --with-imap-ssl \
--enable-werror \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d
diff --git a/azure/setup.yml b/azure/setup.yml
index 825ca4d5f6..e0b4dc79da 100644
--- a/azure/setup.yml
+++ b/azure/setup.yml
@@ -16,4 +16,12 @@ steps:
sudo cp ext/snmp/tests/bigtest /etc/snmp
sudo service snmpd restart
displayName: 'Configure snmpd'
+ - script: |
+ set -e
+ sudo groupadd -g 5000 vmail
+ sudo useradd -m -d /var/vmail -s /bin/false -u 5000 -g vmail vmail
+ sudo cp ext/imap/tests/dovecot.conf /etc/dovecot/dovecot.conf
+ sudo cp ext/imap/tests/dovecotpass /etc/dovecot/dovecotpass
+ sudo service dovecot restart
+ displayName: 'Configure IMAP'
diff --git a/ext/imap/tests/bug75774.phpt b/ext/imap/tests/bug75774.phpt
index 42f5a842c3..08883ad8f0 100644
--- a/ext/imap/tests/bug75774.phpt
+++ b/ext/imap/tests/bug75774.phpt
@@ -8,12 +8,12 @@ extension_loaded('imap') or die('skip imap extension not available in this build
<?php
$fn = __DIR__ . DIRECTORY_SEPARATOR . "foo75774";
-$var1=fopen($fn, "w");
+$var1 = fopen($fn, "w");
try {
imap_append($var1, "", "", "", "");
-} catch (Throwable $e) {
- echo "\nException: " . $e->getMessage() . "\n";
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
}
fclose($var1);
@@ -22,5 +22,4 @@ unlink($fn);
?>
--EXPECTF--
Warning: imap_append(): Internal date not correctly formatted in %s on line %d
-
-Exception: imap_append(): Supplied resource is not a valid imap resource
+imap_append(): supplied resource is not a valid imap resource
diff --git a/ext/imap/tests/dovecot.conf b/ext/imap/tests/dovecot.conf
new file mode 100644
index 0000000000..c465ba3ce9
--- /dev/null
+++ b/ext/imap/tests/dovecot.conf
@@ -0,0 +1,33 @@
+# 2.2.33.2 (d6601f4ec): /etc/dovecot/dovecot.conf
+# Pigeonhole version 0.4.21 (92477967)
+listen = *, ::
+
+# To make authentication work
+ssl = no
+disable_plaintext_auth = no
+
+auth_mechanisms = plain cram-md5
+auth_username_format = %u
+auth_debug = yes
+auth_verbose = yes
+#log
+log_path = /var/log/dovecot.log
+# If not set, use the value from log_path
+info_log_path = /var/log/dovecot-info.log
+# If not set, use the value from info_log_path
+debug_log_path = /var/log/dovecot-debug.log
+## Mailbox locations and namespaces
+mail_location = maildir:/var/vmail/dovecot/mail/%d/%n/Maildir
+passdb {
+ args = scheme=cram-md5 /etc/dovecot/dovecotpass
+ driver = passwd-file
+}
+protocols = imap
+service auth {
+ user = root
+}
+userdb {
+ args = /etc/dovecot/dovecotpass
+ driver = passwd-file
+ override_fields = home=/var/vmail/dovecot/mail/%d/%n
+}
diff --git a/ext/imap/tests/dovecotpass b/ext/imap/tests/dovecotpass
new file mode 100644
index 0000000000..86a069fc4f
--- /dev/null
+++ b/ext/imap/tests/dovecotpass
@@ -0,0 +1 @@
+webmaster@something.com:{CRAM-MD5}be5f3177e9c7c06403272f25d983ba630df4ef40476b353bb3087a8401713451:vmail:vmail
diff --git a/ext/imap/tests/imap_include.inc b/ext/imap/tests/imap_include.inc
index 7de634075a..e57d651697 100644
--- a/ext/imap/tests/imap_include.inc
+++ b/ext/imap/tests/imap_include.inc
@@ -1,6 +1,6 @@
<?php
// Change these to make tests run successfully
-$server = '{127.0.0.1/norsh}';
+$server = '{127.0.0.1:143/norsh}';
$default_mailbox = $server . "INBOX";
$domain = "something.com";
$admin_user = "webmaster"; // a user with admin access
diff --git a/ext/imap/tests/setup.sh b/ext/imap/tests/setup.sh
new file mode 100644
index 0000000000..5cb18334a3
--- /dev/null
+++ b/ext/imap/tests/setup.sh
@@ -0,0 +1,6 @@
+sudo service dovecot stop
+sudo groupadd -g 5000 vmail
+sudo useradd -m -d /var/vmail -s /bin/false -u 5000 -g vmail vmail
+sudo cp ext/imap/tests/dovecot.conf /etc/dovecot/dovecot.conf
+sudo cp ext/imap/tests/dovecotpass /etc/dovecot/dovecotpass
+sudo service dovecot start
diff --git a/ext/imap/tests/skipif.inc b/ext/imap/tests/skipif.inc
index 2820bff5c6..2167ad1d0c 100644
--- a/ext/imap/tests/skipif.inc
+++ b/ext/imap/tests/skipif.inc
@@ -2,7 +2,7 @@
extension_loaded('imap') or die('skip imap extension not available in this build');
// Change these to make tests run successfully
-$mailbox = '{localhost/norsh}';
+$mailbox = '{127.0.0.1:143/debug/norsh}';
$username = 'webmaster@something.com';
$password = 'p4ssw0rd';
$options = OP_HALFOPEN; // this should be enough to verify server present