File: socks_wrapper

package info (click to toggle)
sendmail 8.18.1-8
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 12,496 kB
  • sloc: ansic: 105,736; perl: 7,504; sh: 5,488; makefile: 889
file content (31 lines) | stat: -rw-r--r-- 765 bytes parent folder | download | duplicates (7)
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
#!/bin/bash
# Richard Nelson <cowboy@debain.org>
# Socks5 support wrapper for sendmail

DAEMON=/usr/sbin/sendmail.real
RUNSOCKS=/usr/bin/runsocks
BASENAME=$(basename $0)

# Adjust command name based upon the presence of the socks5 wrapper
if [ -x $RUNSOCKS ]; then
   COMMAND="$RUNSOCKS $DAEMON"
else
   COMMAND="$DAEMON"
   fi
#echo "$BASENAME command="$COMMAND

# Exec the appropriate command
case "$BASENAME" in
    # These don't need socks support, and must be called by name
    "hoststat" | "mailq" | "newaliases" | "purgestat")
	exec -a $BASENAME $DAEMON "$@"
	;;
    # These need socks support
    "sendmail")
	exec -a $DAEMON $COMMAND "$@"
	;;
    # Help... shouldn't be here
    *)
	echo "panic, $BASENAME is not a valid alias for sendmail."
	;;
    esac