Index:
[thread]
[date]
[author]
[stats]
From: markus schnalke <meillo@marmaro.de>
To : <masqmail@marmaro.de>
Date: Wed, 22 Feb 2012 19:50:44 +0100
Re: [masqmail] Debugging pipe calls
[2012-02-22 13:46] "Sebastian M. Alvarez" <sebastianmalvarez@gmail.com>
> On Feb 22, 2012, at 1:27 PM, markus schnalke wrote:
>> [2012-02-22 12:55] "Sebastian M. Alvarez" <sebastianmalvarez@gmail.com>
>>>
>>> The pipe I'm using works fine when running it from bash... But when
>>> masqmail pipes the email to that script, apparently the script dies
>>> at some point and never returns, and a masqmail process runs there
>>> forever...
> The call is actually working. But it seems that the
> /home/ubuntu/Olapic/olapic/Hermes.php script is hanging
> somewhere. Actually I see some logs being executed from the script
> until a certain point, and ends there. It seems that PHP is returning
> some error that I can't find a way to see
You can wrap some script around, that redirects the output to a file.
Something of this kind:
#!/bin/sh
php Hermes.php >>/tmp/foo 2>&1
Now invoke this script from masqmail.
I also took a look into the code. Masqmail does *not* give the pipe
command line directly to `sh -c', but splits it at whitespace and does
an execve() then. For your pipe command:
pipe="/usr/bin/php /home/ubuntu/Olapic/olapic/Hermes.php
--execute EmailUploader &> /tmp/emailjob"
This means, that the stdout/stderr redirection `&>' will not be
carried out, but is given as 4th argument to php.
Solution: Put that command line into a small script and execute that
one. That should work.
The reason, why masqmail does not execute the command line with `sh
-c' seems to be security related. Oliver (oku) had added this command
line splitting later into the peopen snippet he'd found on
sourceforge. The original code's still there. See src/peopen.c for
details.
I'm not convinced that this is the right choice. If the user want's
this command executed this way, why not do exactly that. If quoting is
used to conceil whitespace within an argument, it would be broken up.
Hmm...
(btw: Although not relevant here, some general advice: Such commands
are often executed by /bin/sh, be sure your /bin/sh does recognize
constructs like `&>'. I think dash does not, and Ubuntu for instance
has dash as /bin/sh.)
meillo
>> P.S.
>>> Córdoba, Argentina
>>
>> Saludos a Argentina. :-) Cuanto calor tienen en Cordoba hoy? Y sabes
>> lo de Santiago del Estero tambien?
>
> Hey! Hablas español!?
Si, un poco. :-)
> Vinimos con unos dias de mucho calor, pero ahora esta lindo :)
> En córdoba esta lindo, 26º C...
> Santiago del estero 27
Que lindo. Tenemos -10 C en las noches aqui en Alemania.
> Sos de Santiago?
No, pero fue en Santiago por tres meses, un ano pasado, entre Octubre
y Deciembre 2010. Se han dicho, que hay *mucho* calor en Enero y
Febrero en Santiago: mas de 50 C en 2009.
Index:
[thread]
[date]
[author]
[stats]