[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error: trying to talk to myself?



In dist.zmailer, article <826159289.2994@noris.de>,
  Matti Aarnio <mea@nic.funet.fi> writes:
> 
> 	It gives me an impression that for some reason the system
> 	does not recognize its own name in every case.
> 
We're talking SMTP here. SMTP goes to (a number of) IP addresses.

Unfortunately, most big systems nowadays have more than one name, or more
than one IP address. The sensible approach would therefore be to collect
all the names, extract all the IP numbers, and chop off the MX list at the
lowest priority where one of them matches.

The smtp channel insists on exactly one host name which exactly must be
matched in your MX. IMHO, that's a bug.

One further question: What's the list of toplevel domain names good for?
IMHO, anything with a dot in it should be supposed to be a toplevel domain.

Oh yes, UNRESOLVED PROBLEM: Aliases of the form "|program 2>&1 | program2" 
are ruthlessly mangled (the '>' is deleted, probably due to misguided
canonicalization).


I'm appending my current list of patches four everybody's consideration,
with comments at the beginning of every chunk.


## Router crash.

diff -rub /pub/src/unix/net/mail/zmailer-2.99.26/router/rfc822.c /usr/src/usr.sbin/zmailer-2.99.26/router/rfc822.c
--- /pub/src/unix/net/mail/zmailer-2.99.26/router/rfc822.c	Fri Jan 19 09:24:31 1996
+++ /usr/src/usr.sbin/zmailer-2.99.26/router/rfc822.c	Thu Feb 29 19:08:12 1996
@@ -1942,7 +1942,7 @@
 			} else
 				x = l;
 			if (x != NULL) {
-				if (*x->string == '\0')
+				if (x->string == NULL || *x->string == '\0')
 					putc('-', fp);
 				else
 					fprintf(fp, "%s", x->string);

## Scheduler crash when replying to mailq.

diff -rub /pub/src/unix/net/mail/zmailer-2.99.26/scheduler/qprint.c /usr/src/usr.sbin/zmailer-2.99.26/scheduler/qprint.c
--- /pub/src/unix/net/mail/zmailer-2.99.26/scheduler/qprint.c	Wed Feb  7 08:07:16 1996
+++ /usr/src/usr.sbin/zmailer-2.99.26/scheduler/qprint.c	Sun Feb 25 23:25:47 1996
@@ -162,7 +162,7 @@
 		  fprintf(qpfp,"touched");
 	    } else {
 	      fprintf(qpfp, "(activation pending, thread");
-	      if (vp->thread->proc) {
+	      if (vp->thread && vp->thread->proc) {
 		fprintf(qpfp," pid=%d ", vp->thread->proc->pid);
 		if (vp->thread->proc->thread == vp->thread)
 		  fprintf(qpfp,"expected");


## When user mumble puts "mumble,mumble@foo" into their .forward file
##  and mumble@foo bounces, it pingpongs. Ugh. Fix: Replace the envelope
##  with "real-mumble" and disable forwarding when resolving the latter.
##   Yes, this means using aliases2.cf, which IMHO is far superior to the
##   old way of doing this.
## Adding the expansions parameter to expand_* is necessary since we want
##  to lock out a _different_ user name...
## Forking /bin/expr is stupid when we have ssift.
## Nonexistent users can be bounced _here_, not in the mailbox transport.
##  That way, you can do user/fullname _and_ Usenet delivery.

--- /usr/src/usr.sbin/zmailer-2.99.26/proto/cf/aliases2.cf	Fri Sep 16 11:45:09 1994
+++ /smurf/var/lib/mail/cf/aliases.cf	Thu Mar  7 18:58:24 1996
@@ -73,7 +73,7 @@
 
 	# User's .forward file, xor host routing via homemap.
 	# Note, listing them together makes them exclusive.
-	a=$(expand $quad "$origaddr" forward homemap) && return $a
+	a=$(expand $quad "$origaddr" real_user forward homemap) && return $a
 
 	# File location, via mboxmap.
 	a=$(expand $quad "$origaddr" mboxmap_file) && return $a
@@ -115,12 +115,13 @@
 # XXX there's a better way of doing it.
 
 expand (quad, origaddr) {	# method ...
-	local user attr expansion success result
+	local user attr expansion success result exp
 
 	user="$(user $quad)"
 	attr=$(attributes $quad)
 
 	# This is the key used as a guard.
+	exp="$@"
 	expansion="$@ * $user"
 
 	# A second instance of the same name disappears.
@@ -134,7 +135,7 @@
 	db add expansions "pending $expansion" 1
 	success=''
 	for method in "$@"; do
-		if result=$(expand_$method "$user" $attr "$origaddr"); then
+		if result=$(expand_$method "$user" $attr "$origaddr" "$exp"); then
 			success=yes
 			break
 		fi
@@ -164,7 +165,7 @@
 		priv=$(getpriv "644" $priv "$file" include) || return 99
 		attr=$(newattribute $attr privilege $priv)
 
-		return $(listaddresses <"$file" -e root -c "include $user" |
+		return $(listaddresses <"$file" -e postmaster -c "include $user" |
 			 maprrouter $attr "$user" "$origaddr")
 		;;
 	tfis
@@ -225,7 +226,11 @@
 
 	home=$(homedirectory "$user") || return 99
 
-	a=$(/bin/expr "$home" : "\(/.*\)//*[^/]*/*") || return 99
+	ssift "$home" in
+		(/.*)/[^/]*		a=\1; break ;;
+		.*				return 99 ;;
+	tfiss
+
 	a=$(homemap "$a") || return 99
 
 	return $(rrouter "$user@$a" "$origaddr" $attr)
@@ -268,7 +273,7 @@
 	priv=$(getpriv "644" $priv "$a" .forward) || return 99
 	attr=$(newattribute $attr privilege $priv)
 
-	return $(listaddresses <"$a" -e "$user" -c "forward $user" |
+	return $(listaddresses <"$a" -E "real-$user" -e "real-$user" -c "forward $user" |
 		 maprrouter $attr "$a" "$origaddr")
 }
 
@@ -317,12 +322,12 @@
 expand_list_owner (user, attr, origaddr) {
 	local addrs list file a zzz
 
-	case "$user" in
-	*-request)	list=$(basename "$user" -request);;
-	*-owner)	list=$(basename "$user" -owner);;
-	owner-*)	list=$(/bin/expr "$user" : "owner-\(.*\)");;
-	*)		return 99;;
-	esac
+	ssift "$user" in
+		(.*)-request		list=\1; break ;;
+		(.*)-owner			list=\1; break ;;
+		owner-(.*)			list=\1; break ;;
+		.*					return 99 ;;
+	tfiss
 
 	addrs=()
 	for dir in $MAILLISTS; do
@@ -343,6 +348,27 @@
 }
 
 
+expand_real_user (user, attr, origaddr, exp) {
+	local a expans succ
+
+	ssift "$user" in
+	real-(.*)
+			user="\1"
+			expans="$exp * $user"
+			succ=''
+
+			db add expansions "pending $expans" 1
+			if a=$(rrouter "$user" "$origaddr" $attr) ; then succ=y ; fi
+			db remove expansions "pending $expans" 
+
+			[ $succ ] || return 99;
+
+			return $a ;;
+	.*		return 99 ;;
+	tfiss
+}
+
+
 ### The mboxmap database.
 
 # This database looks like:
@@ -432,6 +458,11 @@
 ### A really real live local user.
 
 expand_local (user, attr, origaddr) {
+	priv=$(login2uid "$user") || return 99
+	if [ $(uid2login $priv) = $NOBODY ]; then
+		return 99
+	fi
+	
 	return (((local "$origaddr" "$user" $attr)))
 }
 

## The RFC Says: If there is a MX, you MUST NOT try to deliver to any A
##  record you may find. That includes the case where the lowest-numbered
##  MX points to yourself!
## 
diff -rub /usr/src/usr.sbin/zmailer-2.99.26/proto/cf/i-smtp.cf /smurf/var/lib/mail/cf/i-smtp.cf
--- /usr/src/usr.sbin/zmailer-2.99.26/proto/cf/i-smtp.cf	Wed Aug 17 12:56:07 1994
+++ /smurf/var/lib/mail/cf/i-smtp.cf	Mon Feb 26 07:11:50 1996
@@ -16,6 +16,7 @@
 	#relation -t bind,cname -n -s 200 canon	# T_CNAME canonicalize hostname
 	relation -t bind,any -n -s 200 canon    # T_ANY canonicalize hostname
 	relation -t bind,mx -s 200 mxhosts	# T_MX
+	relation -t bind,mx -s 200 checkmxhosts	# T_MX
 
 #| The mxhosts relation returns a list of values.
 
@@ -32,8 +33,12 @@
 #| A host is reachable via the IP network if it has a forwarder (an MX
 #| resource record exists for it), or if it is directly on the network.
 
-		a="$(mxhosts "$host" || ipaddress "$host")"
-		return $?
+		a=$(mxhosts "$host") && return $a
+		hostname foo.bar.baz
+		a=$(checkmxhosts "$host") && { hostname $hostname; return 99 }
+		hostname $hostname
+		a=$(ipaddress "$host") && return $a
+		return 99
 	}
 
 	revdomain (domain) {


## If the UUCP path to baz is foo!bar!baz, do not try to resolve foo
## through the paths database while you figure out the route to foo,
## it won't work (the path to foo is "foo", which is unhelpful).

diff -rub /usr/src/usr.sbin/zmailer-2.99.26/proto/cf/p-uucp.cf /smurf/var/lib/mail/cf/p-uucp.cf
--- /usr/src/usr.sbin/zmailer-2.99.26/proto/cf/p-uucp.cf	Mon Aug 15 19:10:30 1994
+++ /smurf/var/lib/mail/cf/p-uucp.cf	Mon Feb 26 10:13:10 1996
@@ -4,19 +4,27 @@
 require uucpdb rrouter standard
 provide uucp
 
+relation -lt incore uuexpand
+
 uucp_neighbour (domain, address, A) {
-	local tmp
+	local tmp tmpa
 	# FIX THIS! Beware of loops due to pathalias database
 	# and local neighbour knowledge being out of sync.
 
+	
 #| If the pathalias database claims a host is known locally, but in fact
 #| it isn't, the configuration code could get into recursive loops.  This
 #| is hard to guard against.  An external consistency checker would be
 #| useful.
 
+	tmp=$(uuexpand $domain) && return 1
+
+	db add uuexpand "$domain" 1
+
 	tmp=$(pathalias "$domain") || return 1
 	sift "$tmp" in
 	[^!]+	if [ $(deliver "$tmp") ]; then
+			db remove uuexpand "$domain"
 			return (((error database "$address" $A)))
 
 #| In case the pathalias database claims local delivery for the
@@ -24,5 +32,17 @@
 
 		fi ;;
 	tfis
-	return $(rrouter "$tmp!$(uucproute "$address")" "$address@$domain" $A)
+	if [ "x$tmp" = "x" ] ; then 
+		db remove uuexpand "$domain"
+		return 1
+	fi
+
+	tmpa=$(rrouter "$tmp!$(uucproute "$address")" "$address" $A) ||
+	{
+		db remove uuexpand "$domain"
+		return 99
+	}
+	db remove uuexpand "$domain"
+
+	return $tmpa
 }

## There is no \3 here!
## There's a form for using IP numbers as addresses, but
##  nobody actually seems to catch the problem..?
## Using @localhost in your address is something I do NOT
##  try to fix. Your config is broken, _you_ fix it.
## ismtp, at our site, is like smtp except MXes are ignored, for local
##  delivery.
## a!b@c means c!a!b. That's it. Plain and simple. Broken UUCP idiots who
##  stupidly slap sitename! in fron tof the address deserve to die.
## a!b%c@d -- the b%c part MUST NOT be touched until the message reaches a.

diff -rub /usr/src/usr.sbin/zmailer-2.99.26/proto/cf/rrouter.cf /smurf/var/lib/mail/cf/rrouter.cf
--- /usr/src/usr.sbin/zmailer-2.99.26/proto/cf/rrouter.cf	Wed Jan  3 09:54:41 1996
+++ /smurf/var/lib/mail/cf/rrouter.cf	Sun Feb 25 22:24:02 1996
@@ -19,9 +19,9 @@
 	sift "$address" in
 	# first make canonical
 	(.*)<(.*)
-		address="\1\2\3" ;;		# defocus
+		address="\1\2" ;;		# defocus
 	(.*)>(.*)
-		address="\1\2\3" ;;		# defocus
+		address="\1\2" ;;		# defocus
 	.*
 		address=$(canonicalize "$address") ;;
 #	<in%>(.*)
@@ -47,9 +47,19 @@
 	(.*)<@\[(.)\]>(.*)
 		# numeric internet spec
 		return (((smtp "[\2]" "\1@$(gethostbyaddr \2)\3" $A))) ;;
+	(.*)<@(.+)>(.*)
+		tmp="\2"
+		tee="\1@\2\3"
+		ssift "$tmp" in
+		[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*
+			return (((error ip-number "$tee" $A))) ;;
+		tfiss
+		;;
 ## end of [1.2.3.4] address case..
 ## -----------------------------------------------------------------
 
+	(.*)<@(localhost)>(.*)
+		return (((error localhost "\1@\2\3" $A))) ;;
 	(.*)<@(.*)\.>(.*)
 		address="\1<@\2>\3" ;;
 
@@ -179,6 +192,13 @@
 	ignore!.*
 		break
 		;;
+	ismtp!
+		sift "$address" in
+		(.*)<@(.+)>(.*)
+			return (((ismtp "\2" "$address" $A)))
+			;;
+		tfis
+		;;
 	(smtp|dns)!
 		sift "$address" in
 		(.*)<@(.+)>(.*)
@@ -216,19 +236,11 @@
 	:include:[^!]+		return $address ;;
 	@(.+:)([^:]+)		address=\1$(uucproute "\2") ;;
 	(.+):(.+)		address=\1!\2 ; continue ;;
-	# This won't work properly for e.g. utzoo!bar@gpu.utcs.toronto.edu
-	# because gpu.utcs also has an active uucp connection with utzoo. Argh.
-	# It will work properly in other cases though, so if we have to guess...
-	#([^!])!(.+)@(.+)	if [ $(ldotsys \1) ]; then
-	#				address=\1!\3!\2
-	#			else
-	#				address=\3!\1!\2
-	#			fi ;;
-	(.+)!([^!]+)%([^!%]+)@(.+)	# route!a%b@c -> route!c!a@b
-				address=\1!\4!\2@\3 ; continue ;;
+	([^!])!(.+)@(.+)	address=\3!\1!\2 ;;
 	([^@]+)@(.+)		address=\2!\1 ;;
 	@(.+)			address=\1 ;;
-	(.+)!([^!]+)[%@](.+)	address=\1!\3!\2 ;;
+	(.+)!([^!]+)@(.+)	address=\1!\3!\2 ;;
+	([^!]+)%(.+)		address=\2!\1 ;;
 	tfis
 	return "$address"
 }	# end of uucproute

## Not everybody has a fullnamedb that's big enough to benefit from DBM...

diff -rub /usr/src/usr.sbin/zmailer-2.99.26/proto/cf/standard.cf /smurf/var/lib/mail/cf/standard.cf
--- /usr/src/usr.sbin/zmailer-2.99.26/proto/cf/standard.cf	Sun Mar 26 00:15:08 1995
+++ /smurf/var/lib/mail/cf/standard.cf	Sun Feb 25 22:14:54 1996
@@ -131,6 +132,8 @@
 # optional: Fullname database: <Full_Name>    <login>
 if [ -f $MAILSHARE/db/fullnames.pag ]; then
 	relation -lmt ndbm -f $MAILSHARE/db/fullnames fullnamemap
+elif [ -f $MAILSHARE/db/fullnames ]; then
+	relation -lmt ordered -f $MAILSHARE/db/fullnames fullnamemap
 else
 	fullnamemap () { return 1 }
 fi

-- 
It is Texas law that when two trains meet each other at a railroad
crossing, each shall come to a full stop, and neither shall proceed
until the other has gone.
-- 
Matthias Urlichs        \ XLink-POP Nürnberg  | EMail: urlichs@smurf.noris.de
Schleiermacherstraße 12  \  Unix+Linux+Mac    | Phone: ...please use email.
90491 Nürnberg (Germany)  \   Consulting+Networking+Programming+etc'ing     42
          PGP: 1B 89 E2 1C 43 EA 80 44  15 D2 29 CF C6 C7 E0 DE 
       Click <A HREF="http://smurf.noris.de/~smurf/finger">here</A>.