Net::Server::PreforkSimple and External Commands

Discussion in 'Perl Misc' started by afrinspray@gmail.com, May 14, 2005.

  1. Guest

    I'm using the Net::Server::preForkSimple framework and
    Net::Server::Mail::ESMTP to make a content filter for postfix. I need
    to call an external program in the data callback of Mail::ESMTP but I'm
    having trouble executing external commands with Exec, System and
    Backticks. Perl returns no errors, and the SMTP client is disconnected
    immediately when calling the command (I just put an echo command in for
    testing, so it's not that).

    Does Net::Server::preforkSimple allow external commands to be executed?
    Any ideas?

    Thanks,

    Mike
     
    , May 14, 2005
    #1
    1. Advertising

  2. Anno Siegel Guest

    <> wrote in comp.lang.perl.misc:
    > I'm using the Net::Server::preForkSimple framework and
    > Net::Server::Mail::ESMTP to make a content filter for postfix. I need
    > to call an external program in the data callback of Mail::ESMTP but I'm
    > having trouble executing external commands with Exec, System and
    > Backticks. Perl returns no errors, and the SMTP client is disconnected
    > immediately when calling the command (I just put an echo command in for
    > testing, so it's not that).
    >
    > Does Net::Server::preforkSimple allow external commands to be executed?
    > Any ideas?


    I don't know the module, but it would have to go through tremendous
    contortions to forbid "exec" and "system".

    Show a short program that demonstrates the behavior. Someone who
    happens to have Net::Server::preforkSimple may be able to run it
    and find out what's wrong.

    Anno
     
    Anno Siegel, May 14, 2005
    #2
    1. Advertising

  3. afrinspray Guest

    Sorry I didn't respond this weekend.
    Here's an example. "Got here" is printed to the client socket, but
    "got here 2" is not.

    -------------------------------------------------------------------

    #!/usr/bin/perl -w
    package PreForkSimpleTest;


    use Net::Server::preForkSimple;
    @ISA = qw(Net::Server::preForkSimple);

    sub process_request
    {
    my $self = shift;

    my $sock = $self->{server}->{client};

    print $sock "Got Here\n";
    my $cmd = `echo Hello`;
    print $sock "Got Here 2\n";

    }

    __PACKAGE__->run(20205);

    1;
     
    afrinspray, May 16, 2005
    #3
  4. afrinspray Guest

    Sorry... the bottom of the example (run(20205)) is not correct. Just
    remove the 20205 and it will default to port 20203.

    Thanks,
    Mike
     
    afrinspray, May 16, 2005
    #4
  5. afrinspray Guest

    Sorry to bump this post, but I still haven't found an answer (two weeks
    later). Can anyone think of any reason why a forked process of a
    PreForkSimple object wouldn't be able to execute external programs?
     
    afrinspray, May 31, 2005
    #5
  6. Guest

    "afrinspray" <> wrote:
    > Sorry to bump this post, but I still haven't found an answer (two weeks
    > later). Can anyone think of any reason why a forked process of a
    > PreForkSimple object wouldn't be able to execute external programs?


    I would guess it has something to do with chroot.

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
     
    , Jun 1, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. caleb
    Replies:
    0
    Views:
    2,924
    caleb
    Jan 3, 2006
  2. Ben Pfaff

    Re: man pages for C commands (GCC commands)

    Ben Pfaff, Jun 24, 2003, in forum: C Programming
    Replies:
    4
    Views:
    4,013
    Thomas Stegen
    Jun 28, 2003
  3. Avi Kak
    Replies:
    4
    Views:
    444
    Fernando Perez
    Jul 26, 2004
  4. Tim Stanka
    Replies:
    1
    Views:
    837
    Jeff Epler
    Aug 2, 2004
  5. Sol Linderstein
    Replies:
    2
    Views:
    176
    A. Sinan Unur
    Jun 1, 2004
Loading...

Share This Page