Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ext/imap/tests/bug77020.phpt tries to send mail #11629

Closed
orlitzky opened this issue Jul 7, 2023 · 3 comments
Closed

ext/imap/tests/bug77020.phpt tries to send mail #11629

orlitzky opened this issue Jul 7, 2023 · 3 comments

Comments

@orlitzky
Copy link
Contributor

orlitzky commented Jul 7, 2023

Description

I noticed today that this test actually tries to send mail:

$ cat ext/imap/tests/bug77020.phpt
--TEST--
Bug #77020 (null pointer dereference in imap_mail)
--EXTENSIONS--
imap
--FILE--
<?php
@imap_mail('1', 1, NULL);
echo 'done'
?>
--EXPECTF--
%Adone

In the docs, the imap_mail() function is a bit mysterious, but if you read ext/imap/php_imap.c, then basically, it runs sendmail:

        if (!INI_STR("sendmail_path")) {
                return 0;
        }
        sendmail = popen(INI_STR("sendmail_path"), "w");
        if (sendmail) {
                ...

I was a little surprised to see it try to relay through my mail server (which is what /usr/bin/sendmail is configured to do by default):

Jul 07 17:51:31 [postfix/cleanup] 43FF23635AF: message-id=<20230707215131.43FF23635AF@gantu>
Jul 07 17:51:31 [postfix/qmgr] 43FF23635AF: from=<[email protected]>, size=272, nrcpt=1 (queue active)
Jul 07 17:51:31 [postfix/smtp] 43FF23635AF: to=<[email protected]>, orig_to=<1> ... 554 5.7.1 <[email protected]>: Recipient address rejected: Access denied (in reply to RCPT TO command))

I can probably fix this in our distribution package by setting sendmail_path = /bin/true or something like that, but I think it's a big enough surprise to report. A similar solution might work in the test itself, but I don't know what we could use on Windows.

PHP Version

php-8.2.8

Operating System

No response

@nielsdos
Copy link
Member

nielsdos commented Jul 7, 2023

Setting sendmail_path would work for Linux. But the WIN32 code seems to take a different path unfortunately.

@nielsdos nielsdos self-assigned this Jul 8, 2023
nielsdos added a commit to nielsdos/php-src that referenced this issue Jul 8, 2023
@nielsdos nielsdos linked a pull request Jul 8, 2023 that will close this issue
@alecpl
Copy link

alecpl commented Jul 8, 2023

Why there is an imap_mail() function that duplicates mail() and has nothing to do with IMAP is beyond me.

@orlitzky
Copy link
Contributor Author

orlitzky commented Jul 8, 2023

Why there is an imap_mail() function that duplicates mail() and has nothing to do with IMAP is beyond me.

The extension needs to be deprecated, really. It's a wrapper around the old UW-IMAP c-client library that has been abandoned for 15 years. Asterisk (the VOIP server) is the only other project I know of that still depends on it.

One thing at a time though.

nielsdos added a commit that referenced this issue Jul 10, 2023
* PHP-8.1:
  Fix GH-11630: proc_nice_basic.phpt only works at certain nice levels
  Fix GH-11629: bug77020.phpt tries to send mail
  Fix GH-11625: DOMElement::replaceWith() doesn't replace node with DOMDocumentFragment but just deletes node or causes wrapping <></> depending on libxml2 version
nielsdos added a commit that referenced this issue Jul 10, 2023
* PHP-8.2:
  Fix GH-11630: proc_nice_basic.phpt only works at certain nice levels
  Fix GH-11629: bug77020.phpt tries to send mail
  Fix GH-11625: DOMElement::replaceWith() doesn't replace node with DOMDocumentFragment but just deletes node or causes wrapping <></> depending on libxml2 version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants