how to test for a qmail virtualdomain?

2001-05-16 Thread Jason R. Mastaler

Does anyone know of a reliable way to programatically test whether an
incoming message is part of a qmail virtualdomain or not?

I've been looking at qmail-send's environment variables under
both a regular setup and a virtualdomain, and can't find a surefire
way to differentiate the two cases.  Take a look at qmail-command(8)
under ENVIRONMENT VARIABLES to see what I'm talking about.

I need a method that works under vmailmgr, vpopmail, and qmail's
builtin virtualdomains support.

For example, under vpopmail, the 'USER' environment variable is set to
the virtualdomain instead of the username, so this is easily tested
for (if username != $USER, ...).  However, this isn't the case under
vmailmgr or virtualdomains.

Thanks.

-- 
(TMDA - http://tmda.sourceforge.net/)
(A qmail-based SPAM reduction system)



Re: how to test for a qmail virtualdomain?

2001-05-16 Thread Tim

  I would say the most reliable way would be to just parse
/var/qmail/virtualdomains and compare the LHS with $HOST (although this
is a problem while somebody has updated virtualdomains but haven't sent
-HUP to qmail-send yet).  Do you just need to test for these three packages
or does it need to handle all types (for example, maildrop has its own
virtual users mechanism)?  How reliable does it need to be?

  Tim

On Wed, May 16, 2001 at 09:53:13AM -0600, Jason R. Mastaler wrote:
 Does anyone know of a reliable way to programatically test whether an
 incoming message is part of a qmail virtualdomain or not?
 
 I've been looking at qmail-send's environment variables under
 both a regular setup and a virtualdomain, and can't find a surefire
 way to differentiate the two cases.  Take a look at qmail-command(8)
 under ENVIRONMENT VARIABLES to see what I'm talking about.
 
 I need a method that works under vmailmgr, vpopmail, and qmail's
 builtin virtualdomains support.
 
 For example, under vpopmail, the 'USER' environment variable is set to
 the virtualdomain instead of the username, so this is easily tested
 for (if username != $USER, ...).  However, this isn't the case under
 vmailmgr or virtualdomains.
 
 Thanks.
 
 -- 
 (TMDA - http://tmda.sourceforge.net/)
 (A qmail-based SPAM reduction system)



Re: how to test for a qmail virtualdomain?

2001-05-16 Thread Dave Sill

Jason R. Mastaler [EMAIL PROTECTED] wrote:

Does anyone know of a reliable way to programatically test whether an
incoming message is part of a qmail virtualdomain or not?

I think you'll have to parse control/virtualdomains.

I've been looking at qmail-send's environment variables under
both a regular setup and a virtualdomain, and can't find a surefire
way to differentiate the two cases.

With a virtualdomains entry like:

  virtual.domain:de5-virtual

A message sent to [EMAIL PROTECTED] is very similar to a message sent
to de5-foo@localhost. Diff'ing the qmail-command environments, I get:

 HOST2=sws5.ctd.ornl
 HOST3=sws5.ctd
 DTLINE=Delivered-To: [EMAIL PROTECTED]
 HOST4=sws5
 HOST=sws5.ctd.ornl.gov
 [EMAIL PROTECTED]
---
 HOST2=virtual
 HOST3=virtual
 DTLINE=Delivered-To: [EMAIL PROTECTED]
 HOST4=virtual
 HOST=virtual.domain
 [EMAIL PROTECTED]

-Dave



Re: how to test for a qmail virtualdomain?

2001-05-16 Thread Jason R. Mastaler

Tim [EMAIL PROTECTED] writes:

   I would say the most reliable way would be to just parse
 /var/qmail/virtualdomains and compare the LHS with $HOST (although
 this is a problem while somebody has updated virtualdomains but
 haven't sent -HUP to qmail-send yet).

In this case, how about comparing $HOST with control/locals?  Someone
suggested this in a private message since when qmail rewrites a
virtualdomain address into a local one, it changes $USER, but not
$HOST.  If $HOST is in locals, then it's not a virtualdomain address.
Any exceptions to this?

 Do you just need to test for these three packages or does it need to
 handle all types (for example, maildrop has its own virtual users
 mechanism)?

All types, I just wasn't aware of maildrop's virtual users mechanism.

 How reliable does it need to be?

Wholly.  If not, I'll just make the user set a configuration variable
to tell the application to expect a virtualdomain.

--
(TMDA - http://tmda.sourceforge.net/)
(A qmail-based SPAM reduction system)