|
|
1.1 ! root 1: #! /bin/sh ! 2: # ! 3: # auth - check forwarding authorization for a mail message ! 4: # ! 5: # mail "from_addr" "to_addr" ! 6: # ! 7: # The message is authorized if any one of the following is true: ! 8: # - the last hop was a gateway machine (meaning the mail ! 9: # has already been approved ! 10: # - the path is two hops away, and we trust the ! 11: # first hop. (This is for unregistered PCs, etc.) ! 12: # Warning: the list appears in two different case statements! ! 13: # - all hops in the "from_addr" are AT&T machines ! 14: # - all hops in the "to_addr" are AT&T machines ! 15: # ! 16: # The addresses are in `!' notation. We return 0 if the ! 17: # forwarding is approved, 1 if not approved. ! 18: ! 19: ATTLIST=/usr/lib/upas/attlist ! 20: GATES=/usr/lib/upas/gatemachines ! 21: AUTHREJECTS=/usr/spool/mail/authrejects ! 22: ! 23: ! 24: case $# in ! 25: 1) exit 0;; # testing a forwarding address, accepted. ! 26: 2) ;; ! 27: *) echo "$0: usage: from_addr to_addr" ! 28: exit 255;; ! 29: esac ! 30: ! 31: from_addr="$1"; shift ! 32: to_addr="$1"; shift ! 33: ! 34: IFS="$IFS!" ! 35: ! 36: set empty $from_addr ! 37: shift # remove empty ! 38: ! 39: case $# in ! 40: 1) exit 0;; # local sender ! 41: esac ! 42: ! 43: case "$1" in ! 44: arpa|coma|research) exit 0;; # our most common gates ! 45: esac ! 46: look -xf "$1" $GATES >/dev/null && exit 0 # already checked ! 47: ! 48: from_inside="true" ! 49: ! 50: while : ! 51: do ! 52: case $# in ! 53: 1) break;; # don't check sender's user name ! 54: esac ! 55: ! 56: case "$1" in ! 57: arpa|coma|uucp|tempo|*.att.com|*.ATT.COM|sf???) ! 58: shift # count this machine ! 59: continue;; ! 60: gauss|cuuxb|mtune|attunix) ! 61: shift # we trust these guys for one more hop ! 62: case "$1" in ! 63: uucp) shift;; ! 64: esac ! 65: case $# in ! 66: 0|1|2) exit 0;; ! 67: esac ! 68: continue;; ! 69: *) ! 70: look -xf "$1" $ATTLIST >/dev/null || { ! 71: from_inside=false ! 72: unknown_from="$1" ! 73: break} ! 74: shift ! 75: continue;; ! 76: esac ! 77: done ! 78: ! 79: case $from_inside in ! 80: true) exit 0;; ! 81: esac ! 82: ! 83: set empty $to_addr ! 84: shift ! 85: ! 86: while : ! 87: do ! 88: case $# in ! 89: 1) break;; # don't check receiver's user name ! 90: esac ! 91: ! 92: case "$1" in ! 93: arpa|coma|uucp|*.att.com|*.ATT.COM|tempo|sf???) ! 94: shift # count this machine ! 95: continue;; ! 96: gauss|cuuxb|mtune|attunix) ! 97: shift # we trust these guys for one more hop ! 98: case "$1" in ! 99: uucp) shift;; ! 100: esac ! 101: case $# in ! 102: 0|1|2) exit 0;; ! 103: esac ! 104: continue;; ! 105: *) ! 106: look -xf "$1" $ATTLIST >/dev/null || { ! 107: echo Won\'t forward to non-AT\&T machines: "$unknown_from", "$1" >&2 ! 108: exit 1} ! 109: shift ! 110: continue;; ! 111: esac ! 112: done ! 113: ! 114: exit 0
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.