File: mailpath

package info (click to toggle)
zmailer 2.99.51.52pre3-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 16,596 kB
  • ctags: 7,422
  • sloc: ansic: 90,470; sh: 3,608; makefile: 2,784; perl: 1,585; python: 115; awk: 22
file content (100 lines) | stat: -rwxr-xr-x 2,034 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/lib/zmailer/bin/router -f
# Note:  should use $0 instead of mailpath in the "echo Try running mailpath"
# but at present, the router has a bug that results in all zsh scripts
# getting $0 == "router".

. /etc/zmailer/zmailer.conf

cd $POSTOFFICE/router

v=`df . | awk 'NR == 2 && /^.*:\/.*/ { split($1,a,":") ; print a[1] }'`
case x$v in
x?*)	echo Mail from this host will be processed on $v.
	echo Try running mailpath there if you want more information.
	exit 0
	;;
esac

. $MAILSHARE/router.cf


#ok="Ok:"
#bad="Error:"
#
#quadprint (quad) {
#	local routes
#
#	case $(channel $quad) in
#	error)	echo "$bad Unresolvable address: $(user $quad)"
#		;;
#	smtp)	routes=$(mxhosts $(host $quad))
#		case $#routes in
#		0|'')	echo "$ok SMTP connection to $nexthop";;
#		1)	echo "$ok SMTP connection to $(car $routes)";;
#		*)	echo -n "$ok SMTP connection to one of "
#			grind $routes
#			;;
#		esac
#		;;
#	local)
#		echo "$ok Local mail."
#		;;
#	usenet)
#		echo "$ok Submission to Usenet newsgroup."
#		;;
#	uucp)	echo -n "$ok UUCP Path selected: "
#		uucproute "$(user $quad)"
#		;;
#	*)
#		echo "Help!"
#		;;
#	esac
#}

quadprint (quad) {
	local text

	case $(channel $quad) in
	local)	text=$(login2uid $(user $quad))	# ignore return value
		if text="$(fullname $(user $quad))"; then
			text="local delivery for $text"
		else
			text="local delivery for"
		fi
		;;
	usenet)	text="local delivery to newsgroup" ;;
	smtp)	text="smtp delivery to"
		routes=$(mxhosts $(host $quad))
		case $#routes in
		0|'')	text="$text $(host $quad) for" ;;
		1)	text="$text $(car $routes) for";;
		*)	text="$text one of"
			pref=" ("
			for host in $(elements $routes)
			do
				text="$text$pref$host"
				pref=", "
			done
			text="$text) for"
			;;
		esac
		;;
	*)	text="$(channel $quad) delivery"
		case "$(host $quad)" in
		-|'')	text="$text for" ;;
		*)	text="$text to $(host $quad) for" ;;
		esac
		;;
	esac
	echo "$text <$(user $quad)>"
}

server init
case $1 in
*@*|*!*)
	server verify "$1"
	;;
*)	server verify user@"$1"
	;;
esac
exit 0