9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] /mail/lib/rewrite
@ 1998-08-20 13:00 presotto
  0 siblings, 0 replies; 6+ messages in thread
From: presotto @ 1998-08-20 13:00 UTC (permalink / raw)


# convert source domain address to a chain a@b@c@d...
@([^@!,]*):([^!@]*)@([^!]*)		alias	\2@\3@\1
@([^@!]*),@([^!@,]*):([^!@]*)@([^!]*)	alias	@\1:\3@\4@\2

# convert a chain a@b@c@d... to ...d!c!b!a
([^@]+)@([^@]+)@(.+)	alias	\2!\1@\3
([^@]+)@([^@]+)		alias	\2!\1

is in our local /mail/lib/rewrite.  I didn't realize the
distribution had something else.  Thanks for pointing it
out.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] /mail/lib/rewrite
@ 2002-05-01 16:51 Russ Cox
  0 siblings, 0 replies; 6+ messages in thread
From: Russ Cox @ 2002-05-01 16:51 UTC (permalink / raw)
  To: 9fans

Here you are.  Thanks for pointing this out.

# To unbundle, run this file
echo rewrite.direct
sed 's/.//' >rewrite.direct <<'//GO.SYSIN DD rewrite.direct'
-#
-#	sample rewrite file for systems that send and receive mail directly.
-#
-#	by default, the return address points to this system; if you have multiple systems
-#	and don't want them all to be mail recipients, set $site to a generic
-#	name (e.g., plan9) or system name in /rc/bin/termrc and /rc/bin/cpurc
-#	and put an MX DNS record in /lib/ndb to point to that system.
-#
-#	replace YOURDOMAIN.DOM in the following rules with your domain name.
-
-# translate local aliases from /mail/lib/namefiles
-[^!@.]+			translate	"/bin/upas/aliasmail '&'"
-
-# deliver mail without a domain locally
-local!(.*)		>>		/mail/box/\1/mbox
-
-# your local names
-\l!(.*)					alias		\1
-\l\.YOURDOMAIN\.DOM!(.*)		alias		\1
-
-# convert source domain address to a chain a@b@c@d...
-@([^@!,]*):([^!@]*)@([^!]*)		alias	\2@\3@\1
-@([^@!]*),@([^!@,]*):([^!@]*)@([^!]*)	alias	@\1:\3@\4@\2
-
-# convert a chain a@b@c@d... to ...d!c!b!a
-([^@]+)@([^@]+)@(.+)	alias		\2!\1@\3
-([^@]+)@([^@]+)		alias		\2!\1
-
-# queue all mail for delivery
-([^!]*)!(.*) 		| 		"/mail/lib/qmail '\s' 'net!\1'" "'\2'"
//GO.SYSIN DD rewrite.direct
echo rewrite.gateway
sed 's/.//' >rewrite.gateway <<'//GO.SYSIN DD rewrite.gateway'
-#
-#	sample rewrite file for systems that send mail to a mail server or gateway
-#	for delivery.  we assume the mail server handles incoming messages.
-#
-#	by default the return address points to this system; set $site
-#	to the name of the mail server that receives your mail in
-#	/rc/bin/termrc and /rc/bin/cpurc.
-#
-#	replace YOURDOMAIN.DOM with the name of your domain.
-#
-#	in the last rule, $smtp is the name of the mail server.  set it
-#	in the DNS database in /lib/ndb (see ndb(6)).
-
-# translate local aliases from /mail/lib/namefiles
-[^!@.]+			translate	"/bin/upas/aliasmail '&'"
-
-# append the local domain to addresses without a domain
-local!(.*)		alias		\1@YOURDOMAIN.DOM
-
-# convert source domain address to a chain a@b@c@d...
-@([^@!,]*):([^!@]*)@([^!]*)		alias	\2@\3@\1
-@([^@!]*),@([^!@,]*):([^!@]*)@([^!]*)	alias	@\1:\3@\4@\2
-
-# convert a chain a@b@c@d... to ...d!c!b!a
-([^@]+)@([^@]+)@(.+)	alias		\2!\1@\3
-([^@]+)@([^@]+)		alias		\2!\1
-
-# send all mail to the gateway or mail server, $smtp,  for delivery
-([^!]*)!(.*) 		| 		"/mail/lib/qmail '\s' 'net!$smtp'" "'\2@\1'"
//GO.SYSIN DD rewrite.gateway



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [9fans] /mail/lib/rewrite
  2002-05-01 14:21 [9fans] slow video fix Russ Cox
