]> granicus.if.org Git - php/commitdiff
Set-up IMAP in Azure
authorGeorge Peter Banyard <girgias@php.net>
Thu, 17 Sep 2020 15:22:01 +0000 (17:22 +0200)
committerGeorge Peter Banyard <girgias@php.net>
Fri, 18 Sep 2020 21:02:01 +0000 (23:02 +0200)
Closes GH-6162

azure/apt.yml
azure/configure.yml
azure/setup.yml
ext/imap/tests/bug75774.phpt
ext/imap/tests/dovecot.conf [new file with mode: 0644]
ext/imap/tests/dovecotpass [new file with mode: 0644]
ext/imap/tests/imap_include.inc
ext/imap/tests/setup.sh [new file with mode: 0644]
ext/imap/tests/skipif.inc

index bd3ba3308e01b845ec64d4e2164d6e6498dd3192..71f58ce8da2ade07d86c75e0330fe3208dca7e17 100644 (file)
@@ -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'
index dc7f754eae4252107f9e0b938ebe6d90ae74f86d..0bfbf6d92e0ece91c72525387d01b608b802abfa 100644 (file)
@@ -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
index 825ca4d5f6c01aebdd52e2b6a1188e45aff8293f..e0b4dc79da991fe2f3e4737c3599fee8f773134f 100644 (file)
@@ -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'
 
index 42f5a842c3469a39a247079e857cf75d9ba7cd3c..08883ad8f0ab56a67b2c535fea468e7ec43d635a 100644 (file)
@@ -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 (file)
index 0000000..c465ba3
--- /dev/null
@@ -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 (file)
index 0000000..86a069f
--- /dev/null
@@ -0,0 +1 @@
+webmaster@something.com:{CRAM-MD5}be5f3177e9c7c06403272f25d983ba630df4ef40476b353bb3087a8401713451:vmail:vmail
index 7de634075a29594f6787dc10a7b1aa3c117880db..e57d6516979f20dea915877a034e42ca4e71fb55 100644 (file)
@@ -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 (file)
index 0000000..5cb1833
--- /dev/null
@@ -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
index 2820bff5c69f4ce3b4e46ea751a006be189fb7bf..2167ad1d0cd652ea0fc5d20d42bdb40a3aa05e4f 100644 (file)
@@ -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