OK, so I tried this:

#!/usr/bin/perl

    if ($#ARGV != 0) {
        die "Usage:  $0 outputfile\n";
    }

open (INFD, "<&1") or die "BAD FD IN";
open (OUTFILE, ">$ARGV[0]") or die "BAD FILE OUT";
# open (OUTFD, ">&1") or die "BAD FD OUT";

while (<INFD>) {
  print OUTFILE "$_";
#  print OUTFD "$_";
}

close (OUTFILE);
close (INFD);
# close (OUTFD);

I tried as is and with the commented lines enabled (just to be sure I didn't step on 
my input for some silly reason). I still end up with a 0 byte
output file, same as
using redirection in the shell. The more I think about it, I'm almost certain that my 
script does not have access to this data (so to speak) when run
via qmail-qfilter.

I think it's time to go back to the drawing board and go dig in the qmail-qfilter 
source. Any more ideas, concurrences, disagreements, etc?

Thanks,
Josh





"Ihnen, David" <[EMAIL PROTECTED]> on 07/19/2000 03:02:08 PM

To:   "Ihnen, David" <[EMAIL PROTECTED]>, "'[EMAIL PROTECTED]'"
      <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
cc:
Subject:  RE: How to grab the envelope contents while filtering? - syntax e
      rror


Provided you remove the comma from the print statement, it'll actually work
too.  ;)

David

-----Original Message-----
From: Ihnen, David [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 19, 2000 11:58 AM
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: How to grab the envelope contents while filtering?


In fooling with tcpclient I found the syntax to do this.  As I'm a perl
junky, here's a program that will read descriptor 6 and print to descriptor
7.  If you know any perl at all this should get you to where you need to
be.

#!/usr/bin/perl

# read descriptor 6 and print it to descriptor 7

open INFILE, "<&6" or die "BAD IN";
open OUTFILE, ">&7" or die "BAD OUT";

while (<INFILE>) {
  print OUTFILE, $_;
}

close OUTFILE;
close INFILE;


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 19, 2000 11:20 AM
To: [EMAIL PROTECTED]
Subject: How to grab the envelope contents while filtering?


Hi all,

I'm using a content filter shell script that I've written (based on inflex)
with qmail-qfilter. During this filter process, I'd like to grab the
contents of the envelope and store them in a file for use later (ie,
reconstructing the envelope for an inject).

I've toyed with trying to pipe fd 1 into a file without success. I know
that this has to be doable with a small C program, but quite honestly, I
don't have the familiarity with C to do it. Can it be done with Perl? In
the shell? Is it as simple as reading fd1, writing a file, and re-writing
fd1?

Any ideas on how I can accomplish this?

Some details:

qmail 1.03
qmail-qfilter 1.0
Redhat 6.2


Thanks in advance for any help,
Josh Tibbs
Kendle International Inc.


$RFC822.eml

Reply via email to