Hi all,

I have a problem while writing my dspam plugin for amavis.

In order to check the current mail I do the following:
  my($dspam_arguments) = '--mode=toe --user amavis --deliver=spam,innocent 
--process --stdout ';
  my($proc_fh,$pid) = run_command('&'.$fh->fileno, "&1", $self->{'dspam'}, 
$dspam_arguments);

Debug logging in run_command tells me that this command is run:
  /usr/local/bin/dspam --mode=toe --user amavis --deliver=spam,innocent 
--process --stdout  <&9 2>&1


Unfortunately, DSPAM fails immediately:
  Invalid training mode specified
  Unable to determine the destination user

Running the command above (both as root and user amavis) works fine.
As you can see, both the mode and the user ARE specified on the
command line.


Therefore I modified dspam.c (DSPAM 3.6.4) :
-----------------------------
int
main (int argc, char *argv[])
{
  int i;
  printf("START\n");
  for (i=0; i<argc; i++) {
    printf("%s\n", argv[i]);
  }
  printf("END\n");
-----------------------------

Now there is some interesting additional output:
START
/usr/local/bin/dspam
 --mode=toe --user amavis --deliver=spam,innocent --process --stdout 
END
Note the additional whitespace at the beginning and the end of " --mode ...".

This is quite unusual. I would expect that the command line is being
split automatically by the C library and this may indeed be the reason
why DSPAM fails.

A simple Python script which just prints the contents of sys.argv,
gives the same results as DSPAM.

On the contrary, a "normal" invocation of DSPAM (where it does not
report any errors) gives me:
START
/usr/local/bin/dspam
--mode=toe
--user
amavis
--deliver=spam,innocent
--process
--stdout
END


Does anybody know what may cause this behavior? Does it have anything
to do with the way, I am using run_command?

I am using amavisd-new 2.4.0-pre7, DSPAM 3.6.4 and Perl 5.8.5 on
CentOS 4.3 (in a VMWare Workstation, Host OS Fedora Core 5).

Thank you very much for your time!
Any help highly appreciated!

fs



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
AMaViS-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/

Reply via email to