summaryrefslogtreecommitdiff
path: root/debian/local
diff options
context:
space:
mode:
authorRichard A Nelson (Rick) <cowboy@debian.org>2008-05-04 05:16:00 +0000
committerAndreas Beckmann <debian@abeckmann.de>2012-10-01 20:07:40 +0200
commit6014a62ee0ac8a43c9a0a0ec04784c602c11daff (patch)
tree336e62b5e2e129a6c4bdf843e7c52476a6375193 /debian/local
parentb4f12f2f3316476c6b45e4b72a73f61475d760fc (diff)
downloadsendmail-6014a62ee0ac8a43c9a0a0ec04784c602c11daff.tar.gz
Imported Debian patch 8.14.3-1debian/8.14.3-1
Diffstat (limited to 'debian/local')
-rw-r--r--debian/local/Makefile692
-rw-r--r--debian/local/Parse_conf.pm963
-rw-r--r--debian/local/Parse_mc.pm1086
-rw-r--r--debian/local/bug/sendmail/script53
-rw-r--r--debian/local/dynamic444
-rw-r--r--debian/local/parse_mc95
-rw-r--r--debian/local/sendmail1282
-rw-r--r--debian/local/sendmailconfig688
-rw-r--r--debian/local/update_auth349
-rw-r--r--debian/local/update_authm4257
-rw-r--r--debian/local/update_conf539
-rw-r--r--debian/local/update_db636
-rw-r--r--debian/local/update_ldap139
-rw-r--r--debian/local/update_mc285
-rw-r--r--debian/local/update_mk765
-rw-r--r--debian/local/update_smrsh94
-rw-r--r--debian/local/update_sys252
-rw-r--r--debian/local/update_tls319
-rw-r--r--debian/local/update_tlsm4252
19 files changed, 9190 insertions, 0 deletions
diff --git a/debian/local/Makefile b/debian/local/Makefile
new file mode 100644
index 0000000..8449f51
--- /dev/null
+++ b/debian/local/Makefile
@@ -0,0 +1,692 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# local/Makefile. Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+
+
+
+pkgdatadir = $(datadir)/sendmail
+pkglibdir = $(libdir)/sendmail
+pkgincludedir = $(includedir)/sendmail
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = x86_64-pc-linux-gnu
+host_triplet = x86_64-pc-linux-gnu
+target_triplet = x86_64-pc-linux-gnu
+subdir = local
+DIST_COMMON = $(dist_man_MANS) $(dist_pkgdata_SCRIPTS) \
+ $(dist_sbin_SCRIPTS) $(nobase_dist_data_DATA) \
+ $(nobase_dist_sysconf_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/Parse_conf.pm.in \
+ $(srcdir)/Parse_mc.pm.in $(srcdir)/dynamic.in \
+ $(srcdir)/parse_mc.in $(srcdir)/sendmail.in \
+ $(srcdir)/sendmailconfig.in $(srcdir)/update_auth.in \
+ $(srcdir)/update_authm4.in $(srcdir)/update_conf.in \
+ $(srcdir)/update_db.in $(srcdir)/update_ldap.in \
+ $(srcdir)/update_mc.in $(srcdir)/update_mk.in \
+ $(srcdir)/update_smrsh.in $(srcdir)/update_sys.in \
+ $(srcdir)/update_tls.in $(srcdir)/update_tlsm4.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/build/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/./build/mkinstalldirs
+CONFIG_CLEAN_FILES = Parse_conf.pm Parse_mc.pm dynamic parse_mc \
+ sendmailconfig sendmail update_auth update_authm4 update_conf \
+ update_db update_ldap update_mc update_mk update_smrsh \
+ update_sys update_tls update_tlsm4
+am__installdirs = "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(sbindir)" \
+ "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(datadir)" \
+ "$(DESTDIR)$(sysconfdir)"
+dist_pkgdataSCRIPT_INSTALL = $(INSTALL_SCRIPT)
+dist_sbinSCRIPT_INSTALL = $(INSTALL_SCRIPT)
+SCRIPTS = $(dist_pkgdata_SCRIPTS) $(dist_sbin_SCRIPTS)
+SOURCES =
+DIST_SOURCES =
+man8dir = $(mandir)/man8
+NROFF = nroff
+MANS = $(dist_man_MANS)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+nobase_dist_dataDATA_INSTALL = $(install_sh_DATA)
+nobase_dist_sysconfDATA_INSTALL = $(install_sh_DATA)
+DATA = $(nobase_dist_data_DATA) $(nobase_dist_sysconf_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = ${SHELL} /home/src/sendmail/sendmail-8.14.3/debian/build/missing --run aclocal-1.10
+AMTAR = ${SHELL} /home/src/sendmail/sendmail-8.14.3/debian/build/missing --run tar
+AUTOCONF = ${SHELL} /home/src/sendmail/sendmail-8.14.3/debian/build/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/src/sendmail/sendmail-8.14.3/debian/build/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/src/sendmail/sendmail-8.14.3/debian/build/missing --run automake-1.10
+AWK = gawk
+CC = cc
+CCDEPMODE = depmode=none
+CFLAGS = -g -Wall -O2 -fPIC -fstack-protector-all -g -Wall -O2 -fPIC -fstack-protector-all
+CPP = cc -E
+CPPFLAGS = -g -Wall -O2 -fPIC -fstack-protector-all -g -Wall -O2 -fPIC -fstack-protector-all
+CYGPATH_W = echo
+DEBIAN = yes
+DEBIAN_DH = 4.1
+DEB_BUILD_ARCH = amd64
+DEB_BUILD_GNU_CPU = x86_64
+DEB_BUILD_GNU_SYSTEM = linux-gnu
+DEB_BUILD_GNU_TYPE = x86_64-linux-gnu
+DEB_HOST_ARCH = amd64
+DEB_HOST_GNU_CPU = x86_64
+DEB_HOST_GNU_SYSTEM = linux-gnu
+DEB_HOST_GNU_TYPE = x86_64-linux-gnu
+DEFS = -DPACKAGE_NAME=\"Sendmail\" -DPACKAGE_TARNAME=\"sendmail\" -DPACKAGE_VERSION=\"8.14.3\" -DPACKAGE_STRING=\"Sendmail\ 8.14.3\" -DPACKAGE_BUGREPORT=\"bug/reportbug\ or\ sendmail@packages.debian.org\" -DPACKAGE=\"sendmail\" -DVERSION=\"8.14.3\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIBMILTER_MFAPI_H=1 -DHAVE_REGEX_H=1 -DHAVE_DB_H=1 -DHAVE_DB_185_H=1 -DHAVE_RPCSVC_YPCLNT_H=1 -DHAVE_RPCSVC_NIS_H=1 -DHAVE_LDAP_H=1 -DHAVE_RESOLV_H=1 -DHAVE_TCPD_H=1 -DHAVE_NETINET_IP6_H=1 -DHAVE_GETADDRINFO=1 -DHAVE_MAILLOCK_H=1 -DHAVE_SASL_SASL_H=1 -DHAVE_OPENSSL_SSL_H=1
+DEPDIR = .deps
+ECHO_C =
+ECHO_N = -n
+ECHO_T =
+EGREP = /bin/grep -E
+EXEEXT =
+GREP = /bin/grep
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
+LDFLAGS = -pie -Wl,-z,noexecstack,-z,relro,-z,now -Wl,--warn-shared-textrel -pie -Wl,-z,noexecstack,-z,relro,-z,now -Wl,--warn-shared-textrel
+LIBOBJS =
+LIBS =
+LN_S = ln -s
+LTLIBOBJS =
+MAINT = #
+MAKEINFO = ${SHELL} /home/src/sendmail/sendmail-8.14.3/debian/build/missing --run makeinfo
+MKDIR_P = /bin/mkdir -p
+OBJEXT = o
+PACKAGE = sendmail
+PACKAGE_BUGREPORT = bug/reportbug or sendmail@packages.debian.org
+PACKAGE_NAME = Sendmail
+PACKAGE_STRING = Sendmail 8.14.3
+PACKAGE_TARNAME = sendmail
+PACKAGE_VERSION = 8.14.3
+PATH_SEPARATOR = :
+SET_MAKE =
+SHELL = /bin/sh
+SM_CPYRT = 2008
+SM_DATE = 2008-04-21 16:15:00
+SM_MAXVERS = 9.0.0
+SM_MINVERS = 8.7.6
+SM_VERS = 8.14.3
+STRIP =
+VERSION = 8.14.3
+abs_builddir = /home/src/sendmail/sendmail-8.14.3/debian/local
+abs_srcdir = /home/src/sendmail/sendmail-8.14.3/debian/local
+abs_top_builddir = /home/src/sendmail/sendmail-8.14.3/debian
+abs_top_srcdir = /home/src/sendmail/sendmail-8.14.3/debian
+ac_ct_CC = cc
+ac_version = 2.61
+am__include = include
+am__leading_dot = .
+am__quote =
+am__tar = ${AMTAR} chof - "$$tardir"
+am__untar = ${AMTAR} xf -
+am_version = 1.10
+bindir = /usr/bin
+build = x86_64-pc-linux-gnu
+build_alias = x86_64-linux-gnu
+build_cpu = x86_64
+build_os = linux-gnu
+build_vendor = pc
+builddir = .
+buildtree = build-tree/sendmail-8.14.3
+datadir = /usr/share
+datarootdir = /usr/share
+docdir = /usr/share/doc
+dvidir = ${docdir}
+exec_prefix = /usr
+host = x86_64-pc-linux-gnu
+host_alias =
+host_cpu = x86_64
+host_os = linux-gnu
+host_vendor = pc
+htmldir = ${docdir}
+includedir = /usr/include
+infodir = /usr/share/info
+install_sh = $(SHELL) /home/src/sendmail/sendmail-8.14.3/debian/build/install-sh
+libdir = /usr/lib
+libexecdir = /usr/lib/sm.bin
+localedir = ${datarootdir}/locale
+localstatedir = /var
+mandir = /usr/share/man
+mkdir_p = /bin/mkdir -p
+oldincludedir = /usr/include
+pdfdir = ${docdir}
+prefix = /usr
+program_transform_name = s,x,x,
+psdir = ${docdir}
+sbindir = /usr/sbin
+sharedstatedir = /usr/com
+sm_auth_lib = 2
+sm_badepends = , libdb4.6-dev, libldap2-dev, libwrap0-dev, liblockfile-dev, libsasl2-dev, libssl-dev
+sm_build_arch = amd64
+sm_custom =
+sm_custom_s =
+sm_databases = REGEX, DB, NIS, NIS+, LDAP, DNS
+sm_date = 2008-05-04
+sm_depends =
+sm_dist_name = Debian
+sm_dist_vers = lenny/sid
+sm_editmap_envdef =
+sm_editmap_libs = -ldb-4.6 -lldap -llber
+sm_enable_auth = yes
+sm_enable_bind = no
+sm_enable_hesiod = no
+sm_enable_ipv6 = yes
+sm_enable_ldap = yes
+sm_enable_maillock = yes
+sm_enable_milter = yes
+sm_enable_ndbm = no
+sm_enable_newdb = yes
+sm_enable_nis = yes
+sm_enable_nisplus = yes
+sm_enable_regex = yes
+sm_enable_sfio = no
+sm_enable_shm = yes
+sm_enable_tcpd = yes
+sm_enable_tls = yes
+sm_envdef = -DHASFCHMOD=1 -DHASSETRLIMIT=1 -DHASFLOCK=0 -DUSESETEUID=1 -DHASGETUSERSHELL=1 -DNETINET6
+sm_features = TCPWrappers, IPv6, LockFile, SMTP AUTH(SASL), STARTTLS(SSL)
+sm_ffr = -D_FFR_QUEUE_SCHED_DBG -D_FFR_SKIP_DOMAINS -D_FFR_GROUPREADABLEAUTHINFOFILE -D_FFR_DAEMON_NETUNIX -D_FFR_NO_PIPE -D_FFR_SHM_STATUS -D_FFR_RHS -D_FFR_MAIL_MACRO -D_FFR_QUEUEDELAY=1 -D_FFR_RESET_MACRO_GLOBALS -D_FFR_TLS_1 -D_FFR_DEAL_WITH_ERROR_SSL
+sm_hesiod_parms =
+sm_host_arch = amd64
+sm_incdirs =
+sm_ldap_lib = -lldap -llber
+sm_libmilter_envdef = -fPIC -DSM_CONF_POLL=1 -D_FFR_MULTILINE -D_FFR_SMFI_PROGRESS
+sm_libmilter_libs =
+sm_libmilter_version = 1.0.1
+sm_libs =
+sm_libsm_envdef = -fPIC -DHAVE_NANOSLEEP=1 -D_LDAP_EXAMPLE_ -DLDAP_REFERRALS -D_FFR_LDAP_URI -D_FFR_LDAP_SETVERSION -DLDAP_DEPRECATED -DSM_CONF_LDAP_MEMFREE
+sm_libsm_libs = -lldap -llber
+sm_libsmdb_envdef =
+sm_libsmdb_libs =
+sm_libsmutil_envdef = -fPIC
+sm_libsmutil_libs =
+sm_m4_ffr = define(`_FFR_MAIL_MACRO')
+sm_mail_local_envdef = -DCONTENTLENGTH -DMAILLOCK
+sm_mail_local_libs = -lldap -llber -llockfile
+sm_mailstats_envdef =
+sm_mailstats_libs = -lldap -llber
+sm_makemap_envdef =
+sm_makemap_libs = -ldb-4.6 -lldap -llber
+sm_mapdef = -DSOCKETMAP -DMAP_REGEX -DNEWDB -DNIS -DNISPLUS -DLDAPMAP
+sm_newdb_lib = -ldb-4.6
+sm_praliases_envdef =
+sm_praliases_libs = -ldb-4.6 -lldap -llber
+sm_recommends =
+sm_revision = -1
+sm_rmail_envdef =
+sm_rmail_libs = -lldap -llber
+sm_sendmail_envdef = -D_PATH_SENDMAILPID=\"/var/run/sendmail/mta/sendmail.pid\" -DIP_SRCROUTE=1 -DLDAP_REFERRALS -D_FFR_LDAP_URI -D_FFR_LDAP_SETVERSION -DLDAP_DEPRECATED -DTCPWRAPPERS -DSASL -I/usr/include/sasl -DSTARTTLS -D_FFR_QUEUE_SCHED_DBG -D_FFR_SKIP_DOMAINS -D_FFR_GROUPREADABLEAUTHINFOFILE -D_FFR_DAEMON_NETUNIX -D_FFR_NO_PIPE -D_FFR_SHM_STATUS -D_FFR_RHS -D_FFR_MAIL_MACRO -D_FFR_QUEUEDELAY=1 -D_FFR_RESET_MACRO_GLOBALS -D_FFR_TLS_1 -D_FFR_DEAL_WITH_ERROR_SSL
+sm_sendmail_libs = -ldb-4.6 -lnsl -lldap -llber -lresolv -lwrap -lsasl2 -lcrypto -lssl
+sm_smrsh_envdef = -DCMDDIR=\"/etc/mail/smrsh\" -DPATH=\"/usr/bin:/bin\"
+sm_smrsh_libs = -lldap -llber
+sm_suggests = , sasl2-bin, libsasl2-modules, openssl
+sm_time = 22:26:20
+sm_utc = +0000
+sm_vacation_envdef =
+sm_vacation_libs = -ldb-4.6 -lldap -llber
+sm_version = 8.14.3
+sm_version_beta =
+sm_version_major = 8.14
+sm_version_math = 527875
+sm_version_minor = 3
+sm_version_r = 14
+sm_version_v = 8
+srcdir = .
+sysconfdir = /etc
+target = x86_64-pc-linux-gnu
+target_alias =
+target_cpu = x86_64
+target_os = linux-gnu
+target_vendor = pc
+top_builddir = ..
+top_srcdir = ..
+
+#!/usr/bin/make -f
+#------------------------------------------------------------------------------
+# vim: syntax=make
+#
+# $Sendmail: Makefile,v 8.14.3 2008-05-04 22:26:20 cowboy Exp $
+#
+# Copyright (c) 1998-2008 Richard Nelson. All Rights Reserved.
+#
+# local/Makefile. Generated from Makefile.in by configure.
+#
+# Rules file for Sendmail 8.14.3-1(527875)
+# on Debian lenny/sid
+# via Debhelper V4.1
+#
+# Note: the .in file supports Sendmail 8.7.6 - 9.0.0
+# on Debian slink, potato, woody, testing, sid, ...
+# but the generated file is customized to the version noted above.
+#
+# Richard Nelson <cowboy@debian.org> 2008-05-04 22:26:20 (+0000)
+#------------------------------------------------------------------------------
+#
+# Shipped programs
+#
+nobase_dist_data_DATA = \
+ bug/sendmail/control \
+ bug/sendmail/script
+
+dist_pkgdata_SCRIPTS = \
+ Parse_conf.pm \
+ Parse_mc.pm \
+ dynamic \
+ parse_mc \
+ sendmail \
+ update_auth update_authm4 \
+ update_conf \
+ update_db \
+ update_ldap \
+ update_mc \
+ update_mk \
+ update_notices \
+ update_sendmail \
+ update_smrsh \
+ update_sys \
+ update_tcpd \
+ update_tls update_tlsm4
+
+dist_sbin_SCRIPTS = \
+ sendmailconfig
+
+#
+# Shipped manpages
+#
+dist_man_MANS = \
+ runq.sendmail.8 \
+ sendmailconfig.8
+
+#
+# Shipped data
+#
+nobase_dist_sysconf_DATA = \
+ mail/service.switch \
+ mail/service.switch-nodns \
+ mail/peers/provider
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu local/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu local/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: # $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): # $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+Parse_conf.pm: $(top_builddir)/config.status $(srcdir)/Parse_conf.pm.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+Parse_mc.pm: $(top_builddir)/config.status $(srcdir)/Parse_mc.pm.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+dynamic: $(top_builddir)/config.status $(srcdir)/dynamic.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+parse_mc: $(top_builddir)/config.status $(srcdir)/parse_mc.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+sendmailconfig: $(top_builddir)/config.status $(srcdir)/sendmailconfig.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+sendmail: $(top_builddir)/config.status $(srcdir)/sendmail.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+update_auth: $(top_builddir)/config.status $(srcdir)/update_auth.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+update_authm4: $(top_builddir)/config.status $(srcdir)/update_authm4.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+update_conf: $(top_builddir)/config.status $(srcdir)/update_conf.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+update_db: $(top_builddir)/config.status $(srcdir)/update_db.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+update_ldap: $(top_builddir)/config.status $(srcdir)/update_ldap.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+update_mc: $(top_builddir)/config.status $(srcdir)/update_mc.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+update_mk: $(top_builddir)/config.status $(srcdir)/update_mk.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+update_smrsh: $(top_builddir)/config.status $(srcdir)/update_smrsh.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+update_sys: $(top_builddir)/config.status $(srcdir)/update_sys.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+update_tls: $(top_builddir)/config.status $(srcdir)/update_tls.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+update_tlsm4: $(top_builddir)/config.status $(srcdir)/update_tlsm4.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-dist_pkgdataSCRIPTS: $(dist_pkgdata_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)"
+ @list='$(dist_pkgdata_SCRIPTS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f $$d$$p; then \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " $(dist_pkgdataSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgdatadir)/$$f'"; \
+ $(dist_pkgdataSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgdatadir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-dist_pkgdataSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_pkgdata_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \
+ rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \
+ done
+install-dist_sbinSCRIPTS: $(dist_sbin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)"
+ @list='$(dist_sbin_SCRIPTS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f $$d$$p; then \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " $(dist_sbinSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
+ $(dist_sbinSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(sbindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-dist_sbinSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_sbin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sbindir)/$$f"; \
+ done
+install-man8: $(man8_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)"
+ @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.8*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 8*) ;; \
+ *) ext='8' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst"; \
+ done
+uninstall-man8:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.8*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 8*) ;; \
+ *) ext='8' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man8dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man8dir)/$$inst"; \
+ done
+install-nobase_dist_dataDATA: $(nobase_dist_data_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(datadir)" || $(MKDIR_P) "$(DESTDIR)$(datadir)"
+ @$(am__vpath_adj_setup) \
+ list='$(nobase_dist_data_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ $(am__vpath_adj) \
+ echo " $(nobase_dist_dataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(datadir)/$$f'"; \
+ $(nobase_dist_dataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(datadir)/$$f"; \
+ done
+
+uninstall-nobase_dist_dataDATA:
+ @$(NORMAL_UNINSTALL)
+ @$(am__vpath_adj_setup) \
+ list='$(nobase_dist_data_DATA)'; for p in $$list; do \
+ $(am__vpath_adj) \
+ echo " rm -f '$(DESTDIR)$(datadir)/$$f'"; \
+ rm -f "$(DESTDIR)$(datadir)/$$f"; \
+ done
+install-nobase_dist_sysconfDATA: $(nobase_dist_sysconf_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(sysconfdir)" || $(MKDIR_P) "$(DESTDIR)$(sysconfdir)"
+ @$(am__vpath_adj_setup) \
+ list='$(nobase_dist_sysconf_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ $(am__vpath_adj) \
+ echo " $(nobase_dist_sysconfDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(sysconfdir)/$$f'"; \
+ $(nobase_dist_sysconfDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(sysconfdir)/$$f"; \
+ done
+
+uninstall-nobase_dist_sysconfDATA:
+ @$(NORMAL_UNINSTALL)
+ @$(am__vpath_adj_setup) \
+ list='$(nobase_dist_sysconf_DATA)'; for p in $$list; do \
+ $(am__vpath_adj) \
+ echo " rm -f '$(DESTDIR)$(sysconfdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sysconfdir)/$$f"; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(SCRIPTS) $(MANS) $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(datadir)" "$(DESTDIR)$(sysconfdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_pkgdataSCRIPTS install-man \
+ install-nobase_dist_dataDATA
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-dist_sbinSCRIPTS \
+ install-nobase_dist_sysconfDATA
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man: install-man8
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_pkgdataSCRIPTS uninstall-dist_sbinSCRIPTS \
+ uninstall-man uninstall-nobase_dist_dataDATA \
+ uninstall-nobase_dist_sysconfDATA
+
+uninstall-man: uninstall-man8
+
+.MAKE: install-am install-data-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+ distclean-generic distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am \
+ install-data-hook install-dist_pkgdataSCRIPTS \
+ install-dist_sbinSCRIPTS install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-man8 \
+ install-nobase_dist_dataDATA install-nobase_dist_sysconfDATA \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-dist_pkgdataSCRIPTS uninstall-dist_sbinSCRIPTS \
+ uninstall-man uninstall-man8 uninstall-nobase_dist_dataDATA \
+ uninstall-nobase_dist_sysconfDATA
+
+#
+# Local customisation... not automake friendly (should all be SCRIPTS) :(
+#
+install-data-hook:
+ chmod a+x ${DESTDIR}${datadir}/bug/sendmail/script;
+ ${LN_S} sendmail ${DESTDIR}${pkgdatadir}/hoststat;
+ ${LN_S} sendmail ${DESTDIR}${pkgdatadir}/mailstats;
+ ${LN_S} sendmail ${DESTDIR}${pkgdatadir}/mailq;
+ ${LN_S} sendmail ${DESTDIR}${pkgdatadir}/newaliases;
+ ${LN_S} sendmail ${DESTDIR}${pkgdatadir}/purgestat;
+ ${LN_S} sendmail ${DESTDIR}${pkgdatadir}/runq;
+ ${LN_S} sendmail ${DESTDIR}${pkgdatadir}/status;
+#
+# Debian targets, phase out
+#
+.PHONY: build-indep build-arch
+.PHONY: install-indep install-arch
+build-indep:
+build-arch:
+install-indep: install
+install-arch:
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/debian/local/Parse_conf.pm b/debian/local/Parse_conf.pm
new file mode 100644
index 0000000..708de7d
--- /dev/null
+++ b/debian/local/Parse_conf.pm
@@ -0,0 +1,963 @@
+#!/usr/bin/perl -w
+#------------------------------------------------------------------------
+#
+# $Sendmail: Parse_conf.pm,v 8.14.3 2008-05-04 22:26:20 cowboy Exp $
+#
+# Parse and update /etc/mail/sendmail.conf
+#
+# Copyright (c) 2001-2008 Richard Nelson. All Rights Reserved.
+#
+# Notes (to all):
+#
+# Notes (to self):
+#
+#------------------------------------------------------------------------
+#
+# Package/Module declaration
+package Parse_conf;
+require Exporter;
+@ISA = qw(Exporter);
+#@EXPORT = qw(read_conf write_conf);
+@EXPORT_OK = qw(read_conf write_conf get_value);
+$VERSION = '2.0000';
+#
+# Initialization of the perl environment
+use strict; # be kosher
+#use warnings; # Not needed here
+use Cwd; # provide cwd()
+use Env; # A few environmental references
+use integer; # Peformance
+use Sys::Hostname; # make sure we have a valid hostname
+use Getopt::Long; # parameter handling
+use FileHandle; # I/O
+
+# Local libraries - for Debian Sendmail Perl helper functions
+# BEGIN { $main::my_path = substr($0,$[,rindex($0,'/')) };
+use lib ('.', substr($0,$[,rindex($0,'/')), "/usr/share/sendmail");
+require Parse_mc;
+
+# Version of this program
+#($main::MYNAME = $main::0) =~ s|.*/||;
+#$main::Author = "Richard Nelson";
+#$main::AuthorMail = "cowboy\@debian.org";
+#$main::Version = '$Revision: 1.00 $ ';
+$Parse_conf::program_name = 'Parse_conf.pm';
+$Parse_conf::program_version = '8.14.3';
+$Parse_conf::program_date = '2008-05-04 22:26:20 cowboy';
+$Parse_conf::debug = 0;
+
+my $interp_pgm = "$^X";
+my $interp_vrm = $];
+$interp_vrm = ("$^V" | '000') if (defined $^V);
+my $current_time = scalar localtime;
+my $user = getlogin || (getpwuid($<))[0] || "Unknown!!";
+my $hostname = hostname();
+my $directory = getcwd();
+
+$Parse_conf::Conffile = "/etc/mail/sendmail.conf";
+my $debug;
+
+#
+#------------------------------------------------------------------------------
+# Global variables
+#------------------------------------------------------------------------------
+my %parm_def = (
+ 'DAEMON_NETMODE' => 'Static'
+ ,'DAEMON_NETIF' => 'eth0'
+ ,'DAEMON_MODE' => 'Daemon'
+ ,'DAEMON_RUNASUSER' => 'No'
+ ,'DAEMON_PARMS' => ''
+ ,'DAEMON_HOSTSTATS' => 'No'
+ ,'DAEMON_MAILSTATS' => 'No'
+ ,'QUEUE_MODE' => '${DAEMON_MODE}'
+ ,'QUEUE_INTERVAL' => '10m'
+ ,'QUEUE_PARMS' => ''
+ ,'MSP_MODE' => 'Cron'
+ ,'MSP_INTERVAL' => '20m'
+ ,'MSP_PARMS' => ''
+ ,'MSP_MAILSTATS' => '${DAEMON_MAILSTATS}'
+ ,'MISC_PARMS' => ''
+ ,'CRON_MAILTO' => 'root'
+ ,'CRON_PARMS' => ''
+ ,'HANDS_OFF' => 'No'
+ ,'LOG_CMDS' => 'No'
+ ,'AGE_DATA' => ''
+ );
+
+my %parameter = %parm_def;
+
+my %parm_kw = (
+ 'DAEMON_NETMODE' => ['static', 'dynamic']
+ ,'DAEMON_MODE' => ['daemon', 'inetd','none']
+ ,'QUEUE_MODE' => ['daemon', 'cron', 'none']
+ ,'MSP_MODE' => ['daemon', 'cron', 'none']
+ );
+
+my %parm_bool = (
+ 'HANDS_OFF' => 1
+ ,'DAEMON_RUNASUSER' => 1
+ ,'DAEMON_HOSTSTATS' => 1
+ ,'DAEMON_MAILSTATS' => 1
+ ,'MSP_MAILSTATS' => 1
+ ,'LOG_CMDS' => 1
+ );
+
+my %parm_dependant = (
+ );
+
+my %parm_deprecated = (
+ 'DAEMON_STATS' => 'DAEMON_MAILSTATS'
+ ,'MSP_STATS' => 'MSP_MAILSTATS'
+ );
+
+my %parm_hidden = (
+ 'DAEMON_RUNASUSER' => 1
+ ,'prefix' => 1
+ ,'exec_prefix' => 1
+ ,'bindir' => 1
+ ,'sbindir' => 1
+ ,'libexecdir' => 1
+ ,'datadir' => 1
+ ,'sysconfdir' => 1
+ ,'sharedstatedir' => 1
+ ,'localstatedir' => 1
+ ,'libdir' => 1
+ ,'MTA_DAEMON' => 1
+ ,'MTA_COMMAND' => 1
+ ,'MTA_L' => 1
+ ,'MTA_L_QUEUE' => 1
+ ,'MTA_ROOT' => 1
+ ,'MTA_PIDFILE' => 1
+ ,'MSP_DAEMON' => 1
+ ,'MSP_COMMAND' => 1
+ ,'MSP_L' => 1
+ ,'MSP_L_QUEUE' => 1
+ ,'MSP_ROOT' => 1
+ ,'MSP_PIDFILE' => 1
+ );
+
+#
+#------------------------------------------------------------------------------
+# Finally, some code (almost)
+#------------------------------------------------------------------------------
+1; # return (true);
+
+
+#
+#------------------------------------------------------------------------------
+# Read /etc/mail/sendmail.conf
+#------------------------------------------------------------------------------
+sub read_conf {
+ my ($input_file) = @_;
+ $input_file ||= $Parse_conf::Conffile;
+
+ $debug = $main::debug || $Parse_conf::debug;
+
+ # Update defaults according to current environment
+ &update_defaults;
+
+ # Read /etc/mail/sendmail.conf (if extant)
+ &read_config($input_file);
+
+ # Update old values to new format
+ &update_values;
+
+ # Make sure things are kosher
+ my $ok = &validate_config;
+ if (! $ok) {
+ die "Terminating due to configuration error.";
+ };
+ };
+
+#
+#------------------------------------------------------------------------------
+# [Re]write /etc/mail/sendmail.conf
+#------------------------------------------------------------------------------
+sub write_conf {
+ my ($output_file) = @_;
+
+ $debug = $main::debug || $Parse_conf::debug;
+
+ &write_config($output_file);
+ };
+
+#
+#------------------------------------------------------------------------
+# Update default settings according to current environment
+#------------------------------------------------------------------------
+sub update_defaults {
+ my ($class, $flags, $files, $options);
+ my ($ok, $stats);
+ my $file;
+
+ # Read the mc/m4 files
+ &Parse_mc::read_dbs('', '');
+
+ # Obtain entry for HOST_STATUS_DIRECTORY
+ ($class, $flags, $files, $options) =
+ &Parse_mc::entry_dbs('confHOST_STATUS_DIRECTORY');
+ $file = @{$files}[0];
+ if ( $file ne '-' and -d $file ) {
+ $parameter{'DAEMON_HOSTSTATS'} = 'Yes';
+ }
+ else {
+ $parameter{'DAEMON_HOSTSTATS'} = 'No';
+ };
+
+ # Obtain entry for STATUS_FILE
+ ($class, $flags, $files, $options) =
+ &Parse_mc::entry_dbs('STATUS_FILE');
+ $file = @{$files}[0];
+ if ( $file ne '-' and -e $file ) {
+ $parameter{'DAEMON_MAILSTATS'} = 'Yes';
+ }
+ else {
+ $parameter{'DAEMON_MAILSTATS'} = 'No';
+ };
+
+ # Obtain entry for MSP_STATUS_FILE
+ ($class, $flags, $files, $options) =
+ &Parse_mc::entry_dbs('MSP_STATUS_FILE');
+ $file = @{$files}[0];
+ if ( $file ne '-' and -e $file ) {
+ $parameter{'MSP_MAILSTATS'} = 'Yes';
+ }
+ else {
+ $parameter{'MSP_MAILSTATS'} = 'No';
+ };
+
+ };
+
+#
+#------------------------------------------------------------------------
+# Update old settings according to current format
+#------------------------------------------------------------------------
+sub update_values {
+ my ($ok, $var);
+
+ # Add m(inutes) to {queue,msp}_interval if needed
+ $parameter{'QUEUE_INTERVAL'} =~ s/^(\d+)$/$1m/;
+ $parameter{'MSP_INTERVAL'} =~ s/^(\d+)$/$1m/;
+
+ # Also update the queue aging data
+ ($ok, $var) = &get_value('AGE_DATA');
+ my $tmpval = eval $var;
+ if ($@) {
+ warn $@;
+ }
+ else {
+ $var = $tmpval;
+ };
+ if (not defined $var) {
+ $tmpval = '""';
+ }
+ elsif (not ref $var) {
+ $tmpval = "$var";
+ }
+ elsif (@{$var} == 0) {
+ $tmpval = '""';
+ }
+ else {
+ $tmpval = '[';
+ foreach my $entry (@{$var}) {
+ foreach my $ndx ($[ .. $#{@{$entry}}) {
+ @{$entry}[$ndx] =~ s/'/\\'/g;
+ };
+ @{$entry}[0] =~ s/^(\d+)$/$1m/;
+ $tmpval .= "['" . join("', '", @{$entry}) . "'],";
+ };
+ $tmpval .= ']';
+ $parameter{'AGE_DATA'} = $tmpval;
+ };
+
+ # Set any dependant fields here...
+ };
+
+#
+#------------------------------------------------------------------------
+# Obtain parameter name
+#------------------------------------------------------------------------
+sub get_name {
+ my ($name, $quiet) = @_;
+
+ # Handle deprecated/renamed variables
+ if ( exists($parm_deprecated{$name}) ) {
+ print STDERR "$name is deprecated."
+ if ($debug and ! $quiet);
+ if ( $parm_deprecated{$name} ) {
+ print STDERR " Please use $parm_deprecated{$name} instead.\n"
+ if ($debug and ! $quiet);
+ $name = $parm_deprecated{$name};
+ }
+ else {
+ print STDERR " It will be ignored.\n"
+ if ($debug and ! $quiet);
+ };
+ };
+
+ return $name;
+ };
+
+#
+#------------------------------------------------------------------------
+# Obtain value directly, or indirectly
+#------------------------------------------------------------------------
+sub get_value {
+ my ($name) = @_;
+ my $ok = 1;
+ my $value = '';
+ if ( ! exists($parameter{$name}) ) {
+ print STDERR "Variable $name not defined...\n";
+ return ($ok, $value);
+ };
+
+ $name = get_name($name, '');
+ $value = $parameter{$name};
+
+ my $tval = $value;
+ $tval =~ s/^\s*//;
+ my $default = 0;
+
+ # Dereference loop... keep original value if we get any errors...
+ Dereference:;
+ if ($tval =~ /^\$/) {
+ my @ref_stack = ($name);
+ my %ref_hash = ($name => 1);
+ while ($tval =~ /^\$/ and $ok) {
+ my $start = 1;
+ my $del = 1;
+ my $char = substr($tval, 1, 1);
+ if ( $char eq '{' or $char eq '(' ) {
+ $start += 1; $del += 2;
+ };
+ my $ref = get_name(substr($tval, $start,
+ length($tval)-$del), '');
+ push @ref_stack, $ref;
+ if (exists($ref_hash{$ref})) {
+ print STDERR "Go directly to jail; do not pass go, ",
+ "do not collect \$200\n";
+ print STDERR " Reference loop: ",
+ join('->', @ref_stack, '...'),"\n";
+ $ok = 0;
+ }
+ else {
+ $ref_hash{$ref} = 1;
+ if (lc $ref eq 'default') {
+ $tval = $parm_def{$name};
+ print STDERR
+ "Setting $name to default value: ",
+ "$parm_def{$name}.\n"
+ if ($debug);
+ }
+ elsif (exists($parameter{$ref})) {
+ $tval = $parameter{$ref};
+ print STDERR
+ "Setting $name to value of $ref: $tval.\n"
+ if ($debug);
+ }
+ else {
+ print STDERR
+ "Can not deference $ref, it doesn't exist.\n";
+ $ok = 0;
+ };
+ };
+ };
+ };
+
+ if ( $ok ) {
+ # Check keyword parms for valid values
+ if (exists $parm_kw{$name}) {
+ my @ltval = split(/\s/,$tval);
+ my $ltval = lc(@ltval[$[]);
+ my $found = "";
+ foreach my $value (@{$parm_kw{$name}}) {
+ if ($value eq $ltval) {
+ $found = 1; $tval = ucfirst($ltval); };
+ };
+ if ( ! $found ) {
+ $default += 1;
+ if ( $default > 1 ) {
+ print STDERR
+ "Can not resolve $name, value=$value.\n";
+ $ok = 0;
+ }
+ else {
+ print STDERR "Illegal value($tval) for $name.\n",
+ " Valid values are: ",
+ join(', ', @{$parm_kw{$name}}),
+ "\n",
+ " Set to default: $parm_def{$name}.\n";
+ $tval = $parm_def{$name};
+ goto Dereference;
+ };
+ };
+ }
+
+ # Check boolean parms for valid values
+ elsif (exists $parm_bool{$name}) {
+ my @ltval = split(/\s/,$tval);
+ my $ltval = lc(@ltval[$[]);
+ $ltval =~ s/^[ty1].*/1/;
+ $ltval =~ s/^[fn0].*/0/;
+ if ($ltval eq '0' or $ltval eq '1') {
+ $tval = ucfirst($ltval); }
+ else {
+ $default += 1;
+ if ( $default > 1 ) {
+ print STDERR
+ "Can not resolve $name, value=$value.\n";
+ $ok = 0;
+ }
+ else {
+ print STDERR "Illegal value($tval) for $name.\n",
+ " Valid values are: T[rue],Y[es],1,",
+ " F[alse],N[o],0\n",
+ " Set to default: $parm_def{$name}.\n";
+ $tval = $parm_def{$name};
+ goto Dereference;
+ };
+ };
+ };
+ };
+
+ $value = $tval if $ok;
+
+ print STDERR "get_value : $name => $value\n"
+ if ($debug);
+
+ return ($ok, $value);
+ };
+
+#
+#------------------------------------------------------------------------
+# Read input configuration file (if no input, just use defaults)
+#------------------------------------------------------------------------
+sub read_config {
+ my ($input_file) = @_;
+ @ARGV = split(' ', $input_file);
+ return if (! -r $input_file);
+
+ my $savename = '';
+ my $parmname = '';
+ my $parmval = '';
+ my $parmref = '';
+ my $defname = '';
+ my $defval = '';
+ my $tmpval = '';
+
+ print STDOUT "Reading configuration from ", join(',',@ARGV), ".\n";
+
+ line: while (<ARGV>) {
+ next line if /^$/; # skip empty lines
+ chomp; # drop tailing \n
+ if (s/\\$//) {
+ $_ .= <>;
+ redo unless eof();
+ };
+
+ # check commented lines for default parameter values
+ # a bit of a kluge, but it works out nicely
+ if (/^#\s*([\w_]+)="([^"]*)"/) {
+ $defname = get_name($1, 1);
+ $defval = $2;
+ print STDERR "Default: $defname => $defval.\n"
+ if ($debug);
+ next line;
+ };
+ # Skip any comments
+ next line if /^#/; # skip comments
+
+ # Process assignment statements
+ if (/^\s*([\w_]+)="([^"]*)"/) {
+ $savename = $1;
+ $parmname = get_name($savename, '');
+ $parmval = $2;
+ print STDERR "Value : $savename => $parmval.\n"
+ if ($debug);
+
+ # Do we know about this parameter?
+ # NOTE: keep, even if we don't know about it to prevent
+ # problems with up/down grades (not loose anything)
+ if ( ! exists($parm_def{$parmname}) and
+ ! exists($parm_hidden{$parmname}) ) {
+ print STDERR "$parmname is a user defined parameter.\n"
+ if ($debug);
+ };
+
+ # Note if value is default, if so, we'll change it to
+ # the current default - maybe counterintuitive, oh well
+ # it does help with migration
+ if ($parmname eq $defname and $parmval eq $defval) {
+ print STDERR "$parmname is the default value: $defval.\n"
+ if ($debug);
+ $parmval = $parm_def{$parmname};
+ };
+
+ # Finally, assign value
+ if (exists $parm_kw{$savename} or
+ exists $parm_bool{$savename}) {
+ $parmval = ucfirst($parmval);
+ };
+
+ if ($savename eq $parmname) {
+ $parameter{$parmname} = $parmval;
+ }
+ else {
+ $parameter{$savename} = $parmval;
+ };
+ };
+ };
+ };
+
+#
+#------------------------------------------------------------------------
+# Validate current configuration
+#------------------------------------------------------------------------
+sub validate_config {
+
+ my $valid = 1;
+
+ print STDOUT "Validating configuration.\n";
+
+ # Really, we only care about the some of the variables - those
+ # that have defaults... the rest, well, so what !
+ foreach my $val (sort keys %parm_def) {
+ my ($ok, $value) = &get_value($val, 1);
+ if (! $ok) { $valid = 0; };
+ };
+
+ if (! $valid ) {
+ print STDERR "\nOne or more errors were encountered!\n\n";
+ };
+
+ return ($valid);
+ };
+
+#
+#------------------------------------------------------------------------
+# Write updated configuration file
+#------------------------------------------------------------------------
+sub write_config {
+ my ($database_file) = @_;
+ my $ofh = new FileHandle;
+
+ # Make sure things are kosher
+ my $result = &validate_config;
+ if (! $result) {
+ die "Terminating due to configuration error.";
+ };
+
+ $database_file = $database_file || $Parse_conf::Conffile;
+ my $caller = "$main::program_name" if ($main::program_name);
+ $caller .= " $main::program_version" if ($main::program_version);
+ $caller .= " $main::program_date" if ($main::program_date);
+
+ print STDOUT "Writing configuration to $database_file.\n";
+ $database_file = '&STDOUT' if ($database_file eq '-');
+ unless ( open($ofh, ">$database_file") ) {
+ warn("Could not open $database_file($!), using STDOUT\n");
+ open($ofh, ">&STDOUT");
+ };
+ $database_file = '-' if ($database_file eq '&STDOUT');
+
+# print $ofh <<"EOT";
+####################################################################
+##### This file is automagically generated -- edit at your own risk
+#####
+##### file: ${database_file}
+##### generated via: (${interp_pgm} ${interp_vrm})
+##### ${caller}
+##### ${Parse_conf::program_name} ${Parse_conf::program_version} ${Parse_conf::program_date}
+##### by: ${user}\@${hostname}
+##### on: ${current_time}
+##### in: ${directory}
+##### input files:
+#EOT
+# foreach my $file ( split(' ', $input_file) ) {
+# print $ofh <<"EOT";
+##### ${file}
+#EOT
+# };
+# print $ofh <<"EOT";
+#####
+####################################################################
+ print $ofh <<"EOT";
+#------------------------------------------------------------------------------
+#
+# $database_file
+#
+# Copyright (c) 2001-2008 Richard Nelson. All Rights Reserved.
+# Version: ${main::program_version}
+# Time-stamp: <${main::program_date}>
+#
+# Parameter file for sendmail (sourced by /usr/share/sendmail/sendmail)
+# Make all changes herein, instead of altering /etc/init.d/sendmail.
+#
+# After making changes here, you'll need to run /usr/sbin/sendmailconfig
+# or ${main::program_name} to have the changes take effect -
+# If you change DAEMON_MODE, QUEUE_MODE, or QUEUE_INTERVAL, you'll also
+# need to run /etc/init.d/sendmail restart.
+#
+# Changes made herein will be kept across upgrades - except for comments!
+# Some comment lines have special significance ...
+#
+# **** **** **** **** DO NOT EDIT THE COMMENTS **** **** **** ****
+#
+# Supported parameters (and defaults) are listed herein.
+#
+# Notes:
+# * This setup allows sendmail to run in several modes:
+# - listener and queue runner..DAEMON_MODE="daemon".QUEUE_MODE="daemon"
+# - listener only..............DAEMON_MODE="daemon".QUEUE_MODE="none"
+# - queue runner only..........DAEMON_MODE="none"...QUEUE_MODE="daemon"
+# - *NOTHING* ?!?..............DAEMON_MODE="none"...QUEUE_MODE="none"
+#
+# * You can also run the listener from inetd:
+# - listener and queue runner..DAEMON_MODE="inetd"..QUEUE_MODE="daemon"
+# - listener only..............DAEMON_MODE="inetd"..QUEUE_MODE="none"
+#
+# * You can also run the queue runner from cron:
+# - listener and queue runner..DAEMON_MODE="....."..QUEUE_MODE="cron"
+# - queue runner only..........DAEMON_MODE="none"...QUEUE_MODE="cron"
+#
+# * _PARMS entries herein are shown in precedence order, any later _PARMS
+# field will, if applicable, override any previous _PARMS fields.
+#
+# * Values *MUST* be surrounded with double quotes ("), single quotes
+# will *NOT* work !
+#
+#------------------------------------------------------------------------------
+# SMTP Listener Configuration
+#
+# DAEMON_NETMODE="$parm_def{'DAEMON_NETMODE'}"; Keyword SMTP network mode
+# static: Do not monitor any network interfaces for changes
+# dynamic: Monitor one or more interfaces for changes
+#
+DAEMON_NETMODE="$parameter{'DAEMON_NETMODE'}";
+#
+# DAEMON_NETIF="$parm_def{'DAEMON_NETIF'}"; string SMTP interface(s)
+# This parameter defines the network interface(s) that the daemon
+# will monitor for status changes (via ppp, dhcp, ifup/down hooks).
+#
+# NOTES:
+# 1) Only list more than one interfaces if they only used for fallback,
+# otherwise the daemon will wind up ping-ponging between interfaces.
+# 2) Do not use 'lo' unless your daemon only listens on the localhost.
+#
+DAEMON_NETIF="$parameter{'DAEMON_NETIF'}";
+#
+# DAEMON_MODE="$parm_def{'DAEMON_MODE'}"; Keyword SMTP listener
+# daemon: Run as standalone daemon
+# inetd: Run from inet supervisor (forks for each mail)
+# none: No listener (ie, nullclient/smarthost)
+#
+# NOTE: If you choose "none", mail will build up in the MSP queues
+# and you will not receive any mail from external sites.
+#
+DAEMON_MODE="$parameter{'DAEMON_MODE'}";
+#
+# DAEMON_PARMS="$parm_def{'DAEMON_PARMS'}"; String Listener parms
+# Any parameters here will be ignored when run from cron.
+# Note that {QUEUE,MISC,CRON}_PARMS, if applicable, will override
+# anything declared herein.
+#
+DAEMON_PARMS="$parameter{'DAEMON_PARMS'}";
+#
+# DAEMON_HOSTSTATS="$parm_def{'DAEMON_HOSTSTATS'}"; Boolean Listener stats
+# This parameter determines whether or not host stats are collected
+# and available for the \`hoststat\` command to display. There will
+# be a (minor) performance hit, as files will be created/updated for each
+# sendmail delivery attempt. The files are fixed in size, and small,
+# but there can be many of them.
+#
+DAEMON_HOSTSTATS="$parameter{'DAEMON_HOSTSTATS'}";
+#
+# DAEMON_MAILSTATS="$parm_def{'DAEMON_MAILSTATS'}"; Boolean Listener stats
+# This parameter determines whether or not mailer stats are collected
+# and available for the \`mailstats\` command to display. There will
+# be a (minor) performance hit, as this file will be updated for each
+# item coming into, or out of, sendmail. The file is fixed in size,
+# and small, so there's no need to rotate it.
+#
+DAEMON_MAILSTATS="$parameter{'DAEMON_MAILSTATS'}";
+#
+#------------------------------------------------------------------------------
+# SMTP MTA Queue Runner Configuration
+#
+# QUEUE_MODE="$parm_def{'QUEUE_MODE'}"; Keyword SMTP queue runner
+# daemon: Run as standalone daemon
+# cron: Run from crontab
+# none: No queue runner (ie, nullclient/smarthost)
+#
+QUEUE_MODE="$parameter{'QUEUE_MODE'}";
+#
+# QUEUE_INTERVAL="$parm_def{'QUEUE_INTERVAL'}"; Timespec (digits+w|d|h|m|s)
+# Interval at which to run the MTA queues. What interval should you use?
+# The amount of time that is acceptable before retrying delivery on
+# mail that couldn't be delivered in one run, or how long an item can
+# set in the queue before having the first delivery attempt done.
+#
+# NOTE: If you leave this field blank, You get *NO* queue runners !!!
+#
+QUEUE_INTERVAL="$parameter{'QUEUE_INTERVAL'}";
+#
+# QUEUE_PARMS="$parm_def{'QUEUE_PARMS'}"; String queue parameters
+# Any parameters here are also used when run from cron.
+# Note that MISC_PARMS and CRON_PARMS, if applicable, will override
+# anything declared herein.
+#
+QUEUE_PARMS="$parameter{'QUEUE_PARMS'}";
+#
+#------------------------------------------------------------------------------
+# SMTP - MSP Queue Runner Configuration
+#
+# MSP_MODE="$parm_def{'MSP_MODE'}"; Keyword MSP queue runner mode
+# daemon: Run as standalone daemon
+# cron: Run from crontab
+# none: No queue runner (ie, nullclient/smarthost)
+#
+# NOTE: If QUEUE_MODE="cron" & MSP_MODE="none", the MSP queue will
+# be run as part of the MTA queue running process.
+#
+MSP_MODE="$parameter{'MSP_MODE'}";
+#
+# MSP_INTERVAL="$parm_def{'MSP_INTERVAL'}"; Timespec (digits+w|d|h|m|s)
+# Interval at which to run the MSP queues. What interval should you use?
+# The amount of time that is acceptable before retrying delivery on
+# mail that couldn't be accepted by the MTA, and was therefore left
+# in the message submission queue. The MTA shouldn't be down that often
+# so this can be larger than QUEUE_INTERVAL.
+#
+# NOTE: If you leave this field blank, The MSP queue will *NOT* be run !!!
+#
+MSP_INTERVAL="$parameter{'MSP_INTERVAL'}";
+#
+# MSP_PARMS="$parm_def{'MSP_PARMS'}"; String queue parameters
+# Any parameters here are also used when run from cron.
+# Note that MISC_PARMS and CRON_PARMS, if applicable, will override
+# anything declared herein.
+#
+MSP_PARMS="$parameter{'MSP_PARMS'}";
+#
+# MSP_MAILSTATS="$parm_def{'MSP_MAILSTATS'}"; Boolean Listener stats
+# This parameter determines whether or not mailer stats are collected
+# and available for the \`mailstats\` command to display. There will
+# be a (minor) performance hit, as this file will be updated for each
+# item coming into, or out of, sendmail. The file is fixed in size,
+# and small, so there's no need to rotate it.
+#
+MSP_MAILSTATS="$parameter{'MSP_MAILSTATS'}";
+#
+#------------------------------------------------------------------------------
+# Miscellaneous Confguration
+#
+# MISC_PARMS="$parm_def{'MISC_PARMS'}"; String miscellaneous parameters
+# Miscellaneous parameters - applied to any sendmail invocation.
+# Any parameters here are also used when run from cron.
+# Applied after {DAEMON,QUEUE}_PARMS, and can therefore override them
+# if need be (in which case why did use them?)
+# Note that CRON_PARMS, if applicable, will override anything
+# declared herein.
+#
+# Here is where'd you setup and debugging or special parms that you
+# want shared betwixt the possibly separate listener/queue-runner
+# processes.
+#
+MISC_PARMS="$parameter{'MISC_PARMS'}";
+#
+#------------------------------------------------------------------------------
+# Cron Job Configuration
+#
+# CRON_MAILTO="$parm_def{'CRON_MAILTO'}"; String cronjob output
+# Recipient of *rare* cronjob output. Some cronjobs will be running
+# under user `mail`, so any problems encountered would probably be missed
+# so define a user who actually (hopefully) checks email now and again.
+#
+CRON_MAILTO="$parameter{'CRON_MAILTO'}";
+#
+# CRON_PARMS="$parm_def{'CRON_PARMS'}"; String cron specific parmeters
+# Cron parameters - applied *only* when sendmail queue running is done
+# via a cronjob. Applied after QUEUE_PARMS and MISC_PARMS, and can
+# therefore override them if need be.
+#
+CRON_PARMS="$parameter{'CRON_PARMS'}";
+#
+#------------------------------------------------------------------------------
+# Other stuff
+# LOG_CMDS="$parm_def{'LOG_CMDS'}"; Binary command logging flag
+# Will cause syslog entries for many of the sendmail related commands
+# like runq, mailq, etc - you'll also see cron jobs (if enabled).
+#
+LOG_CMDS="$parameter{'LOG_CMDS'}";
+#
+# HANDS_OFF="$parm_def{'HANDS_OFF'}"; Binary Do *NOT* touch the configuration
+# Set this *ONLY* if you are going to be fully responsible for the entire
+# setup of sendmail - the directories, permissions, databases, etc. With
+# this variable set to "Yes", nothing will be done for you during updates.
+#
+# In other words, "The blood be upon your hands" if you set this...
+# My ability to help with problems will be greatly reduced !
+#
+# "Well, a pet peeve of mine is people who directly edit the
+# .cf file instead of using the m4 configuration files.
+# Don't do it! [laughs] I treat the .cf file as a binary
+# file - you should too."
+# -- Eric Allman 1999/10/18
+# http://www.dotcomeon.com/allman_sendmail_qa.html
+#
+HANDS_OFF="$parameter{'HANDS_OFF'}";
+#
+#------------------------------------------------------------------------------
+# Queue Aging Configuration
+#
+# Why would you want to age your queues? On every queue-run interval,
+# sendmail will try *every* file in the queue... If a site is down
+# for a while, considerable time can be wasted each interval in retrying
+# it. The scheme supported allows aging by time, and can move the older
+# files to another (less frequently run queue), thereby reducing overal
+# system impact - and providing better mail throughput.
+#
+# Note that this support is completely separate from QUEUE_MODE=cron,
+# you can age queues even if you're running QUEUE_MODE=daemon.
+#
+# There are four parts to the queue aging support, and these parts
+# may be repeated, to operate on multiple queues.
+#
+# 1. Interval at which to age the queues (in minutes).
+# What interval should you use? Roughly twice the normal queue
+# interval, so that messages are tried twice in each successively
+# slower queue.
+#
+# 2. Criteria (optional and defaults to interval). This is the
+# specification of which files to move. It defaults moving
+# files whose age in the queues exceeds the interval.
+# This field, if specified can be very complex - supporting
+# aging by just about anything! see qtool(8) for details.
+#
+# 3. To queue. This is the queue to which files will be moved.
+# It may be fully qualified, or relative to /var/spool/mqueue.
+#
+# 4. From queue. This is the queue from which files will be moved.
+# It may be fully qualified, or relative to /var/spool/mqueue.
+#
+# Samples:
+# AGE_DATA="[['25m', '', 'hourly', 'main']]";
+# Every 25 minutes, move any file older than 25 minutes from
+# /var/spool/mqueue/main to /var/spool/mqueue/hourly
+#
+# AGE_DATA="[['25m', '', 'hourly', 'main'],\\
+# ['125', '', 'daily', 'hourly']]";
+# Same as the above, but also move files from the hourly queue
+# to the daily queue after 125 minutes in the hourly queue.
+#
+# AGE_DATA="[['25m',\\
+# '-e \\'\$msg{message}[0] == /Deferred: 452 4.2.2 Over quota/\\'',\\
+# 'overquota', 'main']]";
+# Every 25 minutes, move all files deferred because of quota
+# violations from /var/spool/mqueue/main to
+# /var/spool/mqueue/overquota where they can be processed on
+# a different interval, or by some other means.
+#
+# If the above samples suggest Perl arrays, well, they are...
+#
+# AGE_DATA="$parm_def{'AGE_DATA'}"; Perl array Queue aging data
+#
+EOT
+ my ($ok, $var) = &get_value('AGE_DATA');
+ my $tmpval = eval $var;
+ if ($@) {
+ warn $@;
+ }
+ else {
+ $var = $tmpval;
+ };
+ if (not defined $var) {
+ print $ofh 'AGE_DATA="";',"\n";
+ }
+ elsif (not ref $var) {
+ print $ofh 'AGE_DATA="',$var,'";',"\n";
+ }
+ elsif (@{$var} == 0) {
+ print $ofh 'AGE_DATA="";',"\n";
+ }
+ else {
+ print $ofh 'AGE_DATA="[\\',"\n";
+ foreach my $entry (@{$var}) {
+ foreach my $ndx ($[ .. $#{@{$entry}}) {
+ @{$entry}[$ndx] =~ s/'/\\'/g;
+ };
+ print $ofh "['",join("', '",@{$entry}),"'],\\\n";
+ };
+ print $ofh ']";',"\n";
+ };
+ print $ofh <<"EOT";
+#
+#------------------------------------------------------------------------------
+# Dependant variables (set according to other variables)
+#
+EOT
+ foreach my $key (sort keys %parm_dependant) {
+ my ($ok, $value);
+ # Don't evaluate value, just stuff it...
+ next if ( ! $parameter{$key} );
+ ($ok, $value) = (1, $parameter{$key});
+ print $ofh "$key=",'"',$value,'";',"\n";
+ };
+ print $ofh <<"EOT";
+#
+#------------------------------------------------------------------------------
+# Hidden variables (the blood be upon your hands)
+#
+EOT
+ foreach my $key (sort keys %parm_hidden) {
+ my ($ok, $value);
+ # Don't evaluate value, just stuff it...
+ next if ( ! $parameter{$key} );
+ ($ok, $value) = (1, $parameter{$key});
+ print $ofh "$key=",'"',$value,'";',"\n";
+ };
+ print $ofh <<"EOT";
+#
+#------------------------------------------------------------------------------
+# Deprecated variables (kept for reference)
+#
+EOT
+ foreach my $key (sort keys %parm_deprecated) {
+ my ($ok, $value);
+ # Don't evaluate value, just stuff it...
+ if ( $parm_deprecated{$key} ) {
+ ($ok, $value) = (1, join('','${', $parm_deprecated{$key}, '}'));
+ }
+ elsif ( $parameter{$key} ) {
+ ($ok, $value) = (1, $parameter{$key});
+ };
+ print $ofh "$key=",'"',$value,'";',"\n";
+ };
+ print $ofh <<"EOT";
+#
+#------------------------------------------------------------------------------
+# Unknown variables (kept for reference)
+#
+EOT
+ foreach my $key (sort keys %parameter) {
+ if (! exists($parm_def{$key}) and
+ ! exists($parm_deprecated{$key})) {
+ # Don't evaluate value, just stuff it...
+ my ($ok, $value) = (1, $parameter{$key});
+ print $ofh "$key=",'"',$value,'";',"\n";
+ };
+ };
+ print $ofh <<"EOT";
+#------------------------------------------------------------------------------
+#
+
+EOT
+
+ close($ofh);
+ if ( $database_file eq $Parse_conf::Conffile ) {
+ chown '0', '0', "$database_file";
+ chmod 0644, "$database_file";
+ };
+ };
+
+__END__
diff --git a/debian/local/Parse_mc.pm b/debian/local/Parse_mc.pm
new file mode 100644
index 0000000..05bbf17
--- /dev/null
+++ b/debian/local/Parse_mc.pm
@@ -0,0 +1,1086 @@
+#!/usr/bin/perl -w
+#------------------------------------------------------------------------
+#
+# $Sendmail: Parse_mc.pm,v 8.14.3 2008-05-04 22:26:20 cowboy Exp $
+#
+# Parse Sendmail config for databases
+#
+# Copyright (c) 2001-2008 Richard Nelson. All Rights Reserved.
+#
+# Notes (to all):
+# * for "define(xxx,...)"; "define(xxx," must be on same line, but the
+# rest may be split across multiple lines
+# * assumes makemap dbtype /etc/mail/database < /etc/mail/database
+#
+# Notes (to self):
+# * changes made herein *must* be reflected in
+# parse_mc,update_mk,update_db,debian.m4
+# * userdb can also have multiple databases and then a forward!
+# * undefine support
+# * include support (also for OSTYPE, DOMAIN, SITE, etc)
+# * F and K lines
+#
+#------------------------------------------------------------------------
+#
+# Package/Module declaration
+package Parse_mc;
+require Exporter;
+@ISA = qw(Exporter);
+#@EXPORT = qw(read_mc write_dbs read_dbs);
+@EXPORT_OK = qw(read_mc write_dbs read_dbs
+ names_dbs restart_dbs entry_dbs format_dbs);
+$VERSION = '2.0002';
+#
+# Initialization of the perl environment
+use strict; # be kosher
+#use warnings; # Not needed here
+use Cwd; # provide cwd()
+use Env; # A few environmental references
+use integer; # Peformance
+use Sys::Hostname; # make sure we have a valid hostname
+use Getopt::Long; # parameter handling
+use FileHandle; # I/O
+
+# Version of this program
+#($main::MYNAME = $main::0) =~ s|.*/||;
+#$main::Author = "Richard Nelson";
+#$main::AuthorMail = "cowboy\@debian.org";
+#$main::Version = '$Revision: 2.00 $ ';
+$Parse_mc::program_name = 'Parse_mc.pm';
+$Parse_mc::program_version = '8.14.3';
+$Parse_mc::program_date = '2008-05-04 22:26:20 cowboy';
+$Parse_mc::debug = 0;
+
+my $interp_pgm = "$^X";
+my $interp_vrm = $];
+$interp_vrm = ("$^V" | '000') if (defined $^V);
+my $current_time = scalar localtime;
+my $user = getlogin || (getpwuid($<))[$[] || "Unknown!!";
+my $hostname = hostname();
+my $directory = getcwd();
+
+$Parse_mc::Conffile = "/etc/mail/databases";
+$Parse_mc::input_files = "/etc/mail/sendmail.mc";
+$Parse_mc::database_file = "/etc/mail/databases";
+
+my $debug;
+
+#
+# List of FEATURE()s, and their default file names (in path ${smdb_loc})
+my %smdb_features = (
+ access_db => 'access'
+ ,authinfo => 'authinfo'
+ ,bitdomain => 'bitdomain'
+ ,domaintable => 'domaintable'
+ ,genericstable => 'genericstable'
+ ,mailertable => 'mailertable'
+ ,use_cw_file => 'use_cw_file'
+ ,use_ct_file => 'use_ct_file'
+ ,uucpdomain => 'uudomain'
+ ,virtusertable => 'virtusertable'
+ );
+
+# List of classes, and a flag to note if it is reasonable to parse it
+my %smdb_classes = (
+ '' => 1 # Default, no class
+ ,'-' => 1 # ditto
+ ,bestmx => 0 # Lookup best MX record for host
+ ,btree => 1 # NEWDB
+ ,dbm => 1 # NDBM
+ ,dequote => 0 # Remove quotes
+ ,dnsmap => 0 # DNSMAP
+ ,hash => 1 # NEWDB
+ ,hesiod => 1 # HESIOD
+ ,host => 0 # Internal hostname lookup
+ ,implicit => 0 # Search for alias database
+ ,ldap => 0 # LDAPMAP
+ ,nis => 1 # NIS
+ ,nisplus => 1 # NISPLUS
+ ,null => 0 # Always returns false
+ ,program => 1 # Run an external program
+ ,sequence => 0 # Search a series of maps
+ ,stab => 0 # Internal alias
+ ,switch => 0 # Internal alias auto-build
+ ,text => 1 # Lookup in flat text file
+ ,userdb => 1 # Lookup in userdb
+ ,user => 1 # lookup passwd
+ ,newaliases => 1 # for internal usage (of this script)
+ );
+
+#
+#------------------------------------------------------------------------------
+# Prefill entries based upon Sendmail/Debian defaults
+# Yeah, this is long winded, but it needs to be said...
+#------------------------------------------------------------------------------
+my $smdb_loc = "/etc/mail/";
+my $smdb_type = 'hash';
+my %smdb_hash = (
+# ----------- Database defaults
+ 'MAIL_SETTINGS_DIR' =>
+ ['-','-',["${smdb_loc}"],'-']
+ ,'DATABASE_MAP_TYPE' =>
+ ["${smdb_type}",'-',['-'],'-']
+# ----------- General stuff
+ ,'sendmail.cf' =>
+ ['m4','-',["${smdb_loc}sendmail.mc"],'-']
+
+ ,'ALIAS_FILE' =>
+ ['newaliases','-',["${smdb_loc}aliases"],'-']
+# ,'CANONIFY_DOMAIN_FILE' =>
+# ['-','-',["${smdb_loc}canonify_domains"],'%[^\\#]']
+# ,'EXPOSED_USER_FILE' =>
+# ['-','-',["${smdb_loc}exposed_users"],'%[^\\#]']
+ ,'HELP_FILE' =>
+ ['-','-',["${smdb_loc}helpfile"],'-']
+# ,'GENERICS_DOMAIN_FILE' =>
+# ['-','-',["${smdb_loc}generic-domains"],'%[^\\#]']
+# ,'MASQUERADE_DOMAIN_FILE' =>
+# ['-,'-',["${smdb_loc}masquerade-domains"],'%[^\\#]']
+ ,'MSP_STATUS_FILE' =>
+ ['-','-',["/var/lib/sendmail/sm-client.st"],'-']
+ ,'MSP_QUEUE_DIR' =>
+ ['-','-',["/var/spool/mqueue-client"],'-']
+ ,'QUEUE_DIR' =>
+ ['-','-',["/var/spool/mqueue"],'-']
+# ,'RELAY_DOMAIN_FILE' =>
+# ['-','-',["${smdb_loc}relay-domains"],'%[^\\#]']
+ ,'STATUS_FILE' =>
+ ['-','-',["/var/lib/sendmail/sendmail.st"],'-']
+# ,'VIRTUSER_DOMAIN_FILE' =>
+# ['-','-',["${smdb_loc}virtual-domains"],'%[^\\#]']
+ ,'confCONTROL_SOCKET_NAME' =>
+ ['-','-',["/var/run/sendmail/smcontrol"],'-']
+ ,'confCR_FILE' =>
+ ['-','-o',["${smdb_loc}relay-domains"],'%[^\\#]']
+ ,'confCT_FILE' =>
+ ['-','-',["${smdb_loc}trusted-users"],'%[^\\#]']
+ ,'confCW_FILE' =>
+ ['-','-',["${smdb_loc}local-host-names"],'%[^\\#]']
+ ,'confDEAD_LETTER_DROP' =>
+ ['-','-',["/var/lib/sendmail/dead.letter"],'-']
+# ,'confDEF_AUTH_INFO' => # Deprecated, use authinfo rules instead
+# ['-','-',["${smdb_loc}default-auth-info"],'-']
+ ,'confEBINDIR' =>
+ ['-','-',["/usr/lib/sm.bin"],'-']
+# ,'confERROR_MESSAGE' => # No default
+# ['-','-',["${smdb_loc}error-header"],'-']
+ ,'confHOSTS_FILE' =>
+ ['-','-',["/etc/hosts"],'-']
+ ,'confHOST_STATUS_DIRECTORY' =>
+ ['-','-',["/var/lib/sendmail/host_status"],'-']
+ ,'confPID_FILE' =>
+ ['-','-',["/var/run/sendmail/mta/sendmail.pid"],'-']
+ ,'confSERVICE_SWITCH_FILE' =>
+ ['-','-',["${smdb_loc}service.switch"],'-']
+# ,'confUSERDB_SPEC' =>
+# ['btree','-o',["${smdb_loc}userdb"],'-']
+# ----------- STARTTLS
+ ,'confTO_STARTTLS' =>
+ ['-','-',["2m"],'-']
+ ,'confCACERT' =>
+ ['-','-',["${smdb_loc}tls/sendmail-server.crt"],'-']
+ ,'confCACERT_PATH' =>
+ ['-','-',["/etc/ssl/certs"],'-']
+ ,'confCRL' =>
+ ['-','-',[""],'-']
+ ,'confCLIENT_CERT' =>
+ ['-','-',["${smdb_loc}tls/sendmail-client.crt"],'-']
+ ,'confCLIENT_KEY' =>
+ ['-','-',["${smdb_loc}tls/sendmail-common.key"],'-']
+ ,'confSERVER_CERT' =>
+ ['-','-',["${smdb_loc}tls/sendmail-server.crt"],'-']
+ ,'confSERVER_KEY' =>
+ ['-','-',["${smdb_loc}tls/sendmail-common.key"],'-']
+ ,'confDH_PARAMETERS' =>
+ ['-','-',["${smdb_loc}tls/sendmail-common.prm"],'-']
+ ,'confTLS_SRV_OPTIONS' =>
+ ['-','-',["V"],'-']
+# ----------- SMTP AUTH (SASL)
+ ,'confTO_AUTH' =>
+ ['-','-',["2m"],'-']
+ ,'confAUTH_MECHANISMS' =>
+ ['-','-',["DIGEST-MD5 CRAM-MD5 NTLM LOGIN PLAIN"],"-"]
+ ,'TRUST_AUTH_MECH' =>
+ ['-','-',["DIGEST-MD5 CRAM-MD5 NTLM LOGIN PLAIN"],"-"]
+ ,'confAUTH_REALM' =>
+ ['-','-',[""],'-']
+ ,
+ );
+#
+#
+# Private entries
+$smdb_hash{'databases'} = ['parse_mc','-',["${smdb_loc}sendmail.mc"],'-'];
+$smdb_hash{'Makefile'} = ['update_mk','-',["${smdb_loc}databases"],'-'];
+$smdb_hash{'crontab'} = ['update_conf','-',["${smdb_loc}sendmail.conf"],'-'];
+$smdb_hash{'auth'} = ['update_auth','-',["${smdb_loc}sasl/sasl.m4"],'-'];
+$smdb_hash{'tls'} = ['update_tls','-',["${smdb_loc}tls/starttls.m4"],'-'];
+$smdb_hash{'include'} = ['-','-',[""],'-'];
+#
+# Conditional entries
+if ( -s "${smdb_loc}submit.mc" ) {
+ $smdb_hash{'submit.cf'} = ['m4','-',["${smdb_loc}submit.mc"],'-'];
+ };
+
+#
+# Databases/files that require a sendmail restart when modified:
+my %smdb_restart = (
+ 'EXPOSED_USER_FILE' => 1
+ ,'LOCAL_USER_FILE' => 1
+ ,'CANONIFY_DOMAIN_FILE' => 1
+ ,'GENERICS_DOMAIN_FILE' => 1
+ ,'RELAY_DOMAIN_FILE' => 1
+ ,'VIRTUSER_DOMAIN_FILE' => 1
+ ,'LDAPROUTE_DOMAIN_FILE' => 1
+ ,'LDAPROUTE_EQUIVALENT_FILE' => 1
+ ,'MASQUERADE_DOMAIN_FILE' => 1
+ ,'MASQUERADE_EXCEPTION_FILE' => 1
+ ,'confCR_FILE' => 1
+ ,'use_ct_file' => 1
+ ,'use_cw_file' => 1
+ ,'crontab' => 1
+ );
+
+$smdb_restart{'sendmail.cf'} = 1;
+if ( -s "${smdb_loc}submit.mc" ) {
+ $smdb_restart{'submit.cf'} = 1; };
+
+# Variables used in parsing lines
+my $smdb_state_looking = 0;
+my $smdb_state_start = 1;
+my $smdb_state_done = 2;
+my $smdb_state = $smdb_state_looking;
+my $smdb_string = '';
+my @smdb_entry = ();
+my $smdb_name = '';
+my $smdb_class = '';
+my @smdb_file = ();
+my $smdb_flags = '';
+my $smdb_options = '';
+my $smdb_default = '';
+
+my $QUEUE_GROUPS = 0;
+my $INCLUDES = 0;
+
+#------------------------------------------------------------------------------
+# Finally, some code (almost)
+#------------------------------------------------------------------------------
+1; # return (true);
+
+#
+#------------------------------------------------------------------------------
+# Read *.mc/*.m4 files
+#------------------------------------------------------------------------------
+sub read_mc {
+ my ($input_files) = @_;
+ my $ifh = new FileHandle;
+
+ $input_files = $input_files || $Parse_mc::input_files;
+ $Parse_mc::input_files = $input_files;
+ $debug = $main::debug || '';
+
+ unless ( open($ifh, "<$input_files") ) {
+ warn("Could not open $input_files($!)\n");
+ return;
+ };
+#print "Reading files:",$input_files,"\n";
+
+ #------------------------------------------------------------------
+ # Main loop, iterate over all input lines
+ #------------------------------------------------------------------
+ line: while (<$ifh>) {
+ next line if /^#/; # skip comments
+ next line if /^$/; # skip empty lines
+ chomp; # drop tailing \n
+ if (s/\\$//) {
+ $_ .= <>;
+ redo unless eof();
+ };
+#print "=>",$_,"\n";
+
+ #--------------------------------------------------------------
+ # Look for default database location
+ # define(MAIL_SETTINGS_DIR, /etc/mail/)dnl # comment
+ #--------------------------------------------------------------
+ if (/^\s*`?define\(\s*`?MAIL_SETTINGS_DIR/ ..
+ /[^\)]*\)/) {
+ &parse_string($_, 'define');
+ next line if ($smdb_state != $smdb_state_done);
+
+ &get_flags_name_opts;
+ $smdb_loc = $smdb_file[$[];
+ $smdb_class = '-';
+
+ &put_entry($ARGV, 'define');
+ }
+
+ #--------------------------------------------------------------
+ # Look for default database type
+ # define(DATABASE_MAP_TYPE, hash)dnl # comment
+ #--------------------------------------------------------------
+ elsif (/^\s*define\(\s*`?DATABASE_MAP_TYPE/ ..
+ /[^\)]*\)/) {
+ &parse_string($_, 'define');
+ next line if ($smdb_state != $smdb_state_done);
+
+ &get_flags_name_opts;
+ $smdb_type = $smdb_file[$[];
+ @smdb_file = ( $smdb_loc );
+ $smdb_class = $smdb_type;
+
+ &put_entry($ARGV, 'define');
+ }
+
+ #
+ #--------------------------------------------------------------
+ # Look for define(confUSERDB specifications
+ # define(confUSERDB_SPEC, /etc/mail/users.db)dnl # comment
+ #--------------------------------------------------------------
+ elsif (/^\s*`?define\(\s*`?confUSERDB_SPEC/ ..
+ /[^\)]*\)/) {
+ &parse_string($_, 'define');
+ next line if ($smdb_state != $smdb_state_done);
+
+ &get_flags_name_opts;
+ $smdb_flags = '-o';
+ $smdb_class = 'btree';
+
+ &put_entry($ARGV, 'define');
+ }
+
+ #--------------------------------------------------------------
+ # Look for all define(confC._FILE specifications
+ # define(confCR_FILE, -o /etc/mail/relay-domains %[^\#])dnl
+ # define(confCT_FILE, -o /etc/mail/sendmail.ct %[^\#])dnl
+ # define(confCW_FILE, -o /etc/mail/sendmail.cw %[^\#])dnl
+ #--------------------------------------------------------------
+ elsif (/^\s*`?define\(\s*`?confC[RTW]_FILE/ ..
+ /[^\)]*\)/) {
+ &parse_string($_, 'define');
+ next line if ($smdb_state != $smdb_state_done);
+
+ &get_flags_name_opts;
+
+ &put_entry($ARGV, 'define');
+ }
+
+ #--------------------------------------------------------------
+ # Look for all *_FILE( specifications
+ # EXPOSED_USER_FILE(/etc/mail/exposed-users %[^\#])dnl
+ # LOCAL_USER_FILE
+ # CANONIFY_DOMAIN_FILE
+ # GENERICS_DOMAIN_FILE(/etc/mail/generic-domains %[^\#])dnl
+ # RELAY_DOMAIN_FILE(/etc/mail/relay-domains %[^\#])dnl
+ # VIRTUSER_DOMAIN_FILE(/etc/mail/virtual-domains %[^\#])dnl
+ # LDAPROUTE_DOMAIN_FILE
+ # LDAPROUTE_EQUIVALENT_FILE
+ # MASQUERADE_DOMAIN_FILE(/etc/mail/masquerade-domains %[^\#])dnl
+ # MASQUERADE_EXCEPTION_FILE
+ #--------------------------------------------------------------
+ elsif (/^\s*`?((EXPOSED|LOCAL)_USER|(CANONIFY|GENERICS|RELAY|VIRTUSER)_DOMAIN|LDAPROUTE_(DOMAIN|EQUIVALENT)|MASQUERADE_(DOMAIN|EXCEPTION))_FILE\(/ ..
+ /[^\)]*\)/) {
+ &parse_string($_, '(');
+ next line if ($smdb_state != $smdb_state_done);
+
+ &get_flags_name_opts;
+
+ &put_entry($ARGV, '');
+ }
+
+ #
+ #--------------------------------------------------------------
+ # Look for all define(conf* specifications
+ # define(confCONTROL_SOCKET_NAME,/var/run/sendmail/smcontrol)dnl
+ # define(confERROR_MESSAGE, MAIL_SETTINGS_DIRerror-header)dnl
+ # define(confSERVICE_SWITCH_FILE,/etc/mail/service.switch)dnl
+ # define(confPID_FILE, /var/run/sendmail/sendmail.pid)dnl
+ # define(confHOSTS_FILE, /etc/hosts)dnl
+ # define(confDEF_AUTH_INFO, /etc/mail/auth-info)dnl
+ # define(confDEAD_LETTER_DROP,/var/lib/sendmail/dead.letter)dnl
+ # define(confHOST_STATUS_DIRECTORY,/var/lib/sendmail/host_status)dnl
+ #--------------------------------------------------------------
+ elsif (/^\s*`?define\(\s*`?conf(CONTROL_SOCKET_NAME|ERROR_MESSAGE|(SERVICE_SWITCH|PID|HOSTS)_FILE|DEF_AUTH_INFO|DEAD_LETTER_DROP|HOST_STATUS_DIRECTORY)/ ..
+ /[^\)]*\)/) {
+ &parse_string($_, 'define');
+ next line if ($smdb_state != $smdb_state_done);
+
+ &get_flags_name_opts;
+
+ &put_entry($ARGV, 'define');
+ }
+
+ #--------------------------------------------------------------
+ # Look for all define(*_FILE specifications (No options here)
+ # define(ALIAS_FILE, /etc/mail/aliases.private,...)dnl
+ # define(HELP_FILE, /etc/mail/helpfile)dnl
+ # define(STATUS_FILE, /var/lib/sendmail/sendmail.st)dnl
+ # define(QUEUE_DIR, /var/spool/mqueue/main*)dnl
+ # define(MSP_QUEUE_DIR, /var/spool/mqueue-client)dnl
+ #--------------------------------------------------------------
+ elsif (/^\s*`?define\(\s*`?((ALIAS|HELP|STATUS)_FILE)|(MSP_)?QUEUE_DIR/ ..
+ /[^\)]*\)/) {
+ &parse_string($_, 'define');
+ next line if ($smdb_state != $smdb_state_done);
+
+ &get_flags_name_opts;
+
+ &put_entry($ARGV, 'define');
+ }
+
+ #--------------------------------------------------------------
+ # Look for all queue definition specifications
+ # define(QUEUE_GROUP, ...)dnl
+ #--------------------------------------------------------------
+ elsif (/^\s*`?QUEUE_GROUP\(/ .. /[^\)]*\)/) {
+ &parse_string($_, '(');
+ next line if ($smdb_state != $smdb_state_done);
+
+ $smdb_string =~ /\s*([\w_]+).*P[^=]*=([^\*,\)]*).*/;
+ $smdb_name = 'QUEUE_GROUP';
+ $smdb_class = '-'; # $1
+ $smdb_flags = '-';
+ @smdb_file = ($2);
+ $smdb_options = '-'; # Pull out other options?
+
+ if ( $QUEUE_GROUPS == 0 ) {
+ &put_entry($ARGV, '', 0);
+ $QUEUE_GROUPS = 1;
+ }
+ else {
+ &put_entry($ARGV, '', 1);
+ };
+ }
+
+ #--------------------------------------------------------------
+ # Look for all AUTH specifications
+ # define(confAUTH_MECHANISMS ...)dnl
+ # define(confAUTH_REALM ...)dnl
+ # TRUST_AUTH_MECH( ...)dnl
+ #--------------------------------------------------------------
+ elsif (/^\s*`?define\(\s*`?confAUTH_(MECHANISMS|REALM)/ ..
+ /[^\)]*\)/) {
+ &parse_string($_, 'define');
+ next line if ($smdb_state != $smdb_state_done);
+
+ next line if ($smdb_string =~ /.*defn\(/);
+
+ &get_flags_name_opts;
+
+ push(@smdb_file, split(' ',$smdb_options))
+ if ($smdb_options ne '-');
+ $smdb_options = '-';
+
+ &put_entry($ARGV, 'define');
+ }
+ elsif (/^\s*`?TRUST_AUTH_MECH\(/ ..
+ /[^\)]*\)/) {
+ &parse_string($_, '(');
+ next line if ($smdb_state != $smdb_state_done);
+
+ next line if ($smdb_string eq ' EXTERNAL');
+
+ &get_flags_name_opts;
+
+ push(@smdb_file, split(' ',$smdb_options));
+ $smdb_options = '-';
+
+ &put_entry($ARGV, '');
+ }
+
+ #--------------------------------------------------------------
+ # Look for all TLS specifications
+ # define(confCACERT, ...)dnl
+ # define(confCACERT_PATH, ...)dnl
+ # define(confCRL, ...)dnl
+ # define(confCLIENT_CERT, ...)dnl
+ # define(confCLIENT_KEY, ...)dnl
+ # define(confSERVER_CERT, ...)dnl
+ # define(confSERVER_KEY, ...)dnl
+ # define(confTLS_SRV_OPTIONS, ...)dnl
+ #--------------------------------------------------------------
+ elsif (/^\s*`?define\(\s*`?conf(TO_STARTTLS|CACERT|CRL|((SERVER|CLIENT)_(KEY|CERT))|TLS_SRV_OPTIONS)/ ..
+ /[^\)]*\)/) {
+ &parse_string($_, 'define');
+ next line if ($smdb_state != $smdb_state_done);
+
+ &get_flags_name_opts;
+
+ &put_entry($ARGV, 'define');
+ }
+
+ #
+ #--------------------------------------------------------------
+ # Locate all non-commented FEATURE macros
+ # FEATURE(name[, [type [flags] file][, ...]...])dnl #comment
+ #--------------------------------------------------------------
+ elsif (/^\s*`?FEATURE\(/ .. /[^\)]*\)/) {
+ &parse_string($_, 'FEATURE');
+ next line if ($smdb_state != $smdb_state_done);
+
+ # ignore non-db features
+ next line if ( ! exists($smdb_features{$smdb_name}) );
+
+ &get_flags_name_opts;
+
+ if ($smdb_name eq 'use_ct_file') {
+ &get_entry('confCT_FILE');
+ }
+ elsif ($smdb_name eq 'use_cw_file') {
+ &get_entry('confCW_FILE');
+ }
+ else {
+ @smdb_file =
+ ("${smdb_loc}$smdb_features{$smdb_name}")
+ if ($smdb_file[$[] eq '-'
+ and $smdb_class ne 'ldap');
+ $smdb_class = $smdb_type
+ if ($smdb_class eq '-');
+ };
+
+ &put_entry($ARGV, 'FEATURE');
+ }
+
+ elsif (/^\s*`?(OSTYPE|DOMAIN|include)\(/ .. /[^\)]*/) {
+ &parse_string($_, '(');
+ next line if ($smdb_state != $smdb_state_done);
+
+ next line if ($smdb_name eq 'include'
+ and $smdb_string =~ /^\s*`?_CF_DIR/);
+
+ $smdb_string =~ /\s*`?([^'\)\s]+)/;
+ $smdb_string = $1;
+ if ($smdb_name eq 'OSTYPE') {
+ $smdb_string =
+ "/usr/share/sendmail/cf/ostype/$smdb_string.m4";
+ }
+ elsif ($smdb_name eq 'DOMAIN') {
+ $smdb_string =
+ "/usr/share/sendmail/cf/domain/$smdb_string.m4";
+ };
+
+ $smdb_name = 'include';
+ $smdb_class = '-'; # $1
+ $smdb_flags = '-';
+ @smdb_file = ($smdb_string);
+ $smdb_options = '-'; # Pull out other options?
+
+ if ($INCLUDES == 0) {
+ &put_entry($ARGV, 'include', 0);
+ $INCLUDES = 1;
+ }
+ else {
+ &put_entry($ARGV, 'include', 1);
+ };
+ &read_mc("$smdb_string");
+ };
+ };
+ };
+
+#
+#------------------------------------------------------------------------------
+# Write out the accumulated information to a flat database file
+#------------------------------------------------------------------------------
+sub write_dbs {
+ my ($database_file, $input_files) = @_;
+ my $ofh = new FileHandle;
+
+ $database_file = $database_file || $Parse_mc::database_file;
+ $Parse_mc::database_file = $database_file;
+ my $caller = "$main::program_name" if ($main::program_name);
+ $caller .= " $main::program_version" if ($main::program_version);
+ $caller .= " $main::program_date" if ($main::program_date);
+ $debug = $main::debug || '';
+
+ $database_file = '&STDOUT' if ($database_file eq '-');
+ unless ( open($ofh, ">$database_file") ) {
+ warn("Could not open $database_file($!), using STDOUT.\n");
+ open($ofh, ">&STDOUT");
+ };
+ $database_file = '-' if ($database_file eq '&STDOUT');
+
+ print $ofh <<"EOT";
+####################################################################
+##### This file is automatically generated -- edit at your own risk
+#####
+##### Copyright (c) 2000-2008 Richard Nelson. All Rights Reserved.
+#####
+##### file: ${database_file}
+##### generated via: (${interp_pgm} ${interp_vrm})
+##### ${caller}
+##### ${Parse_mc::program_name} ${Parse_mc::program_version} ${Parse_mc::program_date}
+##### by: ${user}\@${hostname}
+##### on: ${current_time}
+##### in: ${directory}
+##### input files:
+EOT
+ foreach my $file ( split(' ', $Parse_mc::input_files) ) {
+ print $ofh <<"EOT";
+##### ${file}
+EOT
+ }
+ print $ofh <<"EOT";
+#####
+##### Used by:
+##### update_{db,mk}
+#####
+##### The following databases are used by Debian Sendmail
+#####
+##### Format:
+##### <df>:<map>:<flags>:<file>:<opts>:
+##### Where:
+##### <df> = define or FEATURE name
+##### <map> = map type (-,text,btree,hash, etc.)
+##### <flags> = map flags (-o for optional, etc.)
+##### <file> = file name
+##### <opts> = map options (%[^\\#] for sprintf, etc.)
+#####
+####################################################################
+EOT
+
+ #
+ # delete unneeded elements
+ #delete $smdb_hash{"MAIL_SETTINGS_DIR"};
+ #delete $smdb_hash{"DATABASE_MAP_TYPE"};
+ #delete $smdb_hash{"confCT_FILE"};
+ #delete $smdb_hash{"confCW_FILE"};
+
+ # print define(/FEATURE(/xxx( items
+ foreach $smdb_name (sort keys %smdb_hash) {
+ &get_entry($smdb_name);
+ foreach my $file ( @smdb_file ) {
+ print $ofh join(':',
+ $smdb_name
+ ,$smdb_class
+ ,$smdb_flags
+ ,$file
+ ,$smdb_options
+ ,''
+ ), "\n";
+ };
+ };
+
+ close($ofh);
+ if ($database_file eq $Parse_mc::Conffile) {
+ chown '0', '0', "$database_file";
+ chmod 0644, "$database_file";
+ };
+ };
+
+#
+#------------------------------------------------------------------------------
+# Read in the accumulated information from a flat database file
+#------------------------------------------------------------------------------
+sub read_dbs {
+ my ($database_file, $input_files) = @_;
+ my $ifh = new FileHandle;
+ my $name = '';
+ my @entry;
+
+ $database_file = $database_file || $Parse_mc::database_file;
+ $Parse_mc::database_file = $database_file;
+ $debug = $main::debug || '';
+
+ unless ( open($ifh, "<$database_file") ) {
+ warn("Could not open $database_file($!), creating it.\n");
+ &read_mc($input_files);
+ &write_dbs($database_file, $input_files);
+ # At this point, we have the data, don't need to re-read it...
+ return;
+ };
+
+ #------------------------------------------------------------------
+ # Main loop, iterate over all input lines
+ #------------------------------------------------------------------
+ line: while (<$ifh>) {
+ next line if /^#/; # skip comments
+ next line if /^$/; # skip empty lines
+ chomp; # drop tailing \n
+
+ @entry = split(':', $_);
+
+ # Accumulate file names and enter when complete
+ if ($name eq $entry[$[]) {
+ push @smdb_file, $entry[3];
+ }
+ else {
+ if ($name ne '') {
+ &put_entry('', '');
+ };
+ $name = $entry[$[];
+ $smdb_name = $entry[$[];
+ $smdb_class = $entry[1];
+ $smdb_flags = $entry[2];
+ @smdb_file = $entry[3];
+ $smdb_options = $entry[4];
+ };
+ };
+
+ # enter any remaining data
+ if ($name ne '') {
+ &put_entry('', '');
+ };
+
+ close($ifh);
+ };
+
+#
+#------------------------------------------------------------------------------
+# Obtain the list of names in smdb_hash (in an ordered manor)
+#------------------------------------------------------------------------------
+sub names_dbs {
+
+ # We need a partial ordering here (psuedo dependancies)
+ my @names;
+ my %dbs = ();
+ foreach my $entry ('databases', 'Makefile', 'crontab', 'QUEUE_GROUP',
+ 'sendmail.cf', 'submit.cf') {
+ if (exists($smdb_hash{$entry})) {
+ $dbs{$entry} = '';
+ push @names, $entry;
+ };
+ };
+
+ # Now, add any remaining databases to the list (except aliases)
+ foreach my $entry (sort keys %smdb_hash) {
+ next if ($entry eq 'ALIAS_FILE');
+ push @names, $entry
+ if (! exists($dbs{$entry}));
+ $dbs{$entry} = '';
+ };
+
+ # Finally, add aliases...
+ my $entry = 'ALIAS_FILE';
+ if (exists($smdb_hash{$entry})) {
+ push @names, $entry
+ if (! exists($dbs{$entry}));
+ $dbs{$entry} = '';
+ };
+
+ return(@names);
+ };
+
+#------------------------------------------------------------------------------
+# Obtain the list of names that require a sendmail restart
+#------------------------------------------------------------------------------
+sub restart_dbs {
+ return(keys %smdb_restart);
+ };
+
+#------------------------------------------------------------------------------
+# Obtain an individual database entry (returning a copy)
+#------------------------------------------------------------------------------
+sub entry_dbs {
+ my ($name) = @_;
+ $smdb_name = $name;
+ &get_entry($smdb_name);
+
+ # Return a local copy - so they can't change *MY* data...
+ my @entry = @smdb_entry;
+ return (@entry);
+ };
+
+#
+#------------------------------------------------------------------------------
+# Save the results of the database entry and reset the state
+#------------------------------------------------------------------------------
+sub put_entry {
+ my ($file, $type, $multi_file) = @_;
+
+ # Create entry record from data pieces/parts
+ if ($multi_file and exists($smdb_hash{$smdb_name})) {
+ @smdb_entry = @{$smdb_hash{$smdb_name}};
+ }
+ else {
+ @smdb_entry = ('-', '-', [], '-');
+ };
+ $smdb_entry[$[] = $smdb_class;
+ $smdb_entry[1] = $smdb_flags;
+ push @{$smdb_entry[2]}, @smdb_file;
+ $smdb_entry[3] = $smdb_options;
+
+ # Save lastmost entry
+ @{$smdb_hash{$smdb_name}} = @smdb_entry;
+
+ # Minimal debugging
+ if ($debug) {
+ print STDERR "PUT: ";
+ if ($type ne '') { print STDERR "$type($smdb_name)" }
+ else { print STDERR "$smdb_name()" };
+ print STDERR " => ", join(':'
+ , $smdb_class
+ , join(',', @{$smdb_entry[2]})
+ , $smdb_options
+ , ''
+ ), "\n";
+ };
+
+ # reset state
+ $smdb_state = $smdb_state_looking;
+ };
+
+#
+#------------------------------------------------------------------------------
+# Retrieve a database entry
+#------------------------------------------------------------------------------
+sub get_entry {
+ my ($name) = @_;
+
+ if (exists($smdb_hash{$name}) ) {
+ @smdb_entry = @{$smdb_hash{$name}};
+ }
+ else {
+ @smdb_entry = ('-', '-', ['-'], '-');
+ };
+
+ $smdb_class = $smdb_entry[$[];
+ $smdb_flags = $smdb_entry[1];
+ @smdb_file = @{$smdb_entry[2]};
+ $smdb_options = $smdb_entry[3];
+
+ # Minimal debugging
+ if ($debug) {
+ print STDERR "GET: ",
+ "$name",
+ " => ", join(':'
+ , $smdb_class
+ , join(',', @{$smdb_entry[2]})
+ , $smdb_options
+ , ''
+ ), "\n";
+ };
+
+ };
+
+#
+#
+sub format_dbs {
+ my ($name) = @_;
+ my $string = '';
+
+ &get_entry($name);
+ $string .= " $smdb_class"
+ if ($smdb_class ne '-' and $smdb_class ne ' ');
+ $string .= " $smdb_flags"
+ if ($smdb_flags ne '-' and $smdb_flags ne ' ');
+ $string .= join(',', @smdb_file);
+ $string .= " $smdb_options"
+ if ($smdb_options ne '-' and $smdb_options ne ' ');
+
+ return $string;
+ };
+
+#
+#------------------------------------------------------------------------------
+# This function does most of the work in parsing a series of lines to
+# construct a database entry - it manages the state machine and assorted
+# global variables
+#------------------------------------------------------------------------------
+sub parse_string {
+ my ($str, $type) = @_;
+ my $count = -1;
+ my @entry = '';
+ my $pending_state = 0;
+
+ # Strip trailing '?\)(dnl)?.*$ from string
+ if ($str =~ /\s*'?\s*\)/) {
+ $str =~ s/\s*'?\s*\)\s*(dnl)?.*$//;
+ $pending_state = $smdb_state_done;
+ };
+
+ # Strip trailing 'dnl .*' from string
+ if ($str =~ /dnl(\s+.*)?$/) {
+ $str =~ s/dnl(\s+.*)?$//;
+ };
+
+ # Strip leading `?define\(\s*`? from string
+ if (($type eq 'define') and
+ ($str =~ /^\s*`?define\(/)) {
+ $str =~ s/^\s*`?define\(\s*`?//;
+ $str =~ s/,/ /;
+ $smdb_state = $pending_state || $smdb_state_start;
+ $smdb_string = '';
+ $count = (@entry = split(' ', $str));
+ ($smdb_name = $entry[$[]) =~ tr/'//d;
+ shift(@entry);
+ $str = join(' ', @entry);
+ }
+
+ # Strip leading `?FEATURE\(\s*`? from string
+ elsif (($type eq 'FEATURE') and
+ ($str =~ /^\s*`?FEATURE\(/)) {
+ $str =~ s/^\s*`?FEATURE\(\s*`?//;
+ $str =~ s/,/ /;
+ $smdb_state = $pending_state || $smdb_state_start;
+ $smdb_string = '';
+ $count = (@entry = split(' ', $str));
+ ($smdb_name = $entry[$[]) =~ tr/'//d;
+ shift(@entry);
+ $str = join(' ', @entry);
+ }
+
+ # Strip leading `?[\w_]+\(\s*`? from string
+ elsif (($type eq '(') and
+ ($str =~ /^\s*`?[\w_]+\(/)) {
+ $str =~ s/\(/ /;
+ $smdb_state = $pending_state || $smdb_state_start;
+ $smdb_string = '';
+ $count = (@entry = split(' ', $str));
+ ($smdb_name = $entry[$[]) =~ tr/`'//d;
+ shift(@entry);
+ $str = join(' ', @entry);
+ }
+ else {
+ $smdb_state = $pending_state || $smdb_state;
+ };
+
+ #
+ # Strip quotes (` and ') from string
+ $str =~ tr/`'//d;
+
+ # FEATURE( is the only one allowed to have only one argument
+ if ( ($type ne 'FEATURE'
+ and $type ne '(')
+ and $count == 1) {
+ $str = '';
+ };
+
+ # Change imbedded MAIL_SETTINGS_DIR to $smdb_loc
+ if ($smdb_name ne 'MAIL_SETTINGS_DIR') {
+ $str =~ s/MAIL_SETTINGS_DIR/$smdb_loc/g
+ };
+
+ # Change imbedded DATABASE_MAP_TYPE to $smdb_type
+ if ($smdb_name ne 'DATABASE_MAP_TYPE') {
+ $str =~ s/DATABASE_MAP_TYPE/$smdb_type/g
+ };
+
+ # concatentate this string with any prior information
+ $smdb_string .= ' ' . $str unless($smdb_state == $smdb_state_looking);
+
+ # Return
+ return;
+ };
+
+#
+#------------------------------------------------------------------------------
+# This function parses a line into flags (-o, etc.), name, options
+#------------------------------------------------------------------------------
+sub get_flags_name_opts {
+ my @entry;
+ my $class = '';
+ my $rest = '';
+ my $multi_names = 0;
+
+ $smdb_class = '';
+ $smdb_flags = '';
+ @smdb_file = ();
+ $smdb_options = '';
+
+ @entry = split(' ', $smdb_string);
+
+ # Pull off any leading flags (including database type/class)
+ # Class specification: "[mapkey]@mapclass:mapspec"
+ # RELAY_DOMAIN_FILE(`@LDAP')dnl
+ # VIRTUSER_DOMAIN_FILE(`@ldap:-k
+ # (&(objectClass=virtHosts)(host=*)) -v host')dnl
+ # FEATURE(`genericstable', `LDAP')dnl
+ # FEATURE(`genericstable', `nis:realnames.by2mail')dnl
+ # define(`ALIAS_FILE', `ldap:')dnl
+ # define(`ALIAS_FILE', `ldap:-k
+ # (&(objectClass=mailGroup)(mail=%0)) -v mgrpRFC822MailMember')dnl
+ # but only if there are flags *and* a name...
+ if (@entry) {
+ ($class = lc($entry[$[])) =~ s/:.*//;
+ ($rest = $entry[$[]) =~ s/.*://;
+ $rest = '' if (lc($rest) eq 'ldap');
+ if ($class =~ /^.*@/) {
+ $class =~ s/^.*@//;
+ if (exists($smdb_classes{$class})) {
+ $smdb_class = $class;
+ shift (@entry);
+ };
+ }
+ elsif (exists($smdb_classes{$class})) {
+ $smdb_class = $class;
+ $rest = '' if ($rest eq $class);
+ shift (@entry);
+ @entry = split(' ', join(' ',$rest,@entry) );
+ $#entry = -1 if ($smdb_class eq 'ldap');
+ };
+ FLAG_LOOP: while (@entry) {
+ if (substr($entry[$[], 0, 1) eq '-') {
+ if ($smdb_flags eq '') {
+ $smdb_flags = $entry[$[];
+ }
+ else {
+ $smdb_flags .= ' ' . $entry[$[];
+ };
+ shift (@entry);
+ }
+ else {
+ last FLAG_LOOP;
+ };
+ };
+ };
+#print STDERR "$class($rest) ::= ",scalar @entry,join(' ','',@entry,''),"\n";
+ $smdb_flags = $smdb_flags || '-';
+ $smdb_class = $smdb_class || '-';
+
+ #
+ # A few special cases...
+ if ($smdb_name eq 'ALIAS_FILE' and $smdb_class eq '-') {
+ $smdb_class = 'newaliases';
+ @entry = (join('',@entry));
+ $multi_names = 1;
+ }
+ elsif ($smdb_name eq 'confUSERDB_SPEC') {
+ @entry = (join('',@entry));
+ $multi_names = 1;
+ };
+
+ # Handle multi-files specially
+ if ( $multi_names == 1 ) {
+ @smdb_file = split(',', $entry[$[]);
+ $smdb_options = '-';
+ }
+ else {
+ # Whats left should be a filename (or somesuch) and options
+ if (@entry >= 1) { # file name, possible options if /,/
+ if ($smdb_classes{$smdb_class} != 1) {
+ @smdb_file = '-';
+ }
+ else {
+ @smdb_file = $entry[$[];
+ shift(@entry);
+ };
+ if (@entry >= 1) {
+ $entry[$[] =~ s/^,//;
+ foreach my $ndx ($[ .. $#entry) {
+ $smdb_options .= ' '
+ if ($ndx != 0
+ and substr($entry[$ndx], 0, 1) ne ',');
+ $smdb_options .= $entry[$ndx];
+ }
+ }
+ $#entry = -1;
+ };
+
+ # Check for possible options caught in the filename slot
+ if (@smdb_file >= 1 and index($smdb_file[$[], ',') != -1) {
+ @entry = split(/,/, $smdb_file[$[]);
+ @smdb_file = ( $entry[$[] );
+ if (@entry >= 2) {
+ $smdb_options = join('', @entry[1..$#entry],
+ $smdb_options);
+ $#entry = -1;
+ };
+ };
+ $smdb_file[$[] = $smdb_file[$[] || '-';
+ $smdb_file[$[] =~ s/\.db//;
+ $smdb_options = $smdb_options || '-';
+ };
+
+ # Return
+ return;
+ };
+
+__END__
diff --git a/debian/local/bug/sendmail/script b/debian/local/bug/sendmail/script
new file mode 100644
index 0000000..975bd1c
--- /dev/null
+++ b/debian/local/bug/sendmail/script
@@ -0,0 +1,53 @@
+#!/bin/sh
+#-----------------------------------------------------------------------------
+# $Sendmail: sendmail.bug,v 8.14.3 2008-05-04 22:26:20 cowboy Exp $
+#
+# Copyright (c) 1998-2008 Richard Nelson. All Rights Reserved.
+#
+# Debian helper function script for Debian Sendmail bug reporting
+# Note: this file supports 8.7.6 - 9.0.0
+#
+# Notes (to all):
+# *
+#
+# Notes (to self):
+# *
+#
+#-----------------------------------------------------------------------------
+#
+#set -e;
+DEBUG=0;
+
+# reportbug #169495
+if [ -z "$YESNO" ]; then
+ YESNO=$"yYnN";
+ fi;
+
+# Announce
+printf "Ouput of $0:\n" >&3;
+
+# Show files in /etc/mail
+printf "\nls -alR /etc/mail:\n" >&3;
+ls -alR /etc/mail | grep -Eve '~$' >&3;
+
+# Extract the relevant portion of sendmail.conf
+if [ -e /etc/mail/sendmail.conf ]; then
+ printf "\nsendmail.conf:\n" >&3;
+ grep -ve '^#' "/etc/mail/sendmail.conf" >&3;
+ fi;
+
+# Extract the relevant portion of sendmail.mc
+if [ -e /etc/mail/sendmail.mc ]; then
+ printf "\nsendmail.mc:\n" >&3;
+ grep -Eve '^(#|dnl|$)' "/etc/mail/sendmail.mc" >&3;
+ fi;
+
+# Extract the relevant portion of submit.mc
+if [ -e /etc/mail/submit.mc ]; then
+ printf "\nsubmit.mc...\n" >&3;
+ grep -Eve '^(#|dnl|$)' "/etc/mail/submit.mc" >&3;
+ fi;
+
+printf "\n" >&3;
+
+# vim:set ai et sts=4 sw=4 tw=0:
diff --git a/debian/local/dynamic b/debian/local/dynamic
new file mode 100644
index 0000000..703dd77
--- /dev/null
+++ b/debian/local/dynamic
@@ -0,0 +1,444 @@
+#!/bin/sh
+#------------------------------------------------------------------------
+#
+# $Sendmail: dynamic,v 8.14.3 2008-05-04 22:26:20 cowboy Exp $
+#
+# Shell functions to handle dynamic network updates.
+# Supports ppp, dhcp, ifup/down, etc.
+#
+# Copyright (c) 2004-2008 Richard Nelson. All Rights Reserved.
+#
+# This script is called from the following places:
+# /etc/ppp/ip-down.d/sendmail #\
+# /etc/ppp/ip-up.d/sendmail # | These are deprecated
+# /etc/dhcp3/dhclient-exit-hooks.d/sendmail #/
+# /etc/network/if-down.d/sendmail #standard
+# /etc/network/if-post-down.d/sendmail #standard
+# /etc/network/if-up.d/sendmail #standard
+# /etc/resolvconf/update-libc.d/sendmail #More or less useless :(
+#
+# The other half of the logic is in /etc/mail/sendmail.conf
+#
+# DAEMON_NETMODE="Dynamic"; Keyword SMTP network mode
+# static: Do not monitor any network interfaces for changes
+# dynamic: Monitor one or more interfaces for changes
+#
+# DAEMON_NETIF="eth0"; string SMTP interface(s)
+# This parameter defines the network interface(s) that the daemon
+# will monitor for status changes (via ppp, dhcp, ifup/down hooks).
+#
+# NOTES:
+# 1) Only list more than one interfaces if they only used for fallback,
+# otherwise the daemon will wind up ping-ponging between interfaces.
+# 2) Do not use 'lo' unless your daemon only listens on the localhost.
+#
+# LOG_CMDS="No"; Binary command logging flag
+# Will cause syslog entries for many of the sendmail related commands
+# like runq, mailq, etc - you'll also see cron jobs (if enabled).
+#
+# HANDS_OFF="No"; Binary Do *NOT* touch the configuration
+# Set this *ONLY* if you are going to be fully responsible for the entire
+# setup of sendmail - the directories, permissions, databases, etc. With
+# this variable set to "Yes", nothing will be done for you during
+# updates.
+#
+# In other words, "The blood be upon your hands" if you set this...
+# My ability to help with problems will be greatly reduced !
+#
+# "Well, a pet peeve of mine is people who directly edit the
+# .cf file instead of using the m4 configuration files.
+# Don't do it! [laughs] I treat the .cf file as a binary
+# file - you should too."
+# -- Eric Allman 1999/10/18
+#
+#------------------------------------------------------------------------
+#
+
+# The files we may alter
+provider_m4='/etc/mail/m4/provider.m4';
+dialup_m4='/etc/mail/m4/dialup.m4';
+
+# Default values
+SM_ignore=0; # Ignore any changes
+SM_changed=0; # Something has changed, dunno what
+SM_delay=0; # Expect another call soon, do work then
+SM_interface=''; # The interface that changed
+SM_state=''; # How the interface changed
+SM_provider=''; # ISP/domain name/IPPARM/etc
+SM_ip=''; # IP for the interface
+SM_host=''; # Reverse FQDN of IP
+SM_debug=1; # Of minimal value
+
+# Path to other sendmail helpers
+if [ -x ./update_sendmail ]; then
+ sm_path='.';
+elif [ -x $(/usr/bin/dirname $0)/update_sendmail ]; then
+ sm_path=$(/usr/bin/dirname $0);
+else
+ sm_path=/usr/share/sendmail;
+ fi;
+
+# Bring in sendmail.conf for the network definitions
+if [ ! -f /etc/mail/sendmail.conf ]; then
+ if [ -x $sm_path/update_conf ]; then
+ $sm_path/update_conf;
+ fi;
+ fi;
+DAEMON_NETMODE='Static';
+DAEMON_NETIF='';
+HANDS_OFF='No';
+LOG_CMDS='Yes';
+if [ -f /etc/mail/sendmail.conf ]; then
+ . /etc/mail/sendmail.conf;
+ fi;
+
+# Record information on an interface and its status
+update_interface() {
+ SM_interface="$1";
+ SM_reason="$2";
+
+ # Translate DHCP style actions to a simple up/down
+ case "$SM_reason" in
+ DOWN|EXPIRE|FAIL|RELEASE|STOP) # and TIMEOUT too ???
+ SM_state='down';
+ ;;
+ UP|BOUND|RENEW|REBIND|REBOOT|TIMEOUT) # why TIMEOUT here ???
+ SM_state='up';
+ if [ "$SM_reason" = "BOUND" ]; then
+ SM_changed=1;
+ fi;
+ ;;
+ *)
+ SM_state='unknown';
+ ;;
+ esac;
+
+ # Mark what we're doing...
+ local msg;
+ msg="$SM_interface $SM_state $SM_provider $SM_ip $SM_host";
+ if [ "$LOG_CMDS" != 'No' ]; then
+ /usr/bin/logger -i -p mail.debug -- "$0 (dynamic) update_interface: $msg";
+ fi;
+
+ # Do absolutely nothing if they say so...
+ if [ "$HANDS_OFF" != 'No' -o "$DAEMON_NETMODE" = 'Static' ]; then
+ SM_ignore=1;
+ fi;
+ if [ -z "$SM_interface" ]; then
+ SM_ignore=1;
+ fi;
+
+ # Check to see if we care about this interface
+ if [ $SM_ignore -eq 0 ]; then
+ SM_ignore=1;
+ for if in $DAEMON_NETIF; do
+ if [ "$if" = "$SM_interface" ]; then
+ SM_ignore=0;
+ break;
+ fi;
+ done;
+ fi;
+
+ if [ $SM_ignore -ne 0 ]; then
+ return;
+ fi;
+ };
+
+# Record information about the upstream provider
+update_provider() {
+ SM_provider="$1";
+
+ # Mark what we're doing...
+ local msg;
+ msg="$SM_interface $SM_state $SM_provider $SM_ip $SM_host";
+ if [ "$LOG_CMDS" != 'No' ]; then
+ /usr/bin/logger -i -p mail.debug -- "$0 (dynamic) update_provider: $msg";
+ fi;
+
+ # Do absolutely nothing if they say so...
+ if [ "$HANDS_OFF" != 'No' -o "$DAEMON_NETMODE" = 'Static' ]; then
+ SM_ignore=1;
+ fi;
+ if [ $SM_ignore -ne 0 ]; then
+ return;
+ fi;
+ # Add smarthost information (if any)...
+ # But not if provider.m4 is a link !
+ if [ -z "$SM_provider" ]; then
+ return;
+ fi;
+ if [ ! -e "/etc/mail/peers/$SM_provider" ]; then
+ SM_provider='default';
+ fi;
+ if [ -e "/etc/mail/peers/$SM_provider" ] \
+ && [ ! -L "$provider_m4" ]; then
+ SM_changed=1;
+ cat <<-EOT > "$provider_m4";
+ LOCAL_CONFIG
+ #------------------------------------------------------------
+ #
+ # Dynamic provider updates from $0:
+ # Device=$SM_interface
+ # State=$SM_state
+ # Provider=$SM_provider
+ #
+ # NOTE: The following line *MUST* be in /etc/mail/sendmail.mc
+ #dnl include(\`/etc/mail/provider.m4')dnl
+ #
+ # You may also need to include this file in submit.mc !
+ #
+ # Provider information from /etc/mail/peers/$SM_provider
+ EOT
+ cat "/etc/mail/peers/$SM_provider" >> "$provider_m4";
+ cat <<-EOT >> "$provider_m4";
+ #------------------------------------------------------------
+ EOT
+ fi;
+ };
+
+# Record information on an ip/host
+update_host() {
+ SM_ip="$1";
+
+ # Mark what we're doing...
+ local msg;
+ msg="$SM_interface $SM_state $SM_provider $SM_ip $SM_host";
+ if [ "$LOG_CMDS" != 'No' ]; then
+ /usr/bin/logger -i -p mail.debug -- "$0 (dynamic) update_host: $msg";
+ fi;
+
+ # Do absolutely nothing if they say so...
+ if [ "$HANDS_OFF" != 'No' -o "$DAEMON_NETMODE" = 'Static' ]; then
+ SM_ignore=1;
+ fi;
+ if [ $SM_ignore -ne 0 ]; then
+ return;
+ fi;
+ if [ -z "$SM_ip" ]; then
+ return;
+ fi;
+ find_host;
+ if [ $SM_ignore -ne 0 ]; then
+ return;
+ fi;
+ # Add ip related information (if any)...
+ # But not if dialup.m4 is a link !
+ if [ ! -L "$dialup_m4" ]; then
+ SM_changed=1;
+ cat <<-EOT > "$dialup_m4";
+ LOCAL_CONFIG
+ #------------------------------------------------------------
+ #
+ # Dynamic host/ip updates from $0:
+ # Device=$SM_interface
+ # State=$SM_state
+ # Provider=$SM_provider
+ # IP=$SM_ip
+ # Host=$SM_host
+ #
+ # NOTE: The following line *MUST* be in /etc/mail/sendmail.mc
+ #dnl include(\`/etc/mail/dialup.m4')dnl
+ #
+ # This should *NOT* be included in submit.mc !
+ #
+ # Make sure we accept mail as this ip (for bounces, etc)
+ Cw$SM_ip
+ EOT
+ if [ -z "$SM_host" ]; then
+ cat <<-EOT >> "$dialup_m4";
+ #
+ # Rats... FQDN lookup failed, your kit is incomplete :(
+ EOT
+ else
+ cat <<-EOT >> "$dialup_m4";
+ #
+ # Define our true hostname (from our ISP) - becomes \$j
+ define(\`confDOMAIN_NAME', \`$SM_host')dnl
+ #
+ # Make sure we accept mail as this name (for bounces, etc)
+ Cw$SM_host
+ #
+ # Add our hostname to class G for genericstable support
+ CG$SM_host
+ #------------------------------------------------------------
+ EOT
+ fi;
+ fi;
+ };
+
+# DNS support changed, we may (or may not) have a new name
+# but in any case, we may have stale host info in the queue
+update_resolv() {
+
+ # Mark what we're doing...
+ local msg;
+ msg="$SM_interface $SM_state $SM_provider $SM_ip $SM_host";
+ if [ "$LOG_CMDS" != 'No' ]; then
+ /usr/bin/logger -i -p mail.debug -- "$0 (dynamic) update_resolv: $msg";
+ fi;
+
+ # Do absolutely nothing if they say so...
+ if [ "$HANDS_OFF" != 'No' -o "$DAEMON_NETMODE" = 'Static' ]; then
+ SM_ignore=1;
+ fi;
+ if [ $SM_ignore -ne 0 ]; then
+ return;
+ fi;
+
+ # Ideally, we should re-check our IP if we didn't find the
+ # FQDN previously - but we need a state file to do that :(
+ #
+ # Hell, we don't even know what IF is, and if it is up or down :(
+
+ #SM_interface='?'; #\
+ #SM_state='up'; # \
+ #SM_provider='?'; # | Need to get these from somewhere !
+ #SM_ip='?'; # /
+ #SM_host='?'; #/
+ #find_host;
+
+ # Purge any latent host status that might cause us to *NOT* send mail
+ if [ -x /etc/init.d/sendmail ]; then
+ if [ "$SM_state" = 'up' ]; then
+ /etc/init.d/sendmail purgestat now;
+ fi;
+ fi;
+
+ # resolvconf is called as a DHCP pre-exit, so we'll defer any changes
+ SM_changed=0;
+ }
+
+# Attempt to locate our FQDN
+find_host() {
+ # Determine our fqdn from our ISP
+ maxloop=30;
+ cntr=0;
+ SM_host='';
+ until (test ! -z "$SM_host"); do
+ cntr=`expr $cntr + 1`;
+ if [ $cntr -gt $maxloop ]; then
+ SM_host='';
+ break;
+ fi;
+ rev=$(host $SM_ip);
+ SM_host=$(echo "$rev" | grep '^Name:' | awk '{print $2}');
+ if [ -z "$SM_host" ]; then
+ test=$(echo "$rev" | egrep -e 'not found:');
+ if [ -n "$test" ]; then
+ continue;
+ else
+ SM_host=${rev##*domain name pointer };
+ SM_host=${SM_host%.};
+ fi;
+ fi;
+ test=$(echo $SM_host | cut -d ' ' -f 1);
+ # continue scanning if we get this:
+ # ;; connection timed out; no servers could be reached
+ if [ "$test" = ";;" ]; then
+ SM_host='';
+ elif [ "$test" != "**" ]; then
+ break;
+ fi;
+ sleep 1s;
+ done;
+
+ # See if we actually found a host !
+ if [ -z "$SM_host" ]; then
+ # Drats, no host name :(
+ # We have a few choices - none pretty
+ # 1) Do not start sendmail
+ # 2) Use the info we have (ip) - but
+ # then we may not accept mail we should,
+ # accept mail we should not,
+ # and our ougoing name may be wrong
+ # 3) Use the last known hostname
+ # If it is not correct, we have the same
+ # exposurs as option 2 !
+ #
+ # For the nonce, I choose option 2
+ :
+ fi;
+
+ if [ $SM_debug -ne 0 ]; then
+ echo "addr=$SM_ip, name=$SM_host";
+ fi;
+ };
+
+# If our state has changed in any way, update sendmail
+update_sendmail() {
+ SM_caller="$1";
+ SM_opts="$2";
+
+ # Mark what we're doing...
+ local msg;
+ msg="$SM_interface $SM_state $SM_provider $SM_ip $SM_host";
+ if [ "$LOG_CMDS" != 'No' ]; then
+ /usr/bin/logger -i -p mail.debug -- "$0 (dynamic) update_sendmail: $msg";
+ fi;
+
+ # Do absolutely nothing if they say so...
+ if [ "$HANDS_OFF" != 'No' -o "$DAEMON_NETMODE" = 'Static' ]; then
+ SM_ignore=1;
+ fi;
+ if [ $SM_ignore -ne 0 ]; then
+ return;
+ fi;
+
+ # Check for a delayed restart (for DHCP/PPP)
+ case "$SM_opts" in
+ [Dd]*)
+ if [ "$SM_state" = 'up' ]; then
+ SM_delay=1;
+ fi;
+ ;;
+ esac;
+
+ if [ "$SM_state" = 'down' ]; then
+ SM_changed=1;
+ cat <<-EOT > "$dialup_m4";
+ LOCAL_CONFIG
+ #------------------------------------------------------------
+ # Dynamic host/ip updates from $0:
+ # Device=$SM_interface
+ # State=$SM_state
+ # Provider=$SM_provider
+ # IP=$SM_ip
+ # Host=$SM_host
+ #
+ # NOTE: The following line *MUST* be in /etc/mail/sendmail.mc
+ #dnl include(\`/etc/mail/dialup.m4')dnl
+ # This should *NOT* be included in submit.mc !
+ #
+ # sendmail is to only queue messages until connected again
+ define(\`confDELIVERY_MODE', \`deferred')dnl
+ #
+ # Allow the queue to age without carping every four hours
+ define(\`confTO_QUEUEWARN',\`1d')dnl
+ #
+ # Don't keep host status while the network is down
+ define(\`confHOST_STATUS_DIRECTORY')dnl
+ #------------------------------------------------------------
+ EOT
+ fi;
+
+ if [ $SM_changed -eq 1 ]; then
+ # Build a new sendmail.cf from sendmail.mc, including our address.
+ /usr/bin/make -f /etc/mail/Makefile sendmail.cf;
+ /usr/bin/make -f /etc/mail/Makefile;
+
+ # Purge any latent host status that might cause us to *NOT* send mail
+ # Reload sendmail, IFF already running
+ if [ -x /etc/init.d/sendmail ]; then
+ if [ "$SM_state" = 'up' ]; then
+ /etc/init.d/sendmail purgestat now;
+ fi;
+ /etc/init.d/sendmail reload-if-running & # up, or down
+ fi;
+ fi;
+
+ # Process the sendmail queue
+ # (background so as to not defer other ip-up work)
+ # This can be fatal on IF ping-pongs :(
+ # runq &
+ };
+
diff --git a/debian/local/parse_mc b/debian/local/parse_mc
new file mode 100644
index 0000000..646268f
--- /dev/null
+++ b/debian/local/parse_mc
@@ -0,0 +1,95 @@
+#!/usr/bin/perl -w
+#------------------------------------------------------------------------
+#
+# $Sendmail: parse_mc,v 8.14.3 2008-05-04 22:26:20 cowboy Exp $
+#
+# Parse Sendmail config for databases
+#
+# Copyright 2000-2008 Richard Nelson. All Rights Reserved.
+#
+# Notes (to all):
+# * for "define(xxx,...)"; "define(xxx," must be on same line, but the
+# rest may be split across multiple lines
+# * assumes makemap dbtype /etc/mail/database < /etc/mail/database
+#
+# Notes (to self):
+# *
+#
+#------------------------------------------------------------------------
+# My first perl program (from my first awk program ;-})
+#
+# Initialization of the perl environment
+use strict; # be kosher
+use Env; # A few environmental references
+use integer; # Peformance
+use Getopt::Long; # parameter handling
+
+# Local libraries - for Debian Sendmail Perl helper functions
+# BEGIN { $main::my_path = substr($0,$[,rindex($0,'/')) };
+use lib ('.', substr($0,$[,rindex($0,'/')), "/usr/share/sendmail");
+require Parse_mc;
+require Parse_conf;
+
+# Version of this program
+#($main::MYNAME = $main::0) =~ s|.*/||;
+#$main::Author = "Richard Nelson";
+#$main::AuthorMail = "cowboy\@debian.org";
+#$main::Version = '$Revision: 2.00 $ ';
+$main::program_name = $0;
+$main::program_version = '8.14.3';
+$main::program_date = '2008-05-04 22:26:20 cowboy';
+$main::debug = 0;
+
+#
+#------------------------------------------------------------------------------
+# Finally, some code (almost)
+#------------------------------------------------------------------------------
+#
+# Argument handling...
+$main::opt_help='';
+$main::opt_output_file='';
+$main::opt_input_file='';
+$main::opt_debug='';
+my @options = qw(
+ help|h
+ output-file|output_file|o:s
+ input-file|input_file|i:s@
+ debug!
+ );
+my $result = GetOptions(@options);
+if ( ! $result ) {
+ die "Terminating due to parameter error";
+ };
+if ( $main::opt_help ) {
+ warn "$main::program_name $main::program_version $main::program_date\n";
+ warn "$0 \n";
+ warn " -help\n" if $main::opt_help;
+ warn " -debug\n" if $main::opt_debug;
+ warn " -o $main::opt_output_file\n" if $main::opt_output_file;
+ warn " -i $main::opt_input_file\n" if $main::opt_input_file;
+ exit 0;
+ };
+
+${Parse_mc::database_file} = $main::opt_output_file
+ if $main::opt_output_file;
+my $input_files = join(' ', @main::opt_input_file);
+# $main::debug is used in parse_mc !
+$main::debug = $main::opt_debug || $main::debug;
+
+# Pull in some configuration data
+&Parse_conf::read_conf();
+my ($ok, $value) = &Parse_conf::get_value('HANDS_OFF');
+if ($value ne '0') {
+ unlink "${Parse_mc::database_file}";
+ exit;
+ };
+
+# Let them know wtf is going on...
+print STDOUT "Creating ${Parse_mc::database_file}...\n";
+
+# Read the mc/m4 files
+&Parse_mc::read_mc($input_files);
+
+# Write out the textual representation
+&Parse_mc::write_dbs('', $input_files);
+
diff --git a/debian/local/sendmail b/debian/local/sendmail
new file mode 100644
index 0000000..66998c3
--- /dev/null
+++ b/debian/local/sendmail
@@ -0,0 +1,1282 @@
+#!/bin/sh
+#-----------------------------------------------------------------------------
+# $Sendmail: sm_helper.sh,v 8.14.3 2008-05-04 22:26:20 cowboy Exp $
+#
+# Copyright (c) 1998-2008 Richard Nelson. All Rights Reserved.
+#
+# Debian helper function script for Debian Sendmail
+# Note: this file supports 8.7.6 - 9.0.0
+#
+# Notes (to all):
+# *
+#
+# Notes (to self):
+# * clean_queues fubar, esp wrt MSP
+#
+#-----------------------------------------------------------------------------
+#
+DEBUG=0;
+
+# Support stand-alone execution
+if [ -z "$DAEMON" ]; then
+ PATH=/bin:/usr/bin:/sbin:/usr/sbin
+ DESC="Mail Transport Agent (MTA)"
+ NAME=sendmail
+ DAEMON=/usr/sbin/$NAME
+ DAEMON_ARGS=""
+ SCRIPTNAME=/etc/init.d/$NAME
+
+ # Exit if the package is not installed
+ [ -x "$DAEMON" ] || exit 0
+
+ # Read configuration variable file if it is present
+ [ -r /etc/default/sendmail ] && . /etc/default/sendmail
+
+ # Load the VERBOSE setting and other rcS variables
+ . /lib/init/vars.sh
+
+ # Define LSB log_* functions.
+ . /lib/lsb/init-functions
+ fi;
+
+# Can't do this earlier, the lsb inclusion is unsafe :(
+set -e;
+
+#------------------------------------------------------------------------------
+# Parameters for the sendmail daemon
+# Do *NOT* touch these lines, instead, edit /etc/mail/sendmail.conf
+# The _PARMS lines are listed in precedence order
+#------------------------------------------------------------------------------
+Get_Parameters () {
+
+ # Main configuration parameters in /etc/mail/sendmail.conf
+ DAEMON_MODE='Daemon';
+ DAEMON_PARMS='';
+ DAEMON_UID='root';
+ QUEUE_MODE="$DAEMON_MODE";
+ QUEUE_INTERVAL='10m';
+ QUEUE_PARMS='';
+ MSP_MODE="$QUEUE_MODE";
+ MSP_INTERVAL="$QUEUE_INTERVAL";
+ MSP_PARMS="";
+ MISC_PARMS='';
+ CRON_PARMS='';
+ LOG_CMDS='No';
+
+ # Secondary (non-documented) parameters in /etc/mail/sendmail.conf
+ # Caveat Emptor: change these at your own risk - they impact several
+ # disjoint pieces parts...
+ SENDMAIL_ROOT='/var/run/sendmail';
+ MTA_DAEMON='/usr/sbin/sendmail-mta';
+ MTA_COMMAND='/usr/sbin/sendmail-mta';
+ MTA_A='-Am';
+ MTAL_L='-L sm-mta';
+ MTAL_L_QUEUE='-L sm-mta-queue';
+ MTAL_L_RUNQ='-L sm-mta-runq';
+ MTA_ROOT="${SENDMAIL_ROOT}/mta";
+ MTAL_PIDFILE="${MTA_ROOT}/sendmail.pid";
+ MTAL_SOCKET="${MTA_ROOT}/smsocket";
+ MTAL_CNTL="${MTA_ROOT}/smcontrol";
+ MTAQ_L='-L sm-que';
+ MTAQ_L_RUNQ='-L sm-que-runq';
+ MTAQ_PIDFILE="${MTA_ROOT}/queue.pid";
+ MTAQ_SOCKET="${MTA_ROOT}/qusocket";
+ MTAQ_CNTL="${MTA_ROOT}/qucontrol";
+ MSP_DAEMON='/usr/sbin/sendmail-msp';
+ MSP_COMMAND='/usr/sbin/sendmail-msp';
+ MSP_A='-Ac';
+ MSP_L='-L sm-msp';
+ MSP_L_QUEUE='-L sm-msp-queue';
+ MSP_ROOT="${SENDMAIL_ROOT}/msp";
+ MSP_PIDFILE="${MSP_ROOT}/sendmail.pid";
+ MSP_SOCKET="${MSP_ROOT}/smsocket";
+ MSP_CNTL="${MSP_ROOT}/smcontrol";
+
+ # Pull in any user modified variables
+ if [ -f /etc/mail/sendmail.conf ]; then
+ . /etc/mail/sendmail.conf;
+ fi;
+
+ # These can't be user customized
+ SM_Get_Parameters='yes';
+ PATH='/bin:/usr/bin:/sbin:/usr/sbin';
+ STAMP_DIR="${SENDMAIL_ROOT}/stampdir";
+ START_MTAL_CMD="start-stop-daemon \
+ --pidfile $MTAL_PIDFILE \
+ --exec $MTA_DAEMON \
+ --startas $MTA_COMMAND \
+ --start";
+ STOP_MTAL_CMD="start-stop-daemon \
+ --pidfile $MTAL_PIDFILE \
+ --name sendmail-mta \
+ --stop";
+ SIGNAL_MTAL_CMD="start-stop-daemon \
+ --pidfile $MTAL_PIDFILE \
+ --name sendmail-mta \
+ --stop";
+ START_MTAQ_CMD="start-stop-daemon \
+ --pidfile $MTAQ_PIDFILE \
+ --make-pidfile \
+ --exec $MTA_DAEMON \
+ --startas $MTA_COMMAND \
+ --start";
+ STOP_MTAQ_CMD="start-stop-daemon \
+ --pidfile $MTAQ_PIDFILE \
+ --name sendmail-mta \
+ --stop";
+ SIGNAL_MTAQ_CMD="start-stop-daemon \
+ --pidfile $MTAQ_PIDFILE \
+ --name sendmail-mta \
+ --stop";
+ START_MSP_CMD="start-stop-daemon \
+ --pidfile $MSP_PIDFILE \
+ --exec $MSP_DAEMON \
+ --startas $MSP_COMMAND \
+ --chuid smmsp \
+ --start";
+ STOP_MSP_CMD="start-stop-daemon \
+ --pidfile $MSP_PIDFILE \
+ --name sendmail-msp \
+ --stop";
+ SIGNAL_MSP_CMD="start-stop-daemon \
+ --pidfile $MSP_PIDFILE \
+ --name sendmail-msp \
+ --stop";
+ NAME='sendmail';
+ FLAGS='defaults 50';
+
+ # Sanitize some keyword entries
+ DAEMON_MODE=$(echo "$DAEMON_MODE" | tr '[:upper:]' '[:lower:]');
+ QUEUE_MODE=$(echo "$QUEUE_MODE" | tr '[:upper:]' '[:lower:]');
+ MSP_MODE=$(echo "$MSP_MODE" | tr '[:upper:]' '[:lower:]');
+
+ # See if we can share the listener and queue-runner daemon:
+ # * Both must be in daemon mode
+ # * They must have the same (possibly empty) parameters
+ if [ "$DAEMON_MODE" = "daemon" \
+ -a \( \( "$QUEUE_MODE" = "cron" -o "$QUEUE_MODE" = "none" \) \
+ -o \( "$QUEUE_MODE" != "cron" \
+ -a "$QUEUE_MODE" != "none" \
+ -a "$DAEMON_PARMS" = "$QUEUE_PARMS" \
+ \) \
+ \) ]; then
+ SPLIT_DAEMON=0;
+ else
+ SPLIT_DAEMON=1;
+ fi;
+
+ # Version dependant support:
+ # 8.12.0+ M{TA,MSP}_A
+ if [ ! -f /usr/share/sendmail/cf/feature/msp.m4 ]; then
+ MTA_A='';
+ MTAL_L='';
+ MTAL_L_QUEUE='';
+ MSP_A='';
+ MSP_L='';
+ MSP_L_QUEUE='';
+ fi;
+ };
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# enhanced sendmail startup
+#------------------------------------------------------------------------------
+start_mta () {
+ local result;
+ result=0;
+ #
+ # Make sure /var/run/sendmail/ exists
+ check_dirs;
+ #
+ # If already running, don't start it...
+ if is_running mta; then
+ log_warning_msg 'MTA is already running.';
+ return 1;
+ fi;
+ #
+ # Check if we're going to run a daemon (and how many):
+ daemon_check || result=$?;
+ if [ "$result" -ne 0 ]; then
+ return 0;
+ fi;
+ #
+ # Mark restarted for communication betwixt here and /etc/mail/Makefile
+ touch $STAMP_DIR/reload;
+ #
+ if [ "$DAEMON_MODE" = "daemon" ]; then
+ #
+ # Allow Unix (local) connections betwixt MSP/MTA:
+ touch $MTAL_SOCKET;
+ #
+ # We can only afford to clean the MTA queues if running daemon mode,
+ # otherwise, there is a chance that a cronjob might still be using
+ # the queue... Thats also why we don't clean the MSP queues herein.
+ #clean_queues;
+ #
+ # cd to a safe place to stash core files...
+ cd $MTA_ROOT;
+ CMD="$START_MTAL_CMD -- $MTAL_PARMS";
+ if [ "$LOG_CMDS" = "Yes" ]; then
+ logger -i -p mail.debug -- "$0 $CMD";
+ fi;
+ $CMD &
+ #
+ # Update permissions on smsocket
+ sleep 2;
+ chown $DAEMON_UID:smmsp $MTAL_SOCKET;
+ chmod 0666 $MTAL_SOCKET;
+ fi;
+ #
+ # Check for split daemon mode (separate listener/queue runner)
+ if [ "$SPLIT_DAEMON" -eq 1 ]; then
+ CMD="$START_MTAQ_CMD -- $MTAQ_PARMS";
+ if [ "$LOG_CMDS" = "Yes" ]; then
+ logger -i -p mail.debug -- "$0 $CMD";
+ fi;
+ $CMD &
+ sleep 2;
+ qp=`expr "${MTAQ_PARMS}" : '.*\(-qp[0-9]*[smhdw]\)'` || true;
+ if [ -z "$qp" ]; then
+ chmod 0664 $MTAQ_PIDFILE;
+ else
+ qc=`ps --no-headers -fCsendmail \
+ | egrep -e 'Queue control' \
+ | awk '{print $2}'`;
+ if [ -z "$qc" ]; then
+ rm -f $MTAQ_PIDFILE;
+ else
+ chmod 0664 $MTAQ_PIDFILE;
+ printf "$qc\n$MTA_COMMAND $MTAQ_PARMS" > $MTAQ_PIDFILE;
+ fi;
+ fi;
+ fi;
+ #
+ # if running split service, run the client queues (just to make sure)
+ if check_msp; then
+ $MSP_COMMAND -q $MSP_A $MSP_L_QUEUE $MSP_PARMS $MISC_PARMS;
+ fi;
+ return $result;
+ };
+
+start_msp () {
+ local result;
+ result=0;
+ #
+ # Make sure /var/run/sendmail/ exists
+ check_dirs;
+ #
+ # If already running, don't start it...
+ if is_running msp; then
+ log_warning_msg 'MSP is already running.';
+ return 1;
+ fi;
+ #
+ # Check to see if MSP mode is indeed available
+ if ! check_msp; then
+ return 0;
+ fi;
+ #
+ # Check if we're going to run a daemon:
+ if [ "$MSP_MODE" != 'daemon' ]; then
+ return 0;
+ fi;
+ #
+ # We can only afford to clean the MSP queues if running daemon mode,
+ # otherwise, there is a chance that a cronjob might still be using
+ # the queue... Thats also why we don't clean the MTA queues herein.
+ #clean_queues /var/spool/mqueue-client;
+ #
+ # cd to a safe place to stash core files...
+ cd $MSP_ROOT;
+ $START_MSP_CMD -- \
+ $MSP_A $MSP_L -q${MSP_INTERVAL} $MSP_PARMS $MISC_PARMS &
+ return $result;
+ };
+
+start_sendmail () {
+ local result;
+ # Update databases
+ make_databases;
+ result=0;
+ start_mta || result=$?;
+ if check_msp; then
+ start_msp || true;
+ fi;
+ return $result;
+ };
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# enhanced sendmail reload
+#------------------------------------------------------------------------------
+reload_mta () {
+ local result;
+ #
+ # Make sure /var/run/sendmail/ exists
+ check_dirs;
+ #
+ # Update databases
+ make_databases;
+ #
+ # reload (signal -HUP) is *much* better/faster than stop/start
+ #
+ # Mark restarted for communication betwixt here and /etc/mail/Makefile
+ touch $STAMP_DIR/reload;
+ #
+ # If not running, just start it...
+ if ! is_running mta; then
+ start_mta;
+ fi;
+ #
+ # Is running, must signal it...
+ result=0;
+ $SIGNAL_MTAL_CMD --signal HUP --oknodo --quiet || result=$?;
+ sleep 2;
+ chown $DAEMON_UID:smmta $MTAL_SOCKET;
+ chmod 0666 $MTAL_SOCKET;
+ #
+ # Check for split daemon mode (separate listener/queue runner)
+ if [ "$SPLIT_DAEMON" -eq 1 ]; then
+ $SIGNAL_MTAQ_CMD --signal HUP --oknodo --quiet || true;
+ fi;
+ return $result;
+ };
+
+reload_msp () {
+ local result;
+ result=0;
+ #
+ # Make sure /var/run/sendmail/ exists
+ check_dirs;
+ #
+ # reload (signal -HUP) is *much* better/faster than stop/start
+ #
+ # If not running, just start it...
+ if ! is_running msp; then
+ start_msp;
+ fi;
+ #
+ # Is running, must signal it...
+ $SIGNAL_MSP_CMD --signal HUP --oknodo --quiet || result=$?;
+ return $result;
+ };
+
+reload_sendmail () {
+ local result;
+ result=0;
+ reload_mta || result=$?;
+ if check_msp; then
+ reload_msp || true;
+ fi;
+ return $result;
+ };
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# enhanced sendmail shutdown
+#------------------------------------------------------------------------------
+stop_mta () {
+ local result cnt;
+ result=0;
+ stopped=0;
+ #
+ # Make sure /var/run/sendmail/ exists
+ check_dirs;
+ #
+ # If not running, don't stop it...
+ if ! is_running mta; then
+ return 0;
+ fi;
+ #
+ # Is running, must stop it...
+ $STOP_MTAL_CMD --signal TERM --quiet --oknodo > /dev/null;
+ #
+ # Now we have to wait until sendmail has _really_ stopped.
+ #
+ sleep 2;
+ if $STOP_MTAL_CMD --signal TERM --quiet > /dev/null; then
+ log_progress_msg ' Waiting .';
+ cnt=0;
+ while $STOP_MTAL_CMD --signal TERM --quiet > /dev/null; do
+ cnt=`expr $cnt + 1`;
+ if [ $cnt -gt 60 ]; then
+ #
+ # Waited 120 seconds now. Fail.
+ #
+ echo -n ' Failed ';
+ stopped=1;
+ break;
+ fi;
+ sleep 2;
+ log_progress_msg '.';
+ done;
+ echo -n ' Done ';
+ fi;
+ #
+ # Remove pidfile iff stopped
+ if ! $STOP_MTAL_CMD --signal TERM --quiet > /dev/null; then
+ rm -f "$MTAL_PIDFILE";
+ fi
+ return $result;
+ };
+
+stop_queue () {
+ local result cnt;
+ result=0;
+ stopped=0;
+ #
+ # Make sure /var/run/sendmail/ exists
+ check_dirs;
+ #
+ # If not running, don't stop it...
+ if ! is_running queue; then
+ return 0;
+ fi;
+ #
+ # Is running, must stop it...
+ $STOP_MTAQ_CMD --signal TERM --quiet --oknodo > /dev/null;
+ #
+ # Now we have to wait until sendmail has _really_ stopped.
+ #
+ sleep 2;
+ if $STOP_MTAQ_CMD --signal TERM --quiet > /dev/null; then
+ log_progress_msg ' Waiting .';
+ cnt=0;
+ while $STOP_MTAQ_CMD --signal TERM --quiet > /dev/null; do
+ cnt=`expr $cnt + 1`;
+ if [ $cnt -gt 60 ]; then
+ #
+ # Waited 120 seconds now. Fail.
+ #
+ echo -n ' Failed ';
+ stopped=1;
+ break;
+ fi;
+ sleep 2;
+ log_progress_msg '.';
+ done;
+ echo -n ' Done ';
+ fi;
+ #
+ # Remove pidfile iff stopped
+ if ! $STOP_MTAQ_CMD --signal TERM --quiet > /dev/null; then
+ rm -f "$MTAQ_PIDFILE";
+ fi
+ return $result;
+ };
+
+stop_msp () {
+ local result cnt;
+ result=0;
+ stopped=0;
+ #
+ # Make sure /var/run/sendmail/ exists
+ check_dirs;
+ #
+ # If not running, don't stop it...
+ if ! is_running msp; then
+ return 0;
+ fi;
+ #
+ # Is running, must stop it...
+ $STOP_MSP_CMD --signal TERM --quiet --oknodo > /dev/null;
+ #
+ # Now we have to wait until sendmail has _really_ stopped.
+ #
+ sleep 2;
+ if $STOP_MSP_CMD --signal TERM --quiet > /dev/null; then
+ log_progress_msg 'Waiting .';
+ cnt=0;
+ while $STOP_MSP_CMD --signal TERM --quiet > /dev/null; do
+ cnt=`expr $cnt + 1`;
+ if [ $cnt -gt 60 ]; then
+ #
+ # Waited 120 seconds now. Fail.
+ #
+ echo -n ' Failed ';
+ stopped=1;
+ break;
+ fi;
+ sleep 2;
+ log_progress_msg '.';
+ done;
+ echo -n ' Done ';
+ fi;
+ #
+ # Remove pidfile iff stopped
+ if ! $STOP_MSP_CMD --signal TERM --quiet > /dev/null; then
+ rm -f "$MSP_PIDFILE";
+ fi;
+ return $result;
+ };
+
+stop_sendmail () {
+ local result;
+ result=0;
+ if check_msp; then
+ stop_msp || true;
+ fi;
+ stop_mta || result=$?;
+ stop_queue || true;
+ return $result;
+ };
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# Check to see if sendmail is running
+#------------------------------------------------------------------------------
+is_running () {
+ local result;
+ result=1;
+ #
+ # Make sure /var/run/sendmail/ exists
+ check_dirs;
+ #
+ # Determine proper pidfile to check
+ who=$(echo "$1" | tr '[:upper:]' '[:lower:]');
+ case $who in
+ mta)
+ PIDFILE="$MTAL_PIDFILE";
+ ;;
+ queue)
+ PIDFILE="$MTAQ_PIDFILE";
+ ;;
+ msp)
+ PIDFILE="$MSP_PIDFILE";
+ ;;
+ *)
+ PIDFILE="$1";
+ ;;
+ esac;
+ #
+ # If no pidfile, not running
+ # Extract pid/command and see if still running
+ # Remove pidfile if app didn't
+ # Also remove any control sockets
+ if [ -s $PIDFILE ]; then
+ PID=`head -n 1 $PIDFILE 2>/dev/null`;
+ COMMAND=`tail -n 1 $PIDFILE`;
+ if [ ! -z "`ps --no-heading $PID`" ]; then
+ result=0;
+ else
+ rm -f $PIDFILE;
+ case $who in
+ mta)
+ rm -f $MTAL_SOCKET $MTAL_CNTL;
+ ;;
+ queue)
+ rm -f $MTAQ_SOCKET $MTAQ_CNTL;
+ ;;
+ msp)
+ rm -f $MSP_SOCKET $MSP_CNTL;
+ esac;
+ fi;
+ fi;
+ return $result;
+ };
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# Check to see if running split service (MTA, MSP)
+# Must be at 8.12.0+ for this support
+#------------------------------------------------------------------------------
+check_msp () {
+ local result;
+ result=1;
+ if [ ! -f /usr/share/sendmail/cf/feature/msp.m4 ]; then
+ result=1;
+ elif [ -s /etc/mail/submit.cf ] \
+ && [ -s /etc/mail/submit.mc ]; then
+ if grep -qEe "^[[:space:]]*\`?FEATURE\([[:space:]]*\`?msp" \
+ /etc/mail/submit.mc; then
+ result=0;
+ fi;
+ fi;
+ return $result;
+ };
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# Miscellaneous sendmail command support for MSP/MTA split
+# mailstats, mailq, runq
+#------------------------------------------------------------------------------
+newaliases () {
+ #
+ # Obtain parameters IFF needed
+ if [ -z "$SM_Get_Parameters" ]; then
+ Get_Parameters;
+ fi;
+ #
+ $MTA_COMMAND $MTA_A -bi $*;
+ };
+
+hoststat () {
+ #
+ # Obtain parameters IFF needed
+ if [ -z "$SM_Get_Parameters" ]; then
+ Get_Parameters;
+ fi;
+ #
+ $MTA_COMMAND $MTA_A -bh $*;
+ };
+
+purgestat () {
+ local parms;
+ parms=$(echo "$1" | tr '[:upper:]' '[:lower:]');
+ case $parms in
+ n*) # Now
+ parms='-O Timeout.hoststatus=1s';
+ shift;
+ ;;
+ *)
+ parms='';
+ ;;
+ esac;
+ #
+ # Obtain parameters IFF needed
+ if [ -z "$SM_Get_Parameters" ]; then
+ Get_Parameters;
+ fi;
+ #
+ $MTA_COMMAND $MTA_A -bH $parms $*;
+ };
+
+mailstats () {
+ #
+ # Obtain parameters IFF needed
+ if [ -z "$SM_Get_Parameters" ]; then
+ Get_Parameters;
+ fi;
+ #
+ # if running split service, show the client status first
+ if check_msp; then
+ echo 'MSP statistics...';
+ #check if we have a status file for the MSP
+ statusfile=$(grep -Ee '^O StatusFile=/.*' \
+ /etc/mail/submit.cf | cut -d= -f2);
+ if [ -n $statusfile ]; then
+ /usr/lib/sm.bin/mailstats -C \
+ /etc/mail/submit.cf $* || true;
+ fi;
+ echo 'MTA statistics...';
+ fi;
+ #
+ # check if we have a status file for the MTA
+ statusfile=$(grep -Ee '^O StatusFile=/.*' \
+ /etc/mail/sendmail.cf | cut -d= -f2);
+ if [ -n $statusfile ]; then
+ /usr/lib/sm.bin/mailstats $* || true;
+ fi;
+ };
+
+mailq () {
+ #
+ # Obtain parameters IFF needed
+ if [ -z "$SM_Get_Parameters" ]; then
+ Get_Parameters;
+ fi;
+ #
+ # if running split service, show the client queues first
+ if check_msp; then
+ echo 'MSP Queue status...';
+ #
+ # Check to see if shared memory is in use (8.12.0+)
+ if grep -qEe "^[[:space:]]*\`?define\(\`?confSHAREDMEMORYKEY'?[[:space:]]*,[[:space:]]*\`?0*[1-9]+[0-9]*'?[[:space:]]*\)" \
+ /etc/mail/submit.mc; then
+ $MSP_COMMAND -bP || true;
+ fi;
+ $MSP_COMMAND -bp $MSP_A $MISC_PARMS $* || true;
+ echo 'MTA Queue status...';
+ fi;
+ #
+ # Check to see if shared memory is in use (8.12.0+)
+ if grep -qEe "^[[:space:]]*\`?define\(\`?confSHAREDMEMORYKEY'?[[:space:]]*,[[:space:]]*\`?0*[1-9]+[0-9]*'?[[:space:]]*\)" \
+ /etc/mail/sendmail.mc; then
+ $MTA_COMMAND -bP || true;
+ fi;
+ $MTA_COMMAND -bp $MTA_A $MISC_PARMS $* || true;
+ };
+
+runq () {
+ #
+ # Obtain parameters IFF needed
+ if [ -z "$SM_Get_Parameters" ]; then
+ Get_Parameters;
+ fi;
+ #
+ # if running split service, run the client queues first
+ if check_msp; then
+ echo 'Running the MSP queue...';
+ $MSP_COMMAND -q $MSP_A \
+ $MSP_L_QUEUE $MSP_PARMS $MISC_PARMS $* || true;
+ echo 'Running the MTA queues...';
+ fi;
+ if [ "$SPLIT_DAEMON" -eq 0 ]; then
+ $MTA_COMMAND -q $MTA_A \
+ $MTAL_L_RUNQ $QUEUE_PARMS $MISC_PARMS $* || true;
+ else
+ $MTA_COMMAND -q $MTA_A \
+ $MTAQ_L_RUNQ $QUEUE_PARMS $MISC_PARMS $* || true;
+ fi;
+ };
+
+control () {
+ #
+ # Obtain parameters IFF needed
+ if [ -z "$SM_Get_Parameters" ]; then
+ Get_Parameters;
+ fi;
+ local parms;
+ parms="$*";
+ if [ -z "$parms" ]; then
+ parms='help';
+ fi;
+ if is_running mta; then
+ /usr/share/sendmail/smcontrol.pl $parms;
+ else
+ echo 'MTA: is not running';
+ fi;
+ };
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# Print status of running job(s)
+#------------------------------------------------------------------------------
+status () {
+ #
+ # Make sure /var/run/sendmail/ exists
+ check_dirs;
+ #
+ # Obtain parameters IFF needed
+ if [ -z "$SM_Get_Parameters" ]; then
+ Get_Parameters;
+ fi;
+ #
+ # if running split service, check the client status first
+ if check_msp; then
+ if is_running msp; then
+ echo "MSP: $PID $COMMAND";
+ ps -fwp $PID;
+ if [ -S ${MSP_CNTL} ]; then
+ /usr/share/sendmail/smcontrol.pl \
+ -f ${MSP_CNTL} status || true;
+ fi;
+ elif [ $MSP_MODE = 'cron' ]; then
+ echo "MSP: is run via cron ($MSP_INTERVAL)";
+ elif [ $MSP_MODE = 'none' ]; then
+ echo 'MSP: is disabled';
+ else
+ echo 'MSP: is not running';
+ fi;
+ fi;
+ #
+ # Check MTA listener
+ if is_running mta; then
+ echo "MTA: $PID $COMMAND";
+ ps -fwp $PID;
+ if [ -S ${MTAL_CNTL} ]; then
+ /usr/share/sendmail/smcontrol.pl \
+ -f ${MTAL_CNTL} status || true;
+ fi;
+ elif [ $DAEMON_MODE = 'inetd' ]; then
+ echo 'MTA: is run via inetd';
+ elif [ $DAEMON_MODE = 'none' ]; then
+ echo 'MTA: is disabled';
+ else
+ echo 'MTA: is not running';
+ fi;
+ #
+ # Check for split daemon mode (separate listener/queue runner)
+ if is_running queue; then
+ echo "QUE: $PID $COMMAND";
+ ps -fwp $PID;
+ if [ -S ${MTAQ_CNTL} ]; then
+ /usr/share/sendmail/smcontrol.pl \
+ -f ${MTAQ_CNTL} status || true;
+ fi;
+ elif [ $QUEUE_MODE = 'cron' ]; then
+ echo "QUE: is run via cron ($QUEUE_INTERVAL)";
+ elif [ $QUEUE_MODE = 'none' ]; then
+ echo 'QUE: is disabled';
+ elif [ "$SPLIT_DAEMON" -eq 0 ]; then
+ echo "QUE: Same as MTA";
+ else
+ echo 'QUE: is not running';
+ fi;
+ };
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# Cronjob handling
+#------------------------------------------------------------------------------
+cron_mta () {
+ #
+ # Make sure /var/run/sendmail/ exists
+ check_dirs;
+ #
+ # Obtain parameters IFF needed
+ if [ -z "$SM_Get_Parameters" ]; then
+ Get_Parameters;
+ fi;
+ #
+ # If cron not needed, don't do queue running (though it wouldn't hurt)
+ if [ $QUEUE_MODE = 'cron' ]; then
+ #
+ # If running a split (MTA/MSP) setup, we need to make sure that
+ # messages not immediately accepted by the MTA get delivered.
+ # Only run the MSP queue if MSP_MODE=none
+ if check_msp; then
+ if [ $MSP_MODE = 'none' ]; then
+ # Make sure only *ONE* cronjob at a time
+ if [ ! -f $STAMP_DIR/cron_msp ]; then
+ touch $STAMP_DIR/cron_msp;
+ #clean_queues /var/spool/mqueue-client;
+ $MSP_COMMAND -qf $MSP_A $MSP_L_QUEUE \
+ $MSP_PARMS $MISC_PARMS \
+ $CRON_PARMS || true;
+ rm -f $STAMP_DIR/cron_msp;
+ fi;
+ fi;
+ fi;
+
+ # Make sure only *ONE* cronjob at a time
+ if [ ! -f $STAMP_DIR/cron_mta ]; then
+ touch $STAMP_DIR/cron_mta;
+ $MTA_COMMAND -qf $MTA_A $MTAL_L_QUEUE \
+ $QUEUE_PARMS $MISC_PARMS $CRON_PARMS || true;
+ rm -f $STAMP_DIR/cron_mta;
+ fi;
+ fi;
+ };
+
+cron_msp () {
+ #
+ # Make sure /var/run/sendmail/ exists
+ check_dirs;
+ #
+ # Obtain parameters IFF needed
+ if [ -z "$SM_Get_Parameters" ]; then
+ Get_Parameters;
+ fi;
+ #
+ # If cron not needed, don't do queue running (though it wouldn't hurt)
+ if [ $MSP_MODE = 'cron' ]; then
+ #
+ # If running a split (MTA/MSP) setup, we need to make sure that
+ # messages not immediately accepted by the MTA get delivered.
+ if check_msp; then
+ # Make sure only *ONE* cronjob at a time
+ if [ ! -f $STAMP_DIR/cron_msp ]; then
+ touch $STAMP_DIR/cron_msp;
+ #clean_queues /var/spool/mqueue-client;
+ $MSP_COMMAND -qf $MSP_A $MSP_L_QUEUE \
+ $MSP_PARMS $MISC_PARMS \
+ $CRON_PARMS || true;
+ rm -f $STAMP_DIR/cron_msp;
+ fi;
+ fi;
+ fi;
+ };
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# Determine how to run sendmail mta daemon
+# * No daemon
+# * As listener
+# * As queue runner
+# * As both listener and queue runner
+#------------------------------------------------------------------------------
+daemon_check () {
+ local run_daemon;
+ #
+ # Skip daemon run for the following:
+ # * sendmail hasn't been configured
+ # * DAEMON_MODE = (none | inet) & QUEUE_MODE = (none | cron)
+ if [ ! -s /etc/mail/sendmail.cf ] || \
+ [ ! -s /etc/mail/sendmail.mc ]; then
+ log_failure_msg 'Not configured, not started.';
+ return 1;
+ fi;
+
+ MTAL_PARMS="$MTA_A $MTAL_L";
+ MTAQ_PARMS="$MTA_A $MTAQ_L";
+ run_daemon=3;
+
+ case "$DAEMON_MODE" in
+ none* | \
+ inetd*)
+ run_daemon=`expr $run_daemon - 1`;
+ ;;
+
+ daemon* | \
+ *)
+ MTAL_PARMS="$MTAL_PARMS -bd $DAEMON_PARMS";
+ ;;
+ esac;
+
+ case "$QUEUE_MODE" in
+ none* | \
+ cron*)
+ run_daemon=`expr $run_daemon - 1`;
+ ;;
+
+ daemon* | \
+ *)
+ # Check for split daemon mode (separate listener/queue runner)
+ if [ $SPLIT_DAEMON -eq 0 ]; then
+ if [ ! -z "$QUEUE_INTERVAL" ]; then
+ MTAL_PARMS="$MTAL_PARMS -q${QUEUE_INTERVAL}";
+ fi;
+ MTAL_PARMS="$MTAL_PARMS $QUEUE_PARMS";
+ else
+ if [ ! -z "$QUEUE_INTERVAL" ]; then
+ MTAQ_PARMS="$MTAQ_PARMS -q${QUEUE_INTERVAL}";
+ fi;
+ MTAQ_PARMS="$MTAQ_PARMS $QUEUE_PARMS";
+ fi;
+ ;;
+ esac;
+
+ # Add any miscellanous (ie debugging) parameters
+ MTAL_PARMS="$MTAL_PARMS $MISC_PARMS";
+ MTAQ_PARMS="$MTAQ_PARMS $MISC_PARMS";
+
+ # Add PidFile override for MTA queue runner
+ MTAQ_PARMS="$MTAQ_PARMS -O PidFile=$MTAQ_PIDFILE";
+ MTAQ_PARMS="$MTAQ_PARMS -O ControlSocketName=$MTAQ_CNTL";
+
+ if [ $run_daemon -lt 2 ]; then
+ log_failure_msg 'listen/queue daemon not needed.';
+ return 1;
+ fi;
+ return 0;
+ };
+#------------------------------------------------------------------------------
+
+#------------------------------------------------------------------------------
+# Simple routine to update the databases on start/refresh/restart
+#------------------------------------------------------------------------------
+make_databases () {
+ #
+ # Life is so much simpler with make
+ if test -x /usr/bin/make -a -f /etc/mail/Makefile; then
+ /usr/bin/make all -s -C /etc/mail >/dev/null;
+ #
+ # Here, all I could do would be handle a *few* database -
+ # quite frankly, it isn't worth it, someone will want yet another
+ else
+ echo "No make, you'll have to rebuild your databases by hand :(";
+ fi;
+ }
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# Clean sendmail queues (somewhat): does *not* support split qf/df/xf dirs.
+# NOTE: This whole thing sucks with queue-groups, need to redo it!!!
+# NOTE: Check for race conditions betwixt this code and queue-runners
+#------------------------------------------------------------------------------
+clean_queues () {
+ local QUEUE_ROOT QUEUE QUIET
+ # Obtain queue root directory
+ if [ -z "$1" ]; then
+ QUEUE_ROOT=/var/spool/mqueue
+ QUEUE=/var/spool/mqueue
+ QUIET=''
+ else
+ QUEUE_ROOT="$1"
+ QUEUE="$1"
+ QUIET='1'
+ fi
+ # remove lock files left because of kill/crash
+ # rm -f $QUEUE/[lnx]f* doesn't work with a plethora of files ;-(
+ for i in A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \
+ a b c d e f g h i j k l m n o p q r s t u v w x y z; do
+ rm -f $QUEUE/[lnx]f${i}*
+ done
+ # remove zero length qf files
+ #for qffile in $QUEUE/qf*; do
+ for qffile in $(find $QUEUE_ROOT -type f -name 'qf*'); do
+ if [ -r "$qffile" ] && [ ! -s "$qffile" ]; then
+ if [ ! -z "$QUIET" ]; then
+ echo -n "<zero: $qffile> "; fi
+ rm -f "$qffile"
+ fi
+ done
+ # rename tf files to be qf if the qf does not exist
+ for tffile in $QUEUE/tf*; do
+ qffile=`echo "$tffile" | sed 's/\/tf\([[:alnum:]]*\)$/\/qf\1/'`
+ if [ -r "$tffile" ] && [ ! -f "$qffile" ]; then
+ if [ ! -z "$QUIET" ]; then
+ echo -n "<recovering: $tffile> "; fi
+ mv "$tffile" "$qffile"
+ elif [ -f "$tffile" ]; then
+ echo -n "<extra: $tffile> "
+ rm -f "$tffile"
+ fi
+ done
+ # remove df files with no corresponding qf files
+ for dffile in $QUEUE/df*; do
+ qffile=`echo "$dffile" | sed 's/\/df\([[:alnum:]]*\)$/\/qf\1/'`
+ Dffile=`echo "$dffile" | sed 's/\/df\([[:alnum:]]*\)$/\/Df\1/'`
+ if [ -r "$dffile" ] && [ ! -f "$qffile" ]; then
+ if [ ! -s "$dffile" ]; then
+ rm -f "$dffile"
+ else
+ if [ ! -z "$QUIET" ]; then
+ echo -n "<incomplete: $dffile> "; fi
+ mv "$dffile" "$Dffile";
+ fi
+ fi
+ done
+ # announce files that have been saved during disaster recovery
+ for xffile in $QUEUE/[A-Z]f*; do
+ if [ -f "$xffile" ]; then
+ if [ ! -z "$QUIET" ]; then
+ echo -n "<panic: $xffile> "; fi
+ fi
+ done
+ }
+#------------------------------------------------------------------------------
+
+#------------------------------------------------------------------------------
+# check_dirs: Make sure /var/run/sendmail/{mta,msp,stampdir} exist
+#------------------------------------------------------------------------------
+check_dirs () {
+ if [ ! -d "${SENDMAIL_ROOT}" ]; then
+ mkdir -p "${SENDMAIL_ROOT}";
+ chown root:smmta "${SENDMAIL_ROOT}";
+ chmod 02755 "${SENDMAIL_ROOT}";
+ fi;
+ if [ ! -d "${MTA_ROOT}" ]; then
+ mkdir -p "${MTA_ROOT}";
+ chown $DAEMON_UID:smmta "${MTA_ROOT}";
+ chmod 02755 "${MTA_ROOT}";
+ fi;
+ if [ ! -d "${MSP_ROOT}" ]; then
+ mkdir -p "${MSP_ROOT}";
+ chown smmsp:smmsp "${MSP_ROOT}";
+ chmod 02775 "${MSP_ROOT}";
+ fi;
+ if [ ! -d "${STAMP_DIR}" ]; then
+ mkdir -p "${STAMP_DIR}";
+ chown root:smmsp "${STAMP_DIR}";
+ chmod 02775 "${STAMP_DIR}";
+ fi;
+ }
+
+#------------------------------------------------------------------------------
+# Why are we here ?
+#------------------------------------------------------------------------------
+# Some requisite initialization
+if [ -z "$SM_Get_Parameters" ]; then
+ Get_Parameters;
+ fi;
+if [ "$LOG_CMDS" = "Yes" ]; then
+ logger -i -p mail.debug -- "$0 $@";
+ fi;
+
+#------------------------------------------------------------------------------
+# Handle being called via an alias
+#------------------------------------------------------------------------------
+case $(basename $0) in
+ newaliases)
+ newaliases $*;
+ exit $?;
+ ;;
+ hoststat)
+ hoststat $*;
+ exit $?;
+ ;;
+ purgestat)
+ purgestat $*;
+ exit $?;
+ ;;
+ mailstats)
+ mailstats $*;
+ exit $?;
+ ;;
+ mailq)
+ mailq $*;
+ exit $?;
+ ;;
+ runq)
+ runq $*;
+ exit $?;
+ ;;
+ control|smcontrol)
+ control $*;
+ exit $?;
+ ;;
+ status)
+ status $*
+ exit $?
+ ;;
+ *)
+ : # Fall through and handle below
+ ;;
+ esac;
+
+#------------------------------------------------------------------------------
+# Handle being called via /etc/init.d/sendmail or directly
+#------------------------------------------------------------------------------
+# Ok, why are we here...
+case "$1" in
+
+ #-----------------------------------------------------------------------
+ # Debian required/optional targets:
+ #-----------------------------------------------------------------------
+ start)
+ log_daemon_msg "Starting $DESC" "$NAME";
+ start_sendmail;
+ log_end_msg $?;
+ ;;
+
+ stop|force-stop)
+ log_daemon_msg "Stopping $DESC" "$NAME";
+ stop_sendmail;
+ log_end_msg $?;
+ ;;
+
+ restart)
+ log_daemon_msg "Restarting $DESC" "$NAME";
+ # reload is equivalent (but faster) than stop/start !
+ # but... it doesn't honor changes to /etc/mail/sendmail.conf
+ #reload_sendmail;
+ stop_sendmail;
+ start_sendmail;
+ log_end_msg $?;
+ ;;
+
+ restart-if-running)
+ if ! is_running mta && ! is_running msp; then
+ echo 'Mail Transport Agent: sendmail is not running';
+ else
+ $0 restart;
+ fi;
+ ;;
+
+ reload-if-running)
+ if ! is_running mta && ! is_running msp; then
+ echo 'Mail Transport Agent: sendmail is not running';
+ else
+ $0 reload;
+ fi;
+ ;;
+
+ reload|force-reload)
+ log_daemon_msg "Reloading $DESC" "$NAME";
+ reload_sendmail;
+ log_end_msg $?;
+ ;;
+
+ #-----------------------------------------------------------------------
+ # Local targets (sendmail commands/aliases) for MSP/MTA split support
+ # These targets will pass along any provided parameters
+ #-----------------------------------------------------------------------
+ newaliases)
+ shift;
+ newaliases $*;
+ ;;
+
+ hoststat)
+ shift;
+ hoststat $*;
+ ;;
+
+ purgestat)
+ shift;
+ purgestat $*;
+ ;;
+
+ mailstats)
+ shift;
+ mailstats $*;
+ ;;
+
+ mailq)
+ shift;
+ mailq $*;
+ ;;
+
+ runq)
+ shift;
+ runq $*;
+ ;;
+
+ control|smcontrol)
+ shift;
+ control $*;
+ ;;
+
+ #-----------------------------------------------------------------------
+ # Local targets for extended support/debugging
+ #-----------------------------------------------------------------------
+ status)
+ shift;
+ status $*;
+ ;;
+
+ debug)
+ #
+ # If not running, can't debug
+ if is_running msp; then
+ echo -n 'Dumping MSP state...';
+ $SIGNAL_MSP_CMD --signal USR1;
+ echo 'done.';
+ fi;
+ if is_running mta; then
+ echo -n 'Dumping MTA state...';
+ $SIGNAL_MTAL_CMD --signal USR1;
+ echo 'done.';
+ fi;
+ ;;
+
+ clean|clean_que*|clean-que*)
+ #
+ # If running, don't clean the queues...
+ if is_running mta; then
+ echo 'MTA is running, queue cleaning ill advised...';
+ else
+ echo -n 'Cleaning up the queues...';
+ clean_queues;
+ echo 'done.';
+ fi;
+ ;;
+
+ #-----------------------------------------------------------------------
+ # Local targets for cronjob support
+ #-----------------------------------------------------------------------
+ cron-msp)
+ cron_msp;
+ ;;
+
+ cron-mta)
+ cron_mta;
+ ;;
+
+ #-----------------------------------------------------------------------
+ # Default target - bitch and moan
+ #-----------------------------------------------------------------------
+ *)
+ echo "Invalid command <$1>";
+ echo "Usage: $0 <command>";
+ echo ' Where <command> is one of the following';
+ echo ' start|stop|restart|restart-if-running';
+ echo ' reload-if-running|reload|force-reload';
+ echo ' newaliases|hoststat|purgestat|mailstats|mailq|runq|control';
+ echo ' status|debug|clean';
+ exit 1;
+ ;;
+ esac;
+
+exit 0;
diff --git a/debian/local/sendmailconfig b/debian/local/sendmailconfig
new file mode 100644
index 0000000..adbb513
--- /dev/null
+++ b/debian/local/sendmailconfig
@@ -0,0 +1,688 @@
+#!/bin/sh -e
+#-----------------------------------------------------------------------------
+# $Sendmail: sendmailconfig,v 8.14.3 2008-05-04 22:26:20 cowboy Exp $
+#
+# Interactively configure Sendmail for Debian
+#
+# Copyright (c) 1998-2008 Richard Nelson. All Rights Reserved.
+#
+# Robert Leslie <rob@mars.org>,
+# Rick Nelson <cowboy@debian.org>
+#
+#-----------------------------------------------------------------------------
+set -e;
+
+PATH='/usr/sbin:/usr/bin:/sbin:/bin';
+SENDMAIL_MC="/etc/mail/sendmail.mc";
+SUBMIT_MC="/etc/mail/submit.mc";
+
+# 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
+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;
+
+set +e;
+reload="yes";
+umask 022;
+
+#------------------------------------------------------------------------------
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ --no-reload)
+ reload="";
+ shift;
+ ;;
+
+ *)
+ echo "Usage: $0 [--no-reload]" >&2;
+ exit 1;
+ ;;
+ esac;
+ done;
+
+#------------------------------------------------------------------------------
+
+descrip() {
+ echo '';
+ echo "$1";
+ echo "$1" | sed -e 's/./-/g';
+ cat -;
+ echo '';
+ };
+
+yesno() {
+ local N='N' Y='Y';
+ local q="$1" def=$(eval "echo -n \$$2");
+
+ while :; do
+ echo -n "$q? [$def] ";
+ read REPLY;
+ REPLY=$(echo -n "$REPLY" | sed -e "s/^\ *//" -e "s/^\t*//");
+ test -n "$REPLY" || REPLY="$def";
+
+ case "$REPLY" in
+ [Yy]*)
+ echo yes > /dev/null;
+ eval "$2=\"Y\"";
+ return 0;
+ ;;
+ [Nn]*)
+ echo no > /dev/null;
+ eval "$2=\"N\"";
+ return 1;
+ ;;
+ esac;
+ done;
+ };
+
+input() {
+ local q="$1" def=$(eval "echo -n \$$2");
+
+ echo -n "$q? [$def] ";
+ read REPLY
+ REPLY=$(echo "$REPLY" | sed -e 's/^[ ]*//' -e 's/[ ]*$//' | cat);
+ test -n "$REPLY" || REPLY="$def";
+
+ if [ "NONE" = "$3" ]; then
+ case "$REPLY" in
+ [Nn][Oo][Nn][Ee]*)
+ REPLY='';
+ ;;
+ esac;
+ fi;
+
+ eval "$2=\"$REPLY\"";
+ };
+
+testconfig() {
+ CONFIG=$(grep -Ee "^[[:space:]]*$1" $SENDMAIL_MC 2>/dev/null);
+ };
+
+makecf() {
+ if [ -x $sm_path/update_sendmail ]; then
+ echo "Updating sendmail environment ...";
+ $sm_path/update_sendmail || true;
+ fi;
+
+ if [ "$reload" ] && \
+ yesno \
+ "Reload the running sendmail now with the new configuration" Y
+ then
+ echo "Reloading sendmail ...";
+ /etc/init.d/sendmail reload >/dev/null;
+ fi;
+}
+
+#------------------------------------------------------------------------------
+
+if [ -f $SENDMAIL_MC ]; then
+ if yesno "Configure sendmail with the existing /etc/mail/sendmail.conf" Y
+ then
+ if ! $sm_path/update_conf; then
+ echo "Correct /etc/mail/sendmail.conf before continuing.";
+ exit 1;
+ fi;
+ else
+ echo "Edit /etc/mail/sendmail.conf and reissue $0.";
+ exit 0;
+ fi;
+ if yesno "Configure sendmail with the existing $SENDMAIL_MC" Y
+ then
+ makecf;
+ exit 0;
+ fi;
+ fi;
+
+###############################################################################
+
+exec 3>$SENDMAIL_MC.new;
+trap "rm -f $SENDMAIL_MC.new" 0;
+
+###############################################################################
+
+descrip "Sendmail Configuration" <<-EOT
+By answering the following questions, you can configure sendmail for your
+system. Default values are determined either by your existing configuration
+or from common usage.
+EOT
+
+echo -n "Press [ENTER] ";
+read REPLY;
+
+cat /usr/share/sendmail/cf/debian/sendmail.mc >&3;
+cp -a /usr/share/sendmail/cf/debian/submit.mc \
+ $SUBMIT_MC.new;
+echo "LOCAL_CONFIG" >&3;
+
+###############################################################################
+
+descrip "Mail Name" <<EOT
+Your \`mail name' is the hostname portion of the address to be shown on
+outgoing news and mail messages (following the username and @ sign). This
+name will be used by other programs besides sendmail; it should be the single,
+full domain name (FQDN) from which mail will appear to originate.
+EOT
+
+mailname=$(cat /etc/mailname 2>/dev/null || hostname --fqdn);
+input "Mail name" mailname;
+
+echo "$mailname" >/etc/mailname;
+
+###############################################################################
+
+descrip "Null Client" <<EOT
+A special configuration known as the "null client" can be created for this
+host if all mail should be forwarded to a central hub via a local SMTP-based
+network. This may be a suitable configuration if you want to forward all of
+your mail to your local Internet service provider (ISP) for delivery.
+
+To enable this option, give the name of the host to which all mail should be
+forwarded. Otherwise leave the option empty to disable it.
+To remove a prior name, use \`NONE'.
+EOT
+
+nullclient=""
+! testconfig "FEATURE\(\`?nullclient" ||
+ nullclient=$(echo -n "$CONFIG" | sed -e 's/[^,]*, *\([^)]*\).*/\1/');
+
+input "Null client forward host" nullclient NONE;
+
+if [ ! -z "$nullclient" ]; then
+ echo "EXPOSED_USER(root uucp)dnl # users exempt from masquerading" >&3;
+ echo "LOCAL_USER(root)dnl" >&3;
+ echo "MASQUERADE_AS(\`$mailname')dnl" >&3;
+ echo "FEATURE(\`allmasquerade')dnl" >&3;
+ echo "FEATURE(\`masquerade_envelope')dnl" >&3;
+ echo "FEATURE(\`nullclient', $nullclient)dnl" >&3;
+ fi;
+
+if [ -z "$nullclient" ]; then
+
+###############################################################################
+descrip "Smart Host" <<EOT
+A "Smart Host" is one that can deliver mail to external machines. By using
+a "Smart Host", we don't need DNS, or good connectivity ourselves. This is
+most likely what you want if you have a dialup link, or sit behind a firewall.
+
+To enable this option, give the name of the host to which all non-local mail
+should be forwarded. Otherwise leave the option empty.
+To remove a prior name, use \`NONE'.
+EOT
+
+smarthost="";
+#if [ -n "$nullclient" ]; then
+# smarthost="$nullclient"
+# fi
+! testconfig "define\(\`?SMART_HOST" ||
+ smarthost=$(echo -n "$CONFIG" | sed -e 's/[^:]*:*\([^)]*\).*/\1/');
+input "Smart Host:" smarthost NONE;
+
+if [ -n "$smarthost" ]; then
+ echo "define(\`SMART_HOST', $smarthost)dnl" >&3;
+ echo "MASQUERADE_AS(\`$mailname')dnl" >&3;
+ fi;
+#if [ -n "$nullclient" ] && [ ! -z "$smarthost" ]; then
+# echo "undefine(\`ALIAS_FILE')dnl" >&3
+# echo "define(\`confFORWARD_PATH', \`')dnl" >&3
+# echo "define(\`MAIL_HUB', \`$smarthost')dnl" >&3
+# echo "MASQUERADE_AS(\`$smarthost')dnl" >&3
+# echo "FEATURE(\`allmasquerade')dnl" >&3
+# echo "FEATURE(\`masquerade_envelope')dnl" >&3
+# fi
+###############################################################################
+
+descrip "Address Canonification" <<EOT
+Usually sendmail will canonify all addresses by consulting a name server and
+resolving hosts to their fully qualified domain name (FQDN). Under special
+circumstances you may want to disable this feature, for example if this
+machine acts only as a mail gateway.
+EOT
+
+test -z "$nullclient" || cat <<EOT
+Since this host will be configured as a null client, this option controls
+whether addresses will be qualified with \`$mailname' when
+sent to the central hub via SMTP. Disabling this feature may cause mail to
+appear to come from (and be qualified by the domain for) the hub machine
+rather than this host.
+
+EOT
+
+nocanonify="N";
+! testconfig "FEATURE\(\`?nocanonify" || nocanonify="Y";
+
+! yesno "Disable address canonification" nocanonify || \
+ echo "FEATURE(\`nocanonify')dnl" >&3;
+
+###############################################################################
+
+#descrip "SMTP Mailer" <<EOT
+#If you plan to exchange mail with other computers, you should enable the
+#SMTP mailer. Even if you don't plan to exchange mail with other computers,
+#it is still a good idea to enable this so local programs can use it.
+#EOT
+
+smtp="Y";
+#if [ -f $SENDMAIL_MC ]; then
+# testconfig "MAILER\(\`?smtp" || smtp="N";
+#fi;
+
+#yesno "Enable the SMTP mailer" smtp || true;
+
+###############################################################################
+
+descrip "Masquerade Envelope" <<EOT
+If you want mail envelopes (as well as mail headers) to appear to come from
+\`$mailname', you can enable this option.
+EOT
+
+masqenvelope="Y";
+if [ -f $SENDMAIL_MC ]; then
+ testconfig "FEATURE\(\`?masquerade_envelope" || masqenvelope="N";
+fi;
+
+! yesno "Masquerade envelopes" masqenvelope || \
+ echo "FEATURE(\`masquerade_envelope')dnl" >&3;
+
+###############################################################################
+
+descrip "All Masquerade" <<EOT
+If enabled, this feature will cause recipient addresses to also appear to come
+from \`$mailname'. Normally they get the local hostname.
+Although this may be right for ordinary users, it can break local aliases. For
+example, if you send to "localalias", the originating sendmail will find that
+alias and send to all members, but send the message with
+"To: localalias@$mailname". Since that alias likely does
+not exist, replies will fail. Use this feature ONLY if you can guarantee that
+the ENTIRE namespace of \`$mailname' supersets all the
+local entries. If in doubt, it is safe to leave this option disabled.
+EOT
+
+allmasquerade="N";
+! testconfig "FEATURE\(\`?allmasquerade" || allmasquerade="Y";
+
+! yesno "All masquerade" allmasquerade || \
+ echo "FEATURE(\`allmasquerade')dnl" >&3;
+
+###############################################################################
+
+descrip "Dont masquerade mail to local users" <<EOT
+Send mail to local recipients without masquerading.
+EOT
+
+local_no_masquerade="N";
+! testconfig "FEATURE\(\`?local_no_masquerade" || local_no_masquerade="Y";
+
+! yesno "Dont masquerade local" local_no_masquerade ||
+ echo "FEATURE(\`local_no_masquerade')dnl" >&3;
+
+###############################################################################
+
+descrip "Always Add Domain" <<EOT
+If enabled, the local host domain is included even on locally delivered mail.
+Normally it is not added unless it is already present.
+EOT
+
+alwaysdomain="N";
+! testconfig "FEATURE\(\`?always_add_domain" || alwaysdomain="Y";
+
+! yesno "Always add domain" alwaysdomain || \
+ echo "FEATURE(\`always_add_domain')dnl" >&3;
+
+###############################################################################
+
+descrip "Mail Acceptance" <<EOT
+Sendmail is usually configured to accept mail for your mail name
+($mailname). However, under special circumstances you
+may not wish sendmail to do this, particularly if (and disabling this option
+generally requires that) mail for \`$mailname' is MXed
+to another host. If in doubt, it is safe to leave this option enabled.
+EOT
+
+acceptmailname="Y";
+if [ -f $SENDMAIL_MC ]; then
+ testconfig "^Cw.*$mailname" || acceptmailname="N";
+fi;
+
+yesno "Accept mail for \`$mailname'" acceptmailname || true;
+test "N" = "$acceptmailname" || \
+ echo "LOCAL_CONFIG
+Cw$mailname" >&3;
+
+###############################################################################
+
+descrip "Alternate Names" <<EOT
+In addition to the canonical mail name \`$mailname', you can
+add any number of additional alternate names to recognize for receiving mail.
+If other hosts are MXed to you for local mail, this is where you should list
+them. This list is saved into the file /etc/mail/local-host-names
+so it can be changed later as needed.
+
+To answer this question, separate each alternate name with a space, or answer
+\`NONE' to eliminate all alternate names.
+EOT
+
+cw_file="/etc/mail/local-host-names";
+altnames=$(cat "$cw_file" 2>/dev/null | tr -s '\n \t' ' ' |
+ sed -e 's/^ *//' -e 's/ *$//');
+input "Alternate names" altnames NONE;
+
+if [ -n "$altnames" ]; then
+ echo "$altnames" | tr -s ' \t' '\n' >$cw_file;
+else
+ echo "localhost" >$cw_file;
+fi;
+ chown root:smmsp $cw_file;
+ chmod 0644 $cw_file;
+
+echo "FEATURE(\`use_cw_file')dnl" >&3;
+
+###############################################################################
+
+descrip "Trusted Users" <<EOT
+Sendmail allows a special group of users to set their envelope "From" address
+using the -f option without generating a warning message. If you have
+software such as Majordomo installed, you will want to include the usernames
+from such software here. Note that "root", "daemon", and "uucp" are included
+automatically and do not need to be specified. This list is saved into the
+file /etc/mail/trusted-users so it can be changed later as needed.
+
+To answer this question, separate each username with a space, or answer
+\`NONE' to eliminate all usernames.
+EOT
+
+ct_file="/etc/mail/trusted-users";
+trusted=$(cat "$ct_file" 2>/dev/null | tr -s '\n \t' ' ' |
+ sed -e 's/^ *//' -e 's/ *$//');
+input "Trusted users" trusted NONE;
+
+if [ -n "$trusted" ]; then
+ echo "$trusted" | tr -s ' \t' '\n' >$ct_file;
+ chown root:smmsp $ct_file;
+ chmod 0644 $ct_file;
+else
+ cat /dev/null >$ct_file;
+fi;
+
+echo "FEATURE(\`use_ct_file')dnl" >&3;
+echo "FEATURE(\`use_ct_file')dnl" >> $SUBMIT_MC.new;
+
+###############################################################################
+
+descrip "Redirect Feature" <<EOT
+If enabled, this feature will allow you to alias old names to
+<new-address>.REDIRECT, causing sendmail to return mail to the sender with
+an error but indicating the recipient's new address.
+EOT
+
+redirect="N";
+! testconfig "FEATURE\(\`?redirect" || redirect="Y";
+
+! yesno "Enable redirect option" redirect || \
+ echo "FEATURE(\`redirect')dnl" >&3;
+
+###############################################################################
+
+descrip "UUCP Addresses" <<EOT
+Sendmail can be configured to be smart about UUCP addresses, or it can do
+nothing special with UUCP addresses at all. If you care about UUCP, you will
+need to do some additional configuration, perhaps outside of this script.
+
+*** NOTE *** If you use a smart host or do any kind of forwarding (ie
+LUSER_RELAY and LOCAL_RELAY), it is important that you say "Yes"
+here to prevent a multi-level relay hole - unless you know for *SURE* that
+your smart-host does not deal with UUCP addresses.
+
+(Be safe and just say Y)
+EOT
+
+uucp="Y";
+if [ -f $SENDMAIL_MC ]; then
+ testconfig "FEATURE\(\`?nouucp" || uucp="Y";
+fi;
+
+yesno "Enable UUCP addressing" uucp || \
+ echo "FEATURE(\`nouucp', \`reject')dnl" >&3;
+
+###############################################################################
+
+descrip "Sticky Host" <<EOT
+If enabled, mail sent to \`user@$mailname' is marked as
+"sticky" -- that is, the local addresses aren't matched against UDB and don't
+go through ruleset 5. This is used if you want a setup where \`user' is not
+necessarily the same as \`user@$mailname', e.g., to make
+a distinct domain-wide namespace. If in doubt, it is safe to leave this
+option disabled.
+EOT
+
+sticky="N";
+! testconfig "FEATURE\(\`?stickyhost" || sticky="Y";
+
+! yesno "Enable sticky host option" sticky || \
+ echo "FEATURE(\`stickyhost')dnl" >&3;
+
+###############################################################################
+
+descrip "DNS" <<EOT
+If you are directly connected to the Internet and have access to a domain
+name server, you should enable this option.
+EOT
+
+dns="Y";
+! testconfig "FEATURE\(\`?nodns" || dns="N";
+! testconfig "HACK\(\`?nodns" || dns="N";
+
+yesno "Enable DNS" dns || \
+ echo "HACK(\`nodns')dnl" >&3;
+
+###############################################################################
+
+if [ Y = "$dns" ]; then
+
+###############################################################################
+
+descrip "Best MX is Local" <<EOT
+If enabled, this option will cause sendmail to accept mail as though locally
+addressed for any host that lists this machine as the best possible MX record.
+This generates additional DNS traffic, but should be OK for low-to-medium
+traffic hosts. N.B.: This feature is fundamentally incompatible with wildcard
+MX records. If you have a wildcard MX record that matches your domain, you
+cannot use this feature.
+EOT
+
+bestmxlocal="N";
+! testconfig "FEATURE\(\`?bestmx_is_local" || bestmxlocal="Y";
+
+! yesno "Assume best MX is local" bestmxlocal || \
+ echo "FEATURE(\`bestmx_is_local')dnl" >&3;
+
+###############################################################################
+
+fi; # finished DNS configuration
+
+###############################################################################
+
+descrip "Mailertable" <<EOT
+If enabled, this option causes sendmail to read mail routing rules from
+the text file /etc/mail/mailertable. This is needed for unusual mailers like
+ifmail and fax programs.
+More information is in /usr/share/doc/sendmail-doc/op/op.txt.gz.
+EOT
+
+mailertable="N";
+! testconfig "FEATURE\(\`?mailertable" || mailertable="Y";
+
+! yesno "Enable the mailertable feature" mailertable || \
+ echo "FEATURE(\`mailertable')dnl" >&3;
+
+###############################################################################
+
+descrip "Sendmail Restricted Shell" <<EOT
+If enabled, this option causes sendmail to use the sendmail restricted shell
+program (smrsh) instead of /bin/sh for mailing to programs. This improves your
+ability to control what gets run via email; only those programs which appear
+in a special directory can be run. If you enable this option, please carefully
+read the smrsh(8) man page for further information.
+EOT
+
+smrsh="Y";
+! testconfig "FEATURE\(\'?smrsh" || smrsh="Y";
+
+! yesno "Use the Sendmail Restricted Shell (smrsh)" smrsh || \
+ echo "FEATURE(\`smrsh', \`/usr/lib/sm.bin/smrsh')dnl" >&3;
+
+###############################################################################
+
+#descrip "Mailer Name" <<EOT
+#You can change the name used for internally generated outgoing messages.
+#Usually this is \`MAILER-DAEMON' but it would not be unreasonable to change
+#it to something such as \`postmaster'.
+#EOT
+
+#daemon="MAILER-DAEMON";
+#! testconfig "define\(\`?confMAILER_NAME" ||
+# daemon=$(echo -n "$CONFIG" | sed -e 's/[^,]*, *`\([^'"'"']*\).*/\1/');
+
+#input "Mailer name" daemon;
+
+#test "MAILER-DAEMON" = "$daemon" ||
+# echo "define(\`confMAILER_NAME', \`$daemon')dnl" >&3;
+
+###############################################################################
+
+#descrip "Me Too" <<EOT
+#Sendmail normally excludes the sender address from group expansion. Enabling
+#this option will cause the sender to be included.
+#EOT
+
+#metoo="N";
+#! testconfig "define\(\`?confME_TOO.*True" || metoo="Y";
+
+#! yesno "Enable me too option" metoo ||
+# echo "define(\`confME_TOO', True)dnl" >&3;
+
+###############################################################################
+
+descrip "Message Timeouts" <<EOT
+Sendmail will issue a warning message to the sender if it can't deliver a
+message within a reasonable amount of time. It will also send a failure
+notification and give up trying to deliver the message if it can't deliver it
+after an unreasonable amount of time.
+
+You can configure the message timeouts after which warning and failure
+notifications are sent. Sendmail's defaults are 4 hours and 5 days (4h/5d),
+respectively, but many people feel warnings after only 4 hours are premature.
+EOT
+
+qw="4h";
+! testconfig "define\(\`?confTO_QUEUEWARN" ||
+ qw=$(echo -n "$CONFIG" | sed -e 's/[^,]*, *`\([^'"'"']*\).*/\1/');
+
+qr="5d";
+! testconfig "define\(\`?confTO_QUEUERETURN" ||
+ qr=$(echo -n "$CONFIG" | sed -e 's/[^,]*, *`\([^'"'"']*\).*/\1/');
+
+timeouts="$qw/$qr";
+
+input "Message timeouts" timeouts;
+
+qw=$(expr "$timeouts" : '\([^/]*\)/');
+qr=$(expr "$timeouts" : '[^/]*/\(.*\)');
+
+test "4h" = "$qw" || echo "define(\`confTO_QUEUEWARN', \`$qw')dnl" >&3;
+test "5d" = "$qr" || echo "define(\`confTO_QUEUERETURN', \`$qr')dnl" >&3;
+
+###############################################################################
+# Support dialup configuration
+cat <<-EOT >&3
+dnl #
+dnl # Dialup/LAN connection overrides
+dnl #
+include(\`/etc/mail/m4/dialup.m4')dnl
+include(\`/etc/mail/m4/provider.m4')dnl
+dnl #
+EOT
+
+###############################################################################
+echo "MAILER_DEFINITIONS" >&3
+echo "MAILER(local)dnl" >&3
+
+test "N" = "$smtp" || echo "MAILER(smtp)dnl" >&3;
+
+###############################################################################
+
+if [ -e /etc/ifmail/config ] && \
+ [ -e /usr/share/sendmail/cf/mailer/ifmail.m4 ];
+then
+ echo "MAILER(ifmail)dnl" >&3;
+fi;
+
+###############################################################################
+
+fi; # finished non-"null client" configuration
+
+
+###############################################################################
+
+echo "" >&3;
+echo "LOCAL_CONFIG" >&3;
+#if [ -z $nullclient ]; then
+# echo "MASQUERADE_AS($mailname)dnl" >&3
+# fi
+
+if [ -f $SENDMAIL_MC ]; then
+ sed -n -e '/^## Custom/,$p' $SENDMAIL_MC >&3;
+else
+ echo "## Custom configurations below (will be preserved)" >&3;
+fi;
+
+descrip "Configuration Complete" <<EOT
+Advanced configuration, such as alternate mailers, the use of mailertables,
+Bitnet domains, and UUCP domains can be accomplished by manually editing the
+$SENDMAIL_MC configuration file and rerunning
+\`$0' to generate the appropriate /etc/mail/sendmail.cf
+file. (Local changes made at the end of $SENDMAIL_MC
+will be preserved by \`$0'.)
+
+The m4 library files for sendmail configuration are kept in the
+/usr/share/sendmail/cf directory. You may wish to review the
+documentation in /usr/share/doc/sendmail to assist in further customization.
+
+You may wish to customize your alias database; see the aliases(5) man page
+for information on the format and use of the /etc/aliases file.
+EOT
+
+###############################################################################
+
+exec 3>&-;
+
+if [ -f $SENDMAIL_MC ];then
+ echo "Saving old $SENDMAIL_MC as $SENDMAIL_MC.old ...";
+ mv -f $SENDMAIL_MC $SENDMAIL_MC.old;
+ fi;
+
+chown root:smmsp $SENDMAIL_MC.new;
+chmod 0644 $SENDMAIL_MC.new;
+mv -f $SENDMAIL_MC.new $SENDMAIL_MC;
+if [ ! -f /usr/share/sendmail/cf/feature/msp.m4 ]; then
+ chown root:smmsp $SUBMIT_MC.new;
+ chmod 0644 $SUBMIT_MC.new;
+ mv -f $SUBMIT_MC.new $SUBMIT_MC;
+ fi;
+trap - 0;
+
+makecf;
+exit 0;
diff --git a/debian/local/update_auth b/debian/local/update_auth
new file mode 100644
index 0000000..98f66bd
--- /dev/null
+++ b/debian/local/update_auth
@@ -0,0 +1,349 @@
+#!/bin/sh -e
+#-----------------------------------------------------------------------------
+#
+# $Sendmail: update_auth,v 8.14.3 2008-05-04 22:26:20 cowboy Exp $
+#
+# Sendmail support for SMTP AUTH (SASL)
+#
+# Copyright (c) 2000-2008 Richard Nelson. All Rights Reserved.
+#
+# Notes:
+#
+#-----------------------------------------------------------------------------
+set -e;
+
+NEW=0;
+DEFAULT=0;
+HOSTNAME=`hostname -s`;
+HOSTFQDN=`hostname -f`;
+DOMAINNAME=`hostname -d`;
+SMUID=sendmail;
+SMAID=sendmail;
+SMPWD=sendmailpwd;
+SMRLM="$HOSTNAME.$DOMAINNAME";
+SMMCH='';
+
+# 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
+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;
+
+# See what sendmail was linked with
+if [ "yes" != "yes" ]; then
+ echo "SASL support not included in sendmail, skipping...";
+ exit 0;
+elif [ 2 -eq 2 ]; then
+ SASLDBLISTUSERS='/usr/sbin/sasldblistusers2';
+ SASLPASSWD='/usr/sbin/saslpasswd2';
+ SASLLIB='/usr/lib/sasl2';
+ SASLSO='2';
+ SASLDB='/etc/sasldb2';
+ SASL_BIN='sasl2-bin';
+ SASL_LIB='libsasl2';
+ SASL='SASL2';
+elif [ 2 -eq 1 ]; then
+ SASLDBLISTUSERS='/usr/sbin/sasldblistusers';
+ SASLPASSWD='/usr/sbin/saslpasswd';
+ SASLLIB='/usr/lib/sasl';
+ SASLSO='1';
+ SASLDB='/etc/sasldb';
+ SASL_BIN='sasl-bin';
+ SASL_LIB='libsasl';
+ SASL='SASL';
+ fi;
+
+# Check if SASL is installed
+if [ ! -d ${SASLLIB} ]; then
+ cat <<-EOT
+
+ ${SASL} not installed, not configuring sendmail support.
+
+ EOT
+ if [ "${SASLSO}" = '1' ]; then
+ cat <<-EOT
+ To install ${SASL}, get ${SASL_BIN}, ${SASL_LIB}-modules-plain,
+ ${SASL_LIB}-digestmd5-plain or ${SASL_LIB}-digestmd5-des.
+ EOT
+ else
+ cat <<-EOT
+ To install ${SASL}, get ${SASL_BIN} and ${SASL_LIB}-modules.
+ EOT
+ fi;
+ cat <<-EOT
+
+ To enable sendmail ${SASL} support at a later date, invoke "$0"
+
+ EOT
+ exit 0;
+ fi;
+
+# Check for sasl-bin (wherein resides saslpasswd)
+if [ ! -x ${SASLPASSWD} ]; then
+ cat <<-EOT
+ ${SASL_BIN} not installed, not configuring sendmail support.
+
+ To enable sendmail ${SASL} support at a later date, invoke "$0"
+
+ EOT
+ exit 0;
+ fi;
+#echo " ";
+#echo "Creating/Updating ${SASL} information";
+touch /etc/mail/tsasl;
+if chown root:sasl /etc/mail/tsasl 2>/dev/null; then
+ adduser smmta sasl 1>/dev/null 2>&1;
+ adduser smmsp sasl 1>/dev/null 2>&1;
+ fi;
+ rm /etc/mail/tsasl;
+
+# See if we need to rename an existing SASL info file
+if [ -f /etc/mail/auth-info ] \
+&& [ ! -f /etc/mail/default-auth-info ]; then
+ mv /etc/mail/auth-info \
+ /etc/mail/default-auth-info;
+ fi;
+
+# Use exisisting SASL auth information
+if [ -f /etc/mail/default-auth-info ]; then
+ SMUID=$(head -n1 /etc/mail/default-auth-info);
+ SMAID=$(head -n2 /etc/mail/default-auth-info | tail -n1 -);
+ SMPWD=$(head -n3 /etc/mail/default-auth-info | tail -n1 -);
+ SMRLM=$(head -n4 /etc/mail/default-auth-info | tail -n1 -);
+ SMMCH=$(head -n5 /etc/mail/default-auth-info | tail -n1 -);
+ fi;
+
+# Check for default settings, used in later test
+if [ "$SMUID" = 'sendmail' ] \
+&& [ "$SMAID" = 'sendmail' ] \
+&& [ "$SMPWD" = 'sendmailpwd' ]; then
+ DEFAULT=1;
+ fi;
+
+# Create Default SASL auth information
+if [ ! -f /etc/mail/default-auth-info ]; then
+ cat <<-EOT > /etc/mail/default-auth-info
+ $SMUID
+ $SMAID
+ $SMPWD
+ $SMRLM
+ $SMMCH
+ EOT
+ fi;
+
+# Create any missing SASL configuration files
+if [ -d ${SASLLIB} ]; then
+ # SASL password configuration
+ if [ ! -f ${SASLLIB}/saslpasswd.conf ]; then
+ NEW=1;
+ cp /usr/share/sendmail/examples/sasl/saslpasswd.conf.${SASLSO} \
+ ${SASLLIB}/saslpasswd.conf;
+ fi;
+ chown root:root ${SASLLIB}/saslpasswd.conf;
+ chmod 0640 ${SASLLIB}/saslpasswd.conf;
+
+ # Sendmail SASL configuration
+ if [ -L ${SASLLIB}/Sendmail.conf ]; then
+ ln -sf /etc/mail/sasl/Sendmail.conf.${SASLSO} \
+ ${SASLLIB}/Sendmail.conf;
+ else
+ if [ -f ${SASLLIB}/Sendmail.conf ]; then
+ mv ${SASLLIB}/Sendmail.conf \
+ /etc/mail/sasl/Sendmail.conf.${SASLSO};
+ fi;
+ ln -sf /etc/mail/sasl/Sendmail.conf.${SASLSO} \
+ ${SASLLIB}/Sendmail.conf;
+ fi;
+
+ # Make sure libraries are properly installed...
+ ( cd ${SASLLIB} && \
+ if [ -L libanonymous.so.${SASLSO} ] && [ ! -L libanonymous.so ]; then \
+ ln -s libanonymous.so.${SASLSO} libanonymous.so; \
+ fi; \
+ if [ -L libcrammd5.so.${SASLSO} ] && [ ! -L libcrammd5.so ]; then \
+ ln -s libcrammd5.so.${SASLSO} libcrammd5.so; \
+ fi; \
+ if [ -L libdigestmd5.so.${SASLSO} ] && [ ! -L libdigestmd5.so ]; then \
+ ln -s libdigestmd5.so.${SASLSO} libdigestmd5.so; \
+ fi; \
+ if [ -L libdigestmd5.so.0 ] && [ ! -L libdigestmd5.so ]; then \
+ ln -s libdigestmd5.so.0 libdigestmd5.so; \
+ fi; \
+ if [ -L libgssapiv2.so.${SASLSO} ] && [ ! -L libgssapiv2.so ]; then \
+ ln -s libgssapiv2.so.${SASLSO} libgssapiv2.so; \
+ fi; \
+ if [ -L liblogin.so.${SASLSO} ] && [ ! -L liblogin.so ]; then \
+ ln -s liblogin.so.${SASLSO} liblogin.so; \
+ fi; \
+ if [ -L liblogin.so.0 ] && [ ! -L liblogin.so ]; then \
+ ln -s liblogin.so.0 liblogin.so; \
+ fi; \
+ if [ -L libplain.so.${SASLSO} ] && [ ! -L libplain.so ]; then \
+ ln -s libplain.so.${SASLSO} libplain.so; \
+ fi; )
+ fi;
+
+# Create/update sendmail SASL files
+chown smmta:smmsp /etc/mail/sasl;
+chmod 0755 /etc/mail/sasl;
+if [ ! -f /etc/mail/sasl/Sendmail.conf.${SASLSO} ] \
+&& [ -f /etc/mail/sasl/Sendmail.conf ]; then
+ mv /etc/mail/sasl/Sendmail.conf \
+ /etc/mail/sasl/Sendmail.conf.${SASLSO};
+ fi;
+if [ ! -f /etc/mail/sasl/Sendmail.conf.${SASLSO} ]; then
+ NEW=1;
+ cp /usr/share/sendmail/examples/sasl/Sendmail.conf.${SASLSO} \
+ /etc/mail/sasl/;
+ fi;
+chown smmta:smmsp /etc/mail/sasl/Sendmail.conf.${SASLSO};
+chmod 0640 /etc/mail/sasl/Sendmail.conf.${SASLSO};
+
+#---------------------------------------------------------------------------
+# Make sure prototype /etc/mail/sasl/sasl.m4 exists
+$sm_path/update_authm4 || true;
+
+# Recommend PAM for sendmail authorization
+if [ "${SASLSO}" = "2" ]; then
+ if grep -qEe '^[[:space:]]*auto_transition:[[:space:]]*false' \
+ /etc/mail/sasl/Sendmail.conf.${SASLSO}; then
+ sed -e \
+ 's?^[[:space:]]*auto_transition:.*$?auto_transition: true?' \
+ /etc/mail/sasl/Sendmail.conf.${SASLSO} \
+ > /etc/mail/sasl/Sendmail.conf.new;
+ fi;
+ if [ -f /etc/mail/sasl/Sendmail.conf.new ]; then
+ chown smmta:smmsp /etc/mail/sasl/Sendmail.conf.new;
+ chmod 0644 /etc/mail/sasl/Sendmail.conf.new;
+ mv /etc/mail/sasl/Sendmail.conf.new \
+ /etc/mail/sasl/Sendmail.conf.${SASLSO};
+ fi;
+
+ cat <<-EOT
+
+ Ah, you're setup with SASL${SASLSO} !
+
+ Unfortunately, there is no automagic way to migrate to ${SASLDB} :(
+
+ You'll want to make sure /etc/default/saslauthd is setup to start,
+ and has at least MECHANISMS="pam" !
+
+ If you find out what more is needed, please let me know!
+ EOT
+else
+ if ! grep -qEe "^[[:space:]]*pwcheck_method:[[:space:]]*PAM" \
+ ${SASLLIB}/Sendmail.conf; then
+ cat <<-EOT
+
+ It is *strongly* recommended that you use PAM as the authentication
+ method for sendmail via ${SASL}. Doing so will allow *all* your shell
+ users (those with an /etc/passwd entry) to automagically authenticate
+ themselves when using a MUA with ${SASL} support turned on.
+
+ Do you wish to use PAM (Y|n)?
+ EOT
+ read yn;
+ yn=$(echo -n "$yn" | sed -e "s/^\ *//" -e "s/^\t*//");
+ test -n "$yn" || yn="Y";
+ case "$yn" in
+ [Yy]*)
+ if grep -qEe '^[[:space:]]*pwcheck_method:' \
+ /etc/mail/sasl/Sendmail.conf.${SASLSO}; then
+ sed -e \
+ 's?^[[:space:]]*pwcheck_method:.*$?pwcheck_method: PAM?' \
+ /etc/mail/sasl/Sendmail.conf.${SASLSO} \
+ > /etc/mail/sasl/Sendmail.conf.new;
+ else
+ echo 'pwcheck_method: PAM' \
+ | cat /etc/mail/sasl/Sendmail.conf.${SASLSO} - \
+ > /etc/mail/sasl/Sendmail.conf.new;
+ fi;
+ if [ -f /etc/mail/sasl/Sendmail.conf.new ]; then
+ chown smmta:smmsp /etc/mail/sasl/Sendmail.conf.new;
+ chmod 0640 /etc/mail/sasl/Sendmail.conf.new;
+ mv /etc/mail/sasl/Sendmail.conf.new \
+ /etc/mail/sasl/Sendmail.conf.${SASLSO};
+ fi;
+ ;;
+ esac;
+ fi;
+ fi;
+
+# Make sure default-auth-info is secure
+if [ -f /etc/mail/default-auth-info ]; then
+ chown smmta:smmsp /etc/mail/default-auth-info;
+ chmod 0640 /etc/mail/default-auth-info;
+ fi;
+
+# Create skeleton file, the saslpasswd command will get a failure ;-{
+if [ ! -f ${SASLDB} ]; then
+ NEW=1;
+ if [ -x ${SASLPASSWD} ]; then
+ ${SASLDBLISTUSERS} 1>/dev/null 2>&1 || true;
+ echo "$SMPWD" | ${SASLPASSWD} -p -c -u $SMRLM $SMAID \
+ 1>/dev/null 2>&1 || true;
+ chown root:sasl ${SASLDB};
+ chmod 0660 ${SASLDB};
+ else
+ echo "*** You do not have the ${SASL_BIN} package installed!";
+ echo "*** Please install it and rerun $0";
+ echo "*** Sendmail can't use ${SASL} until this is done...";
+ fi;
+ fi;
+
+# Set SMTP auth password
+if [ -x ${SASLPASSWD} ]; then
+ if [ $DEFAULT = 0 ]; then
+ echo "$SMPWD" | ${SASLPASSWD} -p -c -u $SMRLM $SMAID || true;
+ else
+ ${SASLPASSWD} -d -u $SMRLM $SMAID 1>/dev/null 2>&1 || true;
+ fi;
+ fi;
+
+# For sendmail, /etc/sasldb must be 0600 or (0640/0660 w/dontblamesendmail)
+if [ -f ${SASLDB} ]; then
+ find ${SASLDB} -gid 0 -print | xargs -r chown root:sasl;
+ find ${SASLDB} -gid 8 -print | xargs -r chown root:sasl;
+ find ${SASLDB} -group smmsp -print | xargs -r chown root:sasl;
+ chmod g-x,o-rwx ${SASLDB};
+ fi;
+
+# Tell them about the new wizbang features...
+if [ $NEW -eq 1 ]; then
+ cat <<-EOT
+
+ To enable sendmail to use SASLS, you need to:
+ 1) Add this line to /etc/mail/sendmail.mc and optionally
+ to /etc/mail/submit.mc:
+ include(\`/etc/mail/sasl/sasl.m4')dnl
+ 2) Run sendmailconfig
+ 3) Restart sendmail
+
+ ${SASL} is now minimally setup, there are a few ways to handle users:
+ *) Allow only shell users (default)
+ You're all set, nothing else to do !
+ *) Allow users other than shell
+ Add users via ${SASLPASSWD} and make sure that the
+ realm you used matches what your users specify in their
+ netscape/outlook/mutt/etc profiles.
+
+ If you need to authorize sendmail as a sender, also update
+ /etc/mail/default-auth-info and rerun $0.
+
+ EOT
+ fi;
diff --git a/debian/local/update_authm4 b/debian/local/update_authm4
new file mode 100644
index 0000000..58c20b3
--- /dev/null
+++ b/debian/local/update_authm4
@@ -0,0 +1,257 @@
+#!/usr/bin/perl -w
+#------------------------------------------------------------------------
+#
+# $Sendmail: update_auth,v 8.14.3 2008-05-04 22:26:20 cowboy Exp $
+#
+# Create /etc/mail/sasl/sasl.m4 for Debian Sendmail
+#
+# Copyright 1998-2008 Richard Nelson. All Rights Reserved.
+#
+# Notes (to all):
+# *
+#
+# Notes (to self):
+# *
+#
+#------------------------------------------------------------------------
+#
+# Initialization of the perl environment
+use strict; # be kosher
+use Cwd; # provide cwd()
+use Env; # A few environmental references
+use integer; # Peformance
+use Sys::Hostname; # make sure we have a valid hostname
+use Getopt::Long; # parameter handling
+
+# Local libraries - for Debian Sendmail Perl helper functions
+# BEGIN { $main::my_path = substr($0,$[,rindex($0,'/')) };
+use lib ('.', substr($0,$[,rindex($0,'/')), "/usr/share/sendmail");
+require Parse_mc;
+
+# Version of this program
+#($main::MYNAME = $main::0) =~ s|.*/||;
+#$main::Author = "Richard Nelson";
+#$main::AuthorMail = "cowboy\@debian.org";
+#$main::Version = '$Revision: 2.00 $ ';
+$main::program_name = $0;
+$main::program_version = '8.14.3';
+$main::program_date = '2008-05-04 22:26:20 cowboy';
+$main::debug = 0;
+
+my $interp_pgm = "$^X";
+my $interp_vrm = $];
+$interp_vrm = ("$^V" | '000') if (defined $^V);
+my $current_time = scalar localtime;
+my $user = getlogin || (getpwuid($<))[0] || "Unknown!!";
+my $hostname = hostname();
+my $directory = getcwd();
+
+my $SASL_def = "/etc/mail/sasl/sasl.m4";
+
+# Hash of define names to filename
+my %Def_Map;
+
+#
+#------------------------------------------------------------------------------
+# Finally, some code (almost)
+#------------------------------------------------------------------------------
+#
+# Argument handling...
+$main::opt_help='';
+$main::opt_output_file='';
+$main::opt_input_file='';
+$main::opt_debug='';
+my @options = qw(
+ help|h
+ output-file|output_file|o:s
+ input-file|input_file|i:s
+ debug!
+ );
+my $result = GetOptions(@options);
+if ( ! $result ) {
+ die "Terminating due to parameter error";
+ };
+if ( $main::opt_help ) {
+ warn "$main::program_name $main::program_version $main::program_date\n";
+ warn "$0 \n";
+ warn " -help\n" if $main::opt_help;
+ warn " -debug\n" if $main::opt_debug;
+ warn " -o $main::opt_output_file\n" if $main::opt_output_file;
+ warn " -i $main::opt_input_file\n" if $main::opt_input_file;
+ exit 0;
+ };
+
+my $SASL = $main::opt_output_file || $SASL_def;
+${Parse_mc::database_file} = $main::opt_input_file
+ if $main::opt_input_file;
+# $main::debug is used in Parse_mc !
+$main::debug = $main::opt_debug || $main::debug;
+
+# Let them know wtf is going on...
+print STDOUT "Creating ${SASL}...\n";
+
+# Read the mc/m4 files
+&Parse_mc::read_dbs($Parse_mc::database_file, '');
+
+# Obtain SASL information from database
+&get_data;
+
+# Write out the textual representation
+&write_sasl;
+
+
+#
+#------------------------------------------------------------------------------
+# Obtain information from database
+#------------------------------------------------------------------------------
+sub get_data {
+ my @names = (
+ 'confTO_AUTH'
+ ,'TRUST_AUTH_MECH'
+ ,'confAUTH_MECHANISMS'
+ ,'confAUTH_REALM'
+ );
+
+ foreach my $entry (@names) {
+ my ($class, $flags, $files, $options) =
+ &Parse_mc::entry_dbs($entry);
+ my $file = join(' ',@{$files});
+ $Def_Map{$entry} = '';
+ $Def_Map{$entry} = $file if ($file ne '-');
+ #$Def_Map{$entry} = &Parse_mc::format_dbs($entry);
+ };
+ };
+
+
+#
+#------------------------------------------------------------------------------
+# Create /etc/mail/sasl/sasl.m4
+#------------------------------------------------------------------------------
+sub write_sasl {
+ my $ofh = new FileHandle;
+
+ $SASL = '&STDOUT' if ($SASL eq '-');
+ unless ( open($ofh, ">$SASL") ) {
+ warn("Could not open $SASL($!), using STDOUT.\n");
+ open($ofh, ">&STDOUT");
+ };
+ $SASL = '-' if ($SASL eq '&STDOUT');
+
+ &write_m4($ofh);
+
+ close $ofh;
+ if ($SASL eq $SASL_def) {
+ chown '0', '0', $SASL;
+ chmod 0744, $SASL;
+ };
+ };
+
+
+#
+#------------------------------------------------------------------------------
+# Write SASL m4 file
+#------------------------------------------------------------------------------
+sub write_m4 {
+ my ($ofh) = @_;
+
+ print $ofh <<"EOT";
+divert(-1)dnl
+####################################################################
+##### This file is automagically generated -- edit at your own risk
+#####
+##### Copyright (c) 2002-2008 Richard Nelson. All Rights Reserved.
+#####
+##### file: ${SASL}
+##### AUTH Configuration for Debian Sendmail
+##### generated via: (${interp_pgm} ${interp_vrm})
+##### ${main::program_name}
+##### version: ${main::program_version} ${main::program_date}
+##### by: ${user}\@${hostname}
+##### on: ${current_time}
+##### in: ${directory}
+##### input files: ${Parse_mc::database_file}
+#####
+##### Usage:
+##### 1) To get *ANY* AUTH support for sendmail you
+##### A) *MUST* Add this line to /etc/mail/sendmail.mc
+##### \`include(\`/etc/mail/sasl/sasl.m4\')dnl\'
+##### B) *MAY* Add the same line to /etc/mail/submit.mc
+##### to get MSP<->MTA authentication/encryption
+##### 2) You may modify the marked portions of this file.
+##### If you need finer control of AUTH options, use the access
+##### database.
+#####
+####################################################################
+divert(0)dnl
+VERSIONID(\`\$Id: sasl.m4,v 8.14.3-1 2008-05-04 22:26:20 cowboy Exp \$\')
+dnl #
+dnl #---------------------------------------------------------------------
+dnl # Bring in Autoconf results
+dnl #---------------------------------------------------------------------
+ifdef(\`sm_version\', \`dnl\',
+\`include(\`/usr/share/sendmail/cf/debian/autoconf.m4\')dnl\')
+dnl #
+dnl #---------------------------------------------------------------------
+dnl # SMTP AUTH (SASL) support (sendmail 8.10.0 +)
+dnl # PLAIN/LOGIN needed to support SASL auth via PAM ;(
+dnl # if this bothers you, you allow them only in conjunction w/STARTTLS !
+dnl #---------------------------------------------------------------------
+ifelse(eval(sm_version_math >= 526848), \`1\', \`dnl
+ifelse(sm_enable_auth, \`yes\', \`dnl
+dnl #
+dnl # ...Do not touch anything above this line...
+dnl #
+dnl # Set a more reasonable timeout on negotiation
+dnl #
+define(\`confTO_AUTH\', \`$Def_Map{'confTO_AUTH'}\')dnl # <= EDIT
+dnl #
+dnl # Define the REALM passed to sasl (8.13.0+)
+ifelse(eval(sm_version_math >= 527616), \`1\', \`dnl
+define(`confAUTH_REALM', \`$Def_Map{'confAUTH_REALM'}\')dnl # <= EDIT
+\')dnl
+dnl #
+dnl # Available Authentication methods
+dnl #
+define(\`confAUTH_MECHANISMS\',dnl
+\`$Def_Map{'confAUTH_MECHANISMS'}\')dnl # <= EDIT
+dnl #
+dnl # These, we will trust for relaying
+dnl #
+TRUST_AUTH_MECH(\`$Def_Map{'TRUST_AUTH_MECH'}\')dnl # <= EDIT
+dnl #
+dnl # ...Do not touch anything below this line...
+dnl #
+dnl #
+dnl # for 8.12.0+, add EXTERNAL as an available & trusted mech (w/STARTTLS)
+dnl # and allow sharing of /etc/sasldb(2) file, allow group read/write
+dnl #
+ifelse(eval(sm_version_math >= 527360), \`1\', \`dnl
+define(\`confAUTH_MECHANISMS\',dnl
+\`EXTERNAL \'defn(\`confAUTH_MECHANISMS\'))dnl
+TRUST_AUTH_MECH(\`EXTERNAL\')
+dnl #
+dnl # To support some SASL use, we need the DB to be group readable
+dnl #
+define(\`confDONT_BLAME_SENDMAIL\',dnl
+defn(\`confDONT_BLAME_SENDMAIL\')\`,GroupReadableSASLDBFile,GroupWritableSASLDBFile\')dnl
+\')dnl
+dnl #
+dnl # To support SMTP AUTH in \`sendmail -bs\' :
+dnl # Sigh: SASLV1 MSP AUTH does not work in -bs mode (/etc/sasldb !o+r)
+dnl # so, we have the MSP not use Auth (or ETRN)
+dnl # SASLV2 (w/saslauth) chose to prohibit user authentication - it can
+dnl # be made to work by:
+dnl # 1) changing /etc/sasldb2 {root,sasl,smmta}:smmsp 0660
+dnl # 2) dpkg-statoverride --remove /var/run/saslauthd
+dnl # 3) dpkg-statoverride --add root sasl 711 /var/run/saslauthd
+dnl #
+ifelse(eval(sm_auth_lib < 2), \`1\', \`dnl
+ifdef(\`DEBIAN_MSP\', \`dnl
+ifelse(defn(\`_DPO_\'), \`\', \`dnl
+DAEMON_OPTIONS(\`Name=NoMTA, Addr=0.0.0.0, M=EA\')dnl
+\')\')\')dnl
+dnl #
+\')\')dnl
+EOT
+ };
+
diff --git a/debian/local/update_conf b/debian/local/update_conf
new file mode 100644
index 0000000..7e36c01
--- /dev/null
+++ b/debian/local/update_conf
@@ -0,0 +1,539 @@
+#!/usr/bin/perl -w
+#------------------------------------------------------------------------
+#
+# $Sendmail: update_conf,v 8.14.3 2008-05-04 22:26:20 cowboy Exp $
+#
+# Parse and update /etc/mail/sendmail.conf and reflect its values in
+# /etc/cron.d/sendmail and /etc/inetd.conf.
+#
+# Copyright (c) 2001-2008 Richard Nelson. All Rights Reserved.
+#
+#------------------------------------------------------------------------
+#
+use strict; # be kosher
+use Cwd; # provide cwd()
+use Env; # A few environmental references
+use integer; # Peformance
+use Sys::Hostname; # make sure we have a valid hostname
+use Getopt::Long; # parameter handling
+use FileHandle; # I/O
+
+# Local libraries - for Debian Sendmail Perl helper functions
+# BEGIN { $main::my_path = substr($0,$[,rindex($0,'/')) };
+use lib ('.', substr($0,$[,rindex($0,'/')), "/usr/share/sendmail");
+require Parse_conf;
+require Parse_mc;
+
+$main::program_name = $0; #'update_conf';
+$main::program_version = '8.14.3';
+$main::program_date = '2008-05-04 22:26:20 cowboy';
+$main::debug = 0;
+
+my $interp_pgm = "$^X";
+my $interp_vrm = $];
+$interp_vrm = ("$^V" | '000') if (defined $^V);
+my $current_time = scalar localtime;
+my $user = getlogin || (getpwuid($<))[0] || "Unknown!!";
+my $hostname = hostname();
+my $directory = getcwd();
+
+my $Conffile = "/etc/mail/sendmail.conf";
+my $output_file = '';
+my $ofh = new FileHandle;
+my $debug = 0;
+
+#
+#------------------------------------------------------------------------------
+# Global variables
+#------------------------------------------------------------------------------
+
+#
+#------------------------------------------------------------------------------
+# Finally, some code (almost)
+#------------------------------------------------------------------------------
+
+#
+# Argument handling...
+$main::opt_help='';
+$main::opt_output_file='';
+$main::opt_input_file='';
+$main::opt_debug='';
+$main::opt_test='';
+my @options = qw(
+ help|h
+ output-file|output_file|o:s
+ input-file|input_file|i:s
+ debug!
+ test!
+ );
+my $result = GetOptions(@options);
+if ( ! $result ) {
+ die "Terminating due to parameter error";
+ };
+if ( $main::opt_help ) {
+ warn "$main::program_name $main::program_version $main::program_date\n";
+ warn "$0 \n";
+ warn " -help\n" if $main::opt_help;
+ warn " -debug\n" if $main::opt_debug;
+ warn " -o $main::opt_output_file\n" if $main::opt_output_file;
+ warn " -i $main::opt_input_file\n" if $main::opt_input_file;
+ exit 0;
+ };
+
+if ( $main::opt_test ) {
+ &sm2cron_time("");
+ &sm2cron_time("6s");
+ &sm2cron_time("5m");
+ &sm2cron_time("4h");
+ &sm2cron_time("3d");
+ &sm2cron_time("2w");
+ &sm2cron_time("5w");
+ &sm2cron_time("2w3d4h5m6s");
+ &sm2cron_time("89s");
+ &sm2cron_time("90m");
+ exit 0;
+ };
+
+$output_file = $main::opt_output_file if ($main::opt_output_file);
+my $input_file = $main::opt_input_file || $Conffile;
+# $main::debug is used in Parse_mc !
+$main::debug = $main::opt_debug || $main::debug;
+
+# Read /etc/mail/sendmail.conf (if extant)
+&Parse_conf::read_config($Conffile);
+
+# [Re]write /etc/mail/sendmail.config
+&Parse_conf::write_config($Conffile);
+
+my ($ok, $value) = &Parse_conf::get_value('HANDS_OFF');
+if ($value ne '0') {
+ unlink "/etc/cron.d/sendmail";
+ exit;
+ };
+
+# Reflect settings in /etc/cron.d/sendmail
+&write_crontab;
+if ( $output_file eq '' ) {
+ chown '0', '0', "/etc/cron.d/sendmail";
+ chmod 0644, "/etc/cron.d/sendmail";
+ };
+
+# Reflect settings in /etc/inetd.conf
+&update_inetd;
+
+# Create/Delete files
+&update_files;
+
+exit (0);
+
+#
+#------------------------------------------------------------------------
+# Check for nullclient mode in /etc/mail/sendmail.mc
+#------------------------------------------------------------------------
+sub check_nullclient {
+ my $nullclient = 0;
+ my $in_file = "/etc/mail/sendmail.mc";
+ if ( -r $in_file ) {
+ my $ifh;
+ unless ( open($ifh, "<$in_file") ) {
+ warn("Could not open $in_file($!), ignoring it.\n");
+ };
+
+ line: while (<$ifh>) {
+ next line if /^$/; # skip empty lines
+ next line if /^#/; # skip comments
+ next line if /^dnl /; # skip comments
+ chomp; # drop tailing \n
+
+ if (/^\s*FEATURE\(\s*`?nullclient/) {
+ $nullclient = 1;
+ last line;
+ };
+ };
+ };
+ return $nullclient;
+ };
+
+#
+#------------------------------------------------------------------------
+# Compute time setting for Crontab entry (simplistic)
+#------------------------------------------------------------------------
+sub sm2cron_time {
+ my $month = 0;
+ my $week = 0;
+ my $day = 0;
+ my $hour = 0;
+ my $minute = 0;
+ my $second = 0;
+ my $tmp = 0;
+ my $t = '';
+ my $cron = '';
+
+ my ($sm) = @_;
+ my $seconds = 0;
+ if ($sm eq '') {
+ if ( $main::opt_test ) {
+ print "$cron = sm2cron_time($sm);\n";
+ };
+ return ($cron, $seconds);
+ };
+
+ # Convert sendmail time
+ # 1w2d3h4m5s
+ # to cron time
+ # m h dom mon dow
+ $t = $sm;
+ ($week = $sm) =~ s/.*?(\d+)w.*/$1/ if ( $t =~ /w/ );
+ ($day = $sm) =~ s/.*?(\d+)d.*/$1/ if ( $t =~ /d/ );
+ ($hour = $sm) =~ s/.*?(\d+)h.*/$1/ if ( $t =~ /h/ );
+ ($minute = $sm) =~ s/.*?(\d+)m.*/$1/ if ( $t =~ /m/ );
+ ($second = $sm) =~ s/.*?(\d+)s.*/$1/ if ( $t =~ /s/ );
+ # Convert weeks to days (roughly)
+ $day = $day + (7 * $week);
+
+ # Cron doesn't do seconds, round to minutes or ignore
+ $seconds = $seconds + $second;
+ $tmp = $second;
+ $second = sprintf("%02d", $second%60);
+ $minute = $minute + sprintf("%02d", ($tmp-$second)/60);
+ $minute = $minute + 1 if ($second >= 30);
+
+ # Minute of hour (0-59)
+ $seconds = $seconds + ($minute * 60);
+ $tmp = $minute;
+ $minute = sprintf("%02d", $minute%60);
+ $hour = $hour + sprintf("%02d", ($tmp-$minute)/60);
+ if (0 < $hour + $day + $week + $month) {
+ $hour = $hour + 1 if ($minute >= 30);
+ $cron = "00 ";
+ }
+ else {
+ $minute = '01' if ($minute == 0);
+ $cron = "*/$minute";
+ };
+
+ # Hour of day (0-23)
+ $seconds = $seconds + ($hour * 60 * 60);
+ $tmp = $hour;
+ $hour = sprintf("%02d", $hour%24);
+ $day = $day + sprintf("%02d", ($tmp-$hour)/24);
+ if (0 < $day + $week + $month) {
+ $day = $hour + 1 if ($minute >= 30);
+ $cron = "$cron 00 ";
+ }
+ elsif ($hour != 0) {
+ $cron = "$cron */$hour";
+ }
+ else {
+ $cron = "$cron * ";
+ };
+
+ # Day of month (1-31)
+ $tmp = $day;
+ $day = sprintf("%02d", $day%32);
+ $month = $month + sprintf("%02d", ($tmp-$day)/32);
+ if (0 < $month) {
+ $month = $month + 1 if ($day >= 15);
+ $cron = "$cron 01 ";
+ }
+ elsif ($day != 0) {
+ $cron = "$cron */$day";
+ }
+ else {
+ $cron = "$cron * ";
+ };
+
+ # Month in year (1-12)
+ $month = sprintf("%02d", $month%12);
+ if (0 < $month) {
+ $cron = "$cron */$month";
+ }
+ else {
+ $cron = "$cron * ";
+ };
+
+ $cron = "$cron *"; # Day of week (0-7)
+
+ if ( $main::opt_test ) {
+ print "$cron = sm2cron_time($sm);\n";
+ };
+ return ($cron, $seconds);
+ };
+
+#
+#------------------------------------------------------------------------
+# Write updated cron file
+#------------------------------------------------------------------------
+sub write_crontab {
+ my $var;
+ my $interval = '';
+ my $cronint = '';
+ my $test = "test -x /etc/init.d/sendmail";
+ my $command = '';
+ my $ok = '';
+ my $mailto = '';
+ my $mmode = '';
+ my $qmode = '';
+ my $msp_line = '';
+ my $mta_line = '';
+ my $age_line = '';
+
+ ($ok, $mailto) = &Parse_conf::get_value('CRON_MAILTO');
+ if ( ! $ok ) {
+ return;
+ };
+
+ my $out_file = $output_file || "/etc/cron.d/sendmail";
+ print STDOUT "Writing $out_file.\n";
+ $out_file = '&STDOUT' if ($out_file eq '-');
+ unless ( open($ofh, ">$out_file") ) {
+ warn("Could not open $out_file($!), using STDOUT\n");
+ open($ofh, ">&STDOUT");
+ };
+ $out_file = '-' if ($out_file eq '&STDOUT');
+
+ print $ofh <<"EOT";
+####################################################################
+##### This file is automagically generated -- edit at your own risk
+#####
+##### file: ${out_file}
+##### generated via: (${interp_pgm} ${interp_vrm})
+##### ${main::program_name}
+##### version: ${main::program_version} ${main::program_date}
+##### by: ${user}\@${hostname}
+##### on: ${current_time}
+##### in: ${directory}
+##### input files:
+EOT
+ foreach my $file ( split(' ', $input_file) ) {
+ print $ofh <<"EOT";
+##### ${file}
+EOT
+ };
+ print $ofh <<"EOT";
+#####
+####################################################################
+#------------------------------------------------------------------------------
+#
+# $out_file
+#
+# Copyright (c) 2001-2008 Richard Nelson. All Rights Reserved.
+# Version: ${main::program_version}
+# Time-stamp: <${main::program_date}>
+#
+# Sendmail crontab - Call sendmail at various times to do the following:
+# 1) Age queues - move undelivered mail to a slower queue
+# 2) Retry any mail queued by the message submission process
+# 3) run the queues (deliver mail) if a standalone daemon is not desired
+#
+# Each processes is independant and guided by /etc/mail/sendmail.conf and
+# {sendmail,submit}.mc files.
+#
+# There isn't anything here that should need touching.
+#
+# Any requisite queue/misc parameters must be set in /etc/mail/sendmail.conf
+# and reflected herein via /usr/sbin/sendmailconfig (or more directly via
+# ${main::program_name}).
+#
+#------------------------------------------------------------------------------
+#
+# use default path, shell, home
+#SHELL=/bin/sh
+#PATH=
+#HOME=
+# send mail to this user, as `mail/smmsp` isn't real.
+MAILTO=$mailto
+#
+# format of entries:
+# m h dom mon dow user command
+#
+#------------------------------------------------------------------------------
+# Every so often, give sendmail a chance to run the MSP queues.
+#
+EOT
+ ($ok, $interval) = &Parse_conf::get_value('MSP_INTERVAL');
+ ($cronint, $ok) = &sm2cron_time($interval);
+ $command = "$test && /usr/share/sendmail/sendmail cron-msp";
+ ($ok, $mmode) = &Parse_conf::get_value('MSP_MODE');
+ ($ok, $qmode) = &Parse_conf::get_value('QUEUE_MODE');
+ if ($mmode eq 'Cron'
+ and ($interval ne '')
+ #or ($mmode eq 'None' and $qmode eq 'Cron')
+ ) {
+ $msp_line =
+ "$cronint\t\tsmmsp\t$command";
+ }
+ else {
+ $msp_line =
+ "#$cronint\t\tsmmsp\t$command";
+ };
+ print $ofh "$msp_line\n";
+
+ print $ofh <<"EOT";
+#
+#------------------------------------------------------------------------------
+# Every so often, give sendmail a chance to run the MTA queues.
+# Will also run MSP queues if enabled
+#
+EOT
+ ($ok, $interval) = &Parse_conf::get_value('QUEUE_INTERVAL');
+ ($cronint, $ok) = &sm2cron_time($interval);
+ $command = "$test && /usr/share/sendmail/sendmail cron-mta";
+ if ($qmode eq 'Cron'
+ and ($interval ne '')
+ ) {
+ $mta_line =
+ "$cronint\t\troot\t$command";
+ }
+ else {
+ $mta_line =
+ "#$cronint\t\troot\t$command";
+ };
+ print $ofh "$mta_line\n";
+
+ print $ofh <<"EOT";
+#
+#------------------------------------------------------------------------------
+# Every so often, give sendmail a chance to age the queues.
+#
+EOT
+ ($ok, $var) = &Parse_conf::get_value('AGE_DATA');
+ my $tmpval = eval $var;
+ if ($@) {
+ warn $@;
+ }
+ else {
+ $var = $tmpval;
+ };
+ if (not ref $var) {
+ print $ofh "# No queue aging\n";
+ }
+ elsif (@{$var} == 0) {
+ print $ofh "# No queue aging\n";
+ }
+ else {
+ foreach my $entry (@{$var}) {
+ ($interval, $ok) = &sm2cron_time(@$entry[0]);
+ my $criteria = @$entry[1] || join('','-s ',$ok);
+ my $to = @$entry[2];
+ my $from = @$entry[3];
+ $command = "$test && /usr/share/sendmail/qtool.pl";
+ $from = "/var/spool/mqueue/$from"
+ if ($from !~ /^\//);
+ $to = "/var/spool/mqueue/$to"
+ if ($to !~ /^\//);
+ $age_line =
+ "$interval\t\troot\t$command $criteria $to $from";
+ print $ofh "$age_line >/dev/null\n";
+ };
+ };
+ print $ofh <<"EOT";
+#
+EOT
+
+ close($ofh);
+ };
+
+#
+#------------------------------------------------------------------------
+# Update /etc/inetd.conf file
+#------------------------------------------------------------------------
+sub update_inetd {
+
+ # Don't try to write if we're debugging
+ if ($output_file ne '') {
+ return;
+ };
+
+ my ($ok, $mode) = &Parse_conf::get_value('DAEMON_MODE');
+ if ( $ok and -x '/usr/sbin/update-inetd' ) {
+ if ( $mode eq 'Inetd' ) {
+ system 'update-inetd --group MAIL --enable smtp,smtps,submission'
+ }
+ else {
+ system 'update-inetd --group MAIL --disable smtp,smtps,submission'
+ };
+ };
+
+ };
+
+#
+#------------------------------------------------------------------------
+# Update mail statistics information (create/delete files)
+#------------------------------------------------------------------------
+sub update_files {
+
+ # Don't try to write if we're debugging
+ if ($output_file ne '') {
+ return;
+ };
+
+ my ($class, $flags, $files, $options);
+ my ($ok, $stats);
+ my $file;
+
+ #
+ # Read the mc/m4 files
+ &Parse_mc::read_dbs('', '');
+
+ # Obtain entry for HOST_STATUS_DIRECTORY
+ ($class, $flags, $files, $options) =
+ &Parse_mc::entry_dbs('confHOST_STATUS_DIRECTORY');
+ $file = @{$files}[0];
+ ($ok, $stats) = &Parse_conf::get_value('DAEMON_HOSTSTATS');
+ if ( $ok and $file ne '-' ) {
+ if ( $stats and ! -d $file) {
+ print STDOUT "Enabling HOST statistics file($file).\n";
+ system "mkdir ${file}";
+ my $gid = getgrnam('smmsp');
+ chown '0', $gid, $file;
+ chmod 02755, $file;
+ }
+ elsif ( ! $stats and -d $file ) {
+ print STDOUT "Disabling HOST statistics file($file).\n";
+ system "rm -rf ${file}";
+ };
+ };
+
+ # Obtain entry for STATUS_FILE
+ ($class, $flags, $files, $options) =
+ &Parse_mc::entry_dbs('STATUS_FILE');
+ $file = @{$files}[0];
+ ($ok, $stats) = &Parse_conf::get_value('DAEMON_MAILSTATS');
+ if ( $ok and $file ne '-' ) {
+ if ( $stats and ! -e $file) {
+ print STDOUT "Enabling MTA statistics file($file).\n";
+ open 'STATS', ">$file";
+ close 'STATS';
+ my $gid = getgrnam('smmsp');
+ chown '0', $gid, $file;
+ chmod 0640, $file;
+ }
+ elsif ( ! $stats and -e $file ) {
+ print STDOUT "Disabling MTA statistics file($file).\n";
+ unlink $file;
+ };
+ };
+
+ # Obtain entry for MSP_STATUS_FILE
+ ($class, $flags, $files, $options) =
+ &Parse_mc::entry_dbs('MSP_STATUS_FILE');
+ $file = @{$files}[0];
+ ($ok, $stats) = &Parse_conf::get_value('MSP_MAILSTATS');
+ if ( $ok and $file ne '-') {
+ if ( $stats and ! -e $file ) {
+ print STDOUT "Enabling MSP statistics file($file).\n";
+ open 'STATS', ">$file";
+ close 'STATS';
+ my $gid = getgrnam('smmsp');
+ chown '0', $gid, $file;
+ chmod 0660, $file;
+ }
+ elsif ( ! $stats and -e $file ) {
+ print STDOUT "Disabling MSP statistics file($file).\n";
+ unlink $file;
+ };
+ };
+
+ };
+
diff --git a/debian/local/update_db b/debian/local/update_db
new file mode 100644
index 0000000..e417d93
--- /dev/null
+++ b/debian/local/update_db
@@ -0,0 +1,636 @@
+#!/bin/sh -e
+#-----------------------------------------------------------------------------
+#
+# $Sendmail: update_db,v 8.14.3 2008-05-04 22:26:20 cowboy Exp $
+#
+# Update Sendmail databases for Debian
+#
+# Copyright (c) 1998-2008 Richard Nelson. All Rights Reserved.
+#
+# Notes (to all):
+# * assumes makemap dbtype /etc/mail/database < /etc/mail/database
+#
+# Notes (to self):
+# * changes made herein *must* be reflected in
+# parse_mc,update_mk,update_db,debian.m4
+# * multiple db options not supported
+# * userdb can also have multiple databases and then a forward!
+# * need sendmail stop/start
+#
+#-----------------------------------------------------------------------------
+set -e;
+
+# List of db files/features/etc
+db_files="databases Makefile crontab QUEUE_GROUP sendmail.cf submit.cf \
+ confCR_FILE confCT_FILE confCW_FILE confUSERDB_SPEC \
+ access_db authinfo bitdomain domaintable \
+ genericstable mailertable uucpdomain \
+ use_cw_file use_ct_file virtusertable ALIAS_FILE";
+
+# 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
+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 ensure only one newaliases command is run
+newaliases_run=0;
+
+# flag used to indicate a dataset has been moved, may need another update
+changed=0;
+
+# max return code
+max_rc=0;
+missing_rqd=0;
+missing_opt=0;
+missing_cre=0;
+m4_errors=0;
+
+#-------------------------------------------------------------
+# Initial update of sendmail.mc/databases
+#-------------------------------------------------------------
+initial () {
+ if [ $verbosity -gt 1 ]; then
+ echo "initial()";
+ fi;
+ # Sigh... I wish this was in Perl...
+ $sm_path/parse_mc || true;
+ };
+
+#-------------------------------------------------------------
+# Handle found databases
+#-------------------------------------------------------------
+is_found () {
+ if [ $verbosity -gt 1 ]; then
+ echo "is_found: $dbfeat - $dbname";
+ fi;
+ process=1;
+
+ case "$dbfeat" in
+ ALIAS_FILE)
+ if [ -f /etc/mail/aliases ] & [ ! -f /etc/aliases ]; then
+ echo "Moving /etc/mail/aliases to /etc/aliases";
+ mv /etc/mail/aliases /etc/aliases;
+ ln -sf ../aliases /etc/mail/aliases;
+ fi;
+ ;;
+ submit.cf)
+ if [ ! -f /usr/share/sendmail/cf/feature/msp.m4 ]; then
+ rm -f /etc/mail/submit.cf 2>/dev/null;
+ rm -f /etc/mail/submit.cf.errors 2>/dev/null;
+ process=0;
+ fi;
+ ;;
+ *)
+ ;;
+ esac;
+ };
+
+#-------------------------------------------------------------
+# Handle missing databases:
+# moving /etc/xxx to /etc/mail/xxx
+# rename /etc/mail/xxx to /etc/mail/yyy
+#-------------------------------------------------------------
+move_file () {
+ if [ -f $1 ]; then
+ if [ ! -L $1 ]; then
+ echo "Moving $1 to $dbname.";
+ mv $1 $dbname;
+ chown root:smmsp $dbname;
+ chmod 0644 $dbname;
+ if [ -f $1.db ]; then
+ mv -f /etc/$1.db $dbname.db;
+ fi;
+ if [ -f $1.pag ]; then
+ mv -f /etc/$1.pag $dbname.pag;
+ fi;
+ if [ -f $1.dir ]; then
+ mv -f /etc/$1.dir $dbname.dir;
+ fi;
+ changed=1;
+ process=1;
+ else
+ echo "$1 is a link, move it to $dbname";
+ if [ "$dbopts" = "-o" ]; then
+ missing_opt=`expr $missing_opt + 1`;
+ else
+ missing_rqd=`expr $missing_rqd + 1`;
+ fi;
+ fi;
+ true;
+ else
+ false;
+ fi;
+ };
+
+rename_file () {
+ if [ -f /etc/mail/$1 ]; then
+ echo "Renaming /etc/mail/$1 to $dbname.";
+ mv /etc/mail/$1 $dbname;
+ chown root:smmsp $dbname;
+ chmod 0644 $dbname;
+ changed=1;
+ process=1;
+ true;
+ else
+ false;
+ fi;
+ };
+
+is_not_found () {
+ if [ $verbosity -gt 1 ]; then
+ echo "is_not_found: $dbfeat - $dbname";
+ fi;
+
+ case "$dbfeat" in
+ databases|Makefile)
+ :;
+ ;;
+ use_cw_file|confCW_FILE)
+ if move_file /etc/local-host-names; then
+ :;
+ elif rename_file sendmail.cw; then
+ :;
+ elif move_file /etc/sendmail.cw; then
+ :;
+ else
+ missing_cre=`expr $missing_cre + 1`;
+ echo "Warning: $dbfeat source" \
+ "file not found: $dbname";
+ echo " it was created";
+ echo "localhost" > $dbname;
+ echo `hostname -f` >> $dbname;
+ chown root:smmsp $dbname;
+ chmod 0644 $dbname;
+ fi;
+ ;;
+ use_ct_file|confCT_FILE)
+ if move_file /etc/trusted-users; then
+ :;
+ elif rename_file sendmail.ct; then
+ :;
+ elif move_file /etc/sendmail.ct; then
+ :;
+ else
+ missing_cre=`expr $missing_cre + 1`;
+ echo "Warning: $dbfeat source" \
+ "file not found: $dbname";
+ echo " it was created";
+ touch $dbname;
+ chown root:smmsp $dbname;
+ chmod 0644 $dbname;
+ fi;
+ ;;
+ HELP_FILE)
+ if move_file /etc/sendmail.hf; then
+ :;
+ elif rename_file sendmail.hf; then
+ :;
+ else
+ echo "Error: $dbfeat source file not found: $dbname";
+ missing_rqd=`expr $missing_rqd + 1`;
+ process=0;
+ fi;
+ ;;
+ ALIAS_FILE)
+ if [ -e /etc/$dbsname ]; then
+ echo "Linking /etc/$dbsname to $dbname";
+ ln -sf ../$dbsname $dbname;
+ if [ -f /etc/$dbsname.db ]; then
+ mv /etc/$dbsname.db /etc/mail;
+ fi;
+ if [ -f /etc/$dbsname.pag ]; then
+ mv /etc/$dbsname.pag /etc/mail;
+ fi;
+ if [ -f /etc/$dbsname.dir ]; then
+ mv /etc/$dbsname.dir /etc/mail;
+ fi;
+ elif [ "$dbopts" = "-o" ]; then
+ echo "Informational: $dbfeat source" \
+ "file not found: $dbname";
+ missing_opt=`expr $missing_opt + 1`;
+ process=0;
+ else
+ echo "Error: $dbfeat source file not found: $dbname";
+ missing_rqd=`expr $missing_rqd + 1`;
+ process=0;
+ fi;
+ ;;
+ *.cf)
+ mcfile=$(echo "$dbsname" | sed -e 's/\..*//')
+ if move_file /etc/$dbsname; then
+ if [ -f /etc/${mcfile}.cf ]; then
+ mv -f /etc/${mcfile}.cf /etc/mail/;
+ fi;
+ elif [ "$mcfile" = "sendmail" ]; then
+ cp /usr/share/sendmail/cf/debian/sendmail.mc \
+ $dbname;
+ chown root:smmsp $dbname;
+ chmod 0644 $dbname;
+ elif [ "$mcfile" = "submit" ]; then
+ cp /usr/share/sendmail/cf/debian/submit.mc \
+ $dbname;
+ chown root:smmsp $dbname;
+ chmod 0644 $dbname;
+ elif [ "$dbopts" = "-o" ]; then
+ echo "Informational: $dbfeat source" \
+ "file not found: $dbname";
+ missing_opt=`expr $missing_opt + 1`;
+ process=0;
+ else
+ echo "Error: $dbfeat source file not found: $dbname";
+ missing_rqd=`expr $missing_rqd + 1`;
+ process=0;
+ fi;
+ ;;
+ QUEUE_GROUP)
+ echo "Warning: $dbfeat source" \
+ "file not found: $dbname";
+ echo " it was created";
+ mkdir -p $dbname;
+ chown root:smmsp $dbname;
+ chmod 02750 $dbname;
+ ;;
+ crontab)
+ if [ -x $sm_path/update_conf ]; then
+ $sm_path/update_conf;
+ fi;
+ ;;
+ access_db)
+ missing_cre=`expr $missing_cre + 1`;
+ echo "Warning: $dbfeat source" \
+ "file not found: $dbname";
+ echo " it was created";
+ cp /usr/share/sendmail/examples/db/access \
+ /etc/mail/;
+ chown root:root $dbname;
+ chmod 0644 $dbname;
+ ;;
+ *)
+ if move_file /etc/$dbsname; then
+ :;
+ elif [ "$dbopts" = "-o" ]; then
+ :;
+ else
+ missing_cre=`expr $missing_cre + 1`;
+ echo "Warning: $dbfeat source" \
+ "file not found: $dbname";
+ echo " it was created";
+ touch $dbname;
+ chown root:smmsp $dbname;
+ chmod 0644 $dbname;
+ fi;
+ ;;
+ esac;
+ };
+
+#-------------------------------------------------------------
+# Handle empty databases
+#-------------------------------------------------------------
+is_empty () {
+ if [ $verbosity -gt 1 ]; then
+ echo "is_empty: $dbfeat - $dbname";
+ fi;
+ if [ $process -eq 1 ]; then
+ if [ "$dbtype" != "-" ]; then
+ rm -f $dbname.db;
+ rm -f $dbname.pag;
+ rm -f $dbname.dir;
+ fi;
+ case "$dbfeat" in
+ databases|Makefile)
+ :;
+ ;;
+ access_db)
+ cp /usr/share/sendmail/examples/db/access \
+ /etc/mail/;
+ chown root:root $dbname;
+ chmod 0644 $dbname;
+ ;;
+ *)
+ echo "Informational: $dbfeat file empty: $dbname";
+ if [ "$dbopts" = "-o" ]; then
+ process=0;
+ fi;
+ ;;
+ esac;
+ fi;
+ };
+
+#-------------------------------------------------------------
+# Handle no data (exists, but is only comments) databases
+#-------------------------------------------------------------
+is_comments () {
+ if [ $verbosity -gt 1 ]; then
+ echo "is_comments: $dbfeat - $dbname";
+ fi;
+ if [ $process -eq 1 ] && [ -s "$dbname" ]; then
+ if [ "$dbtype" != "-" ]; then
+ rm -f $dbname.db;
+ rm -f $dbname.pag;
+ rm -f $dbname.dir;
+ fi;
+ case "$dbfeat" in
+ databases|Makefile)
+ :;
+ ;;
+ *)
+ echo "Informational: $dbfeat no data: $dbname";
+ if [ "$dbopts" = "-o" ]; then
+ process=0;
+ fi;
+ ;;
+ esac;
+ fi;
+ };
+
+#-------------------------------------------------------------
+# Handle normal databases (exists, has data)
+#-------------------------------------------------------------
+is_normal () {
+ if [ $verbosity -gt 1 ]; then
+ echo "is_normal: $dbfeat - $dbname";
+ fi;
+
+ # Make sure sensitive databases are *not* generally readable
+ if [ "$dbsname" = "authinfo" ] \
+ || [ "$dbsname" = "access" ]; then
+ chmod go-rwx $dbname;
+ fi;
+
+ if [ $process -eq 1 ] && [ $max_rc -eq 0 ]; then
+ case "$dbtype" in
+ '-'|text|ldap)
+ :;
+ ;;
+ parse_mc)
+ $sm_path/parse_mc || true;
+ ;;
+ update_conf)
+ $sm_path/update_conf || true;
+ ;;
+ update_mk)
+ $sm_path/update_mk || true;
+ ;;
+ btree)
+ echo "Updating $dbname...";
+ /usr/sbin/makemap -d $dbtype $dbname.new.db < $dbname;
+ chown root:smmsp $dbname.new.db;
+ chmod 0644 $dbname.new.db;
+ mv -f $dbname.new.db $dbname.db;
+ ;;
+ dbm | btree | hash)
+ echo "Updating $dbname...";
+ /usr/sbin/makemap $dbtype $dbname.new.db < $dbname;
+ if [ "$dbsname" = "authinfo" ] \
+ || [ "$dbsname" = "access" ]; then
+ chown smmta:smmsp $dbname.new.db;
+ chmod 0640 $dbname.new.db;
+ else
+ chown root:smmsp $dbname.new.db;
+ chmod 0640 $dbname.new.db;
+ fi;
+ mv -f $dbname.new.db $dbname.db;
+ ;;
+ newaliases)
+ echo "Updating $dbname...";
+ if [ $newaliases_run -eq 0 ]; then
+ newaliases_run=1;
+ /usr/lib/sm.bin/newaliases || true;
+ fi;
+ if [ -f $dbname.db ]; then
+ chown smmta:smmsp $dbname.db;
+ chmod 0640 $dbname.db;
+ fi;
+ ;;
+ m4)
+ mcfile=$(echo "$dbsname" | sed -e 's/\..*//');
+ echo "Creating /etc/mail/${mcfile}.cf...";
+ rm -f /etc/mail/${mcfile}.cf.errors;
+ m4 /etc/mail/${mcfile}.mc \
+ > /etc/mail/${mcfile}.cf.new \
+ 2> /etc/mail/${mcfile}.cf.errors || true;
+ echo "### /etc/mail/${mcfile}.mc ###" \
+ >> /etc/mail/${mcfile}.cf.new;
+ sed -e 's/^/# /' /etc/mail/${mcfile}.mc \
+ >> /etc/mail/${mcfile}.cf.new;
+ chown root:smmsp /etc/mail/${mcfile}.cf.new;
+ chmod 0644 /etc/mail/${mcfile}.cf.new;
+ if [ ! -s /etc/mail/${mcfile}.cf.errors ]; then
+ rm -f /etc/mail/${mcfile}.cf.errors;
+ else
+ chown root:smmsp /etc/mail/${mcfile}.cf.errors;
+ cat /etc/mail/${mcfile}.cf.errors;
+ echo " ";
+ m4_errors=1;
+ fi;
+ # Can't tell if the errors are fatal or not ;-{
+ mv -f /etc/mail/${mcfile}.cf.new \
+ /etc/mail/${mcfile}.cf;
+ ;;
+ *)
+ echo "$dbtype map not done herein";
+ ;;
+ esac;
+ fi;
+ };
+
+#-------------------------------------------------------------
+# Handle completion
+#-------------------------------------------------------------
+final () {
+ if [ $verbosity -gt 1 ]; then
+ echo "final()";
+ fi;
+ };
+
+
+# status report if not for single database
+if [ -z "$1" ]; then
+ echo "Checking {sendmail,submit}.mc and related databases...";
+else
+ db_files="$1";
+ fi;
+
+initial;
+
+for file in $db_files; do \
+ line=$(grep -Ee "^[[:space:]]*$file" \
+ /etc/mail/databases || true);
+ while ([ "$line" != "" ]); do
+ str=$(echo "$line" | cut -d "
+" -f 1);
+ line=$(echo "$line" | cut -d "
+" -f 2-);
+
+ # Strip line back into four pieces: feature, type, opts, name
+ dbfeat=$(echo "$str" | cut -d ":" -f 1);
+ dbtype=$(echo "$str" | cut -d ":" -f 2);
+ dbopts=$(echo "$str" | cut -d ":" -f 3);
+ dbname=$(echo "$str" | cut -d ":" -f 4);
+ dbregx=$(echo "$str" | cut -d ":" -f 5);
+ if [ $(dirname "$dbname") = "/etc/mail" ]; then
+ dbsname=$(basename "$dbname");
+ elif [ $(dirname "$dbname") = "/etc" ]; then
+ dbsname=$(basename "$dbname");
+ else
+ dbsname="$dbname";
+ fi;
+ if [ "$dbopts" = "-" ]; then
+ dbopts="";
+ fi;
+ if [ "$dbregx" = "-" ]; then
+ dbregx="";
+ fi;
+
+ # Check to see if we're doing one, or all
+ if [ ! -z "$1" ]; then
+ if [ "$1" = "$dbfeat" ] \
+ || [ "$1" = "$dbname" ] \
+ || [ "$1" = "$dbsname" ]; then
+ :;
+ else
+ continue;
+ fi;
+ fi;
+
+ # Check for special database types
+ case "$dbtype" in
+ ldap)
+ if [ $verbosity -gt 0 ]; then
+ echo "Skipping $dbname...";
+ fi;
+ continue
+ ;;
+ dbm | btree | hash)
+ if [ ! -x /usr/lib/sm.bin/makemap ]; then
+ echo "Delaying $dbname...";
+ continue;
+ fi;
+ ;;
+ newaliases)
+ if [ ! -x /usr/lib/sm.bin/newaliases ]; then
+ echo "Delaying $dbname...";
+ continue;
+ fi;
+ ;;
+ *)
+ ;;
+ esac;
+
+ # Kluge for aliases...
+ if [ "$dbname" = "ldap" ]; then
+ continue;
+ fi;
+
+ process=1;
+ if [ $verbosity -gt 0 ]; then
+ echo "Processing $dbname...";
+ fi;
+
+ # Check for database existance
+ if [ -f "$dbname" ] || [ -d "$dbname" ]; then
+ is_found;
+ else
+ is_not_found;
+ fi;
+
+ # Skip the rest for directories
+ if [ ! -d "$dbname" ]; then
+
+ # Check for something in database
+ if [ ! -s "$dbname" ]; then
+ is_empty;
+ fi;
+
+ # Check for real data (not just comments)
+ if [ $process -eq 1 ]; then
+ if ! grep -qEe "^[[:space:]]*[^$\#]" $dbname; then
+ is_comments;
+ fi;
+ fi;
+
+ # Finally, assume a normal file...
+ is_normal;
+ fi;
+
+ done;
+ done;
+
+final;
+
+# Final notices...
+if [ $changed -ne 0 ]; then
+ echo " ";
+ echo "Informational: Some changes were made to file locations";
+ echo " Make sure sendmail.cf is rebuilt";
+ if [ $max_rc -lt 1 ]; then
+ max_rc=1;
+ fi;
+ fi;
+if [ $missing_opt -ne 0 ]; then
+ echo " ";
+ echo "Informational: $missing_opt optional database(s) sources";
+ echo " were not found, please investigate.";
+ fi;
+if [ $missing_cre -ne 0 ]; then
+ echo " ";
+ echo "Warning: $missing_cre database(s) sources";
+ echo " were not found, (but were created)";
+ echo " please investigate.";
+ fi;
+if [ $missing_rqd -ne 0 ]; then
+ echo " ";
+ echo "Error: $missing_rqd required database(s) sources";
+ echo " were not found, correct this before starting sendmail!";
+ if [ $max_rc -lt 2 ]; then
+ max_rc=2;
+ fi;
+ fi;
+if [ $missing_opt -ne 0 ] || [ $missing_rqd -ne 0 ]; then
+ echo " ";
+ echo "$0 assumes that databases, and their source datasets";
+ echo "have the same base name (not counting the .db). If this is not";
+ echo "true, $0 can not rebuild your databases to make sure";
+ echo "they will work with the newer sendmail. You will have to do this";
+ echo "yourself - before starting sendmail.";
+ echo " ";
+ fi;
+if [ $m4_errors -ne 0 ]; then
+ echo " ";
+ echo "Warning: These messages were issued while creating sendmail.cf";
+ echo " make sure they are benign before starting sendmail!";
+ echo " ";
+ if [ -f /etc/mail/sendmail.cf.errors ]; then
+ echo "Errors in generating sendmail.cf";
+ cat /etc/mail/sendmail.cf.errors;
+ fi;
+ if [ -f /etc/mail/submit.cf.errors ]; then
+ echo "Errors in generating submit.cf";
+ cat /etc/mail/submit.cf.errors;
+ fi;
+ echo " "
+ if [ $max_rc -lt 2 ]; then
+ max_rc=2;
+ fi;
+ fi;
+exit $max_rc;
+
diff --git a/debian/local/update_ldap b/debian/local/update_ldap
new file mode 100644
index 0000000..9f01ef2
--- /dev/null
+++ b/debian/local/update_ldap
@@ -0,0 +1,139 @@
+#!/bin/sh -e
+#-----------------------------------------------------------------------------
+#
+# $Sendmail: update_ldap,v 8.14.3 2008-05-04 22:26:20 cowboy Exp $
+#
+# Sendmail support for LDAP
+#
+# Copyright (c) 2000-2008 Richard Nelson. All Rights Reserved.
+#
+# Notes: supports local umich-ldap and openldap v1/v2 servers
+#
+#-----------------------------------------------------------------------------
+set -e
+
+#
+# Flag to determine if this is an install or update
+NEW=0;
+
+#
+# Flag to determine if any local LDAP server was found
+FOUND=0;
+
+#
+# Path to LDAP server schema directory
+LDAP_PATH=;
+SCHEMA_PATH=;
+SCHEMA_NAME=;
+LDAP_VERSION=;
+
+# 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
+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;
+
+install_schema () {
+#
+# Install sendmail.schema in the appropriate place
+#
+if [ ! -z "$SCHEMA_PATH" ]; then
+ if [ -f "${LDAP_PATH}/slapd.conf" ]; then
+ FOUND=1;
+ if [ ! -e "${SCHEMA_PATH}/sendmail.schema" ]; then
+ NEW=1;
+ fi;
+ cp -p /usr/share/sendmail/examples/ldap/$SCHEMA_NAME \
+ $SCHEMA_PATH/sendmail.schema;
+ chmod 0644 $SCHEMA_PATH/sendmail.schema;
+ chown root:root $SCHEMA_PATH/sendmail.schema;
+ fi;
+ fi;
+ };
+
+#
+# Check if OpenLDAP (2.0.x) is installed
+if [ -d /etc/ldap ]; then
+ LDAP_VERSION="$LDAP_VERSION OpenLDAP V2";
+ LDAP_PATH='/etc/ldap';
+ SCHEMA_PATH="${LDAP_PATH}/schema";
+ SCHEMA_NAME=sendmail.schema.v2;
+ install_schema;
+ fi;
+
+#
+# Check if OpenLDAP (1.x.x) is installed
+if [ -d /etc/openldap ]; then
+ LDAP_VERSION="$LDAP_VERSION OpenLDAP V1";
+ LDAP_PATH='/etc/openldap';
+ SCHEMA_PATH="${LDAP_PATH}";
+ SCHEMA_NAME=sendmail.schema.v1;
+ install_schema;
+ fi;
+
+#
+# Check if UMich-LDAP (3.3) is installed
+if [ -d /etc/umich-ldap ]; then
+ LDAP_VERSION="$LDAP_VERSION UMich-LDAP V3";
+ LDAP_PATH='/etc/umich-ldap';
+ SCHEMA_PATH="${LDAP_PATH}";
+ SCHEMA_NAME=sendmail.schema.v1;
+ install_schema;
+ fi;
+
+#
+# Tell them about the new wizbang features...
+if [ $NEW -eq 0 ]; then
+ :;
+else
+ echo " ";
+ echo "Creating/Updating $LDAP_VERSION information...";
+ echo " ";
+ echo "$SCHEMA_PATH/sendmail.schema has been installed";
+ fi;
+
+if [ $FOUND -eq 0 ] && [ $NEW -eq 1 ]; then
+ cat <<-EOT
+
+ No local LDAP server was located (tried openldap v2/v1, umich-ldap).
+
+ If you wish to use sendmail and LDAP, you'll need to make sure your
+ server has the requisite schema setup.
+
+ You can find the schema (old and new) in the following places:
+ * $SCHEMA_PATH/sendmail.schema for the version of LDAP you
+ currently have installed (if any)
+ * /usr/share/sendmail/examples/ldap/sendmail.schema.<v>
+ where <v> is
+ <v1> for older schema (sendmail.{o,a}t.conf) format
+ <v2> for newer schema (sendmail.schema) format
+
+ If you later install a local LDAP server, be sure to re-run $0.
+ EOT
+elif [ $FOUND -eq 1 ] && [ $NEW -eq 1 ]; then
+ cat <<-EOT
+
+ You have a local $LDAP_VERSION server! Depending upon how (and if)
+ you wish to use LDAP with sendmail, you'll want to check your
+ slapd.conf file and possibly include these files:
+ * $SCHEMA_PATH/sendmail.schema <- alias and other map support
+ * $SCHEMA_PATH/misc.schema <- OpenLDAP V2 ldap-mail-routing
+
+ If you later change your local LDAP server, be sure to re-run $0.
+ EOT
+ fi;
diff --git a/debian/local/update_mc b/debian/local/update_mc
new file mode 100644
index 0000000..a9bbe11
--- /dev/null
+++ b/debian/local/update_mc
@@ -0,0 +1,285 @@
+#!/bin/sh -e
+#-----------------------------------------------------------------------------
+#
+# $Sendmail: update_mc,v 8.14.3 2008-05-04 22:26:20 cowboy Exp $
+#
+# Update Sendmail databases for Debian
+#
+# Copyright (c) 2000-2008 Richard Nelson. All Rights Reserved.
+#
+# Notes (to all):
+# * assumes makemap dbtype /etc/mail/database < /etc/mail/database
+#
+# Notes (to self):
+# * changes made herein *must* be reflected in
+# parse_mc,update_mk,update_db,debian.m4
+#
+#-----------------------------------------------------------------------------
+set -e;
+
+changed=0;
+
+# 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
+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;
+
+new_mc () {
+ chown root:smmsp /etc/mail/"$1".mc.new;
+ chmod 0644 /etc/mail/"$1".mc.new;
+ mv /etc/mail/"$1".mc.new /etc/mail/"$1".mc;
+ changed=1;
+ };
+
+#-----------------------------------------------------------------------------
+# Move sendmail.{mc,cf} from /etc/ to /etc/mail
+if [ ! -f /etc/mail/sendmail.mc ]; then
+ if [ -f /etc/sendmail.mc ]; then
+ echo "Moving /etc/sendmail.* to /etc/mail/";
+ mv /etc/sendmail.mc /etc/mail/sendmail.mc.new;
+ new_mc sendmail;
+ fi;
+ if [ -f /etc/sendmail.cf ]; then
+ mv /etc/sendmail.cf /etc/mail/sendmail.cf;
+ chown root:smmsp /etc/mail/sendmail.cf;
+ chmod 0644 /etc/mail/sendmail.cf;
+ changed=1;
+ fi;
+ fi;
+
+#-----------------------------------------------------------------------------
+# Create {submit,sendmail}.mc if needed
+if [ ! -f /etc/mail/sendmail.mc ]; then
+ cp -p /usr/share/sendmail/cf/debian/sendmail.mc \
+ /etc/mail/sendmail.mc.new;
+ if [ -f /etc/mailname ] && [ ! -z /etc/mailname ]; then
+ masq=$(cat /etc/mailname);
+ echo "dnl # Masquerading options" \
+ >> /etc/mail/sendmail.mc.new;
+ echo "FEATURE(\`always_add_domain')dnl" \
+ >> /etc/mail/sendmail.mc.new;
+ echo "MASQUERADE_AS(\`${masq}')dnl" \
+ >> /etc/mail/sendmail.mc.new;
+ echo "FEATURE(\`allmasquerade')dnl" \
+ >> /etc/mail/sendmail.mc.new;
+ echo "FEATURE(\`masquerade_envelope')dnl" \
+ >> /etc/mail/sendmail.mc.new;
+ fi;
+ new_mc sendmail;
+ fi;
+if [ ! -f /etc/mail/submit.mc ]; then
+ if [ -f /usr/share/sendmail/cf/debian/submit.mc ]; then
+ cp -p /usr/share/sendmail/cf/debian/submit.mc \
+ /etc/mail/submit.mc.new;
+ new_mc submit;
+ fi;
+ fi;
+
+#-----------------------------------------------------------------------------
+# Make sure dialup support m4 files are extant
+if [ ! -f /etc/mail/m4/dialup.m4 ]; then
+ if [ -f /etc/mail/dialup.m4 ]; then
+ mv /etc/mail/dialup.m4 /etc/mail/m4/dialup.m4;
+ else
+ touch /etc/mail/m4/dialup.m4;
+ fi;
+ chown root:smmsp /etc/mail/m4/dialup.m4;
+ chmod 0640 /etc/mail/m4/dialup.m4;
+ fi;
+if [ ! -f /etc/mail/m4/provider.m4 ]; then
+ if [ -f /etc/mail/provider.m4 ]; then
+ mv /etc/mail/provider.m4 /etc/mail/m4/provider.m4;
+ else
+ touch /etc/mail/m4/provider.m4;
+ fi;
+ chown root:smmsp /etc/mail/m4/provider.m4;
+ chmod 0640 /etc/mail/m4/provider.m4;
+ fi;
+if (grep -qEe "^[[:space:]]*include\(\`?/etc/mail/dialup.m4" \
+ /etc/mail/sendmail.mc); then
+ sed -e "s=^\([[:space:]]*\)include(\`\?/etc/mail/dialup\.m4.*$=include(\`/etc/mail/m4/dialup\.m4')dnl=" \
+ /etc/mail/sendmail.mc > /etc/mail/sendmail.mc.new;
+ new_mc sendmail;
+ fi;
+if (grep -qEe "^[[:space:]]*include\(\`?/etc/mail/provider.m4" \
+ /etc/mail/sendmail.mc); then
+ sed -e "s=^\([[:space:]]*\)include(\`\?/etc/mail/provider\.m4.*$=include(\`/etc/mail/m4/provider\.m4')dnl=" \
+ /etc/mail/sendmail.mc > /etc/mail/sendmail.mc.new;
+ new_mc sendmail;
+ fi;
+
+#-----------------------------------------------------------------------------
+# Make sure not using text mailertable (it doesn't work)
+if (grep -qEe "^[[:space:]]*FEATURE\(\`?mailertable'?, \`text /etc/mail/mailertable'\)" \
+ /etc/mail/sendmail.mc); then
+ echo "Correcting FEATURE(mailertable) in /etc/mail/sendmail.mc";
+ sed -e "s=^\([[:space:]]*\)\(\`\?\)FEATURE(\`\?mailertable'\?, \`text /etc/mail/mailertable')\(dnl\)\?=\1\2FEATURE(\`mailertable')dnl=g" \
+ /etc/mail/sendmail.mc > /etc/mail/sendmail.mc.new;
+ new_mc sendmail;
+ fi;
+
+#-----------------------------------------------------------------------------
+# Make sure smrsh points to the correct location
+if (grep -qEe "^[[:space:]]*\`?FEATURE\(\`?smrsh'?[[:space:]]*,.*\)" \
+ /etc/mail/sendmail.mc); then
+ echo "Correcting FEATURE(smrsh) in /etc/mail/sendmail.mc";
+ sed -e "s=\([[:space:]]*\)\(\`\?\)FEATURE(\`\?smrsh'\?[[:space:]]*,.*)\(dnl\)\?=\1\2FEATURE(\`smrsh')dnl=g" \
+ /etc/mail/sendmail.mc > /etc/mail/sendmail.mc.new;
+ new_mc sendmail;
+ fi;
+
+#-----------------------------------------------------------------------------
+# Convert FEATURE(nouucp) to FEATURE(nouucp,reject)
+if (grep -qEe "^[[:space:]]*\`?FEATURE\(\`?nouucp'?\)" \
+ /etc/mail/sendmail.mc); then
+ echo "Correcting FEATURE(nouucp) in /etc/mail/sendmail.mc";
+ sed -e "s=^\([[:space:]]*\)\(\`\?\)FEATURE(\`\?nouucp'\?)\(dnl\)\?=\1\2FEATURE(\`nouucp', \`reject')dnl=g" \
+ /etc/mail/sendmail.mc > /etc/mail/sendmail.mc.new;
+ new_mc sendmail;
+ fi;
+
+#-----------------------------------------------------------------------------
+# Convert FEATURE(dont_masquerade_local) to FEATURE(local_no_masquerade)
+if [ -e /usr/share/sendmail/cf/feature/local_no_masquerade.m4 ]; then
+ if (grep -qEe "^[[:space:]]*\`?FEATURE\(\`?dont_masquerade_local'?\)" \
+ /etc/mail/sendmail.mc); then
+ echo "Correcting FEATURE(dont_masquerade_local) in /etc/mail/sendmail.mc";
+ sed -e "s=^\([[:space:]]*\)\(\`\?\)FEATURE(\`\?dont_masquerade_local'\?)\(dnl\)\?=\1\2FEATURE(\`local_no_masquerade')dnl=g" \
+ /etc/mail/sendmail.mc > /etc/mail/sendmail.mc.new;
+ new_mc sendmail;
+ fi;
+ fi;
+
+#-----------------------------------------------------------------------------
+# Convert FEATURE(access_db,...) to FEATURE(access_db)
+if (grep -qEe "^[[:space:]]*\`?FEATURE\(\`?access_db'?[[:space:]]*,.*\)" \
+ /etc/mail/sendmail.mc); then
+ sed -e "s=^\([[:space:]]*\)\(\`\?\)FEATURE(\`\?access_db'\?[[:space:]]*,[[:space:]]*\`\?hash[[:space:]]*\(-o\)\?[[:space:]]*/etc/mail/access.db'\?[[:space:]]*)\(dnl\)\?=\1\2FEATURE(\`access_db')dnl=g" \
+ /etc/mail/sendmail.mc > /etc/mail/sendmail.mc.new;
+ new_mc sendmail;
+ fi;
+
+#-----------------------------------------------------------------------------
+# change include(/usr/share/sendmail/sendmail.cf/m4/cf.m4)
+if (grep -qEe "^[[:space:]]*\`?include\(\`?/usr/share/sendmail/sendmail.cf/m4/cf.m4'?\)" \
+ /etc/mail/sendmail.mc); then
+ sed -e "s=sendmail/sendmail.cf=sendmail/cf=g" \
+ /etc/mail/sendmail.mc > /etc/mail/sendmail.mc.new;
+ new_mc sendmail;
+ if [ -f /etc/mail/submit.mc ]; then
+ sed -e "s=sendmail/sendmail.cf=sendmail/cf=g" \
+ /etc/mail/submit.mc > /etc/mail/submit.mc.new;
+ new_mc submit;
+ fi;
+ fi;
+
+#-----------------------------------------------------------------------------
+# Add include(/usr/share/sendmail/cf/m4/cf.m4)
+if (grep -qEe "^[[:space:]]*\`?include\(\`?/usr/share/sendmail/cf/m4/cf.m4'?\)" \
+ /etc/mail/sendmail.mc); then
+ :;
+else
+ echo "Adding include(.../cf.m4) to /etc/mail/sendmail.mc";
+ sed -e "s=^\([[:space:]]*\)\(\`\?\)VERSIONID(=\1\2include(\`/usr/share/sendmail/cf/m4/cf.m4')dnl\\
+\1\2VERSIONID(=" \
+ /etc/mail/sendmail.mc > /etc/mail/sendmail.mc.new;
+ new_mc sendmail;
+ fi;
+
+#-----------------------------------------------------------------------------
+# Add define(`_USE_ETC_MAIL_')dnl
+if (grep -qEe "^[[:space:]]*\`?define\(\`?_USE_ETC_MAIL_" \
+ /etc/mail/sendmail.mc); then
+ :;
+else
+ sed -e "s=^\([[:space:]]*\)\(\`\?\)include(\`\?/usr/share/sendmail/cf/m4/cf.m4'\?)\(dnl\)\?=\1\2define(\`_USE_ETC_MAIL_')dnl\\
+include(\`/usr/share/sendmail/cf/m4/cf.m4')dnl=" \
+ /etc/mail/sendmail.mc > /etc/mail/sendmail.mc.new;
+ new_mc sendmail;
+ fi;
+
+#-----------------------------------------------------------------------------
+# Check for badness
+if (grep -qEe "^[[:space:]]*\`?OSTYPE\(\`?linux'?\)" \
+ /etc/mail/sendmail.mc); then
+ sed -e "s=^\([[:space:]]*\)\(\`\?\)OSTYPE(\`\?linux'\?)\(dnl\)\?=\1\2OSTYPE(\`debian')dnl=" \
+ /etc/mail/sendmail.mc > /etc/mail/sendmail.mc.new;
+ new_mc sendmail;
+ fi;
+
+#-----------------------------------------------------------------------------
+# Add DOMAIN(debian-mta)
+if (grep -qEe "^[[:space:]]*\`?DOMAIN\(\`?debian-mta'?\)" \
+ /etc/mail/sendmail.mc); then
+ :;
+else
+ echo "Adding DOMAIN(debian-mta) to /etc/mail/sendmail.mc";
+ sed -e "s=^\([[:space:]]*\)\(\`\?\)OSTYPE(\`\?debian'\?)\(dnl\)\?=\1\2OSTYPE(\`debian')dnl\\
+\1\2DOMAIN(\`debian-mta')dnl=" \
+ /etc/mail/sendmail.mc > /etc/mail/sendmail.mc.new;
+ new_mc sendmail;
+ fi;
+
+#-----------------------------------------------------------------------------
+# Add sendmail.conf customization area
+if (grep -qEe "^dnl # Items controlled by /etc/mail/sendmail.conf" \
+ /etc/mail/sendmail.mc); then
+ :;
+else
+ echo "Adding sendmail.conf customization area to /etc/mail/sendmail.mc";
+ sed -e "s=^\([[:space:]]*\)\(\`\?\)DOMAIN(\`\?debian-mta'\?)\(dnl\)\?=\1\2DOMAIN(\`debian-mta')dnl\\
+dnl # Items controlled by /etc/mail/sendmail.conf - DO NOT TOUCH HERE \\
+dnl undefine(\`confHOST_STATUS_DIRECTORY')dnl #DAEMON_HOSTSTATS \\
+dnl # Items controlled by /etc/mail/sendmail.conf - DO NOT TOUCH HERE=" \
+ /etc/mail/sendmail.mc > /etc/mail/sendmail.mc.new;
+ new_mc sendmail;
+ fi;
+
+#-----------------------------------------------------------------------------
+# Update items in sendmail.conf customization area
+case "$DAEMON_HOSTSTATS" in
+ [Nn]*)
+ if (grep -qEe "^dnl undefine\(\`confHOST_STATUS_DIRECTORY'\)dnl" \
+ /etc/mail/sendmail.mc); then
+ echo "Turning off Host Status collection";
+ sed -e "s=^dnl undefine(\`confHOST_STATUS_DIRECTORY')dnl=undefine(\`confHOST_STATUS_DIRECTORY')dnl=" \
+ /etc/mail/sendmail.mc > /etc/mail/sendmail.mc.new;
+ new_mc sendmail;
+ fi;
+ ;;
+ [Yy]*)
+ if (grep -qEe "^undefine\(\`confHOST_STATUS_DIRECTORY'\)dnl" \
+ /etc/mail/sendmail.mc); then
+ echo "Turning on Host Status collection";
+ sed -e "s=^undefine(\`confHOST_STATUS_DIRECTORY')dnl=dnl undefine(\`confHOST_STATUS_DIRECTORY')dnl=" \
+ /etc/mail/sendmail.mc > /etc/mail/sendmail.mc.new;
+ new_mc sendmail;
+ fi;
+ esac;
+
+#-----------------------------------------------------------------------------
+# Cleanup submit.mc
+if [ -f /etc/mail/submit.mc ]; then
+ sed -e "/^define(\`\?confRUN_AS_USER'\?,.*$/d" \
+ -e "/^define(\`\?confTRUSTED_USER'\?,.*$/d" \
+ /etc/mail/submit.mc > /etc/mail/submit.mc.new;
+ new_mc submit;
+ fi;
+
+exit $changed;
diff --git a/debian/local/update_mk b/debian/local/update_mk
new file mode 100644
index 0000000..6374782
--- /dev/null
+++ b/debian/local/update_mk
@@ -0,0 +1,765 @@
+#!/usr/bin/perl -w
+#------------------------------------------------------------------------
+#
+# $Sendmail: update_mk,v 8.14.3 2008-05-04 22:26:20 cowboy Exp $
+#
+# Create /etc/mail/Makefile for Debian Sendmail databases
+#
+# Copyright 1998-2008 Richard Nelson. All Rights Reserved.
+#
+# Notes (to all):
+# *
+#
+# Notes (to self):
+# * Should actually put data in some files (local-host-names, etc)
+#
+#------------------------------------------------------------------------
+#
+# Initialization of the perl environment
+use strict; # be kosher
+use Cwd; # provide cwd()
+use Env; # A few environmental references
+use integer; # Peformance
+use Sys::Hostname; # make sure we have a valid hostname
+use Getopt::Long; # parameter handling
+
+# Local libraries - for Debian Sendmail Perl helper functions
+# BEGIN { $main::my_path = substr($0,$[,rindex($0,'/')) };
+use lib ('.', substr($0,$[,rindex($0,'/')), "/usr/share/sendmail");
+require Parse_mc;
+require Parse_conf;
+
+# Version of this program
+#($main::MYNAME = $main::0) =~ s|.*/||;
+#$main::Author = "Richard Nelson";
+#$main::AuthorMail = "cowboy\@debian.org";
+#$main::Version = '$Revision: 2.00 $ ';
+$main::program_name = $0;
+$main::program_version = '8.14.3';
+$main::program_date = '2008-05-04 22:26:20 cowboy';
+$main::debug = 0;
+
+my $interp_pgm = "$^X";
+my $interp_vrm = $];
+$interp_vrm = ("$^V" | '000') if (defined $^V);
+my $current_time = scalar localtime;
+my $user = getlogin || (getpwuid($<))[0] || "Unknown!!";
+my $hostname = hostname();
+my $directory = getcwd();
+
+my $Makefile_def = "/etc/mail/Makefile";
+my $Conffile = "/etc/mail/sendmail.conf";
+# List of database entries that will be created if not found
+my %created_dbs;
+my @created_dbs;
+# A few files (like exposed-users) can be listed >1 times !
+my %created_files = ();
+my $reload_stamp = "/var/run/sendmail/stampdir/reload";
+
+#
+#------------------------------------------------------------------------------
+# Finally, some code (almost)
+#------------------------------------------------------------------------------
+#
+# Argument handling...
+$main::opt_help='';
+$main::opt_output_file='';
+$main::opt_input_file='';
+$main::opt_debug='';
+my @options = qw(
+ help|h
+ output-file|output_file|o:s
+ input-file|input_file|i:s
+ debug!
+ );
+my $result = GetOptions(@options);
+if ( ! $result ) {
+ die "Terminating due to parameter error";
+ };
+if ( $main::opt_help ) {
+ warn "$main::program_name $main::program_version $main::program_date\n";
+ warn "$0 \n";
+ warn " -help\n" if $main::opt_help;
+ warn " -debug\n" if $main::opt_debug;
+ warn " -o $main::opt_output_file\n" if $main::opt_output_file;
+ warn " -i $main::opt_input_file\n" if $main::opt_input_file;
+ exit 0;
+ };
+
+my $Makefile = $main::opt_output_file || $Makefile_def;
+${Parse_mc::database_file} = $main::opt_input_file
+ if $main::opt_input_file;
+# $main::debug is used in Parse_mc !
+$main::debug = $main::opt_debug || $main::debug;
+
+# Pull in some configuration data
+&Parse_conf::read_conf("$Conffile");
+my ($ok, $value) = &Parse_conf::get_value('HANDS_OFF');
+if ($value ne '0') {
+ exit;
+ };
+
+# Let them know wtf is going on...
+print STDOUT "Creating ${Makefile}...\n";
+
+# Read the mc/m4 files
+&Parse_mc::read_dbs($Parse_mc::database_file, '');
+
+# Determine names with which we shall work
+my @databases = &get_names();
+
+# Write out the textual representation
+&write_make;
+
+#
+#------------------------------------------------------------------------------
+# Obtain list of candidate databases from sendmail.mc
+#------------------------------------------------------------------------------
+sub get_names {
+ my @names;
+
+ # Database types we know how to handle
+ my %make_types = (
+ 'btree' => 1
+ ,'dbm' => 1
+ ,'hash' => 1
+ ,'m4' => 1
+ ,'newaliases' => 1
+ ,'parse_mc' => 1
+ ,'update_conf' => 1
+ ,'update_mk' => 1
+ ,'update_auth' => 1
+ ,'update_tls' => 1
+ ,'QUEUE_GROUP' => 1
+ ,'include' => 1
+ );
+
+ # Add any qualified databases to the list
+ foreach my $entry (&Parse_mc::names_dbs()) {
+ my ($class, $flags, $files, $options) =
+ &Parse_mc::entry_dbs($entry);
+ if ( (exists($make_types{$entry}) or
+ exists($make_types{$class}))
+ and @{$files}[0] ne '-'
+ and ! exists($created_dbs{$entry})) {
+ push @names, $entry;
+ push @created_dbs, $entry;
+ $created_dbs{$entry} = '';
+ };
+ };
+
+ return @names;
+ };
+
+#
+#------------------------------------------------------------------------------
+# Create Makefile
+#------------------------------------------------------------------------------
+sub write_make {
+ my $ofh = new FileHandle;
+
+ $Makefile = '&STDOUT' if ($Makefile eq '-');
+ unless ( open($ofh, ">$Makefile") ) {
+ warn("Could not open $Makefile($!), using STDOUT.\n");
+ open($ofh, ">&STDOUT");
+ };
+ $Makefile = '-' if ($Makefile eq '&STDOUT');
+
+ &write_header($ofh);
+ &write_target_clean($ofh);
+ &write_target_restart($ofh);
+ &write_target_sendmail($ofh);
+ &write_targets($ofh);
+ &write_files($ofh);
+ &write_footer($ofh);
+
+ close $ofh;
+ if ($Makefile eq $Makefile_def) {
+ my $gid = getgrnam('smmsp');
+ chown '0', $gid, $Makefile;
+ chmod 0754, $Makefile;
+ };
+ };
+
+#
+#------------------------------------------------------------------------------
+# Write Makefile header
+#------------------------------------------------------------------------------
+sub write_header {
+ my ($ofh) = @_;
+
+ print $ofh <<"EOT";
+#!/usr/bin/make -f
+####################################################################
+##### This file is automagically generated -- edit at your own risk
+#####
+##### Copyright (c) 1998-2008 Richard Nelson. All Rights Reserved.
+#####
+##### file: ${Makefile} Makefile for Sendmail databases
+##### generated via: (${interp_pgm} ${interp_vrm})
+##### ${main::program_name}
+##### version: ${main::program_version} ${main::program_date}
+##### by: ${user}\@${hostname}
+##### on: ${current_time}
+##### in: ${directory}
+##### input files: ${Parse_mc::database_file}
+#####
+##### Usage:
+##### 1) Make all targets upto date - use one of the following:
+##### A) \`(cd /etc/mail && make)\`
+##### B) \`make -f ${Makefile}\`
+##### C) \`${Makefile}\`
+##### 2) Force update of <target> - Add <target> to one of the
+##### prior commands ie, \`${Makefile} access\`. Most
+##### any reasonable <target> value is accepted.
+#####
+####################################################################
+SHELL=/bin/sh
+
+#
+# targets that will be routed to the /etc/init.d/sendmail script
+# NOTE: newaliases and clean removed due to extant rules
+#
+INIT = start stop restart restart-if-running \\
+ reload-if-running reload force-reload \\
+ hoststat purgestat mailstats mailq runq control \\
+ status debug
+
+.SUFFIXES:
+.PRECIOUS: $Makefile
+
+#
+# all, the default target, will update everything
+#
+.PHONY: all
+all: sendmail $reload_stamp
+
+#
+# route to the /etc/init.d/sendmail script
+#
+.PHONY: \$(INIT)
+\$(INIT): FORCE
+ /etc/init.d/sendmail \$\@
+
+EOT
+ };
+
+#
+#------------------------------------------------------------------------------
+# Write Makefile 'CLEAN' target
+#------------------------------------------------------------------------------
+sub write_target_clean {
+ my ($ofh) = @_;
+ my @names;
+
+ %created_files = ();
+ foreach my $entry (@databases) {
+ next if ($entry eq 'QUEUE_GROUP'
+ or $entry eq 'Makefile'
+ or $entry eq 'auth'
+ or $entry eq 'tls'
+ or $entry eq 'include'
+ );
+ my ($class, $flags, $files, $options) =
+ &Parse_mc::entry_dbs($entry);
+ foreach my $file (@{$files}) {
+ next if ( $file eq '-'
+ or exists($created_files{$file}) );
+ $created_files{$file} = '';
+ my $dbname;
+ if ($class eq 'parse_mc'
+ or $class eq 'update_mk'
+ or $class eq 'm4') {
+ $dbname = "/etc/mail/$entry";
+ }
+ elsif ($class eq 'update_conf') {
+ $dbname = "/etc/cron.d/sendmail";
+ }
+ elsif ($class eq 'btree'
+ or $class eq 'hash'
+ or $class eq 'newaliases') {
+ $dbname = "$file.db";
+ }
+ else {
+ $dbname = $file;
+ };
+ push @names, $dbname;
+ };
+ };
+
+ print $ofh <<"EOT";
+
+#
+# clean target, remove {sendmail,submit}.cf and generated databases
+#
+EOT
+ print $ofh
+ ".PHONY: clean\n",
+ "clean: FORCE\n",
+ "\trm -f ",join(";\n\trm -f ", @names),";\n";
+ };
+
+#
+#------------------------------------------------------------------------------
+# Write Makefile 'RESTART' target
+#------------------------------------------------------------------------------
+sub write_target_restart {
+ my ($ofh) = @_;
+ my $file;
+
+ print $ofh <<"EOT";
+
+#
+# restart target, check to see if sendmail needs to be restarted
+#
+.PHONY: noreload norestart
+noreload norestart: FORCE
+ \@touch $reload_stamp;
+
+.PHONY: should_reload should_restart
+should_reload should_restart: FORCE
+ \@rm -f $reload_stamp;
+ \@\$(MAKE) -sf $Makefile $reload_stamp;
+
+EOT
+
+ # Spew secondary target of actual restart
+ %created_files = ();
+ my @right;
+ foreach my $entry (sort &Parse_mc::restart_dbs()) {
+ if (! exists($created_dbs{$entry})) {
+ push @created_dbs, $entry;
+ $created_dbs{$entry} = '';
+ };
+ my ($class, $flags, $files, $options) =
+ &Parse_mc::entry_dbs($entry);
+ foreach my $file (@{$files}) {
+ next if ( $file eq '-'
+ or exists($created_files{$file}) );
+ $created_files{$file} = '';
+ my $dbname = $file;
+ $dbname =~ s/\.mc$/\.cf/;
+ push @right, "$dbname";
+ };
+ };
+
+ print $ofh "$reload_stamp: \\\n\t",
+ join(" \\\n\t", @right), "\n",
+ "\t\@if [ ! -f \$\@ ]; then \\\n",
+ "\t\techo 'A forced reload...'; \\\n",
+ "\telse \\\n",
+ "\t\techo 'The following file(s) have changed:'; \\\n",
+ "\t\techo ' \$?'; \\\n",
+ "\t\tfi;\n",
+ "\t\@echo '** ** You should issue ",
+ "\`/etc/init.d/sendmail reload\` ** **';\n";
+ };
+
+#
+#------------------------------------------------------------------------------
+# Write Sendmail dependancies
+#------------------------------------------------------------------------------
+sub write_target_sendmail {
+ my ($ofh) = @_;
+
+ print $ofh <<"EOT";
+
+#
+# sendmail targets, depend upon *ALL* relevant files/databases
+#
+.PHONY: sendmail
+sendmail: sendmail_files sendmail_dbs
+
+EOT
+ my (@smfiles, @smdbs);
+
+ %created_files = ();
+ foreach my $entry (@created_dbs) {
+ my ($class, $flags, $files, $options) =
+ &Parse_mc::entry_dbs($entry);
+ foreach my $file (@{$files}) {
+ next if $file eq '-';
+ next if $file eq 'ldap'; # ALIAS hack
+ if ($class eq 'parse_mc' or $class eq 'update_mk'
+ or $class eq 'm4') {
+ push @smfiles, "$file"
+ if (!exists($created_files{$file}));
+ $created_files{$file} = '';
+ push @smdbs, "/etc/mail/$entry";
+ }
+ elsif ($class eq 'update_conf') {
+ push @smdbs, "/etc/cron.d/sendmail";
+ }
+ elsif ($class eq 'btree' or $class eq 'hash'
+ or $class eq 'newaliases') {
+ push @smfiles, "$file"
+ if (!exists($created_files{$file}));
+ $created_files{$file} = '';
+ push @smdbs, "$file.db";
+ }
+ else {
+ push @smfiles, "$file"
+ if (!exists($created_files{$file}));
+ $created_files{$file} = '';
+ };
+ };
+ };
+
+ print $ofh ".PHONY: sendmail_files\n",
+ "sendmail_files: \\\n\t",
+ join(" \\\n\t", @smfiles), "\n\n";
+ print $ofh ".PHONY: sendmail_dbs\n",
+ "sendmail_dbs: \\\n\t",
+ join(" \\\n\t", @smdbs), "\n";
+ };
+
+#
+#------------------------------------------------------------------------------
+# Write Makefile individual targets
+#------------------------------------------------------------------------------
+sub write_targets {
+ my ($ofh) = @_;
+ my $file;
+
+ print $ofh <<"EOT";
+
+#
+# Individual database targets
+#
+
+#
+# Default db type is hash (Must be in /etc/mail, or
+# fully qualify the dataset for this target to work)
+#
+%.db: % FORCE
+ \@echo 'Updating \$\@...';
+ \@if [ -x /usr/sbin/makemap ]; then \\
+ /usr/sbin/makemap hash \$\@.new.db < \$<; \\
+ chown root:smmsp \$\@.new.db; \\
+ chmod 0640 \$\@.new.db; \\
+ mv -f \$\@.new.db \$\@; \\
+ fi;
+EOT
+
+ # Spew primary target of <target>
+ foreach my $entry (@databases) {
+ my ($class, $flags, $files, $options) =
+ &Parse_mc::entry_dbs($entry);
+ my @names;
+ my $left = '';
+ my $right = '';
+ my $sleft = '';
+ my $dbname = '';
+ print $ofh "\n";
+
+ # Create short name(s) for database entries
+ $sleft .= "$entry ";
+ if ($class eq 'newaliases'
+ or $class eq 'parse_mc'
+ or $class eq 'update_mk'
+ or $class eq 'update_conf'
+ or $class eq 'update_auth'
+ or $class eq 'update_tls'
+ ) {
+ $sleft = 'makefile make ' if ($class eq 'update_mk');
+ $sleft .= 'cron ' if ($class eq 'update_conf');
+ $sleft .= "$class ";
+ };
+
+ foreach my $file (@{$files}) {
+ next if $file eq '-';
+ next if $file eq 'ldap'; # ALIAS hack
+ if ($entry eq 'QUEUE_GROUP' or $entry eq 'include') {
+ $dbname = '';
+ $sleft = lc "${entry}s";
+ $left = lc "${entry}s";
+ }
+ elsif ($class eq 'parse_mc' or $class eq 'update_mk'
+ or $class eq 'm4') {
+ $dbname = "/etc/mail/$entry";
+ }
+ elsif ($class eq 'update_conf') {
+ $dbname = "/etc/cron.d/sendmail";
+ }
+ elsif ($class eq 'btree' or $class eq 'hash'
+ or $class eq 'newaliases') {
+ $dbname = "$file.db";
+ }
+ else {
+ $dbname = $file;
+ $file = ""
+ if ($class eq 'update_tls'
+ or $class eq 'update_auth');
+ };
+ $left .= "$dbname ";
+ $right .= " $file";
+
+ # Create short name(s) for database entries
+ if ($class ne 'parse_mc'
+ and $class ne 'update_mk'
+ and $class ne 'update_conf'
+ and $class ne 'update_auth'
+ and $class ne 'update_tls'
+ and $entry ne 'QUEUE_GROUP'
+ and $entry ne 'include'
+ ) {
+ my $dbsname = "$dbname";
+ $dbsname =~ s/\/etc\/mail\///;
+ $sleft .= "$dbsname " if ($entry ne $dbsname);
+ if ($file ne $dbname) {
+ $dbsname =~ s/\.db//;
+ $sleft .= "$dbsname " if ($entry ne $dbsname);
+ };
+ };
+ };
+
+ # Spew out a phony entry suitable for FORCE
+ print $ofh '.PHONY: ', $sleft, "\n";
+ print $ofh $sleft,": FORCE\n"
+ if ($entry ne 'QUEUE_GROUP' and $entry ne 'include');
+ if ($class eq 'update_mk') {
+ print $ofh "\t\@touch $right;\n",
+ "\t\@\$(MAKE) -sf $Makefile $left;\n";
+ }
+ elsif ($entry ne 'QUEUE_GROUP' and $entry ne 'include') {
+ print $ofh "\t\@rm -f $left;\n",
+ "\t\@\$(MAKE) -sf $Makefile $left;\n";
+ };
+
+ #
+ # Spew out the whole enchilada for this database
+ if ($entry eq 'sendmail.cf' or $entry eq 'databases') {
+ my ($iclass, $iflags, $ifiles, $ioptions) =
+ &Parse_mc::entry_dbs('include');
+ $right .= ' ';
+ $right .= join(' ', @{$ifiles});
+ };
+ print $ofh $left, ':', $right, "\n";
+ next if ($entry eq 'QUEUE_GROUP' or $entry eq 'include');
+ print $ofh "\t\@echo 'Updating $entry ...';\n";
+ if ($class eq 'newaliases') {
+ print $ofh "\t\@if [ -x /usr/sbin/sendmail ]; then \\\n";
+ print $ofh "\t\t/usr/sbin/sendmail -bi || true; \\\n";
+ }
+ elsif ($class eq 'parse_mc'
+ or $class eq 'update_conf'
+ or $class eq 'update_mk'
+ or $class eq 'update_auth'
+ or $class eq 'update_tls'
+ ) {
+ print $ofh "\t\@if [ -x /usr/share/sendmail/${class} ]; then \\\n";
+ print $ofh "\t\t/usr/share/sendmail/${class} || true; \\\n"
+ }
+ elsif ($class eq 'btree' or $class eq 'hash') {
+ print $ofh "\t\@if [ -x /usr/sbin/makemap ]; then \\\n";
+ };
+ foreach my $file (@{$files}) {
+ next if ( $file eq 'ldap' ); # ALIAS hack
+ my $dbname = $file;
+ my $newname = $file;
+ my $uid = 'root';
+ $uid = 'smmta' if ($entry eq 'authinfo'
+ or $entry eq 'access_db'
+ or $entry eq 'QUEUE_GROUP'
+ or $class eq 'newaliases');
+ my $mode = '0644';
+ $mode = '0640' if ($entry eq 'authinfo'
+ or $entry eq 'access_db');
+ $mode = '0640' if ($class eq 'btree' or $class eq 'hash');
+ $mode = '0644' if ($class eq 'm4');
+ $mode = '0754' if ($class eq 'update_mk');
+ $mode = '02750' if ($entry eq 'QUEUE_GROUP');
+ if ($class eq 'btree' or $class eq 'hash') {
+ $dbname .= '.db';
+ $newname .= '.new.db';
+ if (index($flags, '-o') == -1) {
+ print $ofh "\t\t/usr/sbin/makemap $class $newname \\\n",
+ "\t\t\t< $file; \\\n",
+ "\t\tchown $uid:smmsp $newname; \\\n",
+ "\t\tchmod $mode $newname; \\\n",
+ "\t\tmv -f $newname $dbname; \\\n";
+ }
+ else {
+ print $ofh
+ "\t\tif [ -s $file ]; then \\\n",
+ "\t\t/usr/sbin/makemap $class $newname \\\n",
+ "\t\t\t< $file; \\\n",
+ "\t\tchown $uid:smmsp $newname; \\\n",
+ "\t\tchmod $mode $newname; \\\n",
+ "\t\tmv -f $newname $dbname; \\\n",
+ "\t\tfi; \\\n";
+ };
+ }
+ elsif ($class eq 'newaliases') {
+ $newname .= '.db';
+ print $ofh "\t\tif [ -f $newname ]; then \\\n",
+ "\t\t\tchown $uid:smmsp $newname; \\\n",
+ "\t\t\tchmod $mode $newname; \\\n",
+ "\t\t\tfi; \\\n";
+ }
+ elsif ($class eq 'parse_mc' or $class eq 'update_mk') {
+ $newname = "/etc/mail/$entry";
+ print $ofh "\t\tchown $uid:smmsp $newname; \\\n",
+ "\t\tchmod $mode $newname; \\\n";
+ }
+ elsif ($class eq 'm4') {
+ my $oldname = $dbname;
+ $dbname =~ s/\.mc$/\.cf/;
+ $newname =~ s/\.mc$/\.cf\.new/;
+ my $lead = "\t";
+ my $leadh = "\t\@";
+ my $lead2 = "\t\t";
+ my $trail = "";
+ if ($entry eq 'submit.cf') {
+ $lead = "\t\t";
+ $leadh = "\t\t";
+ $lead2 = "\t\t\t";
+ $trail = "\\";
+ };
+ print $ofh
+ "\t\@rm -f ${dbname}.errors\n";
+ print $ofh
+ "\t\@if [ -f /usr/share/sendmail/cf/feature/msp.m4 ]; ",
+ "then \\\n" if ($entry eq 'submit.cf');
+ print $ofh
+ "${leadh}m4 $file > $newname \\\n",
+ "${lead2}2> ${dbname}.errors || true; $trail\n",
+ "${leadh}echo \"### ${oldname} ###\" \\\n",
+ "${lead2}>> $newname; $trail\n",
+ "${leadh}sed -e 's/^/# /' $file \\\n",
+ "${lead2}>> $newname; $trail\n",
+ "${leadh}chown $uid:smmsp $newname; $trail\n",
+ "${leadh}chmod $mode $newname; $trail\n",
+ "${leadh}mv -f $newname $dbname; $trail\n",
+ "${leadh}if [ -s ${dbname}.errors ]; then \\\n",
+ "${lead2}chown $uid:smmsp ${dbname}.errors; \\\n",
+ "${lead2}cat ${dbname}.errors; \\\n",
+ "${lead}else \\\n",
+ "${lead2}rm -f ${dbname}.errors; \\\n",
+ "${lead2}fi; $trail\n";
+ print $ofh
+ "${lead}fi;\n" if ($entry eq 'submit.cf');
+ };
+ };
+ if ($class eq 'newaliases'
+ or $class eq 'parse_mc'
+ or $class eq 'update_conf'
+ or $class eq 'update_mk'
+ or $class eq 'update_auth'
+ or $class eq 'update_tls'
+ or $class eq 'btree' or $class eq 'hash'
+ ) {
+ print $ofh "\t\tfi;\n";
+ };
+ };
+ };
+
+#
+#------------------------------------------------------------------------------
+# Write Makefile file targets (create any missing files)
+#------------------------------------------------------------------------------
+sub write_files {
+ my ($ofh) = @_;
+
+ print $ofh <<"EOT";
+
+#
+# Individual file targets - create any requisite files
+#
+EOT
+
+ %created_files = ();
+ foreach my $entry (@created_dbs) {
+ my ($class, $flags, $files, $options) =
+ &Parse_mc::entry_dbs($entry);
+
+ # These are done above...
+ next if ($entry eq 'databases'
+ or $entry eq 'auth'
+ or $entry eq 'tls'
+ or $entry eq 'Makefile'
+ or $entry eq 'include'
+ );
+
+ foreach my $file (@{$files}) {
+ next if ( $file eq '-'
+ or exists($created_files{$file}) );
+ $created_files{$file} = '';
+ my $uid = 'root';
+ $uid = 'smmta' if ($entry eq 'authinfo'
+ or $entry eq 'access_db'
+ or $entry eq 'QUEUE_GROUP'
+ or $class eq 'newaliases');
+ my $mode = '0644';
+ $mode = '0640' if ($entry eq 'authinfo'
+ or $entry eq 'access_db');
+ $mode = '0640' if ($class eq 'btree' or $class eq 'hash');
+ $mode = '0644' if ($class eq 'm4');
+ $mode = '0754' if ($class eq 'update_mk');
+ $mode = '02750' if ($entry eq 'QUEUE_GROUP');
+ print $ofh "\n$file:\n",
+ "\t\@echo 'Creating $file';\n";
+ if ($entry eq 'QUEUE_GROUP') {
+ print $ofh "\t\@install -d",
+ " -o $uid -g smmsp -m $mode $file;\n",
+ "\t\@chown $uid:smmsp $file;\n",
+ "\t\@chmod $mode $file;\n";
+ }
+ elsif ($entry eq 'sendmail.cf') {
+ print $ofh "\t\@/usr/sbin/sendmailconfig",
+ " --no-reload;\n";
+ }
+ elsif ($entry eq 'submit.cf') {
+ print $ofh "\t\@cp /usr/share/sendmail/",
+ "cf/debian/submit.mc \\\n",
+ "\t\t$file;\n",
+ "\t\@chown $uid:smmsp $file;\n",
+ "\t\@chmod $mode $file;\n";
+ }
+ elsif ($entry eq 'access_db') {
+ print $ofh "\t\@cp /usr/share/sendmail/",
+ "examples/db/access \\\n",
+ "\t\t$file;\n",
+ "\t\@chown $uid:smmsp $file;\n",
+ "\t\@chmod $mode $file;\n";
+ }
+ elsif ($file eq '/etc/mail/aliases') {
+ print $ofh "\t\@ln -s ../aliases /etc/mail/aliases\n";
+ }
+ elsif ($class eq 'update_conf'
+ or $class eq 'update_auth'
+ or $class eq 'update_tls') {
+ print $ofh "\t\@/usr/share/sendmail/${class};\n";
+ }
+ # FIXME: come back and create real data
+ # where needed (local-host-names, etc)
+ elsif (index($flags, '-o') == -1) {
+ print $ofh "\t\@touch $file;\n",
+ "\t\@chown $uid:smmsp $file;\n",
+ "\t\@chmod $mode $file;\n";
+ }
+ elsif (index($flags, '-o') != -1) {
+ print $ofh "\t# Optional file...\n";
+ };
+ };
+ };
+ };
+
+#
+#------------------------------------------------------------------------------
+# Write Makefile footer
+#------------------------------------------------------------------------------
+sub write_footer {
+ my ($ofh) = @_;
+
+print $ofh <<"EOT";
+
+#
+# FORCE target, allow one to override dependancies
+#
+.PHONY: FORCE
+FORCE: ;
+
+EOT
+ };
+
diff --git a/debian/local/update_smrsh b/debian/local/update_smrsh
new file mode 100644
index 0000000..a0f968a
--- /dev/null
+++ b/debian/local/update_smrsh
@@ -0,0 +1,94 @@
+#!/bin/sh -e
+#-----------------------------------------------------------------------------
+#
+# $Sendmail: update_smrsh,v 8.14.3 2008-05-04 22:26:20 cowboy Exp $
+#
+# Update MDA programs used by Sendmail for Debian
+#
+# Copyright (c) 2002-2008 Richard Nelson. All Rights Reserved.
+#
+# Notes (to all):
+# * The entries in /etc/mail/smrsh are used by the feature(smrsh) and
+# sensible-mda.
+#
+# Notes (to self):
+# *
+#
+#-----------------------------------------------------------------------------
+set -e;
+
+# flag used to indicate a dataset has been moved, may need another update
+changed=0;
+new=1;
+
+def_progs="\
+ /usr/lib/sm.bin/mail.local \
+ /usr/lib/sm.bin/sensible-mda \
+ /usr/bin/vacation \
+ /usr/bin/procmail \
+ /usr/bin/maildrop \
+ /usr/bin/deliver \
+ ";
+
+# 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
+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;
+
+echo " ";
+echo "Checking for installed MDAs...";
+
+#------------------------------------------------------------------------------
+# /etc/mail/smrsh is where the links to MDAs and authorized forwarding progs
+if [ ! -e /etc/mail/smrsh ]; then
+ changed=1;
+ new=1;
+ fi;
+chown smmta:smmsp /etc/mail/smrsh;
+chmod 02755 /etc/mail/smrsh;
+
+#------------------------------------------------------------------------------
+# Iterate over the default list of programs and create any missing items
+for file in $def_progs; do
+ ppath=$(dirname "$file");
+ pname=$(basename "$file");
+
+ # the file doesn't exist, see if we can remove its link
+ if [ ! -e $file ]; then
+
+ # let have there own version eh?
+ if [ -e /etc/mail/smrsh/$pname ]; then
+ true;
+
+ # no, if its a danglink symlink, drop it
+ elif [ -L /etc/mail/smrsh/$pname ]; then
+ echo "Removing link for no longer extant program ($pname)";
+ rm /etc/mail/smrsh/$pname;
+ fi;
+
+ # the file exists, see if we need to add its link
+ elif [ ! -e /etc/mail/smrsh/$pname ]; then
+ echo "Adding link for newly extant program ($pname)";
+ ln -sf $file /etc/mail/smrsh/$pname;
+ changed=1;
+ fi;
+ done;
+
+#------------------------------------------------------------------------------
+exit $changed;
diff --git a/debian/local/update_sys b/debian/local/update_sys
new file mode 100644
index 0000000..bfecc33
--- /dev/null
+++ b/debian/local/update_sys
@@ -0,0 +1,252 @@
+#!/bin/sh
+#-----------------------------------------------------------------------------
+#
+# $Sendmail: update_sys,v 8.14.3 2008-05-04 22:26:20 cowboy Exp $
+#
+# Update system files used by Sendmail for Debian
+#
+# Copyright (c) 2001-2008 Richard Nelson. All Rights Reserved.
+#
+# Notes (to all):
+# * Several directories/files have their permissions forced...
+# This is done to allow the MSP/MTA split
+# * This exec runs 'set +e' to ignore errors!!! this is done to
+# support those running NFS (or similiar) systems, where the
+# chmod/chown may fail - If this happens, you'll need to update
+# those items by hand !
+#
+# 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
+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;
+
+# flag used to indicate a dataset has been moved, may need another update
+changed=0;
+
+#-----------------------------------------------------------------------------
+# Warn the user that this may take a bit...
+#-----------------------------------------------------------------------------
+echo '';
+echo 'Checking filesystem, this may take some time - it will not hang!';
+echo -n ' ... ';
+
+#------------------------------------------------------------------------------
+# Create any needed directories, and move any prior data to its new home
+#------------------------------------------------------------------------------
+# /etc/aliases should exist, though not owned by sendmail, we'll create one
+if [ ! -e /etc/aliases ]; then
+ changed=1;
+ if [ -f /usr/share/doc/sendmail/examples/db/aliases ]; then
+ echo "Creating /etc/aliases (not found)";
+ cp /usr/share/sendmail/examples/db/aliases \
+ /etc/aliases;
+ else
+ touch /etc/aliases;
+ fi;
+ chown root:root /etc/aliases;
+ chmod 0644 /etc/aliases;
+ fi;
+
+#------------------------------------------------------------------------------
+# /var/mail is the FHS user mail location, /var/spool/mail is older
+# Note: we set the sticky bit to prevent a sgid exploit from erasing files
+if [ ! -e /var/mail ]; then
+ changed=1;
+ if [ -L /var/spool/mail ]; then
+ ln -sf spool/mail /var/mail;
+ elif [ -d /var/spool/mail ]; then
+ mv /var/spool/mail /var/mail;
+ chown root:root /var/mail;
+ chmod 03777 /var/mail;
+ else
+ mkdir /var/mail;
+ chown root:root /var/mail;
+ chmod 03777 /var/mail;
+ fi;
+ fi;
+#
+# Make sure the sticky bit is set in pre-existing directories
+if [ -d /var/mail ] && [ ! -k /var/mail ]; then
+ chmod 03777 /var/mail;
+ fi;
+if [ -d /var/spool/mail ] \
+&& [ ! -k /var/spool/mail ]; then
+ chmod a+t /var/spool/mail;
+ fi;
+if [ ! -d /var/spool/mail ] \
+&& [ ! -L /var/spool/mail ]; then
+ ln -sf ../mail /var/spool/mail;
+ #mkdir /var/spool/mail;
+ #chown root:root /var/spool/mail;
+ #chmod 03777 /var/spool/mail;
+ fi;
+
+#------------------------------------------------------------------------------
+# /etc/mail is where the Sendmail config files live
+if [ ! -d /etc/mail ]; then
+ changed=1;
+ mkdir /etc/mail;
+ fi;
+chown smmta:smmsp /etc/mail;
+chmod 02755 /etc/mail;
+mkdir -p /etc/mail/m4;
+chown smmta:smmsp /etc/mail/m4;
+chmod 02755 /etc/mail/m4;
+#
+# With the MSP/MTA split, we don't want any g=w files or directories
+# to save us from potential sgid attacks
+find /etc/mail -perm +g=w \( -type f -o -type d \) -print \
+ | xargs -r chmod g-w,o-w;
+
+#------------------------------------------------------------------------------
+# /var/run/sendmail is where we store pid files, control sockets, stamps, etc
+if [ ! -d /var/run/sendmail ]; then
+ changed=1;
+ mkdir /var/run/sendmail;
+ fi;
+chown root:smmta /var/run/sendmail;
+chmod 02755 /var/run/sendmail;
+if [ ! -d /var/run/sendmail/mta ]; then
+ mkdir /var/run/sendmail/mta;
+ fi;
+chown smmta:smmsp /var/run/sendmail/mta;
+chmod 02755 /var/run/sendmail/mta;
+if [ ! -d /var/run/sendmail/msp ]; then
+ mkdir /var/run/sendmail/msp;
+ fi;
+chown smmsp:smmsp /var/run/sendmail/msp;
+chmod 02775 /var/run/sendmail/msp;
+if [ ! -d /var/run/sendmail/stampdir ]; then
+ mkdir /var/run/sendmail/stampdir;
+ fi;
+chown root:smmsp /var/run/sendmail/stampdir;
+chmod 02775 /var/run/sendmail/stampdir;
+#
+# Remove older files
+rm -f /var/run/sendmail.pid;
+rm -f /var/run/sendmail/sendmail.pid;
+rm -f /var/run/sendmail/smcontrol;
+
+#------------------------------------------------------------------------------
+# /var/lib/sendmail is where we stuff host status and sendmail.st
+# instead of the mail queue and /etc/ (respectively)
+if [ ! -d /var/lib/sendmail ]; then
+ changed=1;
+ mkdir /var/lib/sendmail;
+ fi;
+chown smmta:smmsp /var/lib/sendmail;
+chmod 02751 /var/lib/sendmail;
+touch /var/lib/sendmail/dead.letter;
+chown smmta:smmsp /var/lib/sendmail/dead.letter;
+chmod 0660 /var/lib/sendmail/dead.letter;
+if [ -d /var/state/sendmail/host_status ]; then
+ changed=1;
+ echo "Moving /var/state/sendmail/host_status to /var/lib/sendmail/";
+ mv -f /var/state/sendmail/host_status \
+ /var/lib/sendmail/host_status;
+ fi;
+if [ -d /var/sendmail/host_status ]; then
+ changed=1;
+ echo "Moving /var/sendmail/host_status to /var/lib/sendmail/";
+ mv -f /var/sendmail/host_status \
+ /var/lib/sendmail/host_status;
+ fi;
+if [ ! -d /var/lib/sendmail/host_status ]; then
+ mkdir /var/lib/sendmail/host_status;
+ fi;
+chown root:smmsp /var/lib/sendmail/host_status;
+chmod 02775 /var/lib/sendmail/host_status;
+find /var/lib/sendmail/host_status -type d -print \
+ | xargs -r chown root:smmsp;
+find /var/lib/sendmail/host_status -type d -print \
+ | xargs -r chmod 02755;
+#
+# if sendmail.st doesn't exist, don't create it !
+if [ -f /var/log/sendmail.st ]; then
+ changed=1;
+ echo "Moving /var/log/sendmail.st to /var/lib/sendmail/";
+ mv /var/log/sendmail.st \
+ /var/lib/sendmail/sendmail.st;
+ fi;
+if [ -f /var/sendmail/sendmail.st ]; then
+ changed=1;
+ echo "Moving /var/sendmail/sendmail.st to /var/lib/sendmail/";
+ mv /var/sendmail/sendmail.st \
+ /var/lib/sendmail/sendmail.st;
+ fi;
+if [ -f /var/lib/sendmail/sendmail.st ]; then
+ chown root:smmsp /var/lib/sendmail/sendmail.st;
+ chmod 0640 /var/lib/sendmail/sendmail.st;
+ if [ ! -f /var/lib/sendmail/sm-client.st ]; then
+ touch /var/lib/sendmail/sm-client.st;
+ fi;
+ fi;
+if [ -f /var/lib/sendmail/sm-client.st ]; then
+ chown smmsp:smmsp /var/lib/sendmail/sm-client.st;
+ chmod 0660 /var/lib/sendmail/sm-client.st;
+ fi;
+if [ ! -f /var/lib/sendmail/dead.letter ]; then
+ touch /var/lib/sendmail/dead.letter;
+ fi;
+chown root:smmsp /var/lib/sendmail/dead.letter;
+chmod 0660 /var/lib/sendmail/dead.letter;
+#
+# Remove older files
+rm -rf /var/sendmail;
+rm -rf /var/state/sendmail;
+
+#------------------------------------------------------------------------------
+# /var/spool/mqueue is the MTA mail queue directory
+if [ ! -d /var/spool/mqueue ]; then
+ changed=1;
+ mkdir /var/spool/mqueue;
+ fi;
+chown smmta:smmsp /var/spool/mqueue;
+chmod 02750 /var/spool/mqueue;
+#
+# With the MSP/MTA split, we *DO* need g=r, gid=smmsp queue directories and
+# files for mailq to work...
+find /var/spool/mqueue -print \
+ | xargs -r chown smmta:smmsp;
+find /var/spool/mqueue -type d -print \
+ | xargs -r chmod g+rxs-w,o-rwx;
+find /var/spool/mqueue -type f -print \
+ | xargs -r chmod g+r-wx,o-rwx;
+
+#------------------------------------------------------------------------------
+# /var/spool/mqueue-client is the MSP mail queue directory
+if [ ! -d /var/spool/mqueue-client ]; then
+ mkdir /var/spool/mqueue-client;
+ fi;
+chown smmsp:smmsp /var/spool/mqueue-client;
+chmod 02770 /var/spool/mqueue-client;
+find /var/spool/mqueue-client -perm +o=r -print \
+ | xargs -r chmod o-rwx;
+
+#-----------------------------------------------------------------------------
+echo ' Done.';
+
+#------------------------------------------------------------------------------
+exit $changed;
diff --git a/debian/local/update_tls b/debian/local/update_tls
new file mode 100644
index 0000000..8f7b213
--- /dev/null
+++ b/debian/local/update_tls
@@ -0,0 +1,319 @@
+#!/bin/sh -e
+#-----------------------------------------------------------------------------
+#
+# $Sendmail: update_tls,v 8.14.3 2008-05-04 22:26:20 cowboy Exp $
+#
+# Sendmail support for TLS
+#
+# Copyright (c) 2000-2008 Richard Nelson. All Rights Reserved.
+#
+# Notes:
+#
+#-----------------------------------------------------------------------------
+set -e;
+
+#------------------------------------------------------------------------------
+# Local variables
+#---------------------------------------------------------------------------
+HOSTNAME=`hostname -s`;
+DOMAINNAME=`hostname -d`;
+MAILNAME=`cat /etc/mailname 2> /dev/null || hostname -f`;
+SSL_FQDN=`hostname -f`;
+SSL_EMAIL="admin@${MAILNAME}";
+export SSL_FQDN SSL_EMAIL;
+PROGRAM='sendmail';
+CERT_DIR="/etc/ssl/certs";
+COM_PRM="/etc/mail/tls/$PROGRAM-common.prm";
+COM_KEY="/etc/mail/tls/$PROGRAM-common.key";
+MTA_CFG="/etc/mail/tls/$PROGRAM-server.cfg";
+MTA_CSR="/etc/mail/tls/$PROGRAM-server.csr";
+MTA_CRT="/etc/mail/tls/$PROGRAM-server.crt";
+MSP_CFG="/etc/mail/tls/$PROGRAM-client.cfg";
+MSP_CSR="/etc/mail/tls/$PROGRAM-client.csr";
+MSP_CRT="/etc/mail/tls/$PROGRAM-client.crt";
+NEW=0;
+REFD=0;
+
+# 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
+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;
+
+#---------------------------------------------------------------------------
+# create_config: Function to create openssl configuration file
+#---------------------------------------------------------------------------
+create_config () {
+cat >$MTA_CFG <<EOT
+[ ca ]
+default_days = 3650
+x509_extensions = X509v3
+[ req ]
+default_bits = 2048
+distinguished_name = req_DN
+[ req_DN ]
+countryName = "1. Country Name (2 letter code)"
+countryName_min = 2
+countryName_max = 2
+countryName_default =
+stateOrProvinceName = "2. State or Province Name (full name) "
+stateOrProvinceName_default =
+localityName = "3. Locality Name (eg, city) "
+localityName_default =
+0.organizationName = "4. Organization Name (eg, company) "
+0.organizationName_default = Sendmail
+organizationalUnitName = "5. Organizational Unit Name (eg, section) "
+organizationalUnitName_default = Sendmail Server
+commonName = "6. Common Name (MUST==FQDN) "
+commonName_max = 64
+commonName_default = \$ENV::SSL_FQDN
+emailAddress = "7. Email Address (eg, name@FQDN)"
+emailAddress_max = 40
+emailAddress_default = \$ENV::SSL_EMAIL
+[ x509v3 ]
+subjectAltName = email:copy
+issuerAltName = issuer:copy
+basicConstraints = CA:false
+nsComment = "Sendmail generated custom certificate"
+nsCertType = server
+nsSslServerName = \$ENV::SSL_FQDN
+subjectKeyIdentifier=hash
+authorityKeyIdentifier=keyid,issuer:always
+EOT
+};
+
+
+#---------------------------------------------------------------------------
+# Check if OpenSSL is installed
+if [ ! -d "$CERT_DIR" ]; then
+ cat <<-EOT
+
+ OpenSSL is not installed, will not configure sendmail support for it.
+
+ to install openssl, get openssl.
+
+ To enable sendmail TLS support at a later date, invoke "$0"
+
+ EOT
+ exit 0;
+ fi;
+
+echo ' ';
+echo 'Creating/Updating SSL(for TLS) information';
+
+
+#---------------------------------------------------------------------------
+# Process arguments
+#---------------------------------------------------------------------------
+case "$1" in
+ [Nn][Ee][Ww]* | \
+ [Rr][Ee][Nn][Ee][Ww]* | \
+ [Rr][Ee][Ss][Ii][Gg][Nn]*)
+ echo 'Removing any pre-existing sendmail certificates.';
+ if [ -x /usr/bin/openssl ]; then
+ if [ -f $MTA_CRT ]; then
+ LINK="$CERT_DIR/"$(openssl x509 -noout -hash < $MTA_CRT)".0";
+ rm -f $LINK 2>/dev/null;
+ fi;
+ if [ -f $MSP_CRT ]; then
+ LINK="$CERT_DIR/"$(openssl x509 -noout -hash < $MSP_CRT)".0";
+ rm -f $LINK 2>/dev/null;
+ fi;
+ fi;
+ rm -f $MTA_CSR $MTA_CRT 2>/dev/null;
+ rm -f $MSP_CSR $MSP_CRT 2>/dev/null;
+ rm -f $COM_PRM $COM_KEY 2>/dev/null;
+ ;;
+ esac
+
+#---------------------------------------------------------------------------
+# Make sure sendmail.mc points to proper /etc/mail/tls/starttls.m4
+if [ -f /etc/mail/sendmail.mc ]; then
+ if (grep -qEe "^[[:space:]]*include\(\`?/etc/mail/starttls.m4" \
+ /etc/mail/sendmail.mc); then
+ sed -e "s=^\([[:space:]]*\)\(\`\?\)include(\`\?/etc/mail/starttls.m4'\?)\(dnl\)\?=\1\2include(\`/etc/mail/tls/starttls.m4')dnl=g" \
+ /etc/mail/sendmail.mc > /etc/mail/sendmail.mc.new;
+ chown root:smmsp /etc/mail/sendmail.mc.new;
+ chmod 0644 /etc/mail/sendmail.mc.new;
+ mv /etc/mail/sendmail.mc.new /etc/mail/sendmail.mc;
+ fi;
+ fi;
+if [ -f /etc/mail/submit.mc ]; then
+ if (grep -qEe "^[[:space:]]*include\(\`?/etc/mail/starttls.m4" \
+ /etc/mail/submit.mc); then
+ sed -e "s=^\([[:space:]]*\)\(\`\?\)include(\`\?/etc/mail/starttls.m4'\?)\(dnl\)\?=\1\2include(\`/etc/mail/tls/starttls.m4')dnl=g" \
+ /etc/mail/submit.mc > /etc/mail/submit.mc.new;
+ chown root:smmsp /etc/mail/submit.mc.new;
+ chmod 0644 /etc/mail/submit.mc.new;
+ mv /etc/mail/submit.mc.new /etc/mail/submit.mc;
+ fi;
+ fi;
+
+#---------------------------------------------------------------------------
+# check for references to starttls.m4 in sendmail.mc
+if [ -f /etc/mail/sendmail.mc ]; then
+ if grep -qEe "^[[:space:]]*include\(\`?/etc/mail/tls/starttls.m4" \
+ /etc/mail/sendmail.mc; then
+ REFD=1;
+ fi;
+ fi;
+
+#---------------------------------------------------------------------------
+# Make sure prototype /etc/mail/tls/starttls.m4 exists
+mkdir -p /etc/mail/tls 2>/dev/null;
+chown smmta:smmsp /etc/mail/tls;
+chmod 0755 /etc/mail/tls;
+$sm_path/update_tlsm4 || true;
+
+#---------------------------------------------------------------------------
+# check for SSL
+if [ -d "$CERT_DIR" ]; then
+ if [ -f $MTA_CRT ] && [ -f $MSP_CRT ]; then
+ echo 'You already have sendmail certificates';
+ echo ' ';
+ chown root:smmsp $COM_PRM;
+ chown root:smmsp $COM_KEY;
+ chown root:smmsp $MTA_CRT;
+ chown root:smmsp $MSP_CRT;
+ else
+ if [ -x /usr/bin/openssl ]; then
+ yn="Y";
+ else
+ cat <<-EOT
+ $PROGRAM needs openssl (not installed) to create a
+ certificate to validate users
+
+ If you don't need a certificate, say No
+ If you want a certificate, install openssl and say Yes
+
+ Do you wish to create a certificate?
+ EOT
+ read yn;
+ yn=$(echo -n "$yn" | sed -e "s/^\ *//" -e "s/^\t*//");
+ test -n "$yn" || yn="N";
+ fi;
+
+ # Create new (self-signed) certificate
+ case "$yn" in
+ [Yy]*)
+ echo "Creating SSL certificates for sendmail.";
+ # Create prompt file
+ if [ ! -f /etc/mail/tls/no_prompt ]; then
+ cat >/etc/mail/tls/no_prompt <<-EOT
+
+
+
+
+
+
+
+ EOT
+ fi;
+
+ # Create config files
+ if [ ! -f $MTA_CFG ]; then
+ create_config;
+ chmod 0600 $MTA_CFG;
+ fi;
+ if [ ! -f $MSP_CFG ]; then
+ sed -e "s/Sendmail Server/Sendmail Client/" \
+ $MTA_CFG > $MSP_CFG;
+ chmod 0600 $MSP_CFG;
+ fi;
+ # Create shared DSA/DH password parameters
+ if [ ! -s $COM_PRM ]; then
+ openssl dsaparam 2048 -out $COM_PRM;
+ openssl dhparam -dsaparam -in $COM_PRM >> $COM_PRM;
+ chown root:smmsp $COM_PRM;
+ chmod 0640 $COM_PRM;
+ fi;
+ # Create shared DSA/RSA key (RSA preferred for browser support)
+ if [ ! -f $COM_KEY ]; then
+ openssl genrsa -out $COM_KEY 2048;
+ #openssl gendsa -out $COM_KEY $COM_PRM;
+ chown root:smmsp $COM_KEY;
+ chmod 0640 $COM_KEY;
+ fi;
+ # sendmail requires that CN=fqdn
+ # Prompts: 1) Country Name (2 letter code)
+ # 2) State or Province Name
+ # 3) Locality Name (eg, city)
+ # 4) Organization Name (eg, company)
+ # 5) Organizational Unit Name (eg, section)
+ # 6) Common Name (eg, YOUR name)
+ # 7) Email Address
+ if [ ! -f $MTA_CRT ]; then
+ openssl req -new -config $MTA_CFG -key $COM_KEY \
+ -out $MTA_CSR \
+ </etc/mail/tls/no_prompt >/dev/null 2>&1;
+ chmod 0600 $MTA_CSR;
+ openssl x509 -req -extfile $MTA_CFG \
+ -signkey $COM_KEY -in $MTA_CSR \
+ -out $MTA_CRT -days 3650 \
+ >/dev/null 2>&1;
+ chown root:smmsp $MTA_CRT;
+ chmod 0644 $MTA_CRT;
+ fi;
+ if [ ! -f $MSP_CRT ]; then
+ openssl req -new -config $MSP_CFG -key $COM_KEY \
+ -out $MSP_CSR \
+ </etc/mail/tls/no_prompt >/dev/null 2>&1;
+ chmod 0600 $MSP_CSR;
+ openssl x509 -req -extfile $MSP_CFG \
+ -signkey $COM_KEY -in $MSP_CSR \
+ -out $MSP_CRT -days 3650 \
+ >/dev/null 2>&1;
+ chown root:smmsp $MSP_CRT;
+ chmod 0644 $MSP_CRT;
+ fi;
+ esac;
+ fi;
+
+ # Create hash link for new certificate (must do msp last!)
+ if [ -f $MTA_CRT ]; then
+ LINK="$CERT_DIR/"$(openssl x509 -noout -hash < $MTA_CRT)".0";
+ if [ ! -f $LINK ]; then
+ ln -sf $MTA_CRT $LINK;
+ fi;
+ fi;
+ if [ -f $MSP_CRT ]; then
+ LINK="$CERT_DIR/"$(openssl x509 -noout -hash < $MSP_CRT)".0";
+ if [ ! -f $LINK ]; then
+ ln -sf $MSP_CRT $LINK;
+ fi;
+ fi;
+ fi;
+
+if [ $REFD -eq 0 ]; then
+ cat <<-EOT
+
+ *** *** *** WARNING *** WARNING *** WARNING *** WARNING *** *** ***
+
+ Everything you need to support STARTTLS (encrypted mail transmission
+ and user authentication via certificates) is installed and configured
+ but is *NOT* being used.
+
+ To enable sendmail to use STARTTLS, you need to:
+ 1) Add this line to /etc/mail/sendmail.mc and optionally
+ to /etc/mail/submit.mc:
+ include(\`/etc/mail/tls/starttls.m4')dnl
+ 2) Run sendmailconfig
+ 3) Restart sendmail
+
+ EOT
+ fi;
diff --git a/debian/local/update_tlsm4 b/debian/local/update_tlsm4
new file mode 100644
index 0000000..a720e88
--- /dev/null
+++ b/debian/local/update_tlsm4
@@ -0,0 +1,252 @@
+#!/usr/bin/perl -w
+#------------------------------------------------------------------------
+#
+# $Sendmail: update_tls,v 8.14.3 2008-05-04 22:26:20 cowboy Exp $
+#
+# Create /etc/mail/tls/starttls.m4 for Debian Sendmail
+#
+# Copyright 1998-2008 Richard Nelson. All Rights Reserved.
+#
+# Notes (to all):
+# *
+#
+# Notes (to self):
+# *
+#
+#------------------------------------------------------------------------
+#
+# Initialization of the perl environment
+use strict; # be kosher
+use Cwd; # provide cwd()
+use Env; # A few environmental references
+use integer; # Peformance
+use Sys::Hostname; # make sure we have a valid hostname
+use Getopt::Long; # parameter handling
+
+# Local libraries - for Debian Sendmail Perl helper functions
+# BEGIN { $main::my_path = substr($0,$[,rindex($0,'/')) };
+use lib ('.', substr($0,$[,rindex($0,'/')), "/usr/share/sendmail");
+require Parse_mc;
+
+# Version of this program
+#($main::MYNAME = $main::0) =~ s|.*/||;
+#$main::Author = "Richard Nelson";
+#$main::AuthorMail = "cowboy\@debian.org";
+#$main::Version = '$Revision: 2.00 $ ';
+$main::program_name = $0;
+$main::program_version = '8.14.3';
+$main::program_date = '2008-05-04 22:26:20 cowboy';
+$main::debug = 0;
+
+my $interp_pgm = "$^X";
+my $interp_vrm = $];
+$interp_vrm = ("$^V" | '000') if (defined $^V);
+my $current_time = scalar localtime;
+my $user = getlogin || (getpwuid($<))[0] || "Unknown!!";
+my $hostname = hostname();
+my $directory = getcwd();
+
+my $Starttls_def = "/etc/mail/tls/starttls.m4";
+
+# Hash of define names to filename
+my %Def_Map;
+
+#
+#------------------------------------------------------------------------------
+# Finally, some code (almost)
+#------------------------------------------------------------------------------
+#
+# Argument handling...
+$main::opt_help='';
+$main::opt_output_file='';
+$main::opt_input_file='';
+$main::opt_debug='';
+my @options = qw(
+ help|h
+ output-file|output_file|o:s
+ input-file|input_file|i:s
+ debug!
+ );
+my $result = GetOptions(@options);
+if ( ! $result ) {
+ die "Terminating due to parameter error";
+ };
+if ( $main::opt_help ) {
+ warn "$main::program_name $main::program_version $main::program_date\n";
+ warn "$0 \n";
+ warn " -help\n" if $main::opt_help;
+ warn " -debug\n" if $main::opt_debug;
+ warn " -o $main::opt_output_file\n" if $main::opt_output_file;
+ warn " -i $main::opt_input_file\n" if $main::opt_input_file;
+ exit 0;
+ };
+
+my $Starttls = $main::opt_output_file || $Starttls_def;
+${Parse_mc::database_file} = $main::opt_input_file
+ if $main::opt_input_file;
+# $main::debug is used in Parse_mc !
+$main::debug = $main::opt_debug || $main::debug;
+
+# Let them know wtf is going on...
+print STDOUT "Creating ${Starttls}...\n";
+
+# Read the mc/m4 files
+&Parse_mc::read_dbs($Parse_mc::database_file, '');
+
+# Obtain Starttls information from database
+&get_data;
+
+# Write out the textual representation
+&write_starttls;
+
+
+#
+#------------------------------------------------------------------------------
+# Obtain information from database
+#------------------------------------------------------------------------------
+sub get_data {
+ my @names = (
+ 'confTO_STARTTLS'
+ ,'confCACERT'
+ ,'confCACERT_PATH'
+ ,'confCRL'
+ ,'confCLIENT_CERT'
+ ,'confCLIENT_KEY'
+ ,'confSERVER_CERT'
+ ,'confSERVER_KEY'
+ ,'confDH_PARAMETERS'
+ ,'confTLS_SRV_OPTIONS'
+ );
+
+ foreach my $entry (@names) {
+ my ($class, $flags, $files, $options) =
+ &Parse_mc::entry_dbs($entry);
+ my $file = @{$files}[0];
+ $Def_Map{$entry} = '';
+ $Def_Map{$entry} = $file if ($file ne '-');
+ #$Def_Map{$entry} = &Parse_mc::format_dbs($entry);
+ };
+ };
+
+
+#
+#------------------------------------------------------------------------------
+# Create /etc/mail/tls/starttls.m4
+#------------------------------------------------------------------------------
+sub write_starttls {
+ my $ofh = new FileHandle;
+
+ $Starttls = '&STDOUT' if ($Starttls eq '-');
+ unless ( open($ofh, ">$Starttls") ) {
+ warn("Could not open $Starttls($!), using STDOUT.\n");
+ open($ofh, ">&STDOUT");
+ };
+ $Starttls = '-' if ($Starttls eq '&STDOUT');
+
+ &write_m4($ofh);
+
+ close $ofh;
+ if ($Starttls eq $Starttls_def) {
+ chown '0', '0', $Starttls;
+ chmod 0744, $Starttls;
+ };
+ };
+
+
+#
+#------------------------------------------------------------------------------
+# Write Starttls m4 file
+#------------------------------------------------------------------------------
+sub write_m4 {
+ my ($ofh) = @_;
+
+ print $ofh <<"EOT";
+divert(-1)dnl
+####################################################################
+##### This file is automagically generated -- edit at your own risk
+#####
+##### Copyright (c) 2002-2008 Richard Nelson. All Rights Reserved.
+#####
+##### file: ${Starttls}
+##### STARTTLS Configuration for Debian Sendmail
+##### generated via: (${interp_pgm} ${interp_vrm})
+##### ${main::program_name}
+##### version: ${main::program_version} ${main::program_date}
+##### by: ${user}\@${hostname}
+##### on: ${current_time}
+##### in: ${directory}
+##### input files: ${Parse_mc::database_file}
+#####
+##### Usage:
+##### 1) To get *ANY* STARTTLS support for sendmail you
+##### A) *MUST* Add this line to /etc/mail/sendmail.mc
+##### \`include(\`/etc/mail/tls/starttls.m4\')dnl\'
+##### B) *MAY* Add the same line to /etc/mail/submit.mc
+##### to get MSP<->MTA authentication/encryption
+##### 2) You may modify the marked portions of this file, those
+##### deal with the cert/key filenames and TLS options.
+##### If you need finer control of TLS options, use the access
+##### database.
+#####
+####################################################################
+divert(0)dnl
+VERSIONID(\`\$Id: starttls.m4,v 8.14.3-1 2008-05-04 22:26:20 cowboy Exp \$\')
+dnl #
+dnl #---------------------------------------------------------------------
+dnl # Bring in Autoconf results
+dnl #---------------------------------------------------------------------
+ifdef(\`sm_version\', \`dnl\',
+\`include(\`/usr/share/sendmail/cf/debian/autoconf.m4\')dnl\')
+dnl #
+dnl # Check to see if inclusion is valid (version >= 8.11.0, tls enabled)
+ifelse(eval(sm_version_math >= 527104), \`1\', \`dnl
+ifelse(sm_enable_tls, \`yes\', \`dnl
+dnl #
+dnl # To support shared keyfiles, we need them to be group readable
+dnl #
+define(\`confDONT_BLAME_SENDMAIL\',dnl
+ defn(\`confDONT_BLAME_SENDMAIL\')\`,GroupReadableKeyFile\')dnl
+dnl #
+dnl # ...Do not touch anything above this line...
+dnl #
+dnl # Set a more reasonable timeout on negotiation
+dnl #
+define(\`confTO_STARTTLS\', \`$Def_Map{'confTO_STARTTLS'}\')dnl # <= EDIT
+dnl #
+dnl # CA directory - CA certs should be herein
+define(\`confCACERT_PATH\', \`$Def_Map{'confCACERT_PATH'}\')dnl # <= EDIT
+dnl #
+dnl # CA file (may be the same as client/server certificate)
+define(\`confCACERT\', \`$Def_Map{'confCACERT'}\')dnl # <= EDIT
+dnl #
+dnl # Certificate Revocation List
+define(\`confCRL\', \`$Def_Map{'confCRL'}\')dnl # <= EDIT
+EOT
+if (! -f $Def_Map{'confCRL'}) {
+print $ofh <<"EOT";
+dnl # CRL not found... do not issue warnings on it!
+undefine(\`confCRL\')dnl
+EOT
+ };
+ print $ofh <<"EOT";
+dnl #
+dnl # Server certificate/key (can be in the same file, and shared w/client)
+dnl # NOTE: The key must *NOT* be encrypted !!!
+define(\`confSERVER_CERT\', \`$Def_Map{'confSERVER_CERT'}\')dnl # <= EDIT
+define(\`confSERVER_KEY\', \`$Def_Map{'confSERVER_KEY'}\')dnl # <= EDIT
+dnl #
+dnl # Client certificate/key (can be in the same file, and shared w/server)
+dnl # NOTE: The key must *NOT* be encrypted !!!
+define(\`confCLIENT_CERT\', \`$Def_Map{'confCLIENT_CERT'}\')dnl # <= EDIT
+define(\`confCLIENT_KEY\', \`$Def_Map{'confCLIENT_KEY'}\')dnl # <= EDIT
+dnl #
+dnl # DH parameters
+define(\`confDH_PARAMETERS\', \`$Def_Map{'confDH_PARAMETERS'}\')dnl # <= EDIT
+dnl #
+dnl # Optional settings
+define(\`confTLS_SRV_OPTIONS\', \`$Def_Map{'confTLS_SRV_OPTIONS'}\')dnl # <= EDIT
+dnl #
+\')\')dnl
+EOT
+ };
+