@ 2002-05-01 16:41 ` Pat Hacker
  0 siblings, 0 replies; 6+ messages in thread
From: Pat Hacker @ 2002-05-01 16:41 UTC (permalink / raw)
  To: 9fans

I did not see this in the archives but it may have been mentioned
previously,
/mail/lib/rewrite.direct and rewrite.gateway seem to be missing in 4e.
Could someone post those? Thanks.
Pat




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] /mail/lib/rewrite
@ 2000-07-04 15:23 Russ Cox
  0 siblings, 0 replies; 6+ messages in thread
From: Russ Cox @ 2000-07-04 15:23 UTC (permalink / raw)
  To: 9fans

  In /mail/lib/rewrite we will find the line:
  ([^!]*)!(.*) 		| 		"/mail/lib/qmail '\s' 'net!$smtp'" "'\2@\1'"

This line is meant to send _all_ mail to a gateway,
named by the smtp= entry in your /lib/ndb database
for the current machine (or network).  If you're connecting
to an ISP and just want to hand off your mail and let
someone else deal with send retries and the like,
this is the one to use.

  The corresponding line of second edition was:
  ([^!]*)!(.*) 		| 		"/mail/lib/qmail '\s' 'net!\1'" "'\2'"

This line sends to the host directly, no mail gateway.
If you're running a cpu server or your own Plan 9
network, this is more appropriate.  

  However then we have a message in /sys/log/smtp.fail:
	al Jul  4 19:11:09 cs: dns: no translation found(net!$smtp!smtp)

This is almost certainly coming from the first rule,
not the second.

Russ


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [9fans] /mail/lib/rewrite
@ 2000-07-04 10:30 arisawa
  0 siblings, 0 replies; 6+ messages in thread
From: arisawa @ 2000-07-04 10:30 UTC (permalink / raw)
  To: 9fans

Hello 9fans,

In /mail/lib/rewrite we will find the line:
([^!]*)!(.*) 		| 		"/mail/lib/qmail '\s' 'net!$smtp'" "'\2@\1'"

The corresponding line of second edition was:
([^!]*)!(.*) 		| 		"/mail/lib/qmail '\s' 'net!\1'" "'\2'"

In man page, we will find examples of usage of /mail/lib/qmail:
         ([^!]*.bell-labs.com)!(.*)  |  "/mail/lib/qmail '\s' 'net!\1'" "'\2'"
and
          /mail/lib/qmail presotto net!plan9.bell-labs.com ken rob

Where and how can we define $smtp ?

It seems that rewrite rule of second edition style works.
However then we have a message in /sys/log/smtp.fail:
	al Jul  4 19:11:09 cs: dns: no translation found(net!$smtp!smtp)

Thanks,

Kenji Arisawa
E-mail: arisawa@aichi-u.ac.jp


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [9fans] /mail/lib/rewrite
@ 1998-08-20  3:49 arisawa
  0 siblings, 0 replies; 6+ messages in thread
From: arisawa @ 1998-08-20  3:49 UTC (permalink / raw)


Hello 9fans!

I believe the following two lines
@([^@!,]*):([^!@]*)@([^!]*)	alias	\2@\3@\1
@([^@!]*),([^!@,]*):([^!@]*)@([^!]*)	alias	@\1:\3@\4@\2
in /mail/lib/rewrite intend to convert a route address, for example,
@A,@B:alice@C
to another route address
alice@C@B@A


However we can experiment:
term% upas/sendmail '-#' @A,@B:alice@C
invalid address: @A,@B:alice@C
term% upas/sendmail '-#' @A,B:alice@C
/mail/lib/qmail 'arisawa' 'net!A' 'B!C!alice'


I replaced second line to:
@([^!]*),@([^!@,]*):([^!@]*)@([^!]*)	alias	@\1:\3@\4@\2

Then we have:
term% upas/sendmail '-#' @A,@B:alice@C
/mail/lib/qmail 'arisawa' 'net!A' 'B!C!alice'
term% upas/sendmail '-#' @A,B:alice@C
Invalid address: @A,B:alice@C


RFC821 requires the format "@A,@B:alice@C" for route address,
not "@A,B:alice@C".

Bug in /mail/lib/rewrite?

Kenji Arisawa
E-mail: arisawa@aichi-u.ac.jp




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-05-01 16:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-08-20 13:00 [9fans] /mail/lib/rewrite presotto
  -- strict thread matches above, loose matches on Subject: below --
2002-05-01 16:51 Russ Cox
2002-05-01 14:21 [9fans] slow video fix Russ Cox
2002-05-01 16:41 ` [9fans] /mail/lib/rewrite Pat Hacker
2000-07-04 15:23 Russ Cox
2000-07-04 10:30 arisawa
1998-08-20  3:49 arisawa

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).