Hi.

I have a really strange problem and cannot figure out how to do further 
debugging. So I'll explain and I hope someone can point me to things I could 
try...

I use courier (full MTA package, version 0.5.3) and apache/mod_php on the same 
server machine.

When a mod_php driven script sends a message using mail() to a locally hosted 
domain (via aliases, see below), this fails (return value "false", no further 
debugging output available). It will work when the recipient is a domain 
inside "locals" (as opposed to an aliased domain) or if it's totally 
external. 
Also, it will work if the script is not executed via mod_php but instead on 
CGI-PHP or command-line-PHP. The different forms of PHP all use mostly the 
same configuration, they all use courier's sendmail-wrapper.

I't rather weird that there are causes on both sides, it only fails when using 
mod_php *and* when sending to locally hosted but aliased domains.

Example:
PHP-Script:
<?php
echo mail('[EMAIL PROTECTED]', 'test foo bar', 'this is a test');
?>

This works when "bwurst.org" is in /etc/courier/locals.
But it fails when "aliases" contains
@bwurst.org: bernd-bwurst.org

When using PHP without mod_php, it will work anyway, no matter what recipient 
domain.


I tried several things:
* running as CLI-PHP script executed with apache UID => worked
* setting "strace -ff [...] /usr/bin/sendmail" as sendmail executable won't 
work because strace cannot do the UID switch to "mail" (SUID-bit). 
* I'm not very familiar with strace, so I don't know if strace without -f 
(or -F or -ff) should be able to run SUID binaries. But setting simple strace 
as sendmail command for PHP results in the attached lines.

All I changed in the last time was a custom courierfilter. But I just diabled 
that one with "filterctl stop", so that should be out of scope.

Could anybody help me with further debugging? What can I try? The bug is fully 
reproducable only with mod_php.

cu, Bernd
setgid(12)                              = -1 EPERM (Operation not permitted)
getuid()                                = 1001
setuid(1001)                            = 0
rt_sigaction(SIGCHLD, {SIG_DFL}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_IGN}, 8) = 0
brk(0)                                  = 0x517210
brk(0x538210)                           = 0x538210
brk(0x539000)                           = 0x539000
getuid()                                = 1001
pipe([3, 4])                            = 0
pipe([5, 6])                            = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, 
child_tidptr=0x2c375f11f780) = 8765
--- SIGCHLD (Child exited) @ 0 (0) ---
close(3)                                = 0
close(6)                                = 0
fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
fcntl(4, F_GETFL)                       = 0x1 (flags O_WRONLY)
fstat(4, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x2c375edc0000
lseek(4, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
fcntl(5, F_SETFD, FD_CLOEXEC)           = 0
fcntl(5, F_GETFL)                       = 0 (flags O_RDONLY)
fstat(5, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x2c375edc1000
lseek(5, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
rt_sigaction(SIGINT, {0x403a10, [INT], SA_RESTORER|SA_RESTART, 0x2c375edfa130}, 
{SIG_IGN}, 8) = 0
rt_sigaction(SIGTERM, {0x403a10, [TERM], SA_RESTORER|SA_RESTART, 
0x2c375edfa130}, {SIG_IGN}, 8) = 0
rt_sigaction(SIGHUP, {0x403a10, [HUP], SA_RESTORER|SA_RESTART, 0x2c375edfa130}, 
{SIG_IGN}, 8) = 0
rt_sigaction(SIGALRM, {0x401d20, [ALRM], SA_RESTORER|SA_RESTART, 
0x2c375edfa130}, {SIG_DFL}, 8) = 0
alarm(1800)                             = 0
write(4, "bernd\n", 6)                  = -1 EPIPE (Broken pipe)
--- SIGPIPE (Broken pipe) @ 0 (0) ---
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 16), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x2c375edc2000
write(1, "432 Service temporarily unavailable.\n", 37) = 37
exit_group(75)                          = ?

Attachment: signature.asc
Description: This is a digitally signed message part.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to