diff options
author | Stanislav Malyshev <stas@php.net> | 2015-01-25 01:21:53 -0800 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2015-01-28 10:15:11 -0800 |
commit | 14d6de97c5f54ec66dbb6b18ebe9cd0d279e4784 (patch) | |
tree | 561eea8ac7b15138bad5c2bfd93c724c03fea955 | |
parent | b7751630d1c50821146fc5732d05ede05ffdee5f (diff) | |
download | php-git-14d6de97c5f54ec66dbb6b18ebe9cd0d279e4784.tar.gz |
add imap
-rw-r--r-- | .travis.yml | 3 | ||||
-rw-r--r-- | ext/imap/php_imap.c | 5 | ||||
-rw-r--r-- | ext/imap/tests/imap_fetchstructure_basic.phpt | 10 | ||||
-rw-r--r-- | ext/imap/tests/imap_include.inc | 2 | ||||
-rwxr-xr-x | travis/compile.sh | 7 | ||||
-rw-r--r-- | travis/ext/imap/dovecot.conf | 22 | ||||
-rw-r--r-- | travis/ext/imap/dovecotpass | 1 | ||||
-rw-r--r-- | travis/ext/imap/imap.exp | 29 | ||||
-rw-r--r-- | travis/ext/imap/setup.sh | 11 |
9 files changed, 81 insertions, 9 deletions
diff --git a/.travis.yml b/.travis.yml index 418a4f28b3..8b40464432 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,7 @@ env: before_install: - sudo apt-get update -qq - - sudo apt-get install -y libenchant-dev libaspell-dev libpspell-dev librecode-dev + - sudo apt-get install -y libenchant-dev libaspell-dev libpspell-dev librecode-dev libsasl2-dev libxpm-dev libt1-dev libc-client2007e-dev - sudo cp ./travis/de /var/lib/locales/supported.d/de - sudo dpkg-reconfigure locales - ./travis/install.sh @@ -40,6 +40,7 @@ before_script: - . ./travis/ext/pdo_mysql/setup.sh - . ./travis/ext/pgsql/setup.sh - . ./travis/ext/pdo_pgsql/setup.sh + - . ./travis/ext/imap/setup.sh # Run PHPs run-tests.php script: diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 0e3ec533a6..ceaa53afcf 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -1235,7 +1235,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) imap_stream = mail_open(NIL, mailbox->val, flags); if (imap_stream == NIL) { - php_error_docref(NULL, E_WARNING, "Couldn't open stream %s", mailbox); + php_error_docref(NULL, E_WARNING, "Couldn't open stream %s", mailbox->val); efree(IMAPG(imap_user)); IMAPG(imap_user) = 0; efree(IMAPG(imap_password)); IMAPG(imap_password) = 0; RETURN_FALSE; @@ -1340,6 +1340,7 @@ PHP_FUNCTION(imap_append) } } + zend_string_free(regex); ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap); INIT (&st, mail_string, (void *) message->val, message->len); @@ -4045,7 +4046,7 @@ PHP_FUNCTION(imap_search) int argc = ZEND_NUM_ARGS(); SEARCHPGM *pgm = NIL; - if (zend_parse_parameters(argc, "rs|lS", &streamind, &criteria, &flags, &charset) == FAILURE) { + if (zend_parse_parameters(argc, "rS|lS", &streamind, &criteria, &flags, &charset) == FAILURE) { return; } diff --git a/ext/imap/tests/imap_fetchstructure_basic.phpt b/ext/imap/tests/imap_fetchstructure_basic.phpt index 7ad4fc5622..dcf6148a1e 100644 --- a/ext/imap/tests/imap_fetchstructure_basic.phpt +++ b/ext/imap/tests/imap_fetchstructure_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -imap_fetchstructure() function : basic functionality +imap_fetchstructure() function : basic functionality --CREDITS-- Olivier Doucet --SKIPIF-- @@ -34,12 +34,13 @@ var_dump($z->type); var_dump($z->encoding); var_dump($z->bytes); var_dump($z->lines); -var_dump(is_object($z->parameters)); +var_dump($z->ifparameters); +var_dump(is_object($z->parameters[0])); imap_close($stream_id); ?> --CLEAN-- -<?php +<?php require_once('clean.inc'); ?> --EXPECTF-- @@ -67,4 +68,5 @@ int(%d) int(%d) int(%d) int(%d) -bool(true)
\ No newline at end of file +int(1) +bool(true) diff --git a/ext/imap/tests/imap_include.inc b/ext/imap/tests/imap_include.inc index b33a10e5e8..110a449cd5 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 = '{localhost/norsh}'; +$server = '{127.0.0.1/norsh}'; $default_mailbox = $server . "INBOX"; $domain = "something.com"; $admin_user = "webmaster"; // a user with admin access diff --git a/travis/compile.sh b/travis/compile.sh index 9add843a2e..2a78beeea5 100755 --- a/travis/compile.sh +++ b/travis/compile.sh @@ -53,8 +53,13 @@ $TS \ --enable-calendar \ --enable-ftp \ --with-pspell=/usr \ ---with-recode=/usr \ --with-enchant=/usr \ --enable-wddx \ +--with-imap \ +--with-imap-ssl \ +--with-freetype-dir=/usr \ +--with-t1lib=/usr \ +--with-xpm-dir=/usr \ +--with-kerberos \ --enable-sysvmsg make --quiet diff --git a/travis/ext/imap/dovecot.conf b/travis/ext/imap/dovecot.conf new file mode 100644 index 0000000000..c321cb0099 --- /dev/null +++ b/travis/ext/imap/dovecot.conf @@ -0,0 +1,22 @@ +auth_debug = yes +auth_mechanisms = login +auth_verbose = yes +disable_plaintext_auth = no +auth_mechanisms = plain login cram-md5 +listen = * +mail_location = maildir:/home/vmail/mail/%d/%n/Maildir +mbox_write_locks = fcntl +passdb { + args = /etc/dovecot/dovecotpass + driver = passwd-file +} +protocols = imap +service auth { + user = root +} +ssl = no +userdb { + args = uid=11459 gid=10002 home=/home/vmail/dovecot/mail/%d/%n + driver = static +} +log_path = /var/log/dovecot.log diff --git a/travis/ext/imap/dovecotpass b/travis/ext/imap/dovecotpass new file mode 100644 index 0000000000..f68e6c3cae --- /dev/null +++ b/travis/ext/imap/dovecotpass @@ -0,0 +1 @@ +webmaster@something.com:{plain}p4ssw0rd diff --git a/travis/ext/imap/imap.exp b/travis/ext/imap/imap.exp new file mode 100644 index 0000000000..de254bbd8f --- /dev/null +++ b/travis/ext/imap/imap.exp @@ -0,0 +1,29 @@ +send_user "IMAP test start..." +spawn telnet 127.0.0.1 143 + +expect "Dovecot ready" { + send_user "OK: $expect_out(0,string)\n" +} "refused" { + send_user "connect to POP refused\n" + exit 1 +} timeout { + send_user "connect to POP timeout\n" + exit 1 +} + +send "a1 LOGIN webmaster@something.com p4ssw0rd\n" + +expect "a1 OK" { + send_user "OK, imap works\n" +} "a1 NO*" { + send_user "auth failed: $expect_out(buffer)\n" + exit 1 +} "error*" { + send_user "ERROR: $expect_out(buffer)\n" +} timeout { + send_user "connect to POP timeout\n" + exit 1 +} + +exit 0 + diff --git a/travis/ext/imap/setup.sh b/travis/ext/imap/setup.sh new file mode 100644 index 0000000000..228fee037b --- /dev/null +++ b/travis/ext/imap/setup.sh @@ -0,0 +1,11 @@ +#!/bin/sh +sudo groupadd -g 10002 vmail +sudo useradd -g 10002 -u 11459 vmail +sudo apt-get -y install expect dovecot-imapd +sudo cp ./travis/ext/imap/dovecot.conf ./travis/ext/imap/dovecotpass /etc/dovecot +sudo mkdir -p /home/vmail/mail/something.com +sudo chown -R vmail:vmail /home/vmail/mail +sudo chmod -R u+w /home/vmail/mail +sudo service dovecot stop +sudo service dovecot start +expect ./travis/ext/imap/imap.exp |