On Fri, 17 Mar 2000, Petr Novotny wrote:

> Sure. Please think about how qmail works:
> qmail-smtpd gets message, passes to qmail-queue, message gets 
> queued, stop.
> qmail-send wakes up, passes message to qmail-local, it passes 
> message to procmail.
> 
> The TCPREMOTEIP is present only in the first part - ie. qmail-
> smtpd (and wrappers) and qmail-queue (and wrappers).
> 

Makes perfect sense.  Many of the docs on the ORBS and Qmail sites and
related lists/sites provide examples (that I pretty much copy/pasted) that
would indicate the variable is populated when Procmail runs, so I guess I
was assuming that the qmail environment was transferred to any script
invoked from a .qmail file.

These things being said, does anyone have a good origip script to
suggest?

Someone posted the below script to a list a while ago, but it's a
little too simple (recognizes 127.0.0.1) and failed on the test message I 
requested from "[EMAIL PROTECTED]", the ORBS test address:

#!/usr/bin/perl

# Specifically for pulling the remote IP address out of Sendmail
# Received: headers. Supplied by Ophir Ronen <ophir@xxxxxxxxxxxx>,
# ever-so-slightly modified by Edward S. Marshall <emarshal@xxxxxxxxx>.
#
# $Id: origip.pl,v 1.1.1.1 1998/01/09 20:42:50 emarshal Exp $
#
# $Log: origip.pl,v $
# Revision 1.1.1.1  1998/01/09 20:42:50  emarshal
# Initial import into CVS.
#

@msg = <STDIN>;

foreach $line ( @msg )
{
        chop $line;

        if( $line =~ /.*\[(\d+.*)\]/ )
        {
                $REMOTEIP = $1;
                last;
        }
}
print STDOUT ( $REMOTEIP );


-- Chris Hardie -----------------------------
----- mailto:[EMAIL PROTECTED] ----------
-------- http://www.summersault.com/chris/ --

Reply via email to