9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: arisawa@ar.aichi-u.ac.jp
To: 9fans@cse.psu.edu
Subject: Re: [9fans] plan9 username is not desired e-mail source
Date: Mon,  5 Aug 2002 05:39:22 +0900	[thread overview]
Message-ID: <20020804203928.B78B8199A3@mail.cse.psu.edu> (raw)
In-Reply-To: <76c4ce07e21c4afd8f6f34bfa8a4eaf9@plan9.bell-labs.com>

>Aliasmail -f is invoked by /mail/lib/remotemail,
>but only to get a sender's domain.  The sender
>name can't be changed with it.
>
>Russ

The senders name can be chnaged in qmail.

The following is qmail for sender masquerade:
    alice@aichi-u ac.jp is converted to arisawa@ar.aichi-u.ac.jp
where ar.aichi-u.ac.jp is this dom name.

Kenji Arisawa

#!/bin/rc
#
#       qmail derivers a mail to a remote host
#	$* are as follows:
#
#	mail from arisawa@pc.aichi-u.ac.jp to junk@junk.com
#	pc.aichi-u.ac.jp!arisawa net!junk.com junk
#	(don't post to junk.com. this dom really exist now!)
#
#	mail from postmaster to arisawa@pc.aichi-u.ac.jp:
#	/dev/null net!pc.aichi-u.ac.jp arisawa
#

sender=$1
shift
addr=$1
shift

#
#       for example
#       $sender:
#           alice           -- from local mailes
#                 now smptd rejects a sender who pretends local
user.
#           *!alice -- from remote machin
#           ar!*!alice	-- from remote machin via pipeto
#           /dev/null      -- from postmaster
#       $addr:
#           net!vega        -- to remote hosts vega
#       $*:	recipient
#           bob             -- a user on vega
#

#       OK flag
#       1: do sender masquering
#       0: no sender masquering
OK=0

#
#       relay service and  the sender masquering
#
dom=aichi-u.ac.jp
if(~ $sender (pc al)^.$dom!* ar!^(pc al)^.$dom!*){
    ifs0=$ifs
    ifs='!' s=`{echo -n $sender}
    ifs=$ifs0
    sender=$s(2)
    if(~ $s(1) ar) sender=$s(3)
    # echo $sysname: qmail-masq pettern OK $sender >> /sys/log/test
    switch($sender){
    case alice
        OK=1
        sender=arisawa
    }
}

if(~ $OK 1){    # sender masquering
awk '
/^From |^Received:|^MBOX-Line:|^Message-ID:/{f=1;next}
/^From:/{f=1; print "From:","'$sender@ar.aichi-u.ac.jp'"; next}
/^[ \t]/ && f==1 {next}
/^$/{ print; while (getline>0) print $0}
/.+/{f=0;print $0}'|\
/bin/upas/qer /mail/queue mail $sender $addr $* || exit 1
/bin/upas/runq /mail/queue /mail/lib/remotemail</dev/null>/dev/null
>[2=1]
exit
}


#
#       controll the sender's request to relay.
#       If this is not a relay host, you should not answer the
request.
#
# 	relay request from a remote sender.

#
#       local user can send a mail to anywhere
#
#       full-path is required for $sender to be translated
correctlly
#       otherwise the name is regarded as local name.
#	example: if pc!arisawa is translated to
pc!arisawa@ar.aichi-u.ac.jp
#
/bin/upas/qer /mail/queue mail $sender $addr $* || exit 1
/bin/upas/runq /mail/queue /mail/lib/remotemail</dev/null>/dev/null
>[2=1]
exit 0


  reply	other threads:[~2002-08-04 20:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-04 13:35 Russ Cox
2002-08-04 20:39 ` arisawa [this message]
2002-08-04 20:45   ` arisawa
2002-08-19 15:23   ` Boyd Roberts
  -- strict thread matches above, loose matches on Subject: below --
2002-08-04 12:55 presotto
2002-08-03 23:48 presotto
2002-08-03 23:41 Russ Cox
2002-08-03 19:14 cdevilbiss
2002-08-03 18:40 colin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020804203928.B78B8199A3@mail.cse.psu.edu \
    --to=arisawa@ar.aichi-u.ac.jp \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).