[reposting to list, even if you posted other messages after this]

Vadtec a écrit :
>> you have an error in your perl script.
>>   
> Maybe.


debug the script. run it manually.

>>  
>>> [snipped to save space]
>>>
>>> <[EMAIL PROTECTED]>: cannot append message to file
>>>    /path/to/my/perl/script/parse.pl: cannot open file:
>>>    Permission denied
>>>
>>>     
>>
>> why would you append a message to a perl script?
>>   
> Because Perl has the nifty ability to receive from stdin so that I can
> parse the e-mail to extract data from it. I don't so much care about the
> e-mail it self.

That's not how I understand it. I understand it like this: the message
is being appended to (added to the end of) the file /path/.../parse.pl,
not being passed to stding after executing the script. To be clear, this
is like:

# cat message.eml >> /path/.../parse.pl

after a message is appended, the script is invalid (syntax errors). and
after more and more messages are appended, the script becomes larger and
larger. do you understand what I mean?


> parse: |perl /path/to/my/script/parse.pl

As Wietse said, quote the command:

parse: "|perl /path/to/..../parse.pl"

and instead of running perl like this, add "#!/usr/bin/perl" (adjust the
path if perl is somewhere else) at the beginning of the script, and make
the script executable. This way you can simply do

parse: "|/path/.../parse.pl"

it is a good security practice to always use absolute paths
(/usr/bin/perl instead of perl).


Finally, since the aliases file belongs to root, the script is executed
as "nobody", which explains the permission problems.

to run the script as a user "foo", put it in a separate file, say
foo_aliases and use

alias_maps =
        hash:/etc/.../aliases
        hash:/etc/postfix/foo_aliases

then chown foo_aliases to "foo".


An alternative is to use a transport in master.cf instead of using
alias_maps.

Reply via email to