mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
add imap
This commit is contained in:
parent
b7751630d1
commit
14d6de97c5
9 changed files with 81 additions and 9 deletions
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
int(1)
|
||||
bool(true)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
22
travis/ext/imap/dovecot.conf
Normal file
22
travis/ext/imap/dovecot.conf
Normal file
|
@ -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
|
1
travis/ext/imap/dovecotpass
Normal file
1
travis/ext/imap/dovecotpass
Normal file
|
@ -0,0 +1 @@
|
|||
webmaster@something.com:{plain}p4ssw0rd
|
29
travis/ext/imap/imap.exp
Normal file
29
travis/ext/imap/imap.exp
Normal file
|
@ -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
|
||||
|
11
travis/ext/imap/setup.sh
Normal file
11
travis/ext/imap/setup.sh
Normal file
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue