procmail
[Top] [All Lists]

Re: Evaluating result of shell command

2009-08-24 03:04:40
At 04:36 2009-08-24 +0100, Stephen Allen wrote:
Professional Software Engineering wrote:
Be sure you know who the recipe is running as (in a global procmailrc
 before DROPPRIVS, it's not the user).

At this point it's running as root:mail because of the setuid/setgid bits. It *is* in a global rc file, and I drop privileges before delivery/forwarding. I wonder if I should drop even before the spam check part?

Well, it'll have an impact on whether the specified user has execute perms on the file in question, but it's not germaine to your problem in this case.


:0 fw * $     < ${SpamCheckMaxSize} * $?    test -x
${SpamCheckProg} | ${SpamCheckProg}

Uhm, what sort of problem are you having trying to accomplish it the
way you're showing above?  What's your VERBOSE logfile have to say
about it, and what are the perms of the file (and user)?

    -rwxr-xr-x 1 root root 35184 2008-03-03 14:27 /usr/bin/spamc
                                                        ^^^

    procmail: Executing "   test -x /usr/sbin/spamc"
    procmail: Non-zero exitcode (1) from "  test -x /usr/sbin/spamc"
                                                          ^^^^
As far as I can tell (reading the logs), the 'test' command is failing to find an executable file at that location, but because the permissions on spamc 755, I think procmail isn't parsing the line as I expected:

It isn't procmail, it's the pathspec you're providing.


    * $?    test -x ${SpamCheckProg}

How does procmail know that in that condition line, I want it to pass the entire condition to the shell, and just evaluate the result?

the ? flag at the front says you're evaluating the result of a command you're handing to the shell ("Use the exitcode of the specified program.") procmail itself isn't internally making a test evaluation.

Is SpamCheckProg a full and CORRECT path?  Is this running on a local
 mail system, or an NFS mount?

Local path.

But per differences above, not a CORRECT path.

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>