summaryrefslogtreecommitdiff
path: root/debian/local/update_sendmail
blob: 66b7b3a4d236265d080c8976545d2c15e24336df (plain)
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/sh -e
#-----------------------------------------------------------------------------
#
# Update Sendmail environment for Debian
#
# Copyright (c) 2001-2001 Richard Nelson.  All Rights Reserved.
# Time-stamp: <2001/01/17 10:00:00 cowboy>
#
# Notes (to all):
#	*
#
# Notes (to self):
#	* 
#
#-----------------------------------------------------------------------------
set -e;

# Path to other sendmail helpers
if [ -x ./update_sendmail ]; then
	sm_path='.';
elif [ -x $(dirname $0)/update_sendmail ]; then
	sm_path=$(dirname $0);
else
	sm_path=/usr/share/sendmail;
	fi;
# Bring in sendmail.conf for the network definitions
# Here, we *MUST* update the conf file before reading it...
#if [ ! -f /etc/mail/sendmail.conf ]; then
	if [ -x $sm_path/update_conf ]; then
		$sm_path/update_conf;
		fi;
#	fi;
if [ -f /etc/mail/sendmail.conf ]; then
	. /etc/mail/sendmail.conf;
	fi;
if [ "$HANDS_OFF" != 'No' ]; then
	exit 0;
	fi;

# control amount of output
verbosity=0;

# flag used to indicate a dataset has been moved, may need another update
changed=0;

#-------------------------------------------------------------
# Make sure the configuration is setup
if [ -x $sm_path/update_conf ]; then
	$sm_path/update_conf || true;
	fi;

#-------------------------------------------------------------
# Perform some [safe] updates to an existing sendmail.mc to make
# sure it is compatible with the current executables.
if [ -x $sm_path/update_mc ]; then
	$sm_path/update_mc || changed=1;
	rm -f /etc/mail/databases || true;
	$sm_path/parse_mc || true;
	fi;

#-------------------------------------------------------------
# Make sure the system is setup
if [ -x $sm_path/update_sys ]; then
	$sm_path/update_sys || changed=1;
	fi;

#-------------------------------------------------------------
# update smrsh/sensible-mda information if possible
if [ -x $sm_path/update_smrsh ]; then
	$sm_path/update_smrsh || true;
	fi;

#-------------------------------------------------------------
# update LDAP information if possible
if [ -x $sm_path/update_ldap ]; then
	$sm_path/update_ldap || true;
	fi;

#-------------------------------------------------------------
# update SMTP AUTH (SASL) information if possible
if [ -x $sm_path/update_auth ]; then
	$sm_path/update_auth || true;
	fi;

#-------------------------------------------------------------
# update TLS(SSL) information if possible
if [ -x $sm_path/update_tls ]; then
	$sm_path/update_tls || true;
	fi;

#-------------------------------------------------------------
# Check and update (if needed) /etc/hosts.allow
if [ -x $sm_path/update_tcpd ]; then
	$sm_path/update_tcpd || true;
	fi;

#-------------------------------------------------------------
# Correct prior stupidity of the maintainter
# Remove old bogon entries from /etc/mail/access
if [ -s /etc/mail/access ]; then
	cp -p /etc/mail/access /etc/mail/access.new;
	sed \
		-e '/^#\?Connect:8		REJECT/d' \
		-e '/^#\?Connect:41		REJECT/d' \
		-e '/^#\?Connect:71		REJECT/d' \
		-e '/^#\?Connect:72		REJECT/d' \
		-e '/^#\?Connect:73		REJECT/d' \
		-e '/^#\?Connect:74		REJECT/d' \
		-e '/^#\?Connect:75		REJECT/d' \
		-e '/^#\?Connect:76		REJECT/d' \
		/etc/mail/access > /etc/mail/access.new;
	mv /etc/mail/access.new /etc/mail/access;
	fi;	

#-------------------------------------------------------------
# Make sure the databases are in the expected locations
if [ -x $sm_path/update_db ]; then
	$sm_path/update_db || changed=1;
	fi;

#-------------------------------------------------------------
exit $changed