diff options
author | Richard A Nelson (Rick) <cowboy@debian.org> | 2007-11-02 22:14:00 +0000 |
---|---|---|
committer | Andreas Beckmann <debian@abeckmann.de> | 2012-10-01 20:07:33 +0200 |
commit | e2c9ad1abeb477b91d72eaa49080e255de79c907 (patch) | |
tree | 39c92ad9302145e0229f059c5ee1afd5764c3c85 | |
parent | 8c9befc8de046d499e4bf44fc5f7434d72ffd19b (diff) | |
download | sendmail-e2c9ad1abeb477b91d72eaa49080e255de79c907.tar.gz |
Imported Debian patch 8.14.2-1debian/8.14.2-1
97 files changed, 17630 insertions, 35 deletions
diff --git a/debian/Makefile b/debian/Makefile new file mode 100644 index 0000000..72fe7ad --- /dev/null +++ b/debian/Makefile @@ -0,0 +1,913 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 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 = . +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in \ + $(top_srcdir)/./build/debian/libmilter-dev.dirs.in \ + $(top_srcdir)/./build/debian/libmilter-dev.links.in \ + $(top_srcdir)/./build/debian/libmilter-dev.postrm.in \ + $(top_srcdir)/./build/debian/libmilter-dev.preinst.in \ + $(top_srcdir)/./build/debian/libmilter.dirs.in \ + $(top_srcdir)/./build/debian/libmilter.links.in \ + $(top_srcdir)/./build/debian/libmilter.lintian-overrides.in \ + $(top_srcdir)/./build/debian/libmilter.postrm.in \ + $(top_srcdir)/./build/debian/libmilter.preinst.in \ + $(top_srcdir)/./build/debian/rmail.dirs.in \ + $(top_srcdir)/./build/debian/rmail.postrm.in \ + $(top_srcdir)/./build/debian/rmail.preinst.in \ + $(top_srcdir)/./build/debian/sendmail-base.dirs.in \ + $(top_srcdir)/./build/debian/sendmail-base.postinst.in \ + $(top_srcdir)/./build/debian/sendmail-base.postrm.in \ + $(top_srcdir)/./build/debian/sendmail-base.preinst.in \ + $(top_srcdir)/./build/debian/sendmail-base.prerm.in \ + $(top_srcdir)/./build/debian/sendmail-bin.dirs.in \ + $(top_srcdir)/./build/debian/sendmail-bin.postinst.in \ + $(top_srcdir)/./build/debian/sendmail-bin.postrm.in \ + $(top_srcdir)/./build/debian/sendmail-bin.preinst.in \ + $(top_srcdir)/./build/debian/sendmail-bin.prerm.in \ + $(top_srcdir)/./build/debian/sendmail-bin.suid.in \ + $(top_srcdir)/./build/debian/sendmail-cf.dirs.in \ + $(top_srcdir)/./build/debian/sendmail-cf.postrm.in \ + $(top_srcdir)/./build/debian/sendmail-cf.preinst.in \ + $(top_srcdir)/./build/debian/sendmail-doc.dirs.in \ + $(top_srcdir)/./build/debian/sendmail-doc.postrm.in \ + $(top_srcdir)/./build/debian/sendmail-doc.preinst.in \ + $(top_srcdir)/./build/debian/sendmail.cron.daily.in \ + $(top_srcdir)/./build/debian/sendmail.dirs.in \ + $(top_srcdir)/./build/debian/sendmail.init.d.in \ + $(top_srcdir)/./build/debian/sensible-mda.dirs.in \ + $(top_srcdir)/./build/debian/sensible-mda.postrm.in \ + $(top_srcdir)/./build/debian/sensible-mda.preinst.in \ + $(top_srcdir)/./local/sendmail.in \ + $(top_srcdir)/build/autoconf.mk.in \ + $(top_srcdir)/build/autoconf.pl.in \ + $(top_srcdir)/build/autoconf.sh.in \ + $(top_srcdir)/build/debian/changelog.in \ + $(top_srcdir)/build/debian/changelog.sh.in \ + $(top_srcdir)/build/debian/control.m4.in \ + $(top_srcdir)/build/site.config.m4.in \ + $(top_srcdir)/build/update_chaos.in \ + $(top_srcdir)/cf/debian/autoconf.m4.in \ + $(top_srcdir)/cf/debian/sendmail.mc.in \ + $(top_srcdir)/cf/debian/submit.mc.in \ + $(top_srcdir)/cf/domain/debian-msp.m4.in \ + $(top_srcdir)/cf/domain/debian-mta.m4.in \ + $(top_srcdir)/cf/hack/debian_auth.m4.in \ + $(top_srcdir)/cf/hack/virthost_by_ip.m4.in \ + $(top_srcdir)/cf/ostype/debian.m4.in $(top_srcdir)/configure \ + $(top_srcdir)/examples/dhcp3/dhclient-exit-hooks.d/sendmail.in \ + $(top_srcdir)/examples/network/if-down.d/sendmail.in \ + $(top_srcdir)/examples/network/if-up.d/sendmail.in \ + $(top_srcdir)/examples/ppp/ip-down.d/sendmail.in \ + $(top_srcdir)/examples/ppp/ip-up.d/sendmail.in \ + $(top_srcdir)/examples/resolvconf/update-libc.d/sendmail.in \ + $(top_srcdir)/examples/sasl/sasl.m4.in \ + $(top_srcdir)/examples/tls/starttls.m4.in \ + $(top_srcdir)/local/bug/sendmail/script.in \ + ./build/config.guess ./build/config.sub ./build/depcomp \ + ./build/install-sh ./build/missing ./build/mkinstalldirs \ + AUTHORS COPYING ChangeLog INSTALL NEWS TODO +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/./build/mkinstalldirs +CONFIG_CLEAN_FILES = build/autoconf.mk build/autoconf.pl \ + build/autoconf.sh build/debian/changelog.sh \ + build/debian/changelog build/update_chaos build/site.config.m4 \ + build/debian/control.m4 libmilter${sm_libmilter_version}.dirs \ + libmilter${sm_libmilter_version}.links \ + libmilter${sm_libmilter_version}.lintian-overrides \ + libmilter${sm_libmilter_version}.postrm \ + libmilter${sm_libmilter_version}.preinst libmilter-dev.dirs \ + libmilter-dev.links libmilter-dev.postrm libmilter-dev.preinst \ + rmail.dirs rmail.postrm rmail.preinst sendmail.dirs \ + sendmail-base.dirs sendmail-base.postinst sendmail-base.postrm \ + sendmail-base.preinst sendmail-base.prerm sendmail-doc.dirs \ + sendmail-doc.postrm sendmail-doc.preinst sendmail-cf.dirs \ + sendmail-cf.postrm sendmail-cf.preinst sendmail.cron.daily \ + sendmail-bin.dirs sendmail.init.d sendmail-bin.postinst \ + sendmail-bin.postrm sendmail-bin.preinst sendmail-bin.prerm \ + sendmail-bin.suid sensible-mda.dirs sensible-mda.postrm \ + sensible-mda.preinst cf/debian/autoconf.m4 \ + cf/debian/sendmail.mc cf/debian/submit.mc \ + cf/domain/debian-msp.m4 cf/domain/debian-mta.m4 \ + cf/hack/debian_auth.m4 cf/hack/virthost_by_ip.m4 \ + cf/ostype/debian.m4 \ + examples/dhcp3/dhclient-exit-hooks.d/sendmail \ + examples/network/if-down.d/sendmail \ + examples/network/if-up.d/sendmail \ + examples/ppp/ip-down.d/sendmail examples/ppp/ip-up.d/sendmail \ + examples/resolvconf/update-libc.d/sendmail \ + examples/sasl/sasl.m4 examples/tls/starttls.m4 \ + local/bug/sendmail/script +SOURCES = +DIST_SOURCES = +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run aclocal-1.10 +AMTAR = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run tar +AUTOCONF = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run autoconf +AUTOHEADER = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run autoheader +AUTOMAKE = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run automake-1.10 +AWK = gawk +CC = cc +CCDEPMODE = depmode=none +CFLAGS = -g -Wall -O2 -fPIC -fstack-protector-all +CPP = cc -E +CPPFLAGS = +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.1\" -DPACKAGE_STRING=\"Sendmail\ 8.14.1\" -DPACKAGE_BUGREPORT=\"bug/reportbug\ or\ sendmail@packages.debian.org\" -DPACKAGE=\"sendmail\" -DVERSION=\"8.14.1\" -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_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 +LIBOBJS = +LIBS = +LN_S = ln -s +LTLIBOBJS = +MAINT = # +MAKEINFO = ${SHELL} /home/src/sendmail/sendmail-8.14.2/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.2 +PACKAGE_TARNAME = sendmail +PACKAGE_VERSION = 8.14.2 +PATH_SEPARATOR = : +SET_MAKE = +SHELL = /bin/sh +SM_CPYRT = 2007 +SM_DATE = 2007-10-04 21:42:00 +SM_MAXVERS = 9.0.0 +SM_MINVERS = 8.7.6 +SM_VERS = 8.14.1 +STRIP = +VERSION = 8.14.1 +abs_builddir = /home/src/sendmail/sendmail-8.14.2/debian +abs_srcdir = /home/src/sendmail/sendmail-8.14.2/debian +abs_top_builddir = /home/src/sendmail/sendmail-8.14.2/debian +abs_top_srcdir = /home/src/sendmail/sendmail-8.14.2/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.2 +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.2/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 = 2007-11-02 +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 +sm_libs = +sm_libsm_envdef = -fPIC -DHAVE_NANOSLEEP=1 -D_LDAP_EXAMPLE_ -DLDAP_REFERRALS -D_FFR_LDAP_URI -D_FFR_LDAP_SETVERSION -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 -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 | libsasl2-modules-plain | libsasl2-digestmd5-plain | libsasl2-digestmd5-des, openssl +sm_time = 22:20:56 +sm_utc = +0000 +sm_vacation_envdef = +sm_vacation_libs = -ldb-4.6 -lldap -llber +sm_version = 8.14.2 +sm_version_beta = +sm_version_major = 8.14 +sm_version_math = 527874 +sm_version_minor = 2 +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 = . + +# +# AutoMake +# +ACLOCAL_AMFLAGS = -I build +# +# Subdirectories to process +# +SUBDIRS = cf examples local sensible_mda +# +# Kluge to get my own targets include as recursive +# +RECURSIVE_TARGETS = build-arch-recursive build-indep-recursive \ + install-arch-recursive install-indep-recursive +all: all-recursive + +.SUFFIXES: +am--refresh: + @: +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ + cd $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +build/autoconf.mk: $(top_builddir)/config.status $(top_srcdir)/build/autoconf.mk.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +build/autoconf.pl: $(top_builddir)/config.status $(top_srcdir)/build/autoconf.pl.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +build/autoconf.sh: $(top_builddir)/config.status $(top_srcdir)/build/autoconf.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +build/debian/changelog.sh: $(top_builddir)/config.status $(top_srcdir)/build/debian/changelog.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +build/debian/changelog: $(top_builddir)/config.status $(top_srcdir)/build/debian/changelog.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +build/update_chaos: $(top_builddir)/config.status $(top_srcdir)/build/update_chaos.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +build/site.config.m4: $(top_builddir)/config.status $(top_srcdir)/build/site.config.m4.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +build/debian/control.m4: $(top_builddir)/config.status $(top_srcdir)/build/debian/control.m4.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +libmilter${sm_libmilter_version}.dirs: $(top_builddir)/config.status $(top_srcdir)/./build/debian/libmilter.dirs.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +libmilter${sm_libmilter_version}.links: $(top_builddir)/config.status $(top_srcdir)/./build/debian/libmilter.links.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +libmilter${sm_libmilter_version}.lintian-overrides: $(top_builddir)/config.status $(top_srcdir)/./build/debian/libmilter.lintian-overrides.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +libmilter${sm_libmilter_version}.postrm: $(top_builddir)/config.status $(top_srcdir)/./build/debian/libmilter.postrm.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +libmilter${sm_libmilter_version}.preinst: $(top_builddir)/config.status $(top_srcdir)/./build/debian/libmilter.preinst.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +libmilter-dev.dirs: $(top_builddir)/config.status $(top_srcdir)/./build/debian/libmilter-dev.dirs.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +libmilter-dev.links: $(top_builddir)/config.status $(top_srcdir)/./build/debian/libmilter-dev.links.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +libmilter-dev.postrm: $(top_builddir)/config.status $(top_srcdir)/./build/debian/libmilter-dev.postrm.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +libmilter-dev.preinst: $(top_builddir)/config.status $(top_srcdir)/./build/debian/libmilter-dev.preinst.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +rmail.dirs: $(top_builddir)/config.status $(top_srcdir)/./build/debian/rmail.dirs.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +rmail.postrm: $(top_builddir)/config.status $(top_srcdir)/./build/debian/rmail.postrm.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +rmail.preinst: $(top_builddir)/config.status $(top_srcdir)/./build/debian/rmail.preinst.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +sendmail.dirs: $(top_builddir)/config.status $(top_srcdir)/./build/debian/sendmail.dirs.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +sendmail-base.dirs: $(top_builddir)/config.status $(top_srcdir)/./build/debian/sendmail-base.dirs.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +sendmail-base.postinst: $(top_builddir)/config.status $(top_srcdir)/./build/debian/sendmail-base.postinst.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +sendmail-base.postrm: $(top_builddir)/config.status $(top_srcdir)/./build/debian/sendmail-base.postrm.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +sendmail-base.preinst: $(top_builddir)/config.status $(top_srcdir)/./build/debian/sendmail-base.preinst.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +sendmail-base.prerm: $(top_builddir)/config.status $(top_srcdir)/./build/debian/sendmail-base.prerm.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +sendmail-doc.dirs: $(top_builddir)/config.status $(top_srcdir)/./build/debian/sendmail-doc.dirs.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +sendmail-doc.postrm: $(top_builddir)/config.status $(top_srcdir)/./build/debian/sendmail-doc.postrm.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +sendmail-doc.preinst: $(top_builddir)/config.status $(top_srcdir)/./build/debian/sendmail-doc.preinst.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +sendmail-cf.dirs: $(top_builddir)/config.status $(top_srcdir)/./build/debian/sendmail-cf.dirs.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +sendmail-cf.postrm: $(top_builddir)/config.status $(top_srcdir)/./build/debian/sendmail-cf.postrm.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +sendmail-cf.preinst: $(top_builddir)/config.status $(top_srcdir)/./build/debian/sendmail-cf.preinst.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +sendmail.cron.daily: $(top_builddir)/config.status $(top_srcdir)/./build/debian/sendmail.cron.daily.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +sendmail-bin.dirs: $(top_builddir)/config.status $(top_srcdir)/./build/debian/sendmail-bin.dirs.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +sendmail.init.d: $(top_builddir)/config.status $(top_srcdir)/./build/debian/sendmail.init.d.in $(top_srcdir)/./local/sendmail.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +sendmail-bin.postinst: $(top_builddir)/config.status $(top_srcdir)/./build/debian/sendmail-bin.postinst.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +sendmail-bin.postrm: $(top_builddir)/config.status $(top_srcdir)/./build/debian/sendmail-bin.postrm.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +sendmail-bin.preinst: $(top_builddir)/config.status $(top_srcdir)/./build/debian/sendmail-bin.preinst.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +sendmail-bin.prerm: $(top_builddir)/config.status $(top_srcdir)/./build/debian/sendmail-bin.prerm.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +sendmail-bin.suid: $(top_builddir)/config.status $(top_srcdir)/./build/debian/sendmail-bin.suid.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +sensible-mda.dirs: $(top_builddir)/config.status $(top_srcdir)/./build/debian/sensible-mda.dirs.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +sensible-mda.postrm: $(top_builddir)/config.status $(top_srcdir)/./build/debian/sensible-mda.postrm.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +sensible-mda.preinst: $(top_builddir)/config.status $(top_srcdir)/./build/debian/sensible-mda.preinst.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +cf/debian/autoconf.m4: $(top_builddir)/config.status $(top_srcdir)/cf/debian/autoconf.m4.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +cf/debian/sendmail.mc: $(top_builddir)/config.status $(top_srcdir)/cf/debian/sendmail.mc.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +cf/debian/submit.mc: $(top_builddir)/config.status $(top_srcdir)/cf/debian/submit.mc.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +cf/domain/debian-msp.m4: $(top_builddir)/config.status $(top_srcdir)/cf/domain/debian-msp.m4.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +cf/domain/debian-mta.m4: $(top_builddir)/config.status $(top_srcdir)/cf/domain/debian-mta.m4.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +cf/hack/debian_auth.m4: $(top_builddir)/config.status $(top_srcdir)/cf/hack/debian_auth.m4.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +cf/hack/virthost_by_ip.m4: $(top_builddir)/config.status $(top_srcdir)/cf/hack/virthost_by_ip.m4.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +cf/ostype/debian.m4: $(top_builddir)/config.status $(top_srcdir)/cf/ostype/debian.m4.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +examples/dhcp3/dhclient-exit-hooks.d/sendmail: $(top_builddir)/config.status $(top_srcdir)/examples/dhcp3/dhclient-exit-hooks.d/sendmail.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +examples/network/if-down.d/sendmail: $(top_builddir)/config.status $(top_srcdir)/examples/network/if-down.d/sendmail.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +examples/network/if-up.d/sendmail: $(top_builddir)/config.status $(top_srcdir)/examples/network/if-up.d/sendmail.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +examples/ppp/ip-down.d/sendmail: $(top_builddir)/config.status $(top_srcdir)/examples/ppp/ip-down.d/sendmail.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +examples/ppp/ip-up.d/sendmail: $(top_builddir)/config.status $(top_srcdir)/examples/ppp/ip-up.d/sendmail.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +examples/resolvconf/update-libc.d/sendmail: $(top_builddir)/config.status $(top_srcdir)/examples/resolvconf/update-libc.d/sendmail.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +examples/sasl/sasl.m4: $(top_builddir)/config.status $(top_srcdir)/examples/sasl/sasl.m4.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +examples/tls/starttls.m4: $(top_builddir)/config.status $(top_srcdir)/examples/tls/starttls.m4.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +local/bug/sendmail/script: $(top_builddir)/config.status $(top_srcdir)/local/bug/sendmail/script.in + cd $(top_builddir) && $(SHELL) ./config.status $@ + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d $(distdir) || mkdir $(distdir) + @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 + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +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-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-exec-am: + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am clean clean-generic \ + ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ + dist-shar dist-tarZ dist-zip distcheck distclean \ + distclean-generic distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ + tags-recursive uninstall uninstall-am + +# +# Debian targets, phase out +# +.PHONY: build-indep build-indep-am +.PHONY: build-arch build-arch-am +.PHONY: install-indep install-indep-am +.PHONY: install-arch install-arch-am +build-indep: build-indep-recursive +build-indep-am: +build-arch: build-arch-recursive +build-arch-am: +install-indep: install-indep-recursive +install-indep-am: +install-arch: install-arch-recursive +install-arch-am: +# 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/build/autoconf.mk b/debian/build/autoconf.mk index 7e5597b..f4c97b7 100644 --- a/debian/build/autoconf.mk +++ b/debian/build/autoconf.mk @@ -2,13 +2,13 @@ #------------------------------------------------------------------------------ # vim: syntax=make # -# $Sendmail: autoconf.mk,v 8.14.1 2007-10-20 16:39:52 cowboy Exp $ +# $Sendmail: autoconf.mk,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ # # Copyright (c) 1998-2007 Richard Nelson. All Rights Reserved. # # build/autoconf.mk. Generated from autoconf.mk.in by configure. # -# Rules file for Sendmail 8.14.1(527873) +# Rules file for Sendmail 8.14.2-1(527874) # on Debian lenny/sid # via Debhelper V4.1 # @@ -16,13 +16,13 @@ # on Debian slink, potato, woody, testing, sid, ... # but the generated file is customized to the version noted above. # -# Richard Nelson <cowboy@debian.org> 2007-10-20 16:39:52 (-0700) +# Richard Nelson <cowboy@debian.org> 2007-11-02 22:20:56 (+0000) #------------------------------------------------------------------------------ #SHELL := /bin/sh -x # Variables for, and by, Autoconf (Don't touch these! edit config step) PACKAGE_NAME = Sendmail -PACKAGE_VERSION = 8.14.1 +PACKAGE_VERSION = 8.14.2 prefix = /usr exec_prefix = /usr bindir = ${DESTDIR}/usr/bin @@ -40,21 +40,21 @@ infodir = ${DESTDIR}/usr/share/info mandir = ${DESTDIR}/usr/share/man docdir = ${DESTDIR}/usr/share/doc srcdir = . -abs_srcdir = /home/src/sendmail/sendmail-8.14.1/debian/build +abs_srcdir = /home/src/sendmail/sendmail-8.14.2/debian/build top_srcdir = .. -abs_top_srcdir = /home/src/sendmail/sendmail-8.14.1/debian +abs_top_srcdir = /home/src/sendmail/sendmail-8.14.2/debian builddir = . -abs_builddir = /home/src/sendmail/sendmail-8.14.1/debian/build +abs_builddir = /home/src/sendmail/sendmail-8.14.2/debian/build top_builddir = .. -abs_top_builddir = /home/src/sendmail/sendmail-8.14.1/debian +abs_top_builddir = /home/src/sendmail/sendmail-8.14.2/debian # My private variables -buildtree = build-tree/sendmail-8.14.1 +buildtree = build-tree/sendmail-8.14.2 sm_custom = sm_custom_s = -sm_version = 8.14.1 -sm_revision = +sm_version = 8.14.2 +sm_revision = -1 # I like to preserve timestamps... INSTALL := /usr/bin/install -c -p @@ -71,7 +71,7 @@ INSTALL_SCRIPT := ${INSTALL} -m 0755 #AC_CC := cc #AC_CFLAGS := -g -Wall -O2 -fPIC -fstack-protector-all #AC_DEFS := -DPACKAGE_NAME=\"Sendmail\" -DPACKAGE_TARNAME=\"sendmail\" -DPACKAGE_VERSION=\"8.14.1\" -DPACKAGE_STRING=\"Sendmail\ 8.14.1\" -DPACKAGE_BUGREPORT=\"bug/reportbug\ or\ sendmail@packages.debian.org\" -DPACKAGE=\"sendmail\" -DVERSION=\"8.14.1\" -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_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 -#AC_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 +#AC_LDFLAGS := -pie -Wl,-z,noexecstack,-z,relro,-z,now -Wl,--warn-shared-textrel #AC_LIBS := # Private AutoConfig generated diff --git a/debian/build/autoconf.pl b/debian/build/autoconf.pl new file mode 100644 index 0000000..ee649c3 --- /dev/null +++ b/debian/build/autoconf.pl @@ -0,0 +1,41 @@ +#------------------------------------------------------------------------------ +# Autoconf variables - in a form suitable for sh, perl +# build/autoconf.pl. Generated from autoconf.pl.in by configure. +#------------------------------------------------------------------------------ +# Variables for, and by, Autoconf (Don't touch these! edit config step) +my ($PACKAGE_NAME, $PACKAGE_VERSION, $prefix, $exec_prefix, $bindir, + $sbindir, $libexecdir, $datadir, $sysconfdir, $sharedstatedir, + $localstatedir, $libdir, $includedir, $infodir, $mandir, $docdir, + $srcdir, $abs_srcdir, $top_srcdir, $abs_top_srcdir, + $builddir, $abs_builddir, $top_builddir, $abs_top_builddir, + $VPATH); +BEGIN { + $PACKAGE_NAME = "Sendmail"; + $PACKAGE_VERSION = "8.14.2"; + $prefix = "/usr"; + $exec_prefix = "/usr"; + $bindir = "/usr/bin"; + $sbindir = "/usr/sbin"; + $libexecdir = "/usr/lib/sm.bin"; + $sysconfdir = "/etc"; + $sharedstatedir = "/usr/com"; + $localstatedir = "/var"; + $libdir = "/usr/lib"; + $includedir = "/usr/include"; + $oldincludedir = "/usr/include"; + $datarootdir = "/usr/share"; + $datadir = "/usr/share"; + $infodir = "/usr/share/info"; + $mandir = "/usr/share/man"; + $docdir = "/usr/share/doc"; + $srcdir = "."; + $abs_srcdir = "/home/src/sendmail/sendmail-8.14.2/debian/build"; + $top_srcdir = ".."; + $abs_top_srcdir = "/home/src/sendmail/sendmail-8.14.2/debian"; + $builddir = "."; + $abs_builddir = "/home/src/sendmail/sendmail-8.14.2/debian/build"; + $top_builddir = ".."; + $abs_top_builddir = "/home/src/sendmail/sendmail-8.14.2/debian"; + $VPATH = "."; + }; + diff --git a/debian/build/autoconf.sh b/debian/build/autoconf.sh new file mode 100644 index 0000000..47b7e24 --- /dev/null +++ b/debian/build/autoconf.sh @@ -0,0 +1,33 @@ +#------------------------------------------------------------------------------ +# Autoconf variables - in a form suitable for sh, perl +# build/autoconf.sh. Generated from autoconf.sh.in by configure. +#------------------------------------------------------------------------------ +# Variables for, and by, Autoconf (Don't touch these! edit config step) +PACKAGE_NAME="Sendmail"; +PACKAGE_VERSION="8.14.2"; +prefix="/usr"; +exec_prefix="/usr"; +bindir="/usr/bin"; +sbindir="/usr/sbin"; +libexecdir="/usr/lib/sm.bin"; +sysconfdir="/etc"; +sharedstatedir="/usr/com"; +localstatedir="/var"; +libdir="/usr/lib"; +includedir="/usr/include"; +oldincludedir="/usr/include"; +datarootdir="/usr/share"; +datadir="/usr/share"; +infodir="/usr/share/info"; +mandir="/usr/share/man"; +docdir="/usr/share/doc"; +srcdir="."; +abs_srcdir="/home/src/sendmail/sendmail-8.14.2/debian/build" +top_srcdir=".." +abs_top_srcdir="/home/src/sendmail/sendmail-8.14.2/debian" +builddir="." +abs_builddir="/home/src/sendmail/sendmail-8.14.2/debian/build" +top_builddir=".." +abs_top_builddir="/home/src/sendmail/sendmail-8.14.2/debian" +VPATH=":" + diff --git a/debian/build/debian/changelog b/debian/build/debian/changelog new file mode 100644 index 0000000..9072b4d --- /dev/null +++ b/debian/build/debian/changelog @@ -0,0 +1,329 @@ +sendmail (8.14.2-1) unstable; urgency=low + + * New Upstream release + + SASL 2.1.22 change sasl_decode64() requires MTA handle "=" + closes: #443319 + + -- Richard A Nelson (Rick) <cowboy@debian.org> Fri, 02 Nov 2007 22:14:00 -0000 + +sendmail (8.14.2-0) private; urgency=low + + * Upstream release + * Refit patches + * Run for a bit + + -- Richard A Nelson (Rick) <cowboy@debian.org> Fri, 02 Nov 2007 03:00:00 -0000 + +sendmail (8.14.2.Beta0-0) private; urgency=low + + * Upstream Beta + * Refit patches + + -- Richard A Nelson (Rick) <cowboy@debian.org> Tue, 23 Oct 2007 05:50:00 -0000 + +sendmail (8.14.2.Beta0-0) private; urgency=low + + * Upstream Beta + * Refit patches + + -- Richard A Nelson (Rick) <cowboy@debian.org> Mon, 15 Oct 2007 16:20:00 -0000 + +sendmail (8.14.1-12) unstable; urgency=low + + * Correct "poor man's" emphasis closes: #448033 + (Yes, Ubuntu does feed stuff back) + + -- Richard A Nelson (Rick) <cowboy@debian.org> Mon, 29 Oct 2007 22:46:00 -0000 + +sendmail (8.14.1-11) unstable; urgency=low + + * /etc/init.d/sendmail will now rebuild databases on + start/reload/restart (like Redhat derived, various BSDs, etc) + + * Finally nailed (fingers crossed) the elusive cause of + ;; connection timed out; no servers could be reached + There are still issues on what state to leave things in, but + at least the file will be turned into garbage closes: #375787 + + sendmail.conf::DAEMON_NETMODE now defaults to Static + + /etc/{ppp,dhcp3,network,resolvconf}/*/sendmail pass an additional option + + /usr/share/sendmail/dynamic is much more careful + + * ARM is broken, disable -fstack-protector-all closes: #446415 + * add FEATURE(use_cw_file) to default sendmail.mc closes: #433216 + * remove /usr/share/bug/sendmail-doc -> sendmail closes: #387799 + + -- Richard A Nelson (Rick) <cowboy@debian.org> Sat, 20 Oct 2007 23:35:30 -0000 + +sendmail (8.14.1-10) unstable; urgency=low + + * Do not blindly accept client certificates by default + thanks to Jeffrey Honig (from #sendmail@freenode) + NOTE: this only affects new installations - if you've already installed + sendmail, you and haven't changed the default; you should ! + /etc/mail/tls/starttls.m4 + * Set confRRT_IMPLIES_DSN to upstream default of False + * Enable pool() for libmilter closes: #445307 + This should help high performance/load situations where select() just + doesn't scale well + + -- Richard A Nelson (Rick) <cowboy@debian.org> Thu, 04 Oct 2007 22:40:00 -0000 + +sendmail (8.14.1-9) unstable; urgency=low + + * Finally drop MAILER(cyrus21) in favour of cyrusv2 + * Egads, a rules typo dropped all local patches :( closes: #436185 + * upgrade to db4.6 (and newer libdb-dev) + + -- Richard A Nelson (Rick) <cowboy@debian.org> Mon, 13 Aug 2007 20:52:22 -0000 + +sendmail (8.14.1-8) unstable; urgency=low + + * remove dependancy on update-inetd and netbase/inet-superserver + + Default install uses daemon mode (no need for inetd) + + update-inetd call predicated upon it existance + + -- Richard A Nelson (Rick) <cowboy@debian.org> Sat, 28 Jul 2007 01:17:00 -0000 + +sendmail (8.14.1-7) unstable; urgency=low + + * buildd's do not honour Build-Depends-Indep:, so replicate that + information on the Build-Depends line to solve FTBFS Closes: #430405 + + -- Richard A Nelson (Rick) <cowboy@debian.org> Tue, 29 May 2007 02:21:00 -0000 + +sendmail (8.14.1-6) unstable; urgency=low + + * The `ironclad or die` release, using newer gcc/binutils + features to further reduce the exploit footprint of an + application. Thanks to Marc-Christian Petersen + Read more about all that good stuff at: + http://www.gentoo.org/proj/en/hardened/hardened-toolchain.xml#RELRO + + * Create an ELF "PT_GNU_RELRO" segment header in the object. + Or in other words: built with "-z relro" + + * When generating an executable or shared library, mark it to tell + the dynamic linker to resolve all symbols when the program is + started, or when the shared library is linked to using dlopen, + instead of deferring function call resolution to the point when + the function is first called. + Or in other words: built with "-z now" + + * Emit extra code to check for buffer overflows, such as stack + smashing attacks. This is done by adding a guard variable to + functions with vulnerable objects. This includes functions + that call alloca, and functions with buffers larger than 8 + bytes. The guards are initialized when a function is entered + and then checked when the function exits. If a guard check + fails, an error message is printed and the program exits. + Or in other words: built with "-fstack-protector-all" + + * Compiled as PIE (Position Independant Executable) + This assists PAX enabled kernels, with ASLR, and is also needed + for GRSecurity. Even with stock kernels, this makes the memory + mapping less static, hindering attacks. + + -- Richard A Nelson (Rick) <cowboy@debian.org> Tue, 29 May 2007 02:21:00 -0000 + +sendmail (8.14.1-5) private; urgency=low + + * DH_COMPAT = 5 + + * Tweak LSB setup of /etc/init.d/sendmail such that stop/start + when DAEMON_MODE=None is not an error + + * Clean up rules file abit, more to go (I love deleting suff) + + drop sm_conf/sm_conf_opt from debian/rules + + drop old private copy of dbs and use cdbs (not cleanly) + + drop support of older sendmail versions (8.8.8+) + + drop support for building on older debian versions (slink+) + + drop split debian directory kluge + + drop smX support - it requires a complete revamp + + * Things are still complicated by upstream not using autoconf/makefile + builds, but I have used them in support - much of that work remains and + will not be removed in the near term + + * Add alternative build-depend for linux-libc-dev (which will depcrecate + linux-kernel-headers) + + -- Richard A Nelson (Rick) <cowboy@debian.org> Wed, 23 May 2007 05:00:00 -0000 + +sendmail (8.14.1-4) unstable; urgency=low + + * Fix occasional mailq failures caused by set -e and lsb scripts :( + + -- Richard A Nelson (Rick) <cowboy@debian.org> Tue, 22 May 2007 23:00:00 -0000 + +sendmail (8.14.1-3) unstable; urgency=low + + * Add missing build-depends for linux-kernel-headers + Thanks Marc-Christian Petersen + * LSB init scripts + Thanks Marc-Christian Petersen + * Finally, make rmail a suggestion, not a dependancy + and remove conflicts with old versions closes: #376113 + * Suffix _mta to start/stop/configure for ksh closes: #424213 + + -- Richard A Nelson (Rick) <cowboy@debian.org> Thu, 19 May 2007 20:14:00 -0000 + +sendmail (8.14.1-2) unstable; urgency=high + + * Rebuild against a fixed libd4.5 closes: #423153 + + -- Richard A Nelson (Rick) <cowboy@debian.org> Thu, 10 May 2007 21:30:00 -0000 + +sendmail (8.14.1-1) unstable; urgency=low + + * *** *** libmilter gets a new version *** *** + *** *** MimeDefang and other packages will need to be rebuilt *** *** + + * New upstream release + - Fix 8.14.0 regressions & issues + * Refit patches + * Drop qtool patch, equivalent applied upstream + * Force configure defaults (new machine, gotta get it right) + * update configure.ac for newer db versions + * refresh FAQ + * build against db4.5 closes: #421945 + * build-indep-depends on groff, not groff-base closes: #362872 + + -- Richard A Nelson (Rick) <cowboy@debian.org> Sat, 05 May 2007 20:10:00 -0000 + +sendmail (8.14.1-0) private; urgency=low + + * New upstream release + - Fix 8.14.0 regressions & issues + * Refit patches + * Drop qtool patch, equivalent applied upstream + * Force configure defaults (new machine, gotta get it right) + * update configure.ac for newer db versions + * refresh FAQ + + -- Richard A Nelson (Rick) <cowboy@debian.org> Fri, 04 Apr 2007 04:00:00 -0000 + +sendmail (8.14.1.Gamma0-0) private; urgency=low + + * New upstream Gamma + * Refit patches + + -- Richard A Nelson (Rick) <cowboy@debian.org> Fri, 30 Mar 2007 04:40:00 -0000 + +sendmail (8.14.1.Beta2-0) private; urgency=low + + * New upstream Beta + * Refit patches + + -- Richard A Nelson (Rick) <cowboy@debian.org> Sat, 24 Mar 2007 04:30:00 -0000 + +sendmail (8.14.1.Beta1-0) private; urgency=low + + * New upstream Beta + * Refit patches + + -- Richard A Nelson (Rick) <cowboy@debian.org> Fri, 09 Mar 2007 17:00:00 -0000 + +sendmail (8.14.1.Beta0-0) private; urgency=low + + * New upstream Beta + * Refit patches + + -- Richard A Nelson (Rick) <cowboy@debian.org> Mon, 05 Mar 2007 05:40:00 -0000 + +sendmail (8.14.0-0) private; urgency=low + + * New upstream Release + - Headers 8bit clean + - Milter enhancements + * Refit patches + * Some issues, so this will not be uploaded - errata of (2007/02/06) help + + -- Richard A Nelson (Rick) <cowboy@debian.org> Thu, 01 Feb 2007 16:20:00 -0000 + +sendmail (8.14.0.Gamma0-0) private; urgency=low + + * New upstream Release + * Refit patches + + -- Richard A Nelson (Rick) <cowboy@debian.org> Wed, 31 Jan 2007 20:50:00 -0000 + +sendmail (8.14.0.Beta5-1) experimental; urgency=low + + * New upstream Beta + * Refit patches + + * Major item + + Welcome back space betwixt 'from:' and '<other stuff>' + + -- Richard A Nelson (Rick) <cowboy@debian.org> Tue, 09 Jan 2007 21:40:00 -0000 + +sendmail (8.14.0.Beta4-1) experimental; urgency=low + + * Sigh... built here, but not build machines closes: #405917 + * change from ~ to . to appease build scripts and match upstream + * drop my check_helo patch, needs rework + * Upstream incorporated patch for greet_pause closes: #312164 + + -- Richard A Nelson (Rick) <cowboy@debian.org> Sun, 07 Jan 2007 22:50:00 -0000 + +sendmail (8.14.0~Beta4-1) experimental; urgency=low + + * Release to experimental + * New upstream Beta + * Refit patches + + * Major new feature: + + headers are 8 bit "transparent". + + the milter API has been extended. + + * New/improved anti-SPAM features: + + no false-postives on greet_pause failures due to timeouts/rejections + + new option MaxNOOPCommands + + detection of open HTTP proxies (GET, POST, CONNECT, or USER) + + FEATURE(`require_rdns') + + FEATURE(`block_bad_helo') + + FEATURE(`badmx') + + option `relaytofulladdress' for FEATURE(`access_db') + + * Upstream incorporated patch for greet_pause closes: #312164 + + -- Richard A Nelson (Rick) <cowboy@debian.org> Fri, 05 Jan 2007 19:07:46 -0000 + +sendmail (8.14.0~Beta4-0) private; urgency=low + + * New upstream Beta + * Refit patches + + -- Richard A Nelson (Rick) <cowboy@debian.org> Sun, 25 Dec 2006 04:30:00 -0000 + +sendmail (8.14.0~Beta3-0) private; urgency=low + + * New upstream Beta + * Refit patches + + -- Richard A Nelson (Rick) <cowboy@debian.org> Tue, 19 Dec 2006 00:10:00 -0000 + +sendmail (8.14.0~Beta2-0) private; urgency=low + + * New upstream Beta + * Refit patches + + -- Richard A Nelson (Rick) <cowboy@debian.org> Sat, 09 Dec 2006 18:40:00 -0000 + +sendmail (8.14.0~Beta1-0) private; urgency=low + + * New upstream Beta + * Refit patches + + -- Richard A Nelson (Rick) <cowboy@debian.org> Sun, 19 Nov 2006 17:50:00 -0000 + +sendmail (8.14.0~Beta0-0) private; urgency=low + + * New upstream Beta + * Support 8.14 in build tools + * Refit patches + * Update FFRs + + -- Richard A Nelson (Rick) <cowboy@debian.org> Wed, 01 Nov 2006 02:30:00 -0000 + +/* vim:set ai et tw=80 */ diff --git a/debian/build/debian/changelog.sh b/debian/build/debian/changelog.sh new file mode 100644 index 0000000..2235945 --- /dev/null +++ b/debian/build/debian/changelog.sh @@ -0,0 +1,71 @@ +#!/bin/sh -e +#----------------------------------------------------------------------------- +# $Sendmail: changelog.sh,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Copyright (c) 1998-2007 Richard Nelson. All Rights Reserved. +# +# build/debian/changelog.sh. Generated from changelog.sh.in by configure. +# +# Debian script to generate changelogs for sendmail 8.14.2-1 +# +# Note: this file supports 8.7.6 - 9.0.0 +# +#----------------------------------------------------------------------------- +set -e; +# +# Initialization +PACKAGE='sendmail'; + +# +# Remove old combined changelog +rm -f build/debian/changelog; + +echo "Building Sendmail 8.14.2-1 (527874) changelog."; + +# +# Start with Custom changelog (if any) +if [ -n "" ]; then + if [ -f .changelog ]; then + cat .changelog \ + >> build/debian/changelog; + fi; + fi; + +# +# Create a combined changelog *IFF* we have the pieces/parts... +if [ ! -d private/changelogs ]; then + cat changelog >>build/debian/changelog; +else + # + # v.r.m changelogs + if [ -f private/changelogs/8.14.2 ]; then + cat private/changelogs/8.14.2 \ + >> build/debian/changelog; + # + # v.r changelogs + elif [ -f private/changelogs/8.14 ]; then + cat private/changelogs/8.14 >> build/debian/changelog; + + # + # v changelogs + elif [ -f private/changelogs/8 ]; then + cat private/changelogs/8 >> build/debian/changelog; + fi; + # + # Variable definitions + cat private/changelogs/vars >> build/debian/changelog; + fi; + +# +# Update 1st line to add --with-custom (defaults to null) +if [ -z "" ]; then + mv build/debian/changelog build/debian/changelog.in; +else + sed \ + -e '1s/sendmail (8.14.2-/sendmail (8.14.2-/' \ + -e '1s/sendmail (.8.14.2-/sendmail (8.14.2-/' \ + build/debian/changelog \ + > build/debian/changelog.in; + rm build/debian/changelog; + fi; + diff --git a/debian/build/debian/control.m4 b/debian/build/debian/control.m4 new file mode 100644 index 0000000..48e878e --- /dev/null +++ b/debian/build/debian/control.m4 @@ -0,0 +1,262 @@ +dnl #-------------------------------------------------------------------------- +dnl # $Sendmail: control.m4,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +dnl # +dnl # Copyright (c) 1998-2007 Richard Nelson. All Rights Reserved. +dnl # +dnl # build/debian/control.m4. Generated from control.m4.in by configure. +dnl # +dnl # Debian control.m4 for sendmail 8.14.2-1(527874) +dnl # +dnl # Note: the .in file supports 8.7.6 - 9.0.0, but the generated +dnl # file is customized to the version noted above. +dnl # +dnl # Note: Exercise care in the feeding of this file, especially wrt quoting! +dnl # +dnl #-------------------------------------------------------------------------- +changequote([[, ]])dnl +dnl # +dnl # The source package description +dnl # Always built +dnl # +[[Source: sendmail +Priority: extra +Section: mail +Maintainer: Richard A Nelson (Rick) <cowboy@debian.org> +Standards-Version: 3.7.2 +]]dnl # Sigh... build daemons ignore B-D-I, so replicate in B-D :( +[[Build-Depends-Indep: groff, bsdmainutils +Build-Depends: make (>> 3.79.1-14), m4, cdbs, patchutils, dh-buildinfo, debhelper (>= 5), linux-libc-dev (>= 2.6.21-3) | linux-kernel-headers, groff, bsdmainutils , libdb4.6-dev, libldap2-dev, libwrap0-dev, liblockfile-dev, libsasl2-dev, libssl-dev +Build-Conflicts: libbind-dev, bind-dev, fakeroot (<< 0.4.5) +Homepage: http://www.sendmail.org]]dnl +dnl # +dnl # The arch=any package: sendmail-bin +dnl # Always built +dnl # +[[ + +Package: sendmail-bin +Architecture: any +Section: mail +Replaces: mail-transport-agent +Provides: mail-transport-agent +Conflicts: mail-transport-agent +Depends: sendmail-base, sendmail-cf, ${shlibs:Depends}, ${perl:Depends} +Recommends: +Suggests: sendmail-doc, , sasl2-bin, libsasl2-modules | libsasl2-modules-plain | libsasl2-digestmd5-plain | libsasl2-digestmd5-des, openssl, cyrus-common +Description: powerful, efficient, and scalable Mail Transport Agent + Sendmail is an alternative Mail Transport Agent (MTA) for Debian. + It is suitable for handling sophisticated mail configurations, + although this means that its configuration can also be complex. + . + Fortunately, simple thing can be done easily, and complex things + are possible, even if not easily understood ;) Sendmail is the *ONLY* + MTA with a Turing complete language to control *ALL* aspects of delivery! + . + Sendmail provides Security and SPAM/UCE/UBE protection via several means. + . + Sendmail includes *no* Mail User Agents (MUA), you'll have to + pick from the plethora of available MUAs (mutt, vm, etc.) + . + This package supports REGEX, DB, NIS, NIS+, LDAP, DNS maps, + and has enabled TCPWrappers, IPv6, LockFile, SMTP AUTH(SASL), STARTTLS(SSL). + . +Homepage: http://www.sendmail.org]]dnl +dnl # +dnl # The arch=any package: rmail +dnl # Always built +dnl # +[[ + +Package: rmail +Architecture: any +Section: mail +Conflicts: sendmail (<< 8.13.1-7), postfix, exim, exim-tls, exim4-daemon-custom, exim4-daemon-heavy, exim4-daemon-light, courier-mta, smail, zmailer +Depends: sendmail-bin | mail-transport-agent, ${shlibs:Depends} +Description: MTA->UUCP remote mail handler + Rmail handles mail received via uucp and passes it to the local + sendmail (or workalike). + . + This version comes from the sendmail source package and the only + change is the call to sendmail (from -obq to -obi). + . +Homepage: http://www.sendmail.org]]dnl +dnl # +dnl # The arch=any package: sensible-mda (debian private) +dnl # Always built +dnl # +[[ + +Package: sensible-mda +Architecture: any +Section: mail +Depends: sendmail-bin | mail-transport-agent, procmail | maildrop | deliver, ${shlibs:Depends} +Description: Mail Delivery Agent wrapper + Sensible-mda is a Debian addition in the sendmail package and has been + split out in hopes that it might be useful for other MTA packages. + . + Sensible-mda is called by the MTA, and will in turn call whichever of + the following MDAs that it finds (in this order): + procmail, maildrop, deliver, mail.local]]dnl +dnl # +dnl # The arch=any package: libmilter +dnl # Only built if MILTER is enabled +dnl # +ifelse([[yes]], [[yes]], [[[[ + +Package: libmilter1 +Architecture: any +Section: libs +Depends: ${shlibs:Depends} +Description: Sendmail Mail Filter API (Milter) + The Sendmail Mail Filter API (Milter) is designed to allow third-party + programs access to mail messages as they are being processed in order + to filter meta-information(headers) and content. + . + The Debian Sendmail package is built to support libmilter. + . + This package contains libmilter.so + . +Homepage: http://www.sendmail.org + +Package: libmilter1-dbg +Architecture: any +Section: libs +Depends: libmilter1 (= ${binary:Version}), ${shlibs:Depends} +Description: Sendmail Mail Filter API (Milter) + The Sendmail Mail Filter API (Milter) is designed to allow third-party + programs access to mail messages as they are being processed in order + to filter meta-information(headers) and content. + . + The Debian Sendmail package is built to support libmilter. + . + This package contains debugging information for libmilter.so + . +Homepage: http://www.sendmail.org]]dnl +dnl # +dnl # The arch=any package: libmilter-dev +dnl # Only built if MILTER is enabled +dnl # +[[ + +Package: libmilter-dev +Architecture: any +Section: libdevel +Depends: libmilter1 (= ${binary:Version}) +Suggests: sendmail-doc +Description: Sendmail Mail Filter API (Milter) + The Sendmail Mail Filter API (Milter) is designed to allow third-party + programs access to mail messages as they are being processed in order + to filter meta-information (headers) and content. + . + The Debian Sendmail package is built to support libmilter. + . + This is the libmilter static library and include files for development. + . + The documentation on building a Milter is in the sendmail-doc package. + . +Homepage: http://www.sendmail.org]]]])dnl +dnl # +dnl # The arch=all package: sendmail-doc +dnl # Always built +dnl # +[[ + +Package: sendmail-doc +Architecture: all +Section: doc +Description: powerful, efficient, and scalable Mail Transport Agent + Sendmail is an alternative Mail Transport Agent (MTA) for + Debian. It is suitable for handling sophisticated mail + configurations, although this means that its configuration + can also be complex. + . + Don't try anything fancy in sendmail without using this for guidance. + . + Because of the complexity, you may find yourself wanting to peruse + the documentation files included herein. The main files are: + cf.README.gz -- A reference for all things in sendmail.{mc,cf} + op.{ps,txt}.gz -- The care and feeding of Sendmail. + faq.txt.gz -- Sendmail FAQ, current as of the package date. + . + Other files include the references for smrsh and libmilter. + . +Homepage: http://www.sendmail.org]]dnl +dnl # +dnl # The arch=all package: sendmail +dnl # Always built +dnl # +[[ + +Package: sendmail +Architecture: all +Section: mail +Replaces: sendmail-tls +Depends: sendmail-base, sendmail-bin, sendmail-cf, sensible-mda +Suggests: sendmail-doc, rmail +Description: powerful, efficient, and scalable Mail Transport Agent + Sendmail is an alternative Mail Transport Agent (MTA) for Debian. + It is suitable for handling sophisticated mail configurations, + although this means that its configuration can also be complex. + . + Fortunately, simple thing can be done easily, and complex things + are possible, even if not easily understood ;) Sendmail is the *ONLY* + MTA with a Turing complete language to control *ALL* aspects of delivery! + . + Sendmail provides Security and SPAM/UCE/UBE protection via several means. + . + Sendmail includes *no* Mail User Agents (MUA), you'll have to + pick from the plethora of available MUAs (mutt, vm, etc.) + . + This package supports REGEX, DB, NIS, NIS+, LDAP, DNS maps, + and has enabled TCPWrappers, IPv6, LockFile, SMTP AUTH(SASL), STARTTLS(SSL). + . + This package is to make installation/upgrading easier (Do NOT delete it) + . +Homepage: http://www.sendmail.org]]dnl +dnl # +dnl # The arch=all package: sendmail-base +dnl # Always built +dnl # +[[ + +Package: sendmail-base +Architecture: all +Section: mail +Depends: m4, make, adduser, ${perl:Depends} +Suggests: sendmail-doc, ca-certificates, logcheck, logrotate, resolvconf +Description: powerful, efficient, and scalable Mail Transport Agent + Sendmail is an alternative Mail Transport Agent (MTA) for + Debian. It is suitable for handling sophisticated mail + configurations, although this means that its configuration + can also be complex. + . + This package contains the base, architecture independent, portions + of the sendmail packages. + . +Homepage: http://www.sendmail.org]]dnl +dnl # +dnl # The arch=all package: sendmail-cf +dnl # Always built +dnl # +[[ + +Package: sendmail-cf +Architecture: all +Section: mail +Suggests: sendmail-doc +Depends: m4 +Description: powerful, efficient, and scalable Mail Transport Agent + Sendmail is an alternative Mail Transport Agent (MTA) for + Debian. It is suitable for handling sophisticated mail + configurations, although this means that its configuration + can also be complex. + . + This package contains the .m4 (configuration files) for the + sendmail packages. + . +Homepage: http://www.sendmail.org]]dnl +dnl # +dnl # Provide the requisite trailing newline +dnl # + + diff --git a/debian/build/site.config.m4 b/debian/build/site.config.m4 new file mode 100644 index 0000000..abd1f41 --- /dev/null +++ b/debian/build/site.config.m4 @@ -0,0 +1,241 @@ +#----------------------------------------------------------------------------- +# $Sendmail: site.config.m4,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Copyright (c) 1998-2007 Richard Nelson. All Rights Reserved. +# +# build/site.config.m4. Generated from site.config.m4.in by configure. +# +# Debian site.config.m4 for sendmail 8.14.2-1(527874) +# +# Note: the .in file supports 8.7.6 - 9.0.0, but the generated +# file is customized to the version noted above. +# +#----------------------------------------------------------------------------- +# +#------------------------------------------------------------------ +# Sendmail 8.14.2-1(527874) on 2007-11-02 at 22:20:56 (+0000) +#------------------------------------------------------------------ +# +#------------------------------------------------------------------ +# The following sendmail features are included +#------------------------------------------------------------------ +#REGEX: yes +#NDBM: no +#NEWDB: yes -ldb-4.6 +#NIS: yes +#NISPLUS: yes +#LDAP: yes -lldap -llber +#HESIOD: no +#TCPD: yes +#BIND: no +#IPv6: yes +#Maillock: yes +#MILTER: yes +#SFIO: no +#AUTH: yes 2 +#TLS: yes +#SHM: yes +#FFRs: -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 +#M4_FFRs: define(`_FFR_MAIL_MACRO') +# +#------------------------------------------------------------------ +# Packages and build dependancies (Debian packages) +#------------------------------------------------------------------ +#Sendmail: sendmail +#Build-Depends: , libdb4.6-dev, libldap2-dev, libwrap0-dev, liblockfile-dev, libsasl2-dev, libssl-dev +#Depends: +#Recommends: +#Suggests: , sasl2-bin, libsasl2-modules | libsasl2-modules-plain | libsasl2-digestmd5-plain | libsasl2-digestmd5-des, openssl +# +#------------------------------------------------------------------ +# Build Setup +#------------------------------------------------------------------ +#Autoconf version: 2.61 +#Automake version: 1.10 +#DEBIAN_DH(DebHelper): 4.1 internal use(not reliable) +# +#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 +# +#------------------------------------------------------------------ +# Autoconf variable settings defaults +#------------------------------------------------------------------ +#prefix: /usr /usr/local +#exec_prefix: /usr ${prefix} +#bindir: /usr/bin ${exec_prefix}/bin +#sbindir: /usr/sbin ${exec_prefix}/sbin +#libexecdir: /usr/lib/sm.bin ${exec_prefix}/libexec +#datadir: /usr/share ${prefix}/share +#sysconfdir: /etc ${prefix}/etc +#sharedstatedir: /usr/com ${prefix}/com +#localstatedir: /var ${prefix}/var +#libdir: /usr/lib ${exec_prefix}/var +#includedir: /usr/include ${prefix}/include +#oldincludedir: /usr/include /usr/include +#infodir: /usr/share/info ${prefix}/info +#mandir: /usr/share/man ${prefix}/man +#docdir: /usr/share/doc ${prefix}/doc +#srcdir: . configure or .. +# +#------------------------------------------------------------------ +# Build options for the various pieces parts of sendmail +#------------------------------------------------------------------ +# +# Make sure defaults are sound... +define(`confLIBS', `')dnl # was -ldl +# +# global +APPENDDEF(`confINCDIRS', ` ') +APPENDDEF(`confMAPDEF', ` -DSOCKETMAP -DMAP_REGEX -DNEWDB -DNIS -DNISPLUS -DLDAPMAP') +APPENDDEF(`confENVDEF', ` -DHASFCHMOD=1 -DHASSETRLIMIT=1 -DHASFLOCK=0 -DUSESETEUID=1 -DHASGETUSERSHELL=1 -DNETINET6') +APPENDDEF(`confLIBS', `') +# +# editmap +APPENDDEF(`conf_editmap_ENVDEF', `') +APPENDDEF(`conf_editmap_LIBS', ` -ldb-4.6 -lldap -llber') +# +# libmilter +APPENDDEF(`conf_libmilter_ENVDEF', `-fPIC -DSM_CONF_POLL=1 -D_FFR_MULTILINE -D_FFR_SMFI_PROGRESS') +APPENDDEF(`conf_libmilter_LIBS', `') +# +# libsm +APPENDDEF(`conf_libsm_ENVDEF', `-fPIC -DHAVE_NANOSLEEP=1 -D_LDAP_EXAMPLE_ -DLDAP_REFERRALS -D_FFR_LDAP_URI -D_FFR_LDAP_SETVERSION -DSM_CONF_LDAP_MEMFREE') +APPENDDEF(`conf_libsm_LIBS', ` -lldap -llber') +# +# libsmdb +APPENDDEF(`conf_libsmdb_ENVDEF', `') +APPENDDEF(`conf_libsmdb_LIBS', `') +# +# libsmutil +APPENDDEF(`conf_libsmutil_ENVDEF', `-fPIC') +APPENDDEF(`conf_libsmutil_LIBS', `') +# +# mail.local +APPENDDEF(`conf_mail_local_ENVDEF', ` -DCONTENTLENGTH -DMAILLOCK') +APPENDDEF(`conf_mail_local_LIBS', ` -lldap -llber -llockfile') +# +# mailstats +APPENDDEF(`conf_mailstats_ENVDEF', `') +APPENDDEF(`conf_mailstats_LIBS', ` -lldap -llber') +# +# makemap +APPENDDEF(`conf_makemap_ENVDEF', `') +APPENDDEF(`conf_makemap_LIBS', ` -ldb-4.6 -lldap -llber') +# +# praliases +APPENDDEF(`conf_praliases_ENVDEF', `') +APPENDDEF(`conf_praliases_LIBS', ` -ldb-4.6 -lldap -llber') +# +# rmail +APPENDDEF(`conf_rmail_ENVDEF', `') +APPENDDEF(`conf_rmail_LIBS', ` -lldap -llber') +# +# sendmail +APPENDDEF(`conf_sendmail_ENVDEF', ` -D_PATH_SENDMAILPID=\"/var/run/sendmail/mta/sendmail.pid\" -DIP_SRCROUTE=1 -DLDAP_REFERRALS -D_FFR_LDAP_URI -D_FFR_LDAP_SETVERSION -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') +APPENDDEF(`conf_sendmail_LIBS', ` -ldb-4.6 -lnsl -lldap -llber -lresolv -lwrap -lsasl2 -lcrypto -lssl') +# +# smrsh +APPENDDEF(`conf_smrsh_ENVDEF', ` -DCMDDIR=\"/etc/mail/smrsh\" -DPATH=\"/usr/bin:/bin\"') +APPENDDEF(`conf_smrsh_LIBS', ` -lldap -llber') +# +# vacation +APPENDDEF(`conf_vacation_ENVDEF', `') +APPENDDEF(`conf_vacation_LIBS', ` -ldb-4.6 -lldap -llber') +# +#------------------------------------------------------------------ +# Build-time selection not handled by autoconf above +#------------------------------------------------------------------ +# none, for the nonce... +# +#------------------------------------------------------------------ +# Global Build time configuration +#------------------------------------------------------------------ +# compilation/link +define(`confCC', `cc')dnl #Compiler +define(`confOPTIMIZE', `-g -Wall -O2 -fPIC -fstack-protector-all')dnl #Optimization +define(`confCCOPTS', `')dnl #CC options +define(`confCCOPTS_SO' `-fPIC')dnl #Shared libraries +define(`confLD', confCC)dnl #Linker +define(`confLDOPTS', `-pie -Wl,-z,noexecstack,-z,relro,-z,now -Wl,--warn-shared-textrel')dnl #Linker opts +define(`confLDOPTS_SO', `-shared -fPIC -pie -Wl,-z,noexecstack,-z,relro,-z,now -Wl,--warn-shared-textrel')dnl #linker shared lib +define(`confLIBDIRS', `')dnl #-L linker flags +define(`confMTCCOPTS', `-D_REENTRANT')dnl #Multi-thread cc opts +define(`confMTLDOPTS', `-lpthread')dnl #Multi-thread ld opts +define(`confSHAREDLIB_EXT', `.so')dnl # +define(`confSHAREDLIB_SUFFIX', `')dnl # +define(`confSHAREDLIBDIR', `/usr/lib')dnl # +define(`confSONAME',`-soname')dnl # +# +# paths, owners, and modes +# Note: can't use smmsp here, it is dynamically created +# Note: EBINDIR deserves a better home, suggestions? +define(`confEBINDIR', `/usr/lib/sm.bin')dnl #mail.local,smrsh,etc. +define(`confGBINGRP', `mail')dnl #sgid binary group smmsp +define(`confGBINMODE', `02755')dnl #sgid binary mode +define(`confGBINOWN', `root')dnl #sgid binary owner +define(`confHFDIR', `/etc/mail')dnl #helpfile dir +define(`confHFFILE', `helpfile')dnl #helpfile name +define(`confINCGRP', `root')dnl #include group +define(`confINCMODE', `0744')dnl #include mode +define(`confINCOWN', `root')dnl #include owner +ifelse(eval(527874 >= 527363), `1',dnl +`define(`confINCLUDEDIR',`/usr/include')dnl #include target', +`define(`confINCLUDEDIR',`/usr/include/libmilter')dnl #include target' +)dnl +define(`confINST_DEP', `')dnl #submit.cf clientmqueue +define(`confLIBDIR', `/usr/lib/libmilter')dnl #library dir +define(`confLIBGRP', `root')dnl #library group +define(`confLIBMODE', `0744')dnl #library mode +define(`confLIBOWN', `root')dnl #library owner +define(`confMANROOT', `/usr/share/man/man')dnl #man root +define(`confMANROOTMAN',`/usr/share/man/man')dnl #man root +define(`confMANGRP', `root')dnl #man group +define(`confMANMODE', `0744')dnl #man mode +define(`confMANOWN', `root')dnl #man owner +define(`confMBINDIR', `/usr/lib/sm.bin')dnl #MTA bindir /usr/sbin +define(`confMBINGRP', `root')dnl #MTA bin grp +define(`confMBINMODE', `0755')dnl #MTA bin mode +define(`confMBINOWN', `root')dnl #MTA bin owner +define(`confMSPQOWN', `mail')dnl #MSP queue owner smmsp +define(`confMSP_QUEUE_DIR', `/var/spool/mqueue-client')dnl +define(`confSBINDIR', `/usr/lib/sm.bin')dnl #suid bin dir /usr/sbin +define(`confSBINGRP', `root')dnl #suid bin grp +define(`confSBINMODE', `04755')dnl #suid bin mode +define(`confSBINOWN', `root')dnl #suid bin owner +# Note, STDIR in /var/lib/sendmail... default is /var/spool/mqueue +define(`confSTDIR', `/var/lib/sendmail')dnl #Statistics dir +define(`confSTFILE', `statistics')dnl #statistics name +define(`confMSP_STFILE',`sm-client.st')dnl #MSP statistics name +define(`confSTMODE', `0660')dnl #statistics mode +define(`confUBINDIR', `/usr/lib/sm.bin')dnl #usr bin dir /usr/bin +define(`confUBINGRP', `mail')dnl #usr bin grp smmsp +define(`confUBINMODE', `0755')dnl #usr bin mode +define(`confUBINOWN', `root')dnl #usr bin owner +# +# don't provide links, I'll do them myself later +# sigh... must have something in there or $(make install) croaks -- temp file +define(`confLINKS', `sendmail-bin')dnl +define(`confMTA_LINKS')dnl +# +# Force rmail installation +define(`confFORCE_RMAIL')dnl +# +# don't install formatted man pages or sendmail.st +dnl define(`confNO_MAN_INSTALL')dnl +dnl define(`confNO_MAN_BUILD')dnl +define(`confINSTALL_RAWMAN')dnl +define(`confDONT_INSTALL_CATMAN', `')dnl # for 8.12 +define(`confMANDOC', `')dnl # for 8.9.3 +define(`confNROFF', `cat')dnl # for 8.9.3 +define(`confNO_STATISTICS_INSTALL')dnl +# +# flags +# +# Tests (should be temporary) +# diff --git a/debian/build/update_chaos b/debian/build/update_chaos new file mode 100644 index 0000000..5559766 --- /dev/null +++ b/debian/build/update_chaos @@ -0,0 +1,202 @@ +#!/bin/sh +#----------------------------------------------------------------------------- +# $Sendmail: update_chaos,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Copyright (c) 2001-2007 Richard Nelson. All Rights Reserved. +# +# build/update_chaos. Generated from update_chaos.in by configure. +# +# Debian script to rationalize builds for Sendmail 8.14.2-1(@sm_math@) +# +# Note: the .in file supports 8.7.6 - 9.0.0, but the generated +# file is customized to the version noted above. +# +#----------------------------------------------------------------------------- +set -e; + +#------------------------------------------------------------------ +# Exit, stage left, even... if not needed (private dir, or >= 8.10.0) +#------------------------------------------------------------------ +BUILD_TREE='./../../build-tree/sendmail-8.14.2'; +if [ ! -d ${BUILD_TREE} ]; then + exit 0; + fi; +if [ -d ${BUILD_TREE}/devtools/bin ]; then + exit 0; + fi; + +echo "Rationalizing Sendmail-8.14.2 setup..."; + +#------------------------------------------------------------------ +# List of subdirectories to work on +#------------------------------------------------------------------ +SUBDIRS="editmap libmilter mail.local mailstats + makemap praliases rmail sendmail smrsh vacation"; + +#------------------------------------------------------------------ +# Match Sendmail's build directory conventions +#------------------------------------------------------------------ +os=`uname -s | sed -e 's/\//-/g' -e 's/ //g'`; +rel=`uname -r | sed -e 's/(/-/g' -e 's/)//g'`; +arch=`uname -m | sed -e 's/ //g'`; +OBJ_DIR="obj.${os}.${rel}.${arch}"; + +#------------------------------------------------------------------ +# Function to escape quotes (to survive subsequent sed) +#------------------------------------------------------------------ +esq () { + result=$(echo "${1}" | sed -e 's?\"?\\\\\\\"?g'); + }; + +#------------------------------------------------------------------ +# Prior to 8.10.0, sendmail source was in the src directory +# Prior to 8.10.0, devtools was called BuildTools +# Create compatibility links (to look like 8.10.0+) +#------------------------------------------------------------------ +if [ ! -d ${BUILD_TREE}/sendmail ]; then + echo "...Creating \${BUILD_TREE}/sendmail compatibility symlink"; + ln -sf src ${BUILD_TREE}/sendmail; + if [ ! -d ${BUILD_TREE}/devtools ]; then + echo "...Creating \${BUILD_TREE}/devtools compatibility symlink"; + ln -sf BuildTools ${BUILD_TREE}/devtools; + fi; + fi; + +#------------------------------------------------------------------ +# Prior to 8.10.0, objects were in the source directories, not separate +# Create compatibility links (to look like 8.10.0+) +#------------------------------------------------------------------ +echo "...Creating ${OBJ_DIR}/<dir> directories"; +mkdir -p ${BUILD_TREE}/${OBJ_DIR}; +for subdir in $SUBDIRS; do + if [ -d ${BUILD_TREE}/${subdir} ]; then + ln -sf "../${subdir}/${OBJ_DIR}" \ + ${BUILD_TREE}/${OBJ_DIR}/${subdir}; + fi; + done; + +#------------------------------------------------------------------ +# If 8.9.0+, we're done, get the flock outa here... +#------------------------------------------------------------------ +if [ -e ${BUILD_TREE}/sendmail/Build ]; then + echo '...Done.'; + exit 0; + fi; + +#------------------------------------------------------------------ +# Prior to 8.9.0, READ_ME was seen in a few places +# Create compatibility links +#------------------------------------------------------------------ +echo '...Creating READ_ME compatility symlinks'; +for file in $(find ${BUILD_TREE} -name 'READ_ME'); do + ln -sf READ_ME $(echo "${file}" | sed -e 's/READ_ME/README/'); + done; + +#------------------------------------------------------------------ +# Prior to 8.9.0, MAKE was used instead of Build +# We'll install a small wrapper for the earlier releases +# Prior to 8.9.0, Only src directory had an obj.* subdirectory +# Create compatibility links (to look like 8.9.0+) +#------------------------------------------------------------------ +echo "...Creating <dir>/${OBJ_DIR}"; +for subdir in $SUBDIRS; do + if [ -d ${BUILD_TREE}/${subdir} ]; then + if [ ! -d ${BUILD_TREE}/${subdir}/Makefiles ]; then + mkdir -p ${BUILD_TREE}/${subdir}/${OBJ_DIR}; + for file in `find ${BUILD_TREE}/${subdir} -type f`; do + cp -a $file ${BUILD_TREE}/${subdir}/${OBJ_DIR}; + done; + fi; + cp -a debian/build/Build ${BUILD_TREE}/${subdir}/; + fi; + done; +# +#------------------------------------------------------------------ +# Kluge the Makefiles to comply with our file locations. +#------------------------------------------------------------------ +echo '...Kluging Makefiles'; +for file in mailstats/Makefile.dist \ + mail.local/Makefile.dist \ + makemap/Makefile.dist \ + praliases/Makefile.dist \ + smrsh/Makefile.dist \ + src/Makefiles/Makefile.Linux \ + ; do + cp -a ${BUILD_TREE}/${file} ${BUILD_TREE}/${file}.save; + # + # Set local variables to allow for quoting... + esq " "; + sm_incdirs=$result; + esq " -DSOCKETMAP -DMAP_REGEX -DNEWDB -DNIS -DNISPLUS -DLDAPMAP"; + sm_mapdef=$result; + esq " -DHASFCHMOD=1 -DHASSETRLIMIT=1 -DHASFLOCK=0 -DUSESETEUID=1 -DHASGETUSERSHELL=1 -DNETINET6"; + sm_envdef=$result; + esq ""; + sm_libs=$result; + # + # global + sed \ + -e 's?-I/usr/sww/include??' \ + -e 's?-I/usr/local/include??' \ + -e 's?-L/usr/sww/lib??' \ + -e 's?../src?../../src?g' \ + -e "s?^INCDIRS=\(.*\)\$?INCDIRS=\1 $sm_incdirs?" \ + -e "s?^DBMDEF=.*?DBMDEF=$sm_mapdef?" \ + -e "s?^ENVDEF=\(.*\)\$?ENVDEF=\1 $sm_envdef?" \ + -e "s?^LIBS=.*?LIBS=$sm_libs?" \ + ${BUILD_TREE}/${file} > ${BUILD_TREE}/${file}.new; + mv ${BUILD_TREE}/${file}.new ${BUILD_TREE}/${file}; + # + # compilation/link + sed \ + -e 's?^O=.*?O=-g -Wall -O2 -fPIC -fstack-protector-all?' \ + -e 's?^LIBDIRS=.*?LIBDIRS=?' \ + ${BUILD_TREE}/${file} > ${BUILD_TREE}/${file}.new; + mv ${BUILD_TREE}/${file}.new ${BUILD_TREE}/${file}; + + # + # paths, owners, and modes + # Note: EBINDIR deserves a better home, suggestions? + sed \ + -e 's?^BINDIR=.*?BINDIR=${DESTDIR}/usr/sbin?' \ + -e 's?^BINMODE=.*?BINMODE=04755?' \ + -e 's?^BINGRP=.*?BINGRP=mail?' \ + -e 's?^BINOWN=.*?BINOWN=root?' \ + -e 's?^HFDIR=.*?HFDIR=${DESTDIR}/etc/mail?' \ + -e 's?^STDIR=.*?STDIR=${DESTDIR}/var/lib/sendmail?' \ + ${BUILD_TREE}/${file} > ${BUILD_TREE}/${file}.new; + mv ${BUILD_TREE}/${file}.new ${BUILD_TREE}/${file}; + + if [ "${file}" = 'mail.local/Makefile.dist' \ + -o "${file}" = 'smrsh/Makefile.dist' \ + ]; then + sed \ + -e 's?^BINDIR=.*?BINDIR=${DESTDIR}/usr/lib/sm.bin?' \ + -e 's?^BINMODE=.*?BINMODE=04755?' \ + -e 's?^BINGRP=.*?BINGRP=mail?' \ + -e 's?^BINOWN=.*?BINOWN=root?' \ + ${BUILD_TREE}/${file} > ${BUILD_TREE}/${file}.new; + echo 'force-install: install' >> ${BUILD_TREE}/${file}.new; + mv ${BUILD_TREE}/${file}.new ${BUILD_TREE}/${file}; + + elif [ "${file}" = 'mailstats/Makefile.dist' \ + -o "${file}" = 'makemap/Makefile.dist' \ + -o "${file}" = 'praliases/Makefile.dist' \ + ]; then + sed \ + -e 's?^BINDIR=.*?BINDIR=${DESTDIR}/usr/sbin?' \ + -e 's?^BINMODE=.*?BINMODE=0755?' \ + -e 's?^BINGRP=.*?BINGRP=mail?' \ + -e 's?^BINOWN=.*?BINOWN=root?' \ + ${BUILD_TREE}/${file} > ${BUILD_TREE}/${file}.new; + mv ${BUILD_TREE}/${file}.new ${BUILD_TREE}/${file}; + fi; + + # For most directories, replace Makefile with our updated Makefile.dist + if [ "${file}" != 'src/Makefiles/Makefile.Linux' ]; then + cp ${BUILD_TREE}/${file} \ + $(dirname "${BUILD_TREE}/${file}")/${OBJ_DIR}/Makefile; + fi; + done; + +echo '...Done.'; diff --git a/debian/cf/Makefile b/debian/cf/Makefile new file mode 100644 index 0000000..5af2b2d --- /dev/null +++ b/debian/cf/Makefile @@ -0,0 +1,463 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# cf/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 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 = cf +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/./build/mkinstalldirs +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run aclocal-1.10 +AMTAR = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run tar +AUTOCONF = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run autoconf +AUTOHEADER = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run autoheader +AUTOMAKE = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run automake-1.10 +AWK = gawk +CC = cc +CCDEPMODE = depmode=none +CFLAGS = -g -Wall -O2 -fPIC -fstack-protector-all +CPP = cc -E +CPPFLAGS = +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.1\" -DPACKAGE_STRING=\"Sendmail\ 8.14.1\" -DPACKAGE_BUGREPORT=\"bug/reportbug\ or\ sendmail@packages.debian.org\" -DPACKAGE=\"sendmail\" -DVERSION=\"8.14.1\" -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_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 +LIBOBJS = +LIBS = +LN_S = ln -s +LTLIBOBJS = +MAINT = # +MAKEINFO = ${SHELL} /home/src/sendmail/sendmail-8.14.2/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.2 +PACKAGE_TARNAME = sendmail +PACKAGE_VERSION = 8.14.2 +PATH_SEPARATOR = : +SET_MAKE = +SHELL = /bin/sh +SM_CPYRT = 2007 +SM_DATE = 2007-10-04 21:42:00 +SM_MAXVERS = 9.0.0 +SM_MINVERS = 8.7.6 +SM_VERS = 8.14.1 +STRIP = +VERSION = 8.14.1 +abs_builddir = /home/src/sendmail/sendmail-8.14.2/debian/cf +abs_srcdir = /home/src/sendmail/sendmail-8.14.2/debian/cf +abs_top_builddir = /home/src/sendmail/sendmail-8.14.2/debian +abs_top_srcdir = /home/src/sendmail/sendmail-8.14.2/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.2 +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.2/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 = 2007-11-02 +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 +sm_libs = +sm_libsm_envdef = -fPIC -DHAVE_NANOSLEEP=1 -D_LDAP_EXAMPLE_ -DLDAP_REFERRALS -D_FFR_LDAP_URI -D_FFR_LDAP_SETVERSION -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 -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 | libsasl2-modules-plain | libsasl2-digestmd5-plain | libsasl2-digestmd5-des, openssl +sm_time = 22:20:56 +sm_utc = +0000 +sm_vacation_envdef = +sm_vacation_libs = -ldb-4.6 -lldap -llber +sm_version = 8.14.2 +sm_version_beta = +sm_version_major = 8.14 +sm_version_math = 527874 +sm_version_minor = 2 +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.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Copyright (c) 1998-2007 Richard Nelson. All Rights Reserved. +# +# cf/Makefile. Generated from Makefile.in by configure. +# +# Rules file for Sendmail 8.14.2-1(527874) +# 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> 2007-11-02 22:20:56 (+0000) +#------------------------------------------------------------------------------ +# +# Shipped data +# +# Installed cf subdirectories +CF_DIRS = cf debian domain feature hack m4 mailer ostype +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 cf/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu cf/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 +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 +installdirs: +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: + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-data-hook + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +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: + +.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-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man 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 + +# +# Local customisation... not automake friendly +# +install-data-hook: + $(INSTALL) -d ${DESTDIR}${pkgdatadir}/cf; + cp -a ${top_srcdir}/../${buildtree}/cf/* ${DESTDIR}${pkgdatadir}/cf; + chmod a+x ${DESTDIR}${pkgdatadir}/cf/sh/makeinfo.sh; + $(RM) ${DESTDIR}${pkgdatadir}/cf/README; + $(RM) ${DESTDIR}${pkgdatadir}/cf/sendmail.schema; + $(RM) ${DESTDIR}${pkgdatadir}/cf/cf/Build; + $(RM) ${DESTDIR}${pkgdatadir}/cf/cf/Makefile; + $(RM) ${DESTDIR}${pkgdatadir}/cf/cf/*.cf; + for dir in ${CF_DIRS}; do \ + $(INSTALL) -d ${DESTDIR}${pkgdatadir}/cf/$$dir; \ + find $$dir -type f -name '*.mc' -o -name '*.m4' \ + | xargs -ri \ + $(INSTALL_DATA) '{}' ${DESTDIR}${pkgdatadir}/cf/'{}'; \ + done; + if [ -f ${top_srcdir}/../${buildtree}/contrib/domainmap.m4 ]; then \ + $(INSTALL_DATA) ${top_srcdir}/../${buildtree}/contrib/domainmap.m4 \ + ${DESTDIR}${pkgdatadir}/cf/feature; \ + fi; + if [ -f ${top_srcdir}/../${buildtree}/contrib/dnsblaccess.m4 ]; then \ + $(INSTALL_DATA) ${top_srcdir}/../${buildtree}/contrib/dnsblaccess.m4 \ + ${DESTDIR}${pkgdatadir}/cf/hack; \ + fi; +# +# Debian targets, phase out (this needs to be treated as -arch, not -indep) +# +.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/cf/debian/autoconf.m4 b/debian/cf/debian/autoconf.m4 new file mode 100644 index 0000000..34d14f1 --- /dev/null +++ b/debian/cf/debian/autoconf.m4 @@ -0,0 +1,60 @@ +divert(-1)dnl +#----------------------------------------------------------------------------- +# $Sendmail: autoconf.m4,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Copyright (c) 2001-2007 Richard Nelson. All Rights Reserved. +# +# cf/debian/autoconf.m4. Generated from autoconf.m4.in by configure. +# +# m4 autoconf config file for building Sendmail 8.14.2-1 +# +# Note: the .in file supports 8.7.6 - 9.0.0, but the generated +# file is customized to the version noted above. +# +#----------------------------------------------------------------------------- +# +divert(0)dnl +VERSIONID(`$Id: autoconf.m4, v 8.14.2-1 2007-11-02 22:20:56 cowboy Exp $') +dnl # +dnl #--------------------------------------------------------------------- +dnl # Export (from autoconf to m4) some items of dubious value +dnl #--------------------------------------------------------------------- +define(`SM_VERS', `8.14.1')dnl +define(`SM_DATE', `2007-10-04 21:42:00')dnl +define(`SM_MINVERS', `8.7.6')dnl +define(`SM_MAXVERS', `9.0.0')dnl +define(`SM_CPYRT', `2007')dnl +define(`sm_date', `2007-11-02')dnl +define(`sm_time', `22:20:56')dnl +define(`sm_utc', `+0000')dnl +define(`sm_version', `8.14.2')dnl +define(`sm_revision', `-1')dnl +define(`sm_version_v', `8')dnl +define(`sm_version_r', `14')dnl +define(`sm_version_major', `8.14')dnl +define(`sm_version_minor', `2')dnl +define(`sm_version_beta', `')dnl +define(`sm_version_math', `527874')dnl +define(`sm_enable_regex', `yes')dnl +define(`sm_enable_ndbm', `no')dnl +define(`sm_enable_newdb', `yes')dnl +define(`sm_newdb_lib', `-ldb-4.6')dnl +define(`sm_enable_nis', `yes')dnl +define(`sm_enable_nisplus', `yes')dnl +define(`sm_enable_ldap', `yes')dnl +define(`sm_ldap_lib', `-lldap -llber')dnl +define(`sm_enable_hesiod', `no')dnl +define(`sm_hesiod_parms', `')dnl +define(`sm_enable_tcpd', `yes')dnl +define(`sm_enable_ipv6', `yes')dnl +define(`sm_enable_maillock',`yes')dnl +define(`sm_enable_milter', `yes')dnl +define(`sm_enable_sfio', `no')dnl +define(`sm_enable_auth', `yes')dnl +define(`sm_auth_lib', `2')dnl +define(`sm_enable_tls', `yes')dnl +define(`sm_enable_shm', `yes')dnl +define(`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')dnl +define(`sm_m4_ffr', ` define(`_FFR_MAIL_MACRO')')dnl +define(`sm_enable_dev', `@sm_enable_dev@')dnl +define(`sm_enable_doc', `@sm_enable_doc@')dnl diff --git a/debian/cf/debian/sendmail.mc b/debian/cf/debian/sendmail.mc new file mode 100644 index 0000000..157aa9b --- /dev/null +++ b/debian/cf/debian/sendmail.mc @@ -0,0 +1,104 @@ +divert(-1)dnl +#----------------------------------------------------------------------------- +# $Sendmail: debproto.mc,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Copyright (c) 1998-2007 Richard Nelson. All Rights Reserved. +# +# cf/debian/sendmail.mc. Generated from sendmail.mc.in by configure. +# +# sendmail.mc prototype config file for building Sendmail 8.14.2 +# +# Note: the .in file supports 8.7.6 - 9.0.0, but the generated +# file is customized to the version noted above. +# +# This file is used to configure Sendmail for use with Debian systems. +# +# If you modify this file, you will have to regenerate /etc/mail/sendmail.cf +# by running this file through the m4 preprocessor via one of the following: +# * `sendmailconfig` +# * `make` +# * `m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf` +# The first two options are preferred as they will also update other files +# that depend upon the contents of this file. +# +# The best documentation for this .mc file is: +# /usr/share/doc/sendmail-doc/cf.README.gz +# +#----------------------------------------------------------------------------- +divert(0)dnl +# +# Copyright (c) 1998-2005 Richard Nelson. All Rights Reserved. +# +# This file is used to configure Sendmail for use with Debian systems. +# +define(`_USE_ETC_MAIL_')dnl +include(`/usr/share/sendmail/cf/m4/cf.m4')dnl +VERSIONID(`$Id: sendmail.mc, v 8.14.2-1 2007-11-02 22:20:56 cowboy Exp $') +OSTYPE(`debian')dnl +DOMAIN(`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 +dnl # +dnl # General defines +dnl # +dnl # SAFE_FILE_ENV: [undefined] If set, sendmail will do a chroot() +dnl # into this directory before writing files. +dnl # If *all* your user accounts are under /home then use that +dnl # instead - it will prevent any writes outside of /home ! +dnl # define(`confSAFE_FILE_ENV', `')dnl +dnl # +dnl # Daemon options - restrict to servicing LOCALHOST ONLY !!! +dnl # Remove `, Addr=' clauses to receive from any interface +dnl # If you want to support IPv6, switch the commented/uncommentd lines +dnl # +FEATURE(`no_default_msa')dnl +dnl DAEMON_OPTIONS(`Family=inet6, Name=MTA-v6, Port=smtp, Addr=::1')dnl +DAEMON_OPTIONS(`Family=inet, Name=MTA-v4, Port=smtp, Addr=127.0.0.1')dnl +dnl DAEMON_OPTIONS(`Family=inet6, Name=MSP-v6, Port=submission, Addr=::1')dnl +DAEMON_OPTIONS(`Family=inet, Name=MSP-v4, Port=submission, Addr=127.0.0.1')dnl +dnl # +dnl # Be somewhat anal in what we allow +define(`confPRIVACY_FLAGS',dnl +`needmailhelo,needexpnhelo,needvrfyhelo,restrictqrun,restrictexpand,nobodyreturn,authwarnings')dnl +dnl # +dnl # Define connection throttling and window length +define(`confCONNECTION_RATE_THROTTLE', `15')dnl +define(`confCONNECTION_RATE_WINDOW_SIZE',`10m')dnl +dnl # +dnl # Features +dnl # +dnl # use /etc/mail/local-host-names +FEATURE(`use_cw_file')dnl +dnl # +dnl # The access db is the basis for most of sendmail's checking +FEATURE(`access_db', , `skip')dnl +dnl # +dnl # The greet_pause feature stops some automail bots - but check the +dnl # provided access db for details on excluding localhosts... +FEATURE(`greet_pause', `1000')dnl 1 seconds +dnl # +dnl # Delay_checks allows sender<->recipient checking +FEATURE(`delay_checks', `friend', `n')dnl +dnl # +dnl # If we get too many bad recipients, slow things down... +define(`confBAD_RCPT_THROTTLE',`3')dnl +dnl # +dnl # Stop connections that overflow our concurrent and time connection rates +FEATURE(`conncontrol', `nodelay', `terminate')dnl +FEATURE(`ratecontrol', `nodelay', `terminate')dnl +dnl # +dnl # If you're on a dialup link, you should enable this - so sendmail +dnl # will not bring up the link (it will queue mail for later) +dnl define(`confCON_EXPENSIVE',`True')dnl +dnl # +dnl # Dialup/LAN connection overrides +dnl # +include(`/etc/mail/m4/dialup.m4')dnl +include(`/etc/mail/m4/provider.m4')dnl +dnl # +dnl # Default Mailer setup +MAILER_DEFINITIONS +MAILER(`local')dnl +MAILER(`smtp')dnl + diff --git a/debian/cf/debian/submit.mc b/debian/cf/debian/submit.mc new file mode 100644 index 0000000..7d64506 --- /dev/null +++ b/debian/cf/debian/submit.mc @@ -0,0 +1,56 @@ +divert(-1)dnl +#----------------------------------------------------------------------------- +# $Sendmail: submit.mc,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Copyright (c) 2000-2007 Richard Nelson. All Rights Reserved. +# +# cf/debian/submit.mc. Generated from submit.mc.in by configure. +# +# submit.mc prototype config file for building Sendmail 8.14.2 +# +# Note: the .in file supports 8.7.6 - 9.0.0, but the generated +# file is customized to the version noted above. +# +# This file is used to configure Sendmail for use with Debian systems. +# +# If you modify this file, you will have to regenerate /etc/mail/submit.cf +# by running this file through the m4 preprocessor via one of the following: +# * `sendmailconfig` +# * `make` +# * `m4 /etc/mail/submit.mc > /etc/mail/submit.cf` +# The first two options are preferred as they will also update other files +# that depend upon the contents of this file. +# +# The best documentation for this .mc file is: +# /usr/share/doc/sendmail-doc/cf.README.gz +# +#----------------------------------------------------------------------------- +divert(0)dnl +# +# Copyright (c) 2000-2002 Richard Nelson. All Rights Reserved. +# +# This file is used to configure Sendmail for use with Debian systems. +# +define(`_USE_ETC_MAIL_')dnl +include(`/usr/share/sendmail/cf/m4/cf.m4')dnl +VERSIONID(`$Id: submit.mc, v 8.14.2-1 2007-11-02 22:20:56 cowboy Exp $') +OSTYPE(`debian')dnl +DOMAIN(`debian-msp')dnl +dnl # +dnl #--------------------------------------------------------------------- +dnl # Masquerading information, if needed, should go here +dnl # You likely will not need this, as the MTA will do it +dnl #--------------------------------------------------------------------- +dnl MASQUERADE_AS()dnl +dnl FEATURE(`masquerade_envelope')dnl +dnl # +dnl #--------------------------------------------------------------------- +dnl # The real reason we're here: the FEATURE(msp) +dnl #--------------------------------------------------------------------- +FEATURE(`msp', `[127.0.0.1]', `MSA')dnl +dnl # +dnl #--------------------------------------------------------------------- +dnl # Some minor cleanup from FEATURE(msp) +dnl #--------------------------------------------------------------------- +dnl # +dnl #--------------------------------------------------------------------- diff --git a/debian/cf/domain/debian-msp.m4 b/debian/cf/domain/debian-msp.m4 new file mode 100644 index 0000000..303401f --- /dev/null +++ b/debian/cf/domain/debian-msp.m4 @@ -0,0 +1,73 @@ +divert(-1)dnl +#----------------------------------------------------------------------------- +# $Sendmail: debian-msp.m4,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Copyright (c) 1998-2007 Richard Nelson. All Rights Reserved. +# +# cf/domain/debian-msp.m4. Generated from debian-msp.m4.in by configure. +# +# domain(debian-msp) config file for building Sendmail 8.14.2-1 +# +# Note: the .in file supports 8.7.6 - 9.0.0, but the generated +# file is customized to the version noted above. +# +#----------------------------------------------------------------------------- +# +divert(0)dnl +dnl # +dnl #--------------------------------------------------------------------- +dnl # Bring in Autoconf results +dnl #--------------------------------------------------------------------- +ifdef(`sm_version', `dnl', +`include(`/usr/share/sendmail/cf/debian/autoconf.m4')dnl') +dnl # +VERSIONID(`$Id: debian-msp.m4, v 8.14.2-1 2007-11-02 22:20:56 cowboy Exp $') +define(`DEBIAN_MSP')dnl +define(`confCF_VERSION', `Submit')dnl +dnl # +dnl # changes made herein *must* be reflected in parse_mc,update_db,debian.m4 +dnl # +define(`MSP_QUEUE_DIR', `/var/spool/mqueue-client')dnl +define(`STATUS_FILE', `/var/lib/sendmail/sm-client.st')dnl +dnl # +dnl # Since MSP only delivers to MTA, persistant status isn't needed +define(`confHOST_STATUS_DIRECTORY', `')dnl +dnl # +dnl # For FHS, we use a subdirectory in /var/run (multiple files) +dnl # For permissions, we use separate MSP/MTA subdirectories +define(`confPID_FILE', `/var/run/sendmail/msp/sendmail.pid')dnl +define(`confCONTROL_SOCKET_NAME', + `/var/run/sendmail/msp/smcontrol')dnl +dnl # +dnl # flags +define(`confPROCESS_TITLE_PREFIX', `MSP')dnl +define(`confNO_RCPT_ACTION', `add-to-undisclosed')dnl +define(`confRRT_IMPLIES_DSN', `False')dnl +define(`confSAFE_FILE_ENV', `/')dnl +define(`confSAFE_QUEUE', `True')dnl +define(`confQUEUE_FILE_MODE', `0660')dnl +define(`confTEMP_FILE_MODE', `0644')dnl +dnl # +dnl # Provide some 'more reasonable' timeout values +dnl # See SASL/TLS sections below for more timeout values +dnl # +define(`confTO_ICONNECT', `2s')dnl # rfc min= , def=5m +define(`confTO_MAIL', `2m')dnl # rfc min=5m, def=10m, too long +define(`confTO_DATAINIT', `2m')dnl # rfc min=2m, def=5m +define(`confTO_RSET', `1m')dnl # rfc min= , def=5m +define(`confTO_QUIT', `2m')dnl # rfc min= , def=2m +define(`confTO_COMMAND', `5m')dnl # rfc min=5m, def=1h +define(`confTO_IDENT', `5s')dnl # , def=5s, 0=skip +define(`confTO_HOSTSTATUS',`0')dnl # , def=30m +dnl # +dnl # by default, disable Message Submission Agent (8.10.0+) +ifelse(eval(sm_version_math >= 526848), `1',dnl +`FEATURE(`no_default_msa')') +dnl # +dnl # Mail Submission Program uid/gid +define(`confRUN_AS_USER', `smmsp')dnl +define(`confTRUSTED_USER', confRUN_AS_USER)dnl +dnl # +dnl # Optional items (should be a subset site.config.m4 used for build) +dnl # to prevent sendmail error messages +dnl # diff --git a/debian/cf/domain/debian-mta.m4 b/debian/cf/domain/debian-mta.m4 new file mode 100644 index 0000000..41b9657 --- /dev/null +++ b/debian/cf/domain/debian-mta.m4 @@ -0,0 +1,112 @@ +divert(-1)dnl +#----------------------------------------------------------------------------- +# $Sendmail: debian-mta.m4,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Copyright (c) 1998-2007 Richard Nelson. All Rights Reserved. +# +# cf/domain/debian-mta.m4. Generated from debian-mta.m4.in by configure. +# +# domain(debian-mta) config file for building Sendmail 8.14.2-1 +# +# Note: the .in file supports 8.7.6 - 9.0.0, but the generated +# file is customized to the version noted above. +# +#----------------------------------------------------------------------------- +# +divert(0)dnl +dnl # +dnl #--------------------------------------------------------------------- +dnl # Bring in Autoconf results +dnl #--------------------------------------------------------------------- +ifdef(`sm_version', `dnl' , +`include(`/usr/share/sendmail/cf/debian/autoconf.m4')dnl') +dnl # +VERSIONID(`$Id: debian-mta.m4, v 8.14.2-1 2007-11-02 22:20:56 cowboy Exp $') +define(`DEBIAN_MTA')dnl +dnl # +dnl # changes made herein *must* be reflected in parse_mc,update_db,debian.m4 +dnl # +define(`STATUS_FILE', `/var/lib/sendmail/sendmail.st')dnl +define(`confHOST_STATUS_DIRECTORY', + `/var/lib/sendmail/host_status')dnl +dnl # +dnl # For FHS, we use a subdirectory in /var/run (multiple files) +dnl # For permissions, we use separate MSP/MTA subdirectories +define(`confPID_FILE', `/var/run/sendmail/mta/sendmail.pid')dnl +define(`confCONTROL_SOCKET_NAME', + `/var/run/sendmail/mta/smcontrol')dnl +dnl # +dnl # flags +define(`confPROCESS_TITLE_PREFIX', `MTA')dnl +define(`confMAX_DAEMON_CHILDREN', `0')dnl +define(`confNO_RCPT_ACTION', `add-to-undisclosed')dnl +define(`confRRT_IMPLIES_DSN', `False')dnl +define(`confSAFE_FILE_ENV', `/')dnl +define(`confSAFE_QUEUE', `True')dnl +define(`confQUEUE_FILE_MODE', `0600')dnl +define(`confTEMP_FILE_MODE', `0600')dnl +dnl # +dnl # Provide some 'more reasonable' timeout values +dnl # See SASL/TLS sections below for more timeout values +dnl # +define(`confTO_ICONNECT', `2m')dnl # rfc min= , def=5m +define(`confTO_MAIL', `2m')dnl # rfc min=5m, def=10m, too long +define(`confTO_DATAINIT', `2m')dnl # rfc min=2m, def=5m +define(`confTO_RSET', `1m')dnl # rfc min= , def=5m +define(`confTO_QUIT', `2m')dnl # rfc min= , def=2m +define(`confTO_COMMAND', `5m')dnl # rfc min=5m, def=1h +define(`confTO_IDENT', `5s')dnl # , def=5s, 0=skip +dnl # +dnl RFC 2821 recommends a higher value for max-hop than the default(25) +define(`confMAX_HOP', `100')dnl +dnl # +dnl # Debian users have group writable directories/files by default (8.9.0+) +ifelse(eval(sm_version_math >= 526592), `1',dnl +`define(`confDONT_BLAME_SENDMAIL',dnl + defn(`confDONT_BLAME_SENDMAIL')`,AssumeSafeChown,ForwardFileInGroupWritableDirPath,GroupWritableForwardFileSafe,GroupWritableIncludeFileSafe,IncludeFileInGroupWritableDirPath')dnl' +)dnl +dnl # +dnl # Don't warn for non-existant forward files (8.10.0+) +ifelse(eval(sm_version_math >= 526848), `1',dnl +`define(`confDONT_BLAME_SENDMAIL',dnl + defn(`confDONT_BLAME_SENDMAIL')`,DontWarnForwardFileInUnsafeDirPath,TrustStickyBit,NonRootSafeAddr')dnl' +)dnl +dnl # +dnl # Allow group-writable include files (8.12.0+) +ifelse(eval(sm_version_math >= 527360), `1',dnl +`define(`confDONT_BLAME_SENDMAIL',dnl + defn(`confDONT_BLAME_SENDMAIL')`,GroupWritableIncludeFile,GroupReadableaDefaultAuthInfoFile')dnl' +)dnl +dnl # +dnl # by default, disable Message Submission Agent (8.10.0+) +dnl # except for 8.12.0+, where its needed for MSA ! +ifelse(eval(sm_version_math >= 526848), `1',dnl +`ifelse(eval(sm_version_math < 527360), `1',dnl +`FEATURE(`no_default_msa')',`dnl')') +dnl # +dnl # Allow mailq/hoststat to work with both MSP/MTA queues +ifelse(eval(sm_version_math >= 527360), `1',dnl +`define(`confQUEUE_FILE_MODE', `0640')dnl' +`define(`confTEMP_FILE_MODE', `0644')dnl') +dnl # +dnl # For security, we default to not letting lusers run the queues +dnl # If possible, we prevent sendmail -bv from reading things they shouldn't +dnl # +define(`confPRIVACY_FLAGS', `restrictqrun') +ifelse(eval(sm_version_math >= 527360), `1',dnl +`define(`confPRIVACY_FLAGS',dnl + defn(`confPRIVACY_FLAGS')`,restrictexpand')dnl') +dnl # +dnl # Define trusted user to be the new mta uid (smmta) +dnl # +ifdef(`confTRUSTED_USER',,`define(`confTRUSTED_USER',`smmta')dnl') +dnl # +dnl # Provide a more reasonable default for number of queue-runners +dnl # because many/most? people will not discover this themselves +dnl # and the sendmail default is one! +dnl # +define(`confMAX_RUNNERS_PER_QUEUE', `5')dnl +dnl # +dnl # Optional items (should be a subset site.config.m4 used for build) +dnl # to prevent sendmail error messages +dnl # diff --git a/debian/cf/hack/debian_auth.m4 b/debian/cf/hack/debian_auth.m4 new file mode 100644 index 0000000..833ae9a --- /dev/null +++ b/debian/cf/hack/debian_auth.m4 @@ -0,0 +1,47 @@ +divert(-1)dnl +#----------------------------------------------------------------------------- +# $Sendmail: debian_auth.m4,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Copyright (c) 2001-2007 Richard Nelson. All Rights Reserved. +# +# cf/hack/debian_auth.m4. Generated from debian_auth.m4.in by configure. +# +# debian_trustauth.m4 m4 file for +# * supporting MSP->MTA and MTA->MTA authentication +# * supporting the auth= parameter on the mail from: command. +# +# This file is an extremely simple example that lets *ALL* trusted users +# sendmail, daemon, root, uucp, etc. proxy for any user. +# +# If you've a better idea, please let me know +# +#----------------------------------------------------------------------------- +divert(0)dnl +VERSIONID(`$Id: debian_auth.m4,v 8.14.2-1 2007-11-02 22:20:56 cowboy Exp $') +dnl # +dnl # MTA as Client authentication - only if authinfo/access_db *NOT* used... +define(`confDEF_AUTH_INFO', `MAIL_SETTINGS_DIR`'default-auth-info')dnl +dnl # +dnl # add (fake) uid 'sendmail' to trusted users - it is used as the id +dnl # for MSP->MTA, and MTA->MTA proxying. +ifdef(`confTRUSTED_USERS', + `define(`confTRUSTED_USERS', + defn(`confTRUSTED_USERS')`,sendmail')', + `define(`confTRUSTED_USERS', `sendmail')')dnl +dnl # +dnl # Define local rulesets for trust_auth +LOCAL_RULESETS +# +#----------------------------------------------------------------------------- +# Local_trust_auth: Define who is able to authenticate for whom... +# The sendmail default is to allow *IFF* authen == author +# This ruleset also allows trusted users to authenicate as anyone - needed +# for MSP->MTA and MTA->MTA forwarding of mail from: <...> auth=... +SLocal_trust_auth +R$* $: $&{auth_authen} Put authentication id in the workspace +ifdef(`DEBIAN_DEBUG',dnl +`R$* $: $(log authtype:$&{auth_type} $) $1 +R$* $: $(log authauthen:$&{auth_authen} $) $1 +R$* $: $(log authauthor:$&{auth_author} $) $1') +R$=t $@ $#ok Trusted users... Allow trusted users to auth= as anyone +#----------------------------------------------------------------------------- diff --git a/debian/cf/hack/virthost_by_ip.m4 b/debian/cf/hack/virthost_by_ip.m4 new file mode 100644 index 0000000..8877dda --- /dev/null +++ b/debian/cf/hack/virthost_by_ip.m4 @@ -0,0 +1,77 @@ +divert(-1)dnl +#----------------------------------------------------------------------------- +# $Sendmail: virthost_by_ip.m4,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Copyright (c) 2001-2007 Richard Nelson. All Rights Reserved. +# +# cf/hack/virthost_by_ip.m4. Generated from virthost_by_ip.m4.in by configure. +# +# hack(virthost_by_ip) config file for building Sendmail 8.14.2-1 +# Note: Also check op.{ps,txt} for the 'b' modifier to daemon_options - it +# extends ip based virtual hosting. +# +# Note: the .in file supports 8.7.6 - 9.0.0, but the generated +# file is customized to the version noted above. +# +#----------------------------------------------------------------------------- +# +divert(0)dnl +dnl # +dnl #--------------------------------------------------------------------- +dnl # Bring in Autoconf results +dnl #--------------------------------------------------------------------- +ifdef(`sm_version', `dnl', +`include(`/usr/share/sendmail/cf/debian/autoconf.m4')dnl') +dnl # +VERSIONID(`$Id: virthost_by_ip.m4, v 8.14.2-1 2007-11-02 22:20:56 cowboy Exp $') +dnl # +dnl #--------------------------------------------------------------------- +dnl # Virtual hosting extensions - Login (greeting message) +dnl #--------------------------------------------------------------------- +define(`confSMTP_LOGIN_MSG', `$?{if_name}${if_name}$|$j$. Sendmail $v/$Z; $b; (No UCE/UBE) $?{client_addr}logging access from: ${client_name}(${client_resolve})-$_$.')dnl +dnl # +dnl #--------------------------------------------------------------------- +dnl # Virtual hosting extensions - Received-by headers (8.12.0 style) +dnl #--------------------------------------------------------------------- +dnl # 8.7.0+ +ifdef(`_REC_HDR_', `dnl', +`define(`_REC_HDR_', `$?sfrom $s $.$?_($?s$|from $.$_)')dnl' +`define(`_REC_END_', `for $u; $|; + $.$b')dnl' +) +dnl # AUTH(SASL) 8.10.0+ +ifdef(`_REC_AUTH_', `dnl', +`define(`_REC_AUTH_', `$.$?{auth_type}(authenticated')dnl' +`define(`_REC_FULL_AUTH_', `$.$?{auth_type}(user=${auth_authen} $?{auth_author}author=${auth_author} $.mech=${auth_type}')dnl' +) +dnl # TLS(SSL) 8.11.0+ +ifdef(`_REC_BY_', `dnl', +`define(`_REC_BY_', `$.by $j ($v/$Z)$?r with $r$. id $i$?{tls_version}')dnl' +`define(`_REC_TLS_', `(version=${tls_version} cipher=${cipher} bits=${cipher_bits} verify=${verify})$.$?u')dnl' +) +dnl # Now, override default settings for virtual hosting +define(`_REC_BY_', `$.by $?{if_name}${if_name}$|$j$. ($v/$Z)$?r with $r$. id $i$?{tls_version}')dnl +define(`confRECEIVED_HEADER', `_REC_HDR_ + _REC_FULL_AUTH_$?{auth_ssf} bits=${auth_ssf}$.) + _REC_BY_ + _REC_TLS_ + _REC_END_')dnl +dnl # +dnl #--------------------------------------------------------------------- +dnl # Virtual hosting extensions - ClientPortOptions (modifier=h) +dnl # -- Use name of interface for HELO command +dnl #--------------------------------------------------------------------- +ifelse(eval(sm_version_math >= 526848), `1',dnl +`ifelse(defn(`_CPO_'), `dnl', +`CLIENT_OPTIONS(`Modifier=h')dnl')dnl') +dnl # +dnl #--------------------------------------------------------------------- +dnl # Virtual hosting extensions - DaemonPortOptions (modifier=b) +dnl # -- Bind to interface mail was received on +dnl # I can't do this for you, because each use of DAEMON_OPTIONS will +dnl # create a new listener ! +dnl #--------------------------------------------------------------------- +dnl ifelse(eval(sm_version_math >= 526848), `1',dnl +dnl `ifelse(defn(`_DPO_'), `dnl', +dnl `DAEMON_OPTIONS(`Modifier=b')dnl')dnl') + diff --git a/debian/cf/ostype/debian.m4 b/debian/cf/ostype/debian.m4 new file mode 100644 index 0000000..68843e1 --- /dev/null +++ b/debian/cf/ostype/debian.m4 @@ -0,0 +1,113 @@ +divert(-1)dnl +#----------------------------------------------------------------------------- +# $Sendmail: debian.m4,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Copyright (c) 1998-2007 Richard Nelson. All Rights Reserved. +# +# cf/ostype/debian.m4. Generated from debian.m4.in by configure. +# +# ostype(debian) config file for building Sendmail 8.14.2-1 +# +# Note: the .in file supports 8.7.6 - 9.0.0, but the generated +# file is customized to the version noted above. +# +#----------------------------------------------------------------------------- +# +divert(0)dnl +dnl # +dnl #--------------------------------------------------------------------- +dnl # Bring in Autoconf results +dnl #--------------------------------------------------------------------- +ifdef(`sm_version', `dnl', +`include(`/usr/share/sendmail/cf/debian/autoconf.m4')dnl') +dnl # +VERSIONID(`$Id: debian.m4, v 8.14.2-1 2007-11-02 22:20:56 cowboy Exp $') +define(`confCF_VERSION', `Debian-1')dnl +dnl # +dnl # changes made herein *must* be reflected in parse_mc,update_db,debian.m4 +dnl # +ifdef(`MAIL_SETTINGS_DIR', `dnl', + `define(`MAIL_SETTINGS_DIR', `/etc/mail/')dnl') +dnl # support 8.9.3 migration to 8.10.0 naming convention +dnl # Note: this is too late... needs to be in sendmail.mc - at top +ifdef(`_USE_ETC_MAIL_', `dnl', `define(`_USE_ETC_MAIL_')dnl') +dnl # +dnl # Define default greeting +define(`confSMTP_LOGIN_MSG', `$j Sendmail $v/$Z; $b; (No UCE/UBE) $?{client_addr}logging access from: ${client_name}(${client_resolve})-$_$.')dnl +dnl # +dnl # Keep dead letter drop, it is the last resort home for abused mail +define(`confDEAD_LETTER_DROP', `/var/lib/sendmail/dead.letter')dnl +dnl # +dnl # Put status file in other than /etc/mail (sendmail default) +dnl # Many people run with R/O /etc +define(`STATUS_FILE', `/var/lib/sendmail/sendmail.st')dnl +define(`confHOST_STATUS_DIRECTORY', + `/var/lib/sendmail/host_status')dnl +dnl # +dnl # Allow scanf extensions for common text files +define(`confCR_FILE', `-o '`MAIL_SETTINGS_DIR`'relay-domains %[^\#]')dnl +define(`confCT_FILE', `MAIL_SETTINGS_DIR`'trusted-users %[^\#]')dnl +define(`confCW_FILE', `MAIL_SETTINGS_DIR`'local-host-names %[^\#]')dnl +dnl # +dnl # This *really* needs a better home +define(`confEBINDIR', `/usr/lib/sm.bin')dnl +dnl # +dnl # add .' to mustquote chars (and match the binary default) +changequote([, ])dnl +define([confMUST_QUOTE_CHARS], [.'])dnl +changequote(`, ')dnl +dnl # +dnl # Default in 8.10+, used to be false (iirc), deprecated +define(`confME_TOO', `True')dnl +dnl # +dnl # Set the default user/group for mailers (mail:mail) +dnl # this should help NIS startup time +dnl # +define(`confDEF_USER_ID', `mail:mail')dnl +dnl # +dnl #--------------------------------------------------------------------- +dnl # mailer paths and options +dnl #--------------------------------------------------------------------- +define(`LOCAL_MAILER_PATH', `/usr/sbin/sensible-mda')dnl +define(`LOCAL_MAILER_ARGS', `sensible-mda $g $u $h ${client_addr}')dnl +MODIFY_MAILER_FLAGS(`LOCAL', `+S')dnl #do keep root +MODIFY_MAILER_FLAGS(`LOCAL', `-r')dnl #do not munge args +MODIFY_MAILER_FLAGS(`LOCAL', `-m')dnl #do not try LMTP +define(`PROCMAIL_MAILER_PATH', `/usr/bin/procmail')dnl +define(`PROCMAIL_MAILER_ARGS', `procmail -m $h $f $u')dnl +define(`USENET_MAILER_PATH', `/usr/bin/inews')dnl +define(`UUCP_MAILER_ARGS',`uux - -r -z -a$g -gC $h!rmail ($u)')dnl +dnl define(`confDEF_CHAR_SET', `iso-8859-1')dnl +dnl # +dnl # Optional items (should be a subset site.config.m4 used for build) +dnl # to prevent sendmail error messages +dnl # +dnl #--------------------------------------------------------------------- +dnl # IPv6 support (new option for 8.12+) +dnl # IPv6 causes problems for some DNS servers, work around them +dnl #--------------------------------------------------------------------- +ifelse(sm_enable_ipv6, `yes',dnl +`ifelse(eval(sm_version_math >= 527360), `1',dnl +`define(`confBIND_OPTS', `+WorkAroundBrokenAAAA')dnl')') +dnl # +dnl #--------------------------------------------------------------------- +dnl # Milter (8.10.0-8.11.0) built-in with 8.12.0+ +dnl #--------------------------------------------------------------------- +ifelse(sm_enable_milter, `yes',dnl +`define(`_FFR_MILTER')dnl') +# +#------------------------------------------------------------------------- +# +# Undocumented features are available in Debian Sendmail 8.14.2-1. +# * none +# +# _FFR_ features are available in Debian Sendmail 8.14.2-1. +ifelse(sm_enable_milter, `yes',dnl +`# * milter') +# * sm_ffr +#------------------------------------------------------------------------- +# +# These _FFR_ features are for sendmail.mc processing +# + define(`_FFR_MAIL_MACRO') +#------------------------------------------------------------------------- diff --git a/debian/changelog b/debian/changelog index 895f430..9072b4d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,40 @@ +sendmail (8.14.2-1) unstable; urgency=low + + * New Upstream release + + SASL 2.1.22 change sasl_decode64() requires MTA handle "=" + closes: #443319 + + -- Richard A Nelson (Rick) <cowboy@debian.org> Fri, 02 Nov 2007 22:14:00 -0000 + +sendmail (8.14.2-0) private; urgency=low + + * Upstream release + * Refit patches + * Run for a bit + + -- Richard A Nelson (Rick) <cowboy@debian.org> Fri, 02 Nov 2007 03:00:00 -0000 + +sendmail (8.14.2.Beta0-0) private; urgency=low + + * Upstream Beta + * Refit patches + + -- Richard A Nelson (Rick) <cowboy@debian.org> Tue, 23 Oct 2007 05:50:00 -0000 + +sendmail (8.14.2.Beta0-0) private; urgency=low + + * Upstream Beta + * Refit patches + + -- Richard A Nelson (Rick) <cowboy@debian.org> Mon, 15 Oct 2007 16:20:00 -0000 + +sendmail (8.14.1-12) unstable; urgency=low + + * Correct "poor man's" emphasis closes: #448033 + (Yes, Ubuntu does feed stuff back) + + -- Richard A Nelson (Rick) <cowboy@debian.org> Mon, 29 Oct 2007 22:46:00 -0000 + sendmail (8.14.1-11) unstable; urgency=low * /etc/init.d/sendmail will now rebuild databases on diff --git a/debian/examples/Makefile b/debian/examples/Makefile new file mode 100644 index 0000000..9216a2c --- /dev/null +++ b/debian/examples/Makefile @@ -0,0 +1,653 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# examples/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 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 = examples +DIST_COMMON = $(dist_man_MANS) $(dist_sbin_SCRIPTS) \ + $(nobase_dist_sysconf_DATA) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/./build/mkinstalldirs +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)" \ + "$(DESTDIR)$(sysconfdir)" +dist_sbinSCRIPT_INSTALL = $(INSTALL_SCRIPT) +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_sysconfDATA_INSTALL = $(install_sh_DATA) +DATA = $(nobase_dist_sysconf_DATA) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run aclocal-1.10 +AMTAR = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run tar +AUTOCONF = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run autoconf +AUTOHEADER = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run autoheader +AUTOMAKE = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run automake-1.10 +AWK = gawk +CC = cc +CCDEPMODE = depmode=none +CFLAGS = -g -Wall -O2 -fPIC -fstack-protector-all +CPP = cc -E +CPPFLAGS = +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.1\" -DPACKAGE_STRING=\"Sendmail\ 8.14.1\" -DPACKAGE_BUGREPORT=\"bug/reportbug\ or\ sendmail@packages.debian.org\" -DPACKAGE=\"sendmail\" -DVERSION=\"8.14.1\" -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_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 +LIBOBJS = +LIBS = +LN_S = ln -s +LTLIBOBJS = +MAINT = # +MAKEINFO = ${SHELL} /home/src/sendmail/sendmail-8.14.2/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.2 +PACKAGE_TARNAME = sendmail +PACKAGE_VERSION = 8.14.2 +PATH_SEPARATOR = : +SET_MAKE = +SHELL = /bin/sh +SM_CPYRT = 2007 +SM_DATE = 2007-10-04 21:42:00 +SM_MAXVERS = 9.0.0 +SM_MINVERS = 8.7.6 +SM_VERS = 8.14.1 +STRIP = +VERSION = 8.14.1 +abs_builddir = /home/src/sendmail/sendmail-8.14.2/debian/examples +abs_srcdir = /home/src/sendmail/sendmail-8.14.2/debian/examples +abs_top_builddir = /home/src/sendmail/sendmail-8.14.2/debian +abs_top_srcdir = /home/src/sendmail/sendmail-8.14.2/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.2 +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.2/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 = 2007-11-02 +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 +sm_libs = +sm_libsm_envdef = -fPIC -DHAVE_NANOSLEEP=1 -D_LDAP_EXAMPLE_ -DLDAP_REFERRALS -D_FFR_LDAP_URI -D_FFR_LDAP_SETVERSION -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 -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 | libsasl2-modules-plain | libsasl2-digestmd5-plain | libsasl2-digestmd5-des, openssl +sm_time = 22:20:56 +sm_utc = +0000 +sm_vacation_envdef = +sm_vacation_libs = -ldb-4.6 -lldap -llber +sm_version = 8.14.2 +sm_version_beta = +sm_version_major = 8.14 +sm_version_math = 527874 +sm_version_minor = 2 +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.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Copyright (c) 1998-2007 Richard Nelson. All Rights Reserved. +# +# examples/Makefile. Generated from Makefile.in by configure. +# +# Rules file for Sendmail 8.14.2-1(527874) +# 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> 2007-11-02 22:20:56 (+0000) +#------------------------------------------------------------------------------ +# +# Shipped programs +# +dist_sbin_SCRIPTS = checksendmail/checksendmail +# +# Shipped manpages +# +dist_man_MANS = checksendmail/checksendmail.8 +# +# Shipped data +# +# Installed example subdirectories +EXAMPLES_DIRS = amavis db dhcp3 \ + ldap logcheck milter network \ + pam.d ppp resolvconf sasl tls + +# +# Sigh... I wanted to use sysconf_SCRIPTS, but automake says NO! +nobase_dist_sysconf_DATA = dhcp3/dhclient-exit-hooks.d/sendmail \ + logcheck/ignore.d.paranoid/sendmail \ + logcheck/ignore.d.server/sendmail \ + logcheck/ignore.d.workstation/sendmail \ + logcheck/violations.ignore.d/logcheck-sendmail \ + network/if-down.d/sendmail network/if-post-down.d/sendmail \ + network/if-up.d/sendmail pam.d/smtp ppp/ip-down.d/sendmail \ + ppp/ip-up.d/sendmail resolvconf/update-libc.d/sendmail +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 examples/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu examples/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 +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_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)$(sbindir)" "$(DESTDIR)$(man8dir)" "$(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-man + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-data-hook + +install-dvi: install-dvi-am + +install-exec-am: install-dist_sbinSCRIPTS \ + install-nobase_dist_sysconfDATA + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-exec-hook + +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_sbinSCRIPTS uninstall-man \ + uninstall-nobase_dist_sysconfDATA + +uninstall-man: uninstall-man8 + +.MAKE: install-am install-data-am install-exec-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_sbinSCRIPTS install-dvi \ + install-dvi-am install-exec install-exec-am install-exec-hook \ + install-html install-html-am install-info install-info-am \ + install-man install-man8 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_sbinSCRIPTS uninstall-man uninstall-man8 \ + uninstall-nobase_dist_sysconfDATA + +# +# Local customisation... not automake friendly +# +install-data-hook: + $(INSTALL) -d ${DESTDIR}${pkgdatadir}/examples; + for dir in ${EXAMPLES_DIRS}; do \ + $(INSTALL) -d ${DESTDIR}${pkgdatadir}/examples/$$dir; \ + find $$dir -type f \ + ! -name '*.in' -a ! -name '*.am' -a ! -name '*.old' \ + | xargs -ri \ + $(INSTALL_DATA) '{}' ${DESTDIR}${pkgdatadir}/examples/'{}'; \ + done; + chmod a+rx ${DESTDIR}${pkgdatadir}/examples/milter/Makefile; + chmod a+rx ${DESTDIR}${pkgdatadir}/examples/dhcp3/dhclient-exit-hooks.d/sendmail; + chmod a+rx ${DESTDIR}${pkgdatadir}/examples/network/if-down.d/sendmail; + chmod a+rx ${DESTDIR}${pkgdatadir}/examples/network/if-post-down.d/sendmail; + chmod a+rx ${DESTDIR}${pkgdatadir}/examples/network/if-up.d/sendmail; + chmod a+rx ${DESTDIR}${pkgdatadir}/examples/ppp/ip-down.d/sendmail; + chmod a+rx ${DESTDIR}${pkgdatadir}/examples/ppp/ip-up.d/sendmail; + chmod a+rx ${DESTDIR}${pkgdatadir}/examples/resolvconf/update-libc.d/sendmail; + chmod a+rx ${DESTDIR}${sysconfdir}/dhcp3/dhclient-exit-hooks.d/sendmail; + chmod a+rx ${DESTDIR}${sysconfdir}/network/if-down.d/sendmail; + chmod a+rx ${DESTDIR}${sysconfdir}/network/if-post-down.d/sendmail; + chmod a+rx ${DESTDIR}${sysconfdir}/network/if-up.d/sendmail; + chmod a+rx ${DESTDIR}${sysconfdir}/ppp/ip-down.d/sendmail; + chmod a+rx ${DESTDIR}${sysconfdir}/ppp/ip-up.d/sendmail; + chmod a+rx ${DESTDIR}${sysconfdir}/resolvconf/update-libc.d/sendmail; + $(INSTALL_DATA) checksendmail/address.resolve \ + ${DESTDIR}${sysconfdir}/mail/; +install-exec-hook: + sed -e "s?/etc/sendmail.cf?${sysconfdir}/mail/sendmail.cf?g" \ + -e "s?address.resolve?${sysconfdir}/mail/address.resolve?g" \ + checksendmail/checksendmail \ + > ${DESTDIR}${sbindir}/checksendmail; + chmod 0755 ${DESTDIR}${sbindir}/checksendmail; + if [ -f ${top_srcdir}/../${buildtree}/contrib/buildvirtuser ]; then \ + $(INSTALL_SCRIPT) ${top_srcdir}/../${buildtree}/contrib/buildvirtuser \ + ${DESTDIR}${pkgdatadir}/; \ + fi; + sed 's?/bin/perl?/usr/bin/perl?g' \ + ${top_srcdir}/../${buildtree}/contrib/passwd-to-alias.pl \ + > ${DESTDIR}${pkgdatadir}/examples/passwd-to-alias; + chmod 0755 ${DESTDIR}${pkgdatadir}/examples/passwd-to-alias; + sed -e 's?/usr/local/bin/perl?/usr/bin/perl?g' \ + -e "s?/etc/sendmail.cf?${sysconfdir}/mail/sendmail.cf?g" \ + ${top_srcdir}/../${buildtree}/contrib/etrn.pl \ + > ${DESTDIR}${sbindir}/etrn; + chmod 0755 ${DESTDIR}${sbindir}/etrn; + if [ -f ${top_srcdir}/../${buildtree}/contrib/etrn.0 ]; then \ + sed -e 's?/usr/local/bin/perl?/usr/bin/perl?g' \ + -e 's?etrn(1M)?etrn(8)?g' \ + ${top_srcdir}/../${buildtree}/contrib/etrn.0 \ + > ${DESTDIR}${mandir}/man8/etrn.8; \ + else \ + sed -e 's?/usr/local/bin/perl?/usr/bin/perl?g' \ + -e 's?etrn(1M)?etrn(8)?g' \ + ${top_srcdir}/../${buildtree}/contrib/etrn.pl \ + > ${DESTDIR}${mandir}/man8/etrn.8; \ + fi; + sed -e 's?/usr/local/bin/perl?/usr/bin/perl?g' \ + ${top_srcdir}/../${buildtree}/contrib/expn.pl \ + > ${DESTDIR}${bindir}/expn; + chmod 0755 ${DESTDIR}${bindir}/expn; + sed -e 's?/usr/local/bin/perl?/usr/bin/perl?g' \ + ${top_srcdir}/../${buildtree}/contrib/expn.pl \ + > ${DESTDIR}${mandir}/man1/expn.1; + sed -e 's?/usr/local/bin/perl?/usr/bin/perl?g' \ + -e 's?/usr/sbin/sendmail -q30m -bd?/etc/init.d/sendmail start?g' \ + ${top_srcdir}/../${buildtree}/contrib/smcontrol.pl \ + > ${DESTDIR}${pkgdatadir}/smcontrol.pl; + chmod 0755 ${DESTDIR}${pkgdatadir}/smcontrol.pl; + $(INSTALL_SCRIPT) ${top_srcdir}/../${buildtree}/contrib/doublebounce.pl \ + ${DESTDIR}${pkgdatadir}; + if [ -f ${top_srcdir}/../${buildtree}/contrib/qtool.pl ]; then \ + sed -e 's?/usr/bin/env perl?/usr/bin/perl?g' \ + ${top_srcdir}/../${buildtree}/contrib/qtool.pl \ + > ${DESTDIR}${pkgdatadir}/qtool.pl; \ + chmod 0755 ${DESTDIR}${datadir}/sendmail/qtool.pl; \ + $(INSTALL_DATA) ${top_srcdir}/../${buildtree}/contrib/qtool.8 \ + ${DESTDIR}${mandir}/man8/; \ + fi; +# +# Debian targets, phase out (this needs to be treated as -arch, not -indep) +# +.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/examples/dhcp3/dhclient-exit-hooks.d/sendmail b/debian/examples/dhcp3/dhclient-exit-hooks.d/sendmail new file mode 100644 index 0000000..7135a80 --- /dev/null +++ b/debian/examples/dhcp3/dhclient-exit-hooks.d/sendmail @@ -0,0 +1,49 @@ +#!/bin/sh +# +# This script is called when a dhcp event occurs. +# +# Here is where we'll start/stop sendmail if needed. +# +# Written By Richard Nelson <cowboy@debian.org> +# +# NOTE: The following lines (without the #) must be in /etc/mail/sendmail.mc: +# include(`/etc/mail/dialup.m4')dnl +# include(`/etc/mail/provider.m4')dnl +# +# NOTE: The dhcp DNS name is used as the peer name in /etc/mail/peers. +# + +# No need to continue if we're called with an unsupported option +case "$reason" in + EXPIRE|FAIL|RELEASE|STOP) #down... and TIMEOUT too ??? + ;; + BOUND|RENEW|REBIND|REBOOT|TIMEOUT) #up... why TIMEOUT here ??? + ;; + *) + return; + ;; + esac; + +# Bring in some script functions to handle dynamic configuration +. /usr/share/sendmail/dynamic; + +# Note the interface that just changed +update_interface "$interface" "$reason"; + +# If the domain name has changed, update the provider information +if [ "$new_domain_name" != "$old_domain_name" ]; then + update_provider "$new_domain_name"; + fi; + +# If the ip address has changed, update the host information +if [ "$new_ip_address" != "$oldnew_ip_address" ]; then + update_host "$new_ip_address"; + fi; + +# If anything has been changed, update sendmail.cf and reload +# Actually, we'll delay the reload because we'll be hit in a moment +# to handle the change by /etc/network/if-up.d/sendmail +update_sendmail "dhcp" Delayed; + +return; + diff --git a/debian/examples/network/if-down.d/sendmail b/debian/examples/network/if-down.d/sendmail new file mode 100644 index 0000000..5cb9322 --- /dev/null +++ b/debian/examples/network/if-down.d/sendmail @@ -0,0 +1,42 @@ +#!/bin/sh +# +# This script is called when a network device goes down. +# +# Here is where we'll stop sendmail if needed +# +# Written By Richard Nelson <cowboy@debian.org> +# +# NOTE: The following lines (without the #) must be in /etc/mail/sendmail.mc: +# include(`/etc/mail/dialup.m4')dnl +# include(`/etc/mail/provider.m4')dnl +# + +# These variables are for the use of the scripts run by run-parts +#IFACE=; +#IF_ADDRESS=; +#IF_PROVIDER=; + +if [ ! -z "$IFACE" ]; then + addr=$IF_ADDRESS; + provider=$IF_PROVIDER; + iface=$IFACE; +else + addr=$1; + provider=$2; + iface=$3; + fi; + +if [ -z "$provider" ]; then + exit 0; + fi; + +# Bring in some script functions to handle dynamic configuration +. /usr/share/sendmail/dynamic; + +# Note the interface that just changed +update_interface "$iface" "STOP"; + +# If anything has been changed, update sendmail.cf and reload +update_sendmail "ifupdown"; + +exit 0; diff --git a/debian/examples/network/if-up.d/sendmail b/debian/examples/network/if-up.d/sendmail new file mode 100644 index 0000000..e6aa213 --- /dev/null +++ b/debian/examples/network/if-up.d/sendmail @@ -0,0 +1,63 @@ +#!/bin/sh +# +# This script is called when a network device comes up. +# +# Here is where we'll start sendmail if needed. +# +# Written By Richard Nelson <cowboy@debian.org> +# +# NOTE: The following lines (without the #) must be in /etc/mail/sendmail.mc: +# include(`/etc/mail/dialup.m4')dnl +# include(`/etc/mail/provider.m4')dnl +# +# ALSO: make sure to use a 'provider <isp>' tag in /etc/network/interfaces +# it will be used as the name of a file in /etc/mail/peers +# If you don't use provider, we'll use DNS_DOMAIN, or lacking that, +# the first entry in DNS_SEARCH +# + + +# These variables are for the use of the scripts run by run-parts +#IFACE=; <-- ifupdown +#IF_ADDRESS=; <-- ifupdown +#IF_PROVIDER=; <-- sendmail specific +#IF_DNS_DOMAIN=; <-- resolvconf +#IF_DNS_SEARCH=; <-- resolvconf + +if [ ! -z "$IFACE" ]; then + addr=$IF_ADDRESS; + if [ -n "$IF_PROVIDER" ]; then + provider="$IF_PROVIDER"; + elif [ -n "$IF_DNS_DOMAIN" ]; then + provider="$IF_DNS_DOMAIN"; + elif [ -n "$IF_DNS_SEARCH" ]; then + provider=$(echo "$IF_DNS_SEARCH" | /usr/bin/cut -d' ' -f 1); + fi; + iface=$IFACE; +else + addr=$1; + provider=$2; + iface=$3; + fi; + +# Bring in some script functions to handle dynamic configuration +. /usr/share/sendmail/dynamic; + +# Note the interface that just changed +update_interface "$iface" "BOUND"; + +# If the domain name has changed, update the provider information +if [ -n "$provider" ]; then + update_provider "$provider"; + fi; + +# If the ip address has changed, update the host information +if [ -n "$addr" ]; then + update_host "$addr"; + fi; + +# If anything has been changed, update sendmail.cf and reload +update_sendmail "ifupdown"; + +exit 0; + diff --git a/debian/examples/ppp/ip-down.d/sendmail b/debian/examples/ppp/ip-down.d/sendmail new file mode 100644 index 0000000..8b4188e --- /dev/null +++ b/debian/examples/ppp/ip-down.d/sendmail @@ -0,0 +1,47 @@ +#!/bin/sh +# +# This script is called when ppp disconnects from the network. +# +# Here is where we'll stop sendmail if needed +# +# Written By Richard Nelson <cowboy@debian.org> +# +# NOTE: The following lines (without the #) must be in /etc/mail/sendmail.mc: +# include(`/etc/mail/dialup.m4')dnl +# include(`/etc/mail/provider.m4')dnl +# + +# These variables are for the use of the scripts run by run-parts +#PPP_IFACE="$1"; +#PPP_TTY="$2"; +#PPP_SPEED="$3"; +#PPP_LOCAL="$4"; +#PPP_REMOTE="$5"; +#PPP_IPPARAM="$6"; + +if [ ! -z "$PPP_LOCAL" ]; then + addr=$PPP_LOCAL; + provider=$PPP_IPPARAM; + iface=$PPP_IFACE; +else + addr=$1; + provider=$2; + iface=$3; + fi; + +if [ -z "$provider" ]; then + exit 0; + fi; + +# Bring in some script functions to handle dynamic configuration +. /usr/share/sendmail/dynamic; + +# Note the interface that just changed +update_interface "$iface" "STOP"; + +# If anything has been changed, update sendmail.cf and reload +# Actually, we'll delay the reload because we'll be hit in a moment +# to handle the change by /etc/network/if-up.d/sendmail +update_sendmail "ppp" Delayed; + +exit 0; diff --git a/debian/examples/ppp/ip-up.d/sendmail b/debian/examples/ppp/ip-up.d/sendmail new file mode 100644 index 0000000..2ec9854 --- /dev/null +++ b/debian/examples/ppp/ip-up.d/sendmail @@ -0,0 +1,57 @@ +#!/bin/sh +# +# This script is called when ppp connects to the network. +# +# Here is where we'll start sendmail if needed. +# +# Written By Richard Nelson <cowboy@debian.org> +# +# NOTE: The following lines (without the #) must be in /etc/mail/sendmail.mc: +# include(`/etc/mail/dialup.m4')dnl +# include(`/etc/mail/provider.m4')dnl +# +# ALSO: make sure ipparam is specified somewhere in the ppp options; +# it will be used as the name of a file in /etc/mail/peers +# + +# Define our domain name (from PPP) for sendmail. + +# These variables are for the use of the scripts run by run-parts +#PPP_IFACE="$1"; +#PPP_TTY="$2"; +#PPP_SPEED="$3"; +#PPP_LOCAL="$4"; +#PPP_REMOTE="$5"; +#PPP_IPPARAM="$6"; + +if [ ! -z "$PPP_LOCAL" ]; then + addr=$PPP_LOCAL; + provider=$PPP_IPPARAM; + iface=$PPP_IFACE; +else + addr=$1; + provider=$2; + iface=$3; + fi; + +if [ -z "$provider" ]; then + exit 0; + fi; + +# Bring in some script functions to handle dynamic configuration +. /usr/share/sendmail/dynamic; + +# Note the interface that just changed +update_interface "$iface" "BOUND"; + +# If the domain name has changed, update the provider information +update_provider "$provider"; + +# If the ip address has changed, update the host information +update_host "$addr"; + +# If anything has been changed, update sendmail.cf and reload +update_sendmail "ppp"; + +exit 0; + diff --git a/debian/examples/resolvconf/update-libc.d/sendmail b/debian/examples/resolvconf/update-libc.d/sendmail new file mode 100644 index 0000000..31a1638 --- /dev/null +++ b/debian/examples/resolvconf/update-libc.d/sendmail @@ -0,0 +1,13 @@ +#!/bin/sh + +# Make sendmail aware of changes to resolv.conf +# so that we can reset the statistics for unresolvable hostnames + +# Bring in some script functions to handle dynamic configuration +. /usr/share/sendmail/dynamic; + +# Note the interface that just changed - unfortunately, we know not how :( +update_resolv; + +# If anything has been changed, update sendmail.cf and reload +update_sendmail; diff --git a/debian/examples/sasl/sasl.m4 b/debian/examples/sasl/sasl.m4 new file mode 100644 index 0000000..32c70ff --- /dev/null +++ b/debian/examples/sasl/sasl.m4 @@ -0,0 +1,81 @@ +divert(-1)dnl +#----------------------------------------------------------------------------- +# $Sendmail: sasl.m4,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Copyright (c) 2003-2007 Richard Nelson. All Rights Reserved. +# +# examples/sasl/sasl.m4. Generated from sasl.m4.in by configure. +# +# sasl.m4 m4 file to support user->MTA, MSP->MTA, and MTA->MTA +# encryption and/or authentication. +# +# To use this file, add this line to sendmail.mc and possibly submit.mc: +# `include(`/etc/mail/sasl/sasl.m4')dnl' +# +#----------------------------------------------------------------------------- +# +divert(0)dnl +VERSIONID(`$Id: sasl.m4, v 8.14.2-1 2007-11-02 22:20:56 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 # Set a more reasonable timeout on negotiation +dnl # +define(`confTO_AUTH', `2m')dnl # , def=10m +dnl # +dnl # Do not touch anything above this line... +dnl # +dnl # Available Authentication methods +dnl # +define(`confAUTH_MECHANISMS',dnl +`DIGEST-MD5 CRAM-MD5 PLAIN LOGIN')dnl +dnl # +dnl # These, we will trust for relaying +dnl # +TRUST_AUTH_MECH(`DIGEST-MD5 CRAM-MD5 PLAIN LOGIN') +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') +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 # Define the REALM passed to sasl (8.13.0+) +ifelse(eval(sm_version_math >= 527616), `1', `dnl +dnl define(`confAUTH_REALM', `')dnl # Fill this in and uncomment it +')dnl +dnl # +dnl # Do not touch anything below this line... +')')dnl diff --git a/debian/examples/tls/starttls.m4 b/debian/examples/tls/starttls.m4 new file mode 100644 index 0000000..f6f8ddb --- /dev/null +++ b/debian/examples/tls/starttls.m4 @@ -0,0 +1,61 @@ +divert(-1)dnl +#----------------------------------------------------------------------------- +# $Sendmail: starttls.m4,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Copyright (c) 2002-2007 Richard Nelson. All Rights Reserved. +# +# examples/tls/starttls.m4. Generated from starttls.m4.in by configure. +# +# starttls.m4 m4 file to support user->MTA, MSP->MTA, and MTA->MTA +# encryption and/or authentication. +# +# To use this file, add this line to sendmail.mc and possibly submit.mc: +# `include(`/etc/mail/tls/starttls.m4')dnl' +# +#----------------------------------------------------------------------------- +# +divert(0)dnl +VERSIONID(`$Id: starttls.m4,v 8.14.2-1 2007-11-02 22:20:56 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 it to be group readable +dnl # +define(`confDONT_BLAME_SENDMAIL',dnl + defn(`confDONT_BLAME_SENDMAIL')`,GroupReadableKeyFile')dnl +dnl # +dnl # Set a more reasonable timeout on negotiation +dnl # +define(`confTO_STARTTLS', `2m')dnl # , def=10m +dnl # +dnl # Do not touch anything above this line... +dnl # +dnl # CA directory - CA certs should be herein +define(`confCACERT_PATH', `/etc/ssl/certs')dnl +dnl # +dnl # CA file (may be the same as client/server certificate) +define(`confCACERT', `/etc/mail/tls/sendmail-server.crt')dnl +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', `/etc/mail/tls/sendmail-server.crt')dnl +define(`confSERVER_KEY', `/etc/mail/tls/sendmail-common.key')dnl +dnl # +dnl # Clien certificate/key (can be in the same file, and shared w/server) +dnl # NOTE: The key must *NOT* be encrypted !!! +define(`confCLIENT_CERT', `/etc/mail/tls/sendmail-client.crt')dnl +define(`confCLIENT_KEY', `/etc/mail/tls/sendmail-common.key')dnl +dnl # +dnl # Optional settings +define(`confTLS_SRV_OPTIONS', `V')dnl # do not request user certs +dnl # +dnl # Do not touch anything below this line... +')')dnl diff --git a/debian/libmilter-dev.dirs b/debian/libmilter-dev.dirs new file mode 100644 index 0000000..099cfb2 --- /dev/null +++ b/debian/libmilter-dev.dirs @@ -0,0 +1,7 @@ +./DEBIAN +./usr/include/libmilter +./usr/lib +./usr/lib/libmilter +./usr/share/doc/libmilter-dev +./usr/share/bug +./usr/share/lintian/overrides diff --git a/debian/libmilter-dev.links b/debian/libmilter-dev.links new file mode 100644 index 0000000..445183e --- /dev/null +++ b/debian/libmilter-dev.links @@ -0,0 +1,3 @@ +usr/share/bug/sendmail usr/share/bug/libmilter-dev +usr/lib/libmilter.so.1 usr/lib/libmilter/libmilter.so.1 +usr/lib/libmilter/libmilter.so.1 usr/lib/libmilter/libmilter.so diff --git a/debian/libmilter-dev.postrm b/debian/libmilter-dev.postrm new file mode 100644 index 0000000..aceb57f --- /dev/null +++ b/debian/libmilter-dev.postrm @@ -0,0 +1,53 @@ +#!/bin/sh -e +# +# Debian post removal script +# +# Install of already installed package: +# 1) Upgrade of package: +# new-preinst upgrade old-version +# *) new-postrm abort-upgrade old-version +# 2) package had some configuration files from a previous version installed +# new-preinst install old-version +# *) new-postrm abort-install old-version +# 3) Otherwise (i.e., the package was completely purged) +# new-preinst install +# *) new-postrm abort-install +# +# Removal of a package: +# 1) prerm remove +# 2) The package's files are removed (except conffiles). +# 3) postrm remove +# 4) All the maintainer scripts except the postrm are removed. +# 5) The conffiles and any backup files +# (~-files, #*# files, %-files, .dpkg-{old,new,tmp}, etc.) are removed. +# 6) postrm purge +# 7) The package's file list is removed +# +set -e; + +PACKAGE=libmilter-dev; + +case "$1" in + remove) + # /usr/share/doc/$PACKAGE is a symlink to /usr/share/doc/sendmail + rm -f /usr/share/doc/$PACKAGE 2>/dev/null || true; + rmdir /usr/share/doc/sendmail 2>/dev/null || true; + ;; + + purge) + ;; + + upgrade) + ;; + + failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "$PACKAGE postrm called with unknown argument \`$1'" >&2; + exit 1; + ;; + esac; + +#DEBHELPER# +exit 0; diff --git a/debian/libmilter-dev.preinst b/debian/libmilter-dev.preinst new file mode 100644 index 0000000..80d37f3 --- /dev/null +++ b/debian/libmilter-dev.preinst @@ -0,0 +1,55 @@ +#!/bin/sh -e +# +# Debian pre install script +# +# Install of already installed package: +# 1) Upgrade of package: +# new-preinst upgrade old-version +# *) new-postrm abort-upgrade old-version +# 2) package had some configuration files from a previous version installed +# new-preinst install old-version +# *) new-postrm abort-install old-version +# 3) Otherwise (i.e., the package was completely purged) +# new-preinst install +# *) new-postrm abort-install +# +set -e; + +PACKAGE=libmilter-dev; + +case "$1" in + install) + # DPKG doesn't overwrite directories with symlinks... + if [ -d /usr/share/doc/$PACKAGE ]; then + rm -rf /usr/share/doc/$PACKAGE; + fi; + if [ ! -d /usr/share/doc/sendmail ]; then + mkdir -p /usr/share/doc/sendmail; + chmod a+rx /usr/share/doc/sendmail; + fi; + ln -sf sendmail /usr/share/doc/$PACKAGE; + ;; + + upgrade) + # DPKG doesn't overwrite directories with symlinks... + if [ -d /usr/share/doc/$PACKAGE ]; then + rm -rf /usr/share/doc/$PACKAGE; + fi; + if [ ! -d /usr/share/doc/sendmail ]; then + mkdir -p /usr/share/doc/sendmail; + chmod a+rx /usr/share/doc/sendmail; + fi; + ln -sf sendmail /usr/share/doc/$PACKAGE; + ;; + + abort-upgrade) + ;; + + *) + echo "$PACKAGE preinst called with unknown argument \`$1'" >&2; + exit 1; + ;; + esac; + +#DEBHELPER# +exit 0; diff --git a/debian/libmilter1.dirs b/debian/libmilter1.dirs new file mode 100644 index 0000000..b2f5da8 --- /dev/null +++ b/debian/libmilter1.dirs @@ -0,0 +1,5 @@ +./DEBIAN +./usr/lib/libmilter +./usr/share/doc/libmilter1 +./usr/share/bug +./usr/share/lintian/overrides diff --git a/debian/libmilter1.links b/debian/libmilter1.links new file mode 100644 index 0000000..9f6597f --- /dev/null +++ b/debian/libmilter1.links @@ -0,0 +1 @@ +usr/share/bug/sendmail usr/share/bug/libmilter1 diff --git a/debian/libmilter1.lintian-overrides b/debian/libmilter1.lintian-overrides new file mode 100644 index 0000000..6e12b65 --- /dev/null +++ b/debian/libmilter1.lintian-overrides @@ -0,0 +1,4 @@ +libmilter1: description-synopsis-starts-with-a-capital-letter +libmilter1: postinst-has-useless-call-to-ldconfig +libmilter1: postrm-has-useless-call-to-ldconfig +libmilter1: non-dev-pkg-with-shlib-symlink diff --git a/debian/libmilter1.postrm b/debian/libmilter1.postrm new file mode 100644 index 0000000..dd9b983 --- /dev/null +++ b/debian/libmilter1.postrm @@ -0,0 +1,53 @@ +#!/bin/sh -e +# +# Debian post removal script +# +# Install of already installed package: +# 1) Upgrade of package: +# new-preinst upgrade old-version +# *) new-postrm abort-upgrade old-version +# 2) package had some configuration files from a previous version installed +# new-preinst install old-version +# *) new-postrm abort-install old-version +# 3) Otherwise (i.e., the package was completely purged) +# new-preinst install +# *) new-postrm abort-install +# +# Removal of a package: +# 1) prerm remove +# 2) The package's files are removed (except conffiles). +# 3) postrm remove +# 4) All the maintainer scripts except the postrm are removed. +# 5) The conffiles and any backup files +# (~-files, #*# files, %-files, .dpkg-{old,new,tmp}, etc.) are removed. +# 6) postrm purge +# 7) The package's file list is removed +# +set -e; + +PACKAGE=libmilter1; + +case "$1" in + remove) + # /usr/share/doc/$PACKAGE is a symlink to /usr/share/doc/sendmail + rm -f /usr/share/doc/$PACKAGE 2>/dev/null || true; + rmdir /usr/share/doc/sendmail 2>/dev/null || true; + ;; + + purge) + ;; + + upgrade) + ;; + + failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "$PACKAGE postrm called with unknown argument \`$1'" >&2; + exit 1; + ;; + esac; + +#DEBHELPER# +exit 0; diff --git a/debian/libmilter1.preinst b/debian/libmilter1.preinst new file mode 100644 index 0000000..f396aee --- /dev/null +++ b/debian/libmilter1.preinst @@ -0,0 +1,55 @@ +#!/bin/sh -e +# +# Debian pre install script +# +# Install of already installed package: +# 1) Upgrade of package: +# new-preinst upgrade old-version +# *) new-postrm abort-upgrade old-version +# 2) package had some configuration files from a previous version installed +# new-preinst install old-version +# *) new-postrm abort-install old-version +# 3) Otherwise (i.e., the package was completely purged) +# new-preinst install +# *) new-postrm abort-install +# +set -e; + +PACKAGE=libmilter1; + +case "$1" in + install) + # DPKG doesn't overwrite directories with symlinks... + if [ -d /usr/share/doc/$PACKAGE ]; then + rm -rf /usr/share/doc/$PACKAGE; + fi; + if [ ! -d /usr/share/doc/sendmail ]; then + mkdir -p /usr/share/doc/sendmail; + chmod a+rx /usr/share/doc/sendmail; + fi; + ln -sf sendmail /usr/share/doc/$PACKAGE; + ;; + + upgrade) + # DPKG doesn't overwrite directories with symlinks... + if [ -d /usr/share/doc/$PACKAGE ]; then + rm -rf /usr/share/doc/$PACKAGE; + fi; + if [ ! -d /usr/share/doc/sendmail ]; then + mkdir -p /usr/share/doc/sendmail; + chmod a+rx /usr/share/doc/sendmail; + fi; + ln -sf sendmail /usr/share/doc/$PACKAGE; + ;; + + abort-upgrade) + ;; + + *) + echo "$PACKAGE preinst called with unknown argument \`$1'" >&2; + exit 1; + ;; + esac; + +#DEBHELPER# +exit 0; diff --git a/debian/local/Makefile b/debian/local/Makefile new file mode 100644 index 0000000..93acabb --- /dev/null +++ b/debian/local/Makefile @@ -0,0 +1,691 @@ +# Makefile.in generated by automake 1.10 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 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)/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.2/debian/build/missing --run aclocal-1.10 +AMTAR = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run tar +AUTOCONF = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run autoconf +AUTOHEADER = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run autoheader +AUTOMAKE = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run automake-1.10 +AWK = gawk +CC = cc +CCDEPMODE = depmode=none +CFLAGS = -g -Wall -O2 -fPIC -fstack-protector-all +CPP = cc -E +CPPFLAGS = +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.1\" -DPACKAGE_STRING=\"Sendmail\ 8.14.1\" -DPACKAGE_BUGREPORT=\"bug/reportbug\ or\ sendmail@packages.debian.org\" -DPACKAGE=\"sendmail\" -DVERSION=\"8.14.1\" -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_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 +LIBOBJS = +LIBS = +LN_S = ln -s +LTLIBOBJS = +MAINT = # +MAKEINFO = ${SHELL} /home/src/sendmail/sendmail-8.14.2/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.2 +PACKAGE_TARNAME = sendmail +PACKAGE_VERSION = 8.14.2 +PATH_SEPARATOR = : +SET_MAKE = +SHELL = /bin/sh +SM_CPYRT = 2007 +SM_DATE = 2007-10-04 21:42:00 +SM_MAXVERS = 9.0.0 +SM_MINVERS = 8.7.6 +SM_VERS = 8.14.1 +STRIP = +VERSION = 8.14.1 +abs_builddir = /home/src/sendmail/sendmail-8.14.2/debian/local +abs_srcdir = /home/src/sendmail/sendmail-8.14.2/debian/local +abs_top_builddir = /home/src/sendmail/sendmail-8.14.2/debian +abs_top_srcdir = /home/src/sendmail/sendmail-8.14.2/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.2 +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.2/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 = 2007-11-02 +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 +sm_libs = +sm_libsm_envdef = -fPIC -DHAVE_NANOSLEEP=1 -D_LDAP_EXAMPLE_ -DLDAP_REFERRALS -D_FFR_LDAP_URI -D_FFR_LDAP_SETVERSION -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 -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 | libsasl2-modules-plain | libsasl2-digestmd5-plain | libsasl2-digestmd5-des, openssl +sm_time = 22:20:56 +sm_utc = +0000 +sm_vacation_envdef = +sm_vacation_libs = -ldb-4.6 -lldap -llber +sm_version = 8.14.2 +sm_version_beta = +sm_version_major = 8.14 +sm_version_math = 527874 +sm_version_minor = 2 +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.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Copyright (c) 1998-2007 Richard Nelson. All Rights Reserved. +# +# local/Makefile. Generated from Makefile.in by configure. +# +# Rules file for Sendmail 8.14.2-1(527874) +# 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> 2007-11-02 22:20:56 (+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..7045a94 --- /dev/null +++ b/debian/local/Parse_conf.pm @@ -0,0 +1,962 @@ +#!/usr/bin/perl -w +#------------------------------------------------------------------------ +# +# $Sendmail: Parse_conf.pm,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Parse and update /etc/mail/sendmail.conf +# +# Copyright (c) 2001-2007 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.2'; +$Parse_conf::program_date = '2007-11-02 22:20:56 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-2007 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 +# +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..ab1893c --- /dev/null +++ b/debian/local/Parse_mc.pm @@ -0,0 +1,1084 @@ +#!/usr/bin/perl -w +#------------------------------------------------------------------------ +# +# $Sendmail: Parse_mc.pm,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Parse Sendmail config for databases +# +# Copyright (c) 2001-2007 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.2'; +$Parse_mc::program_date = '2007-11-02 22:20:56 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"],'-'] + ,'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-2007 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..2377c12 --- /dev/null +++ b/debian/local/bug/sendmail/script @@ -0,0 +1,53 @@ +#!/bin/sh +#----------------------------------------------------------------------------- +# $Sendmail: sendmail.bug,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Copyright (c) 1998-2007 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..7a72732 --- /dev/null +++ b/debian/local/dynamic @@ -0,0 +1,435 @@ +#!/bin/sh +#------------------------------------------------------------------------ +# +# $Sendmail: dynamic,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Shell functions to handle dynamic network updates. +# Supports ppp, dhcp, ifup/down, etc. +# +# Copyright (c) 2004-2007 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="$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' ]; 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="$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' ]; 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="$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' ]; 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="$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' ]; 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 + /etc/init.d/sendmail purgestat now + 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="$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' ]; 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 + /etc/init.d/sendmail purgestat now + /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..79db52f --- /dev/null +++ b/debian/local/parse_mc @@ -0,0 +1,95 @@ +#!/usr/bin/perl -w +#------------------------------------------------------------------------ +# +# $Sendmail: parse_mc,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Parse Sendmail config for databases +# +# Copyright 2000-2007 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.2'; +$main::program_date = '2007-11-02 22:20:56 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..a1366a0 --- /dev/null +++ b/debian/local/sendmail @@ -0,0 +1,1282 @@ +#!/bin/sh +#----------------------------------------------------------------------------- +# $Sendmail: sm_helper.sh,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Copyright (c) 1998-2007 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..9a5d90a --- /dev/null +++ b/debian/local/sendmailconfig @@ -0,0 +1,688 @@ +#!/bin/sh -e +#----------------------------------------------------------------------------- +# $Sendmail: sendmailconfig,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Interactively configure Sendmail for Debian +# +# Copyright (c) 1998-2007 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..7773104 --- /dev/null +++ b/debian/local/update_auth @@ -0,0 +1,349 @@ +#!/bin/sh -e +#----------------------------------------------------------------------------- +# +# $Sendmail: update_auth,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Sendmail support for SMTP AUTH (SASL) +# +# Copyright (c) 2000-2007 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:smmsp ${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:smmsp; + find ${SASLDB} -gid 8 -print | xargs -r chown root:smmsp; + find ${SASLDB} -group smmsp -print | xargs -r chmod g+rw; + 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..373c423 --- /dev/null +++ b/debian/local/update_authm4 @@ -0,0 +1,257 @@ +#!/usr/bin/perl -w +#------------------------------------------------------------------------ +# +# $Sendmail: update_auth,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Create /etc/mail/sasl/sasl.m4 for Debian Sendmail +# +# Copyright 1998-2007 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.2'; +$main::program_date = '2007-11-02 22:20:56 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-2007 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.2-1 2007-11-02 22:20:56 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..b96b07a --- /dev/null +++ b/debian/local/update_conf @@ -0,0 +1,539 @@ +#!/usr/bin/perl -w +#------------------------------------------------------------------------ +# +# $Sendmail: update_conf,v 8.14.2 2007-11-02 22:20:56 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-2007 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.2'; +$main::program_date = '2007-11-02 22:20:56 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-2007 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..9bb1d8b --- /dev/null +++ b/debian/local/update_db @@ -0,0 +1,636 @@ +#!/bin/sh -e +#----------------------------------------------------------------------------- +# +# $Sendmail: update_db,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Update Sendmail databases for Debian +# +# Copyright (c) 1998-2007 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..3ea9022 --- /dev/null +++ b/debian/local/update_ldap @@ -0,0 +1,139 @@ +#!/bin/sh -e +#----------------------------------------------------------------------------- +# +# $Sendmail: update_ldap,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Sendmail support for LDAP +# +# Copyright (c) 2000-2007 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..5265baf --- /dev/null +++ b/debian/local/update_mc @@ -0,0 +1,285 @@ +#!/bin/sh -e +#----------------------------------------------------------------------------- +# +# $Sendmail: update_mc,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Update Sendmail databases for Debian +# +# Copyright (c) 2000-2007 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..4c433c3 --- /dev/null +++ b/debian/local/update_mk @@ -0,0 +1,765 @@ +#!/usr/bin/perl -w +#------------------------------------------------------------------------ +# +# $Sendmail: update_mk,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Create /etc/mail/Makefile for Debian Sendmail databases +# +# Copyright 1998-2007 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.2'; +$main::program_date = '2007-11-02 22:20:56 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-2007 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..92a1616 --- /dev/null +++ b/debian/local/update_smrsh @@ -0,0 +1,94 @@ +#!/bin/sh -e +#----------------------------------------------------------------------------- +# +# $Sendmail: update_smrsh,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Update MDA programs used by Sendmail for Debian +# +# Copyright (c) 2002-2007 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..3583e99 --- /dev/null +++ b/debian/local/update_sys @@ -0,0 +1,252 @@ +#!/bin/sh +#----------------------------------------------------------------------------- +# +# $Sendmail: update_sys,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Update system files used by Sendmail for Debian +# +# Copyright (c) 2001-2007 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 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..d9ec7f2 --- /dev/null +++ b/debian/local/update_tls @@ -0,0 +1,319 @@ +#!/bin/sh -e +#----------------------------------------------------------------------------- +# +# $Sendmail: update_tls,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Sendmail support for TLS +# +# Copyright (c) 2000-2007 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][Nn][Gg]*) + 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_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 + # Skip this for now... + if [ ! -f $COM_PRM ]; then + #openssl dsaparam 2048 -out $COM_PRM; + #openssl dhparam -dsaparam -in $COM_PRM >> $COM_PRM; + touch $COM_PRM; + chmod 0600 $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_tls.in b/debian/local/update_tls.in index 3d37708..99358bf 100644 --- a/debian/local/update_tls.in +++ b/debian/local/update_tls.in @@ -306,7 +306,7 @@ if [ $REFD -eq 0 ]; then Everything you need to support STARTTLS (encrypted mail transmission and user authentication via certificates) is installed and configured - but *IS* not being used. + but is *NOT* being used. To enable sendmail to use STARTTLS, you need to: 1) Add this line to @sysconfdir@/mail/sendmail.mc and optionally diff --git a/debian/local/update_tlsm4 b/debian/local/update_tlsm4 new file mode 100644 index 0000000..4b14ea1 --- /dev/null +++ b/debian/local/update_tlsm4 @@ -0,0 +1,248 @@ +#!/usr/bin/perl -w +#------------------------------------------------------------------------ +# +# $Sendmail: update_tls,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Create /etc/mail/tls/starttls.m4 for Debian Sendmail +# +# Copyright 1998-2007 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.2'; +$main::program_date = '2007-11-02 22:20:56 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' + ,'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-2007 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.2-1 2007-11-02 22:20:56 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 # Optional settings +define(\`confTLS_SRV_OPTIONS\', \`$Def_Map{'confTLS_SRV_OPTIONS'}\')dnl # <= EDIT +dnl # +\')\')dnl +EOT + }; + diff --git a/debian/patches/8.14/8.14.1/control_c.patch b/debian/patches/8.14/8.14.2/control_c.patch index 578d178..1fb6379 100644 --- a/debian/patches/8.14/8.14.1/control_c.patch +++ b/debian/patches/8.14/8.14.2/control_c.patch @@ -19,7 +19,7 @@ diff -c 'sendmail/control.c' 'debian/patches/control.c' Index: ./sendmail/control.c Prereq: 8.128 -*** sendmail-8.14.1/sendmail/control.c Sat Nov 20 15:26:23 1999 +*** sendmail-8.14.2/sendmail/control.c Sat Nov 20 15:26:23 1999 --- ./debian/patches/control.c Sat Nov 20 15:39:52 1999 *************** *** 92,98 **** diff --git a/debian/patches/8.14/8.14.1/cyrusv2.m4.debian.patch b/debian/patches/8.14/8.14.2/cyrusv2.m4.debian.patch index 7ddbbe8..a3b38fd 100644 --- a/debian/patches/8.14/8.14.1/cyrusv2.m4.debian.patch +++ b/debian/patches/8.14/8.14.2/cyrusv2.m4.debian.patch @@ -1,4 +1,4 @@ ---- sendmail-8.14.1/cf/mailer/cyrusv2.m4 Sat Jun 1 15:14:57 2002 +--- sendmail-8.14.2/cf/mailer/cyrusv2.m4 Sat Jun 1 15:14:57 2002 +++ cyrusv2.m4.new Wed Jun 5 04:21:34 2002 @@ -12,7 +12,7 @@ diff --git a/debian/patches/8.14/8.14.1/drac.patch b/debian/patches/8.14/8.14.2/drac.patch index 5094538..1737e47 100644 --- a/debian/patches/8.14/8.14.1/drac.patch +++ b/debian/patches/8.14/8.14.2/drac.patch @@ -1,5 +1,5 @@ ---- sendmail-8.14.1/cf/m4/proto.m4.orig 2003-03-29 02:20:53.000000000 +0900 -+++ sendmail-8.14.1/cf/m4/proto.m4 2003-03-30 13:22:18.731049640 +0900 +--- sendmail-8.14.2/cf/m4/proto.m4.orig 2003-03-29 02:20:53.000000000 +0900 ++++ sendmail-8.14.2/cf/m4/proto.m4 2003-03-30 13:22:18.731049640 +0900 @@ -2110,6 +2110,13 @@ R127.0.0.1 $@ RELAY originated locally RIPv6:::1 $@ RELAY originated locally @@ -15,7 +15,7 @@ R$* $: $>A <$1> <?> <+ Connect> <$1> R<RELAY> $* $@ RELAY relayable IP address --- /dev/null 2002-01-01 00:00:00.000000000 +0900 -+++ sendmail-8.14.1/cf/feature/drac.m4 2002-04-18 21:33:31.716576810 +0900 ++++ sendmail-8.14.2/cf/feature/drac.m4 2002-04-18 21:33:31.716576810 +0900 @@ -0,0 +1,5 @@ +define(`_DRAC_', `') + diff --git a/debian/patches/8.14/8.14.1/kfreebsd.patch b/debian/patches/8.14/8.14.2/kfreebsd.patch index bbb1f1b..4dc3857 100644 --- a/debian/patches/8.14/8.14.1/kfreebsd.patch +++ b/debian/patches/8.14/8.14.2/kfreebsd.patch @@ -1,6 +1,6 @@ -diff -Nurd sendmail-8.14.1.orig/devtools/bin/Build sendmail-8.14.1/devtools/bin/Build ---- sendmail-8.14.1.orig/devtools/bin/Build 2005-09-09 11:36:00.000000000 +0200 -+++ sendmail-8.14.1/devtools/bin/Build 2005-09-09 12:02:15.000000000 +0200 +diff -Nurd sendmail-8.14.2.orig/devtools/bin/Build sendmail-8.14.2/devtools/bin/Build +--- sendmail-8.14.2.orig/devtools/bin/Build 2005-09-09 11:36:00.000000000 +0200 ++++ sendmail-8.14.2/devtools/bin/Build 2005-09-09 12:02:15.000000000 +0200 @@ -422,6 +422,7 @@ NeXT) mkdir="mkdirs";; UNICOSMK) rel=`echo $rel | sed -e 's/\(.*\)\.\(.*\)\.\(.*\)\..*$/\1.\2.\3/'`;; @@ -9,9 +9,9 @@ diff -Nurd sendmail-8.14.1.orig/devtools/bin/Build sendmail-8.14.1/devtools/bin/ esac # get "base part" of operating system release -diff -Nurd sendmail-8.14.1.orig/include/sm/conf.h sendmail-8.14.1/include/sm/conf.h ---- sendmail-8.14.1.orig/include/sm/conf.h 2005-09-09 11:36:00.000000000 +0200 -+++ sendmail-8.14.1/include/sm/conf.h 2005-09-09 11:57:33.000000000 +0200 +diff -Nurd sendmail-8.14.2.orig/include/sm/conf.h sendmail-8.14.2/include/sm/conf.h +--- sendmail-8.14.2.orig/include/sm/conf.h 2005-09-09 11:36:00.000000000 +0200 ++++ sendmail-8.14.2/include/sm/conf.h 2005-09-09 11:57:33.000000000 +0200 @@ -783,7 +783,7 @@ ** See also BSD defines. */ @@ -100,9 +100,9 @@ diff -Nurd sendmail-8.14.1.orig/include/sm/conf.h sendmail-8.14.1/include/sm/con ** DELL SVR4 Issue 2.2, and others ** From Kimmo Suominen <kim@grendel.lut.fi> ** -diff -Nurd sendmail-8.14.1.orig/include/sm/os/sm_os_linux.h sendmail-8.14.1/include/sm/os/sm_os_linux.h ---- sendmail-8.14.1.orig/include/sm/os/sm_os_linux.h 2005-09-09 11:36:00.000000000 +0200 -+++ sendmail-8.14.1/include/sm/os/sm_os_linux.h 2005-09-09 11:45:45.000000000 +0200 +diff -Nurd sendmail-8.14.2.orig/include/sm/os/sm_os_linux.h sendmail-8.14.2/include/sm/os/sm_os_linux.h +--- sendmail-8.14.2.orig/include/sm/os/sm_os_linux.h 2005-09-09 11:36:00.000000000 +0200 ++++ sendmail-8.14.2/include/sm/os/sm_os_linux.h 2005-09-09 11:45:45.000000000 +0200 @@ -15,23 +15,27 @@ #define SM_OS_NAME "linux" diff --git a/debian/patches/8.14/8.14.1/ldap_url_search.patch b/debian/patches/8.14/8.14.2/ldap_url_search.patch index 5175ec9..6813017 100644 --- a/debian/patches/8.14/8.14.1/ldap_url_search.patch +++ b/debian/patches/8.14/8.14.2/ldap_url_search.patch @@ -4,7 +4,7 @@ RCS file: /cvs/libsm/ldap.c,v retrieving revision 1.51 retrieving revision 1.53 diff -u -r1.51 -r1.53 ---- ./sendmail-8.14.1/libsm/ldap.c 30 Oct 2003 23:11:12 -0000 1.51 +--- ./sendmail-8.14.2/libsm/ldap.c 30 Oct 2003 23:11:12 -0000 1.51 +++ ldap.c 30 Oct 2003 23:33:10 -0000 1.53 @@ -1043,6 +1043,7 @@ NULL : lmap->ldap_attr), diff --git a/debian/patches/8.14/8.14.1/local_procmail.patch b/debian/patches/8.14/8.14.2/local_procmail.patch index fabaa06..1b8d7aa 100644 --- a/debian/patches/8.14/8.14.1/local_procmail.patch +++ b/debian/patches/8.14/8.14.2/local_procmail.patch @@ -19,7 +19,7 @@ diff -c 'cf/feature/local_procmail.m4' 'debian/patches/local_procmail.m4' Index: ./cf/feature/local_procmail.m4 Prereq: 8.22 -*** sendmail-8.14.1/cf/feature/local_procmail.m4 Sat Nov 20 15:26:21 1999 +*** sendmail-8.14.2/cf/feature/local_procmail.m4 Sat Nov 20 15:26:21 1999 --- ./debian/patches/local_procmail.m4 Sat Nov 20 15:39:46 1999 *************** *** 27,32 **** diff --git a/debian/patches/8.14/8.14.1/mailer_cyrus.patch b/debian/patches/8.14/8.14.2/mailer_cyrus.patch index 4f52c19..500aba8 100644 --- a/debian/patches/8.14/8.14.1/mailer_cyrus.patch +++ b/debian/patches/8.14/8.14.2/mailer_cyrus.patch @@ -1,4 +1,4 @@ ---- sendmail-8.14.1/cf/mailer/cyrus.m4 Tue May 2 14:40:24 2000 +--- sendmail-8.14.2/cf/mailer/cyrus.m4 Tue May 2 14:40:24 2000 +++ ./debian/patches/cf/mailer/cyrus.m4 Tue May 2 14:41:21 2000 @@ -36,12 +36,12 @@ # diff --git a/debian/patches/8.14/8.14.1/mailer_fax.patch b/debian/patches/8.14/8.14.2/mailer_fax.patch index c779634..1976849 100644 --- a/debian/patches/8.14/8.14.1/mailer_fax.patch +++ b/debian/patches/8.14/8.14.2/mailer_fax.patch @@ -19,7 +19,7 @@ diff -c './cf/mailer/fax.m4' 'fax.m4' Index: ./cf/mailer/fax.m4 Prereq: 8.16 -*** sendmail-8.14.1/cf/mailer/fax.m4 Mon Oct 18 02:35:28 1999 +*** sendmail-8.14.2/cf/mailer/fax.m4 Mon Oct 18 02:35:28 1999 --- ./fax.m4 Wed Jan 3 14:26:13 2001 *************** *** 19,26 **** diff --git a/debian/patches/8.14/8.14.1/maxseq.patch b/debian/patches/8.14/8.14.2/maxseq.patch index 5447136..0bff5e1 100644 --- a/debian/patches/8.14/8.14.1/maxseq.patch +++ b/debian/patches/8.14/8.14.2/maxseq.patch @@ -19,7 +19,7 @@ diff -c 'conf.h' 'conf.h.new' Index: ./conf.h Prereq: 8.574 -*** ./sendmail-8.14.1/sendmail/conf.h Fri Sep 21 19:01:46 2001 +*** ./sendmail-8.14.2/sendmail/conf.h Fri Sep 21 19:01:46 2001 --- ./conf.h.new Wed Oct 10 09:24:41 2001 *************** *** 74,79 **** diff --git a/debian/patches/8.14/8.14.1/rmail.odi.patch b/debian/patches/8.14/8.14.2/rmail.odi.patch index 19c3c05..5645939 100644 --- a/debian/patches/8.14/8.14.1/rmail.odi.patch +++ b/debian/patches/8.14/8.14.2/rmail.odi.patch @@ -19,7 +19,7 @@ diff -c 'rmail/rmail.c' 'debian/patches/rmail.c' Index: ./rmail/rmail.c Prereq: 8.61 -*** sendmail-8.14.1/rmail/rmail.c Sat Sep 16 18:20:25 2000 +*** sendmail-8.14.2/rmail/rmail.c Sat Sep 16 18:20:25 2000 --- ./debian/patches/rmail.c Thu Sep 28 17:00:59 2000 *************** *** 318,324 **** diff --git a/debian/rmail.dirs b/debian/rmail.dirs new file mode 100644 index 0000000..509a76d --- /dev/null +++ b/debian/rmail.dirs @@ -0,0 +1,6 @@ +./DEBIAN +./usr/sbin +./usr/share/man +./usr/share/man/man8 +./usr/share/bug +./usr/share/lintian/overrides diff --git a/debian/rmail.postrm b/debian/rmail.postrm new file mode 100644 index 0000000..84136af --- /dev/null +++ b/debian/rmail.postrm @@ -0,0 +1,53 @@ +#!/bin/sh -e +# +# Debian post removal script +# +# Install of already installed package: +# 1) Upgrade of package: +# new-preinst upgrade old-version +# *) new-postrm abort-upgrade old-version +# 2) package had some configuration files from a previous version installed +# new-preinst install old-version +# *) new-postrm abort-install old-version +# 3) Otherwise (i.e., the package was completely purged) +# new-preinst install +# *) new-postrm abort-install +# +# Removal of a package: +# 1) prerm remove +# 2) The package's files are removed (except conffiles). +# 3) postrm remove +# 4) All the maintainer scripts except the postrm are removed. +# 5) The conffiles and any backup files +# (~-files, #*# files, %-files, .dpkg-{old,new,tmp}, etc.) are removed. +# 6) postrm purge +# 7) The package's file list is removed +# +set -e; + +PACKAGE=rmail; + +case "$1" in + remove) + # /usr/share/doc/$PACKAGE is a symlink to /usr/share/doc/sendmail + rm -f /usr/share/doc/$PACKAGE 2>/dev/null || true; + rmdir /usr/share/doc/sendmail 2>/dev/null || true; + ;; + + purge) + ;; + + upgrade) + ;; + + failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "$PACKAGE postrm called with unknown argument \`$1'" >&2; + exit 1; + ;; + esac; + +#DEBHELPER# +exit 0; diff --git a/debian/rmail.preinst b/debian/rmail.preinst new file mode 100644 index 0000000..d052966 --- /dev/null +++ b/debian/rmail.preinst @@ -0,0 +1,55 @@ +#!/bin/sh -e +# +# Debian pre install script +# +# Install of already installed package: +# 1) Upgrade of package: +# new-preinst upgrade old-version +# *) new-postrm abort-upgrade old-version +# 2) package had some configuration files from a previous version installed +# new-preinst install old-version +# *) new-postrm abort-install old-version +# 3) Otherwise (i.e., the package was completely purged) +# new-preinst install +# *) new-postrm abort-install +# +set -e; + +PACKAGE=rmail; + +case "$1" in + install) + # DPKG doesn't overwrite directories with symlinks... + if [ -d /usr/share/doc/$PACKAGE ]; then + rm -rf /usr/share/doc/$PACKAGE; + fi; + if [ ! -d /usr/share/doc/sendmail ]; then + mkdir -p /usr/share/doc/sendmail; + chmod a+rx /usr/share/doc/sendmail; + fi; + ln -sf sendmail /usr/share/doc/$PACKAGE; + ;; + + upgrade) + # DPKG doesn't overwrite directories with symlinks... + if [ -d /usr/share/doc/$PACKAGE ]; then + rm -rf /usr/share/doc/$PACKAGE; + fi; + if [ ! -d /usr/share/doc/sendmail ]; then + mkdir -p /usr/share/doc/sendmail; + chmod a+rx /usr/share/doc/sendmail; + fi; + ln -sf sendmail /usr/share/doc/$PACKAGE; + ;; + + abort-upgrade) + ;; + + *) + echo "$PACKAGE preinst called with unknown argument \`$1'" >&2; + exit 1; + ;; + esac; + +#DEBHELPER# +exit 0; diff --git a/debian/sendmail-base.dirs b/debian/sendmail-base.dirs new file mode 100644 index 0000000..4f0ae0f --- /dev/null +++ b/debian/sendmail-base.dirs @@ -0,0 +1,60 @@ +./DEBIAN +./etc/cron.d +./etc/cron.daily +./etc/default +./etc/dhcp3 +./etc/dhcp3/dhclient-exit-hooks.d +./etc/logcheck +./etc/logcheck/ignore.d.paranoid +./etc/logcheck/ignore.d.server +./etc/logcheck/ignore.d.workstation +./etc/logcheck/violations.ignore.d +./etc/logrotate.d +./etc/mail +./etc/mail/m4 +./etc/mail/peers +./etc/mail/smrsh +./etc/mail/sasl +./etc/mail/tls +./etc/network +./etc/network/if-down.d +./etc/network/if-post-down.d +./etc/network/if-up.d +./etc/pam.d +./etc/ppp/ip-down.d +./etc/ppp/ip-up.d +./etc/resolvconf +./etc/resolvconf/update-libc.d +./usr/bin +./usr/sbin +./usr/share/doc/sendmail-base +./usr/share/man +./usr/share/man/man1 +./usr/share/man/man8 +./usr/share/bug +./usr/share/bug/sendmail +./usr/share/sendmail +./usr/share/sendmail/examples +./usr/share/sendmail/examples/db +./usr/share/sendmail/examples/dhcp3 +./usr/share/sendmail/examples/dhcp3/dhclient-exit-hooks.d +./usr/share/sendmail/examples/ppp +./usr/share/sendmail/examples/ppp/ip-down.d +./usr/share/sendmail/examples/ppp/ip-up.d +./usr/share/sendmail/examples/ldap +./usr/share/sendmail/examples/logcheck +./usr/share/sendmail/examples/logcheck/ignore.d.paranoid +./usr/share/sendmail/examples/logcheck/ignore.d.server +./usr/share/sendmail/examples/logcheck/ignore.d.workstation +./usr/share/sendmail/examples/logcheck/violations.ignore.d +./usr/share/sendmail/examples/milter +./usr/share/sendmail/examples/network +./usr/share/sendmail/examples/network/if-down.d +./usr/share/sendmail/examples/network/if-post-down.d +./usr/share/sendmail/examples/network/if-up.d +./usr/share/sendmail/examples/pam.d +./usr/share/sendmail/examples/resolvconf +./usr/share/sendmail/examples/resolvconf/update-libc.d +./usr/share/sendmail/examples/sasl +./usr/share/sendmail/examples/tls +./usr/share/lintian/overrides diff --git a/debian/sendmail-base.postinst b/debian/sendmail-base.postinst new file mode 100644 index 0000000..5c48335 --- /dev/null +++ b/debian/sendmail-base.postinst @@ -0,0 +1,116 @@ +#!/bin/sh -e +# +# Debian post installation script +# +# Install of already installed package: +# 1) old-prerm upgrade new-version +# *) new-prerm failed-upgrade old-version +# *) old-postinst abort-upgrade new-version +# +# If a `conflicting' package is being removed at the same time: +# 1) forall packages depending on conflicting package and --auto-deconfigure +# deconfigured's-prerm deconfigure \ +# in-favour package-being-installed version \ +# removing conflicting-package version +# *) deconfigured's-postinst abort-deconfigure \ +# in-favour package-being-installed-but-failed version \ +# removing conflicting-package version +# 2) To prepare for removal of the conflicting package +# conflictor's-prerm remove \ +# in-favour package new-version +# *) conflictor's-postinst abort-remove \ +# in-favour package new-version +# +# Configuration of package: +# postinst configure most-recently-configured-version +# +set -e; + +PACKAGE=sendmail-base; + +# do we have debconf? +if [ -f /usr/share/debconf/confmodule ]; then + DEBCONF=true; + #. /usr/share/debconf/confmodule; + #db_stop; # For testing +else + DEBCONF=''; + fi; + +case "$1" in + configure) + #----------------------------------------------------------- + if [ "$2" = "" ]; then + :; + #echo " "; + #echo "A new sendmail user, welcome!"; + fi; + + #----------------------------------------------------------- + # Tell users about new and interesting things... + if [ -x /usr/share/sendmail/update_notices ]; then + /usr/share/sendmail/update_notices $2; + fi; + + #----------------------------------------------------------- + # Create group/user smmta/smmsp iff needed + touch /etc/mail/tsmmta; + if ! chown root:smmta /etc/mail/tsmmta 2>/dev/null; then + addgroup --system --quiet smmta; + fi; + if ! chown smmta:smmta /etc/mail/tsmmta 2>/dev/null; then + adduser --system --ingroup smmta --home "/var/lib/sendmail" \ + --disabled-password \ + --quiet --gecos 'Mail Transfer Agent' smmta; + fi; + rm /etc/mail/tsmmta; + touch /etc/mail/tsmmsp; + if ! chown root:smmsp /etc/mail/tsmmsp 2>/dev/null; then + addgroup --system --quiet smmsp; + fi; + if ! chown smmsp:smmsp /etc/mail/tsmmsp 2>/dev/null; then + adduser --system --ingroup smmsp --home "/var/lib/sendmail" \ + --disabled-password \ + --quiet --gecos 'Mail Submission Program' smmsp; + fi; + rm /etc/mail/tsmmsp; + + #----------------------------------------------------------- + # With a dynamic uid/gid, have to set appropriate ownership herein + chown root:smmsp /etc/mail/sasl; + chown root:smmsp /etc/mail/tls; + + #----------------------------------------------------------- + # Save the current configuration files in safe place... + if [ -x /etc/cron.daily/sendmail ]; then + echo "Saving current /etc/mail/sendmail.mc,cf to /var/backups"; + /etc/cron.daily/sendmail || true; + fi; + + #----------------------------------------------------------- + # Make sure inetd.conf has sendmail in it (but disabled) + if [ -x /usr/sbin/update-inetd ]; then + update-inetd --remove "^587"; + update-inetd --group MAIL --add \ + "#<off># smtp\tstream\ttcp\tnowait\troot\t/usr/sbin/sendmail sendmail -Am -bs"; + update-inetd --group MAIL --add \ + "#<off># submission\tstream\ttcp\tnowait\troot\t/usr/sbin/sendmail sendmail -Am -bs"; + update-inetd --group MAIL --add \ + "#<off># smtps\tstream\ttcp\tnowait\troot\t/usr/sbin/sendmail sendmail -Am -bs"; + update-inetd --group MAIL --disable smtp,smtps,submission; + fi; + + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + exit 0; + ;; + + *) + echo "$PACKAGE postinst called with unknown argument \`$1'" >&2; + exit 1; + ;; + esac; + +#DEBHELPER# +exit 0; diff --git a/debian/sendmail-base.postrm b/debian/sendmail-base.postrm new file mode 100644 index 0000000..c932cc6 --- /dev/null +++ b/debian/sendmail-base.postrm @@ -0,0 +1,106 @@ +#!/bin/sh -e +# +# Debian post removal script +# +# Install of already installed package: +# 1) Upgrade of package: +# new-preinst upgrade old-version +# *) new-postrm abort-upgrade old-version +# 2) package had some configuration files from a previous version installed +# new-preinst install old-version +# *) new-postrm abort-install old-version +# 3) Otherwise (i.e., the package was completely purged) +# new-preinst install +# *) new-postrm abort-install +# +# Removal of a package: +# 1) prerm remove +# 2) The package's files are removed (except conffiles). +# 3) postrm remove +# 4) All the maintainer scripts except the postrm are removed. +# 5) The conffiles and any backup files +# (~-files, #*# files, %-files, .dpkg-{old,new,tmp}, etc.) are removed. +# 6) postrm purge +# 7) The package's file list is removed +# +set -e; + +PACKAGE=sendmail-base; + +case "$1" in + remove) + if [ ! -z "$2" ]; then + echo "Removing $PACKAGE $2 $3($4)"; + fi; + + if [ -x /usr/sbin/update-inetd ]; then + update-inetd --remove "^smtp"; + update-inetd --remove "^smtps"; + update-inetd --remove "^submission"; + fi; + ;; + + purge) + # Currently, dh_installdebconf doesn't do db_stop... ensure it is done! + if [ "$1" = "purge" ] && [ -e /usr/share/debconf/confmodule ]; then + # Source debconf library. + . /usr/share/debconf/confmodule; + # Make sure we're done + #db_stop; + # Remove my changes to the db. + db_purge; + fi; + + # Remove user/group smmsp + if [ -x /usr/sbin/deluser ]; then + deluser --quiet smmta || true; + deluser --quiet smmsp || true; + fi; + userdel smmta 2>/dev/null || true; + groupdel smmta 2>/dev/null || true; + userdel smmsp 2>/dev/null || true; + groupdel smmsp 2>/dev/null || true; + + # Purge those files installed in other package directories + rm -f /usr/lib/lib/sasl/Sendmail.conf; + rm -f /etc/certs/sendmail.pem; + rm -f /usr/share/bug/sendmail*; + # Can't touch these as they may be included in slapd.conf + #rm -rf /etc/ldap/schema/sendmail.schema; + #rm -rf /etc/openldap/sendmail.schema; + #rm -rf /etc/umich-ldap/sendmail.schema; + # Purge psuedo conffiles (managed by sendmail) + rm -f /etc/mail/sendmail.conf; + # Purge sendmail configuration files + rm -f /etc/mail/sendmail.mc \ + /etc/mail/submit.mc \ + /etc/mail/m4/dialup.m4 \ + /etc/mail/m4/provider.m4 \ + /etc/mail/local-host-names \ + /etc/mail/relay-domains \ + /etc/mail/trusted-users \ + /etc/mail/default-auth-info \ + ; + rmdir /etc/mail/peers 2>/dev/null || true; + rmdir /etc/mail 2>/dev/null || true; + + ;; + + upgrade) + ;; + + failed-upgrade|abort-install|abort-upgrade|disappear) + echo "$1 of $PACKAGE $2"; + ;; + + *) + echo "$PACKAGE postrm called with unknown argument \`$1'" >&2; + exit 1; + ;; + esac; + +# NOTE WELL: If we fall through here during purge, update-rc.d will be +# called with remove... and /etc/init.d/$PACKAGE goes away! +#DEBHELPER# + +exit 0; diff --git a/debian/sendmail-base.preinst b/debian/sendmail-base.preinst new file mode 100644 index 0000000..cd1d5c7 --- /dev/null +++ b/debian/sendmail-base.preinst @@ -0,0 +1,66 @@ +#!/bin/sh -e +# +# Debian pre install script +# +# Install of already installed package: +# 1) Upgrade of package: +# new-preinst upgrade old-version +# *) new-postrm abort-upgrade old-version +# 2) package had some configuration files from a previous version installed +# new-preinst install old-version +# *) new-postrm abort-install old-version +# 3) Otherwise (i.e., the package was completely purged) +# new-preinst install +# *) new-postrm abort-install +# +set -e; + +PACKAGE=sendmail-base; + +case "$1" in + install) + # DPKG doesn't overwrite directories with symlinks... + rm -rf /usr/share/doc/sendmail/examples 2>/dev/null || true; + if [ -d /usr/share/doc/$PACKAGE ]; then + rm -rf /usr/share/doc/$PACKAGE; + fi; + if [ ! -d /usr/share/doc/sendmail ]; then + mkdir -p /usr/share/doc/sendmail; + chmod a+rx /usr/share/doc/sendmail; + fi; + ln -sf sendmail /usr/share/doc/$PACKAGE; + ;; + + upgrade) + # DPKG doesn't overwrite directories with symlinks... + if [ -d /usr/share/doc/$PACKAGE ]; then + rm -rf /usr/share/doc/$PACKAGE; + fi; + if [ ! -d /usr/share/doc/sendmail ]; then + mkdir -p /usr/share/doc/sendmail; + chmod a+rx /usr/share/doc/sendmail; + fi; + ln -sf sendmail /usr/share/doc/$PACKAGE; + + # Prevent cronjob from running during upgrade... + if [ -f /etc/cron.d/sendmail ]; then + echo "#preinst" > /etc/cron.d/sendmail; + fi; + + # Move files to new home + if [ -d /etc/mail/ssl ]; then + mv -f /etc/mail/ssl /etc/mail/tls; + fi; + ;; + + abort-upgrade) + ;; + + *) + echo "$PACKAGE preinst called with unknown argument \`$1'" >&2; + exit 1; + ;; + esac; + +#DEBHELPER# +exit 0; diff --git a/debian/sendmail-base.prerm b/debian/sendmail-base.prerm new file mode 100644 index 0000000..09a09cf --- /dev/null +++ b/debian/sendmail-base.prerm @@ -0,0 +1,138 @@ +#!/bin/sh -e +# +# Debian pre removal script +# +# Install of already installed package: +# 1) old-prerm upgrade new-version +# *) new-prerm failed-upgrade old-version +# *) old-postinst abort-upgrade new-version +# +# If a `conflicting' package is being removed at the same time: +# 1) forall packages depending on conflicting package and --auto-deconfigure +# deconfigured's-prerm deconfigure \ +# in-favour package-being-installed version \ +# removing conflicting-package version +# *) deconfigured's-postinst abort-deconfigure \ +# in-favour package-being-installed-but-failed version \ +# removing conflicting-package version +# 2) To prepare for removal of the conflicting package +# conflictor's-prerm remove \ +# in-favour package new-version +# *) conflictor's-postinst abort-remove \ +# in-favour package new-version +# +# Removal of a package: +# 1) prerm remove +# 2) The package's files are removed (except conffiles). +# 3) postrm remove +# 4) All the maintainer scripts except the postrm are removed. +# +set -e; + +PACKAGE=sendmail-base; + +case "$1" in + remove) + if [ ! -z "$2" ]; then + echo "Removing $PACKAGE $2 $3($4)"; + fi; + + if [ -x /usr/sbin/update-inetd ]; then + update-inetd --group MAIL --disable smtp,smtps,submission; + fi; + + # Make sure /etc/aliases is left (move it from /etc/mail if needed) + if [ -L /etc/mail/aliases ]; then + rm -f /etc/mail/aliases; + elif [ -f /etc/mail/aliases ] \ + && [ -L /etc/aliases ]; then + mv /etc/mail/aliases /etc/aliases; + fi; + + # Remove psuedo conffiles (managed by sendmail) + rm -f /etc/cron.d/sendmail; + + # Remove files scattered across the system that + # happened to be created by sendmail + rm -f /usr/lib/sasl/Sendmail.conf; + + # Remove those files created by sendmail + rm -rf /var/lib/sendmail; + rm -rf /var/run/sendmail; + # Note: syslog really owns these files + #rm -f /var/log/mail/*; + #rm -f /var/log/mail.log; + # Note: these can lead to a loss of mail!!!! + if [ -x /etc/init.d/sendmail ]; then + /etc/init.d/sendmail clean; + fi; + if [ -L /var/spool/mqueue ]; then + rmdir --ignore-fail-on-non-empty \ + `readlink -fn /var/spool/mqueue`; + elif [ -d /var/spool/mqueue ]; then + rmdir --ignore-fail-on-non-empty \ + /var/spool/mqueue; + fi; + if [ -L /var/spool/mqueue-client ]; then + rmdir --ignore-fail-on-non-empty \ + `readlink -fn /var/spool/mqueue-client`; + elif [ -d /var/spool/mqueue-client ]; then + rmdir --ignore-fail-on-non-empty \ + /var/spool/mqueue-client; + fi; + + # Remove sendmail built configuration files + rm -f /etc/mail/*.db \ + /etc/mail/*.dir \ + /etc/mail/*.pag; + rm -f /etc/mail/sendmail.cf \ + /etc/mail/sendmail.cf.old \ + /etc/mail/sendmail.cf.errors \ + /etc/mail/sendmail.mc.old \ + /etc/mail/submit.cf \ + /etc/mail/submit.cf.errors \ + /etc/mail/submit.mc.old \ + /etc/mail/databases \ + /etc/mail/Makefile \ + ; + rm -rf /etc/mail/smrsh \ + /etc/mail/sasl \ + /etc/mail/tls; + + # Remove empty files (probably touched databases) + find /etc/mail -maxdepth 1 -size 0 | xargs -r rm; + ;; + + upgrade) + # Potentially move the old configuration file to the new name - + # before it gets deleted (for not existing in the new package) + mv -f /etc/default/sendmail \ + /etc/mail/sendmail.conf 2>/dev/null || true; + + # Prevent cronjob from running during upgrade... + if [ -f /etc/cron.d/sendmail ]; then + echo "#prerm" > /etc/cron.d/sendmail; + fi; + ;; + + failed-upgrade) + ;; + + deconfigure) + echo "Deconfigure of $PACKAGE $2 $3($4) $5 $6($7) "; + ;; + + *) + echo "$PACKAGE prerm called with unknown argument \`$1'" >&2; + exit 1; + ;; + esac; + +# The @DEBHELPER@ stuff causes problems with upgrades because of the +# length of time that Sendmail is stopped... + +# +# Included for sanity checks +# +#DEBHELPER# +exit 0; diff --git a/debian/sendmail-bin.dirs b/debian/sendmail-bin.dirs new file mode 100644 index 0000000..5287c1d --- /dev/null +++ b/debian/sendmail-bin.dirs @@ -0,0 +1,20 @@ +./DEBIAN +./etc/cron.daily +./etc/init.d +./usr/bin +./usr/sbin +./usr/lib/sm.bin +./usr/share/doc/sendmail +./usr/share/man +./usr/share/man/man1 +./usr/share/man/man5 +./usr/share/man/man8 +./usr/share/bug +./var/lib/sendmail +./var/run/sendmail +./var/run/sendmail/msp +./var/run/sendmail/mta +./var/run/sendmail/stampdir +./var/spool/mqueue +./var/spool/mqueue-client +./usr/share/lintian/overrides diff --git a/debian/sendmail-bin.postinst b/debian/sendmail-bin.postinst new file mode 100644 index 0000000..16c5b8c --- /dev/null +++ b/debian/sendmail-bin.postinst @@ -0,0 +1,319 @@ +#!/bin/sh -e +# +# Debian post installation script +# +# Install of already installed package: +# 1) old-prerm upgrade new-version +# *) new-prerm failed-upgrade old-version +# *) old-postinst abort-upgrade new-version +# +# If a `conflicting' package is being removed at the same time: +# 1) forall packages depending on conflicting package and --auto-deconfigure +# deconfigured's-prerm deconfigure \ +# in-favour package-being-installed version \ +# removing conflicting-package version +# *) deconfigured's-postinst abort-deconfigure \ +# in-favour package-being-installed-but-failed version \ +# removing conflicting-package version +# 2) To prepare for removal of the conflicting package +# conflictor's-prerm remove \ +# in-favour package new-version +# *) conflictor's-postinst abort-remove \ +# in-favour package new-version +# +# Configuration of package: +# postinst configure most-recently-configured-version +# +set -e; + +PACKAGE=sendmail-bin; + +#----------------------------------------------------------- +#stop(): stop sendmail +stop_mta () { + # Account for varying PIDfile locations of older sendmail packages + if [ -f /var/run/sendmail/mta/sendmail.pid ]; then + start-stop-daemon --stop --oknodo --quiet \ + --pidfile /var/run/sendmail/msp/sendmail.pid > /dev/null; + start-stop-daemon --stop --oknodo --quiet \ + -pidfile /var/run/sendmail/mta/sendmail.pid > /dev/null; + elif [ -f /var/run/sendmail/sendmail.pid ]; then + start-stop-daemon --stop --oknodo --quiet \ + --pidfile /var/run/sendmail/sendmail.pid > /dev/null; + elif [ -f /var/run/sendmail.pid ]; then + start-stop-daemon --stop --oknodo --quiet \ + --pidfile /var/run/sendmail.pid > /dev/null; + fi; + # Since we changed the executable, do one more try - using the old name + if [ -f /var/run/sendmail/mta/sendmail.pid ]; then + start-stop-daemon --stop --oknodo --quiet \ + --pidfile /var/run/sendmail/mta/sendmail.pid > /dev/null; + fi; + start-stop-daemon --stop --oknodo --quiet \ + --name sendmail > /dev/null; + if [ -x /etc/init.d/sendmail ]; then + if [ -x /usr/sbin/invoke-rc.d ]; then + /usr/sbin/invoke-rc.d --quiet --force sendmail stop; + else + /etc/init.d/sendmail stop; + fi; + fi; + }; + +#----------------------------------------------------------- +#start(): start sendmail +start_mta () { + if [ -x /usr/sbin/invoke-rc.d ]; then + /usr/sbin/invoke-rc.d sendmail start; + else + /etc/init.d/sendmail start; + fi; + }; + +#----------------------------------------------------------- +# configure(): save sendmail.cf, call sendmailconfig +configure_mta () { + local enter; + echo -n "Configure now ? (y/N) "; + read yn; + yn=$(echo -n "$yn" | sed -e "s/^\ *//" -e "s/^\t*//"); + test -n "$yn" || yn="N"; + case "$yn" in + [Yy]*) + stop_mta; + /usr/sbin/sendmailconfig --no-reload; + start_mta; + ;; + + [Nn]*) + echo -e "\nTo configure sendmail later, type" \ + "sendmailconfig"; + echo "After configuring sendmail, you can" \ + "start it via /etc/init.d/sendmail start"; + echo -n "Press [ENTER] "; + read enter; + ;; + esac; + }; + +# do we have debconf? +if [ -f /usr/share/debconf/confmodule ]; then + DEBCONF=true; + #. /usr/share/debconf/confmodule; + #db_stop; # For testing +else + DEBCONF=''; + fi; + +case "$1" in + configure) + # continue below + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + exit 0; + ;; + + *) + echo "$PACKAGE postinst called with unknown argument \`$1'" >&2; + exit 1; + ;; + esac; + +#-------------------------------------------------------------------- +# Continuation of "$1" = "configure" + +# Note: can't use debhelper here because the actions aren't contiguous +#xxxHELPER# + +# Automatically added by dh_installinit +if [ -x "/etc/init.d/sendmail" ]; then + update-rc.d -f sendmail remove >/dev/null; + update-rc.d sendmail defaults 21 19 >/dev/null; + #/etc/init.d/sendmail start +fi +# End automatically added section + +#----------------------------------------------------------- +# Create (or update) MTA, MSP alternatives +# This way, we'll be able to install 2 MTAs on the same box :) +update-alternatives \ + --install /usr/sbin/sendmail-mta sendmail-mta /usr/lib/sm.bin/sendmail 25 \ + --slave /usr/share/man/man8/sendmail-mta.8.gz sendmail-mta.8.gz \ + /usr/share/man/man8/sendmail.sendmail.8.gz \ + --slave /usr/sbin/runq runq /usr/share/sendmail/runq \ + --slave /usr/share/man/man8/runq.8.gz runq.8.gz \ + /usr/share/man/man8/runq.sendmail.8.gz \ + --slave /usr/sbin/newaliases newaliases \ + /usr/share/sendmail/newaliases \ + --slave /usr/share/man/man8/newaliases.8.gz newaliases.8.gz \ + /usr/share/man/man8/newaliases.sendmail.8.gz \ + --slave /usr/bin/mailq mailq /usr/share/sendmail/mailq \ + --slave /usr/share/man/man1/mailq.1.gz mailq.1.gz \ + /usr/share/man/man1/mailq.sendmail.1.gz \ + --slave /usr/share/man/man5/aliases.5.gz aliases.5.gz \ + /usr/share/man/man5/aliases.sendmail.5.gz \ + ; +update-alternatives \ + --install /usr/sbin/sendmail-msp sendmail-msp /usr/lib/sm.bin/sendmail 25 \ + --slave /usr/share/man/man8/sendmail-msp.8.gz sendmail-msp.8.gz \ + /usr/share/man/man8/sendmail.sendmail.8.gz \ + --slave /usr/sbin/sendmail sendmail /usr/lib/sm.bin/sendmail \ + --slave /usr/lib/sendmail lib.sendmail /usr/lib/sm.bin/sendmail \ + --slave /usr/share/man/man8/sendmail.8.gz sendmail.8.gz \ + /usr/share/man/man8/sendmail.sendmail.8.gz \ + ; + +#----------------------------------------------------------- +# With a dynamic uid/gid, have to set appropriate ownership herein +if command -v suidregister >/dev/null 2>&1 && test -s /etc/suid.conf; then + suidregister -s sendmail /usr/sbin/sendmail root smmsp 02755; + suidregister -s sendmail /usr/lib/sm.bin/mailstats root smmsp 02755; +elif [ -x /usr/sbin/sendmail ]; then + chown root:smmsp /usr/lib/sm.bin/sendmail; + chmod 02755 /usr/lib/sm.bin/sendmail; + chown root:smmsp /usr/lib/sm.bin/mailstats; + chmod 02755 /usr/lib/sm.bin/mailstats; + fi; + +#----------------------------------------------------------- +# Create backups of /etc/mail/{sendmail,submit}.mc +if [ -f /etc/mail/sendmail.cf ]; then + echo "Saving old /etc/mail/sendmail.cf" \ + "as /etc/mail/sendmail.cf.old ..."; + cp -f /etc/mail/sendmail.cf \ + /etc/mail/sendmail.cf.old; + chown root:root /etc/mail/sendmail.cf.old; + chmod 0644 /etc/mail/sendmail.cf.old; + fi; +if [ -f /etc/mail/submit.cf ]; then + cp -f /etc/mail/submit.cf \ + /etc/mail/submit.cf.old; + chown root:root /etc/mail/submit.cf.old; + chmod 0644 /etc/mail/submit.cf.old; + fi; + +start_ask=0; + +#----------------------------------------------------------- +# Create /etc/mail/sendmail.mc if it doesn't exist +if [ ! -f /etc/mail/sendmail.mc ]; then + cat <<-EOT + + You are doing a new install, or have erased /etc/mail/sendmail.mc. + If you've accidentaly erased /etc/mail/sendmail.mc, check /var/backups. + + I am creating a safe, default sendmail.mc for you and you can + run sendmailconfig later if you need to change the defaults. + + EOT + fi; + +if [ -x /usr/share/sendmail/update_sendmail ]; then + stop_mta; + echo "Updating sendmail environment ..."; + /usr/share/sendmail/update_sendmail || true; + start_mta; + fi; +exit 0; + + +#----------------------------------------------------------- +# See if we can do this automagically... +cat <<-EOT + +It is a good idea to regenerate the sendmail configuration +file with each new spin of the sendmail package. + +But, if you hand edit sendmail.cf instead of making changes through +sendmail.mc, then you want to say no, save your old sendmail.cf, run +sendmailconfig, then migrate your changes into the new version. + +EOT +echo -n "Automagically regenerate the sendmail.cf configuration file? (Y/n) "; +read yn; +yn=$(echo -n "$yn" | sed -e "s/^\ *//" -e "s/^\t*//"); +test -n "$yn" || yn="Y"; +case "$yn" in + [Yy]*) + if [ -f /etc/mail/sendmail.cf ]; then + echo "Saving old /etc/mail/sendmail.cf" \ + "as /etc/mail/sendmail.cf.old ..."; + cp -f /etc/mail/sendmail.cf \ + /etc/mail/sendmail.cf.old; + chown root:root /etc/mail/sendmail.cf.old; + chmod 0644 /etc/mail/sendmail.cf.old; + fi; + if [ -f /etc/mail/submit.cf ]; then + cp -f /etc/mail/submit.cf \ + /etc/mail/submit.cf.old; + chown root:root /etc/mail/submit.cf.old; + chmod 0644 /etc/mail/submit.cf.old; + fi; + if [ -x /usr/share/sendmail/update_sendmail ]; then + stop_mta; + echo "Updating sendmail environment ..."; + /usr/share/sendmail/update_sendmail || true; + fi; + ;; + + [Nn]*) + cat <<-EOT + + Your files (sendmail.mc,cf, etc) have *not* been altered. + + *** Warning *** Warning *** Warning *** Warning *** Warning *** Warning *** + + There have been changes in + * Paths of some databases and executables + * FEATUREs, DOMAIN, includes + * Internal Database storage + + These changes were *NOT* made for you ... And will not be + until you run sendmailconfig! + + Until you update /etc/mail/sendmail.cf via sendmailconfig, + you should expect to have problems running sendmail! + + "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 + + *** Warning *** Warning *** Warning *** Warning *** Warning *** Warning *** + + EOT + echo "Do you wish to run sendmailconfig now, or later"; + start_ask=0; + configure_mta; + case "$yn" in + [Yy]*) + cat <<-EOT + + Do you wish to start sendmail with the new sendmail.cf, + or do you wish to delay until you can merge any changes + from your older sendmail.cf.old? + EOT + start_ask=1; + start_mta; + ;; + esac; + exit 0; + esac; + +#----------------------------------------------------------- +# If we're still here, we're going the automagic path... +# Now, liberal application of smoke and mirrors +if [ -f /etc/mail/sendmail.mc ]; then + start_ask=1; + start_mta; + fi; + +exit 0; + +#----------------------------------------------------------- +# +# List herein (for reference) what debhelper would've done: +#DEBHELPER# +exit 0; diff --git a/debian/sendmail-bin.postrm b/debian/sendmail-bin.postrm new file mode 100644 index 0000000..7d62447 --- /dev/null +++ b/debian/sendmail-bin.postrm @@ -0,0 +1,85 @@ +#!/bin/sh -e +# +# Debian post removal script +# +# Install of already installed package: +# 1) Upgrade of package: +# new-preinst upgrade old-version +# *) new-postrm abort-upgrade old-version +# 2) package had some configuration files from a previous version installed +# new-preinst install old-version +# *) new-postrm abort-install old-version +# 3) Otherwise (i.e., the package was completely purged) +# new-preinst install +# *) new-postrm abort-install +# +# Removal of a package: +# 1) prerm remove +# 2) The package's files are removed (except conffiles). +# 3) postrm remove +# 4) All the maintainer scripts except the postrm are removed. +# 5) The conffiles and any backup files +# (~-files, #*# files, %-files, .dpkg-{old,new,tmp}, etc.) are removed. +# 6) postrm purge +# 7) The package's file list is removed +# +set -e; + +PACKAGE=sendmail-bin; + +case "$1" in + remove) + if [ ! -z "$2" ]; then + echo "Removing $PACKAGE $2 $3($4)"; + if [ "$PACKAGE" = 'sendmail' ] && [ "$3" = 'sendmail-tls' ] || \ + [ "$PACKAGE" = 'sendmail-tls' ] && [ "$3" = 'sendmail' ]; then + echo '...Nothing to do...'; + exit 0; + fi; + fi; + ;; + + purge) + # If postrm is called *AND* there are no files, exit quickly + # (This is a *GROSS* hack... beter use the test below) + #if [ ! -s `echo "$0" | sed -e 's/postrm$/list/'` ]; then + # echo "Purging replaced package $PACKAGE, nothing to do..."; + # exit 0; + # fi; + + # We're *really* purging; neither sendmail nor sendmail-tls + # is currently installed + if [ -f /usr/lib/sm.bin/sendmail ]; then + echo "Purging replaced package $PACKAGE, nothing to do..."; + exit 0; + fi; + + # Currently, dh_installdebconf doesn't do db_stop... ensure it is done! + if [ "$1" = "purge" ] && [ -e /usr/share/debconf/confmodule ]; then + # Source debconf library. + . /usr/share/debconf/confmodule; + # Make sure we're done + #db_stop; + # Remove my changes to the db. + db_purge; + fi; + ;; + + upgrade) + ;; + + failed-upgrade|abort-install|abort-upgrade|disappear) + echo "$1 of $PACKAGE $2"; + ;; + + *) + echo "$PACKAGE postrm called with unknown argument \`$1'" >&2; + exit 1; + ;; + esac; + +# NOTE WELL: If we fall through here during purge, update-rc.d will be +# called with remove... and /etc/init.d/$PACKAGE goes away! +#DEBHELPER# + +exit 0; diff --git a/debian/sendmail-bin.preinst b/debian/sendmail-bin.preinst new file mode 100644 index 0000000..e4eb388 --- /dev/null +++ b/debian/sendmail-bin.preinst @@ -0,0 +1,52 @@ +#!/bin/sh -e +# +# Debian pre install script +# +# Install of already installed package: +# 1) Upgrade of package: +# new-preinst upgrade old-version +# *) new-postrm abort-upgrade old-version +# 2) package had some configuration files from a previous version installed +# new-preinst install old-version +# *) new-postrm abort-install old-version +# 3) Otherwise (i.e., the package was completely purged) +# new-preinst install +# *) new-postrm abort-install +# +set -e; + +PACKAGE=sendmail-bin; + +# do we have debconf? +if [ -f /usr/share/debconf/confmodule ]; then + DEBCONF=true; + . /usr/share/debconf/confmodule; +else + DEBCONF=''; + fi; + +case "$1" in + install) + ;; + + upgrade) + # DPKG doesn't overwrite directories with symlinks... + rm -rf /usr/lib/sendmail 2>/dev/null || true; + + # Prevent cronjob from running during upgrade... + if [ -f /etc/cron.d/sendmail ]; then + echo "#preinst" > /etc/cron.d/sendmail; + fi; + ;; + + abort-upgrade) + ;; + + *) + echo "$PACKAGE preinst called with unknown argument \`$1'" >&2; + exit 1; + ;; + esac; + +#DEBHELPER# +exit 0; diff --git a/debian/sendmail-bin.prerm b/debian/sendmail-bin.prerm new file mode 100644 index 0000000..6a16386 --- /dev/null +++ b/debian/sendmail-bin.prerm @@ -0,0 +1,90 @@ +#!/bin/sh -e +# +# Debian pre removal script +# +# Install of already installed package: +# 1) old-prerm upgrade new-version +# *) new-prerm failed-upgrade old-version +# *) old-postinst abort-upgrade new-version +# +# If a `conflicting' package is being removed at the same time: +# 1) forall packages depending on conflicting package and --auto-deconfigure +# deconfigured's-prerm deconfigure \ +# in-favour package-being-installed version \ +# removing conflicting-package version +# *) deconfigured's-postinst abort-deconfigure \ +# in-favour package-being-installed-but-failed version \ +# removing conflicting-package version +# 2) To prepare for removal of the conflicting package +# conflictor's-prerm remove \ +# in-favour package new-version +# *) conflictor's-postinst abort-remove \ +# in-favour package new-version +# +# Removal of a package: +# 1) prerm remove +# 2) The package's files are removed (except conffiles). +# 3) postrm remove +# 4) All the maintainer scripts except the postrm are removed. +# +set -e; + +PACKAGE=sendmail-bin; + +case "$1" in + remove) + if [ ! -z "$2" ]; then + echo "Removing $PACKAGE $2 $3($4)"; + if [ "$PACKAGE" = 'sendmail' ] && [ "$3" = 'sendmail-tls' ] || \ + [ "$PACKAGE" = 'sendmail-tls' ] && [ "$3" = 'sendmail' ]; then + echo '...Nothing to do...'; + exit 0; + fi; + fi; + # Remove alternatives for MTA, MSP + update-alternatives --remove sendmail-mta /usr/lib/sm.bin/sendmail; + update-alternatives --remove sendmail-msp /usr/lib/sm.bin/sendmail; + if [ -x /etc/init.d/sendmail ] && \ + [ -x /usr/share/sendmail/sendmail ]; then + if [ -x /usr/sbin/invoke-rc.d ]; then + /usr/sbin/invoke-rc.d --quiet --force sendmail stop; + else + /etc/init.d/sendmail stop; + fi; + fi; + # Prevent cronjob from running during upgrade... + if [ -f /etc/cron.d/sendmail ]; then + rm -f /etc/cron.d/sendmail; + fi; + ;; + + upgrade) + # Prevent cronjob from running during upgrade... + if [ -f /etc/cron.d/sendmail ]; then + echo "#prerm" > /etc/cron.d/sendmail; + fi; + + # NOTE NOTE NOTE NOTE NOTE + # If we fall through to DEBHELPER, sendmail will be stopped + # much earlier than necessary !!! + exit 0; + ;; + + failed-upgrade) + ;; + + deconfigure) + echo "Deconfigure of $PACKAGE $2 $3($4) $5 $6($7) "; + ;; + + *) + echo "$PACKAGE prerm called with unknown argument \`$1'" >&2; + exit 1; + ;; + esac; + +# +# Included for sanity checks +# +#DEBHELPER# +exit 0; diff --git a/debian/sendmail-bin.suid b/debian/sendmail-bin.suid new file mode 100644 index 0000000..711d9c6 --- /dev/null +++ b/debian/sendmail-bin.suid @@ -0,0 +1,2 @@ +/usr/sbin/sendmail +/usr/lib/sm.bin/mailstats diff --git a/debian/sendmail-cf.dirs b/debian/sendmail-cf.dirs new file mode 100644 index 0000000..c223d3a --- /dev/null +++ b/debian/sendmail-cf.dirs @@ -0,0 +1,14 @@ +./DEBIAN +./usr/share/doc/sendmail-cf +./usr/share/bug +./usr/share/sendmail/cf +./usr/share/sendmail/cf/cf +./usr/share/sendmail/cf/debian +./usr/share/sendmail/cf/domain +./usr/share/sendmail/cf/feature +./usr/share/sendmail/cf/hack +./usr/share/sendmail/cf/m4 +./usr/share/sendmail/cf/mailer +./usr/share/sendmail/cf/ostype +./usr/share/sendmail/cf/sh +./usr/share/lintian/overrides diff --git a/debian/sendmail-cf.postrm b/debian/sendmail-cf.postrm new file mode 100644 index 0000000..986a66c --- /dev/null +++ b/debian/sendmail-cf.postrm @@ -0,0 +1,56 @@ +#!/bin/sh -e +# +# Debian post removal script +# +# Install of already installed package: +# 1) Upgrade of package: +# new-preinst upgrade old-version +# *) new-postrm abort-upgrade old-version +# 2) package had some configuration files from a previous version installed +# new-preinst install old-version +# *) new-postrm abort-install old-version +# 3) Otherwise (i.e., the package was completely purged) +# new-preinst install +# *) new-postrm abort-install +# +# Removal of a package: +# 1) prerm remove +# 2) The package's files are removed (except conffiles). +# 3) postrm remove +# 4) All the maintainer scripts except the postrm are removed. +# 5) The conffiles and any backup files +# (~-files, #*# files, %-files, .dpkg-{old,new,tmp}, etc.) are removed. +# 6) postrm purge +# 7) The package's file list is removed +# +set -e; + +PACKAGE=sendmail-cf; + +case "$1" in + remove) + # /usr/share/doc/$PACKAGE is a symlink to /usr/share/doc/sendmail + rm -f /usr/share/doc/$PACKAGE 2>/dev/null || true; + rmdir /usr/share/doc/sendmail 2>/dev/null || true; + + # Make sure the data directory is *clean* + rm -rf /usr/share/sendmail/cf + ;; + + purge) + ;; + + upgrade) + ;; + + failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "$PACKAGE postrm called with unknown argument \`$1'" >&2; + exit 1; + ;; + esac; + +#DEBHELPER# +exit 0; diff --git a/debian/sendmail-cf.preinst b/debian/sendmail-cf.preinst new file mode 100644 index 0000000..7da106b --- /dev/null +++ b/debian/sendmail-cf.preinst @@ -0,0 +1,55 @@ +#!/bin/sh -e +# +# Debian pre install script +# +# Install of already installed package: +# 1) Upgrade of package: +# new-preinst upgrade old-version +# *) new-postrm abort-upgrade old-version +# 2) package had some configuration files from a previous version installed +# new-preinst install old-version +# *) new-postrm abort-install old-version +# 3) Otherwise (i.e., the package was completely purged) +# new-preinst install +# *) new-postrm abort-install +# +set -e; + +PACKAGE=sendmail-cf; + +case "$1" in + install) + # DPKG doesn't overwrite directories with symlinks... + if [ -d /usr/share/doc/$PACKAGE ]; then + rm -rf /usr/share/doc/$PACKAGE; + fi; + if [ ! -d /usr/share/doc/sendmail ]; then + mkdir -p /usr/share/doc/sendmail; + chmod a+rx /usr/share/doc/sendmail; + fi; + ln -sf sendmail /usr/share/doc/$PACKAGE; + ;; + + upgrade) + # DPKG doesn't overwrite directories with symlinks... + if [ -d /usr/share/doc/$PACKAGE ]; then + rm -rf /usr/share/doc/$PACKAGE; + fi; + if [ ! -d /usr/share/doc/sendmail ]; then + mkdir -p /usr/share/doc/sendmail; + chmod a+rx /usr/share/doc/sendmail; + fi; + ln -sf sendmail /usr/share/doc/$PACKAGE; + ;; + + abort-upgrade) + ;; + + *) + echo "$PACKAGE preinst called with unknown argument \`$1'" >&2; + exit 1; + ;; + esac; + +#DEBHELPER# +exit 0; diff --git a/debian/sendmail-doc.dirs b/debian/sendmail-doc.dirs new file mode 100644 index 0000000..89441fe --- /dev/null +++ b/debian/sendmail-doc.dirs @@ -0,0 +1,8 @@ +./DEBIAN +./usr/share/doc/sendmail-doc +./usr/share/doc/sendmail-doc/libmilter +./usr/share/doc/sendmail-doc/libmilter/html +./usr/share/doc/sendmail-doc/op +./usr/share/doc/sendmail-doc/sendmail +./usr/share/bug +./usr/share/lintian/overrides diff --git a/debian/sendmail-doc.postrm b/debian/sendmail-doc.postrm new file mode 100644 index 0000000..c9bba6f --- /dev/null +++ b/debian/sendmail-doc.postrm @@ -0,0 +1,53 @@ +#!/bin/sh -e +# +# Debian post removal script +# +# Install of already installed package: +# 1) Upgrade of package: +# new-preinst upgrade old-version +# *) new-postrm abort-upgrade old-version +# 2) package had some configuration files from a previous version installed +# new-preinst install old-version +# *) new-postrm abort-install old-version +# 3) Otherwise (i.e., the package was completely purged) +# new-preinst install +# *) new-postrm abort-install +# +# Removal of a package: +# 1) prerm remove +# 2) The package's files are removed (except conffiles). +# 3) postrm remove +# 4) All the maintainer scripts except the postrm are removed. +# 5) The conffiles and any backup files +# (~-files, #*# files, %-files, .dpkg-{old,new,tmp}, etc.) are removed. +# 6) postrm purge +# 7) The package's file list is removed +# +set -e; + +PACKAGE=sendmail-doc; + +case "$1" in + remove) + # /usr/share/doc/$PACKAGE is a symlink to /usr/share/doc/sendmail + rm -f /usr/share/doc/$PACKAGE 2>/dev/null || true; + rmdir /usr/share/doc/sendmail 2>/dev/null || true; + ;; + + purge) + ;; + + upgrade) + ;; + + failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "$PACKAGE postrm called with unknown argument \`$1'" >&2; + exit 1; + ;; + esac; + +#DEBHELPER# +exit 0; diff --git a/debian/sendmail-doc.preinst b/debian/sendmail-doc.preinst new file mode 100644 index 0000000..af0eec0 --- /dev/null +++ b/debian/sendmail-doc.preinst @@ -0,0 +1,55 @@ +#!/bin/sh -e +# +# Debian pre install script +# +# Install of already installed package: +# 1) Upgrade of package: +# new-preinst upgrade old-version +# *) new-postrm abort-upgrade old-version +# 2) package had some configuration files from a previous version installed +# new-preinst install old-version +# *) new-postrm abort-install old-version +# 3) Otherwise (i.e., the package was completely purged) +# new-preinst install +# *) new-postrm abort-install +# +set -e; + +PACKAGE=sendmail-doc; + +case "$1" in + install) + # DPKG doesn't overwrite directories with symlinks... + if [ -d /usr/share/doc/$PACKAGE ]; then + rm -rf /usr/share/doc/$PACKAGE; + fi; + if [ ! -d /usr/share/doc/sendmail ]; then + mkdir -p /usr/share/doc/sendmail; + chmod a+rx /usr/share/doc/sendmail; + fi; + ln -sf sendmail /usr/share/doc/$PACKAGE; + ;; + + upgrade) + # DPKG doesn't overwrite directories with symlinks... + if [ -d /usr/share/doc/$PACKAGE ]; then + rm -rf /usr/share/doc/$PACKAGE; + fi; + if [ ! -d /usr/share/doc/sendmail ]; then + mkdir -p /usr/share/doc/sendmail; + chmod a+rx /usr/share/doc/sendmail; + fi; + ln -sf sendmail /usr/share/doc/$PACKAGE; + ;; + + abort-upgrade) + ;; + + *) + echo "$PACKAGE preinst called with unknown argument \`$1'" >&2; + exit 1; + ;; + esac; + +#DEBHELPER# +exit 0; diff --git a/debian/sendmail.cron.daily b/debian/sendmail.cron.daily new file mode 100644 index 0000000..fad6020 --- /dev/null +++ b/debian/sendmail.cron.daily @@ -0,0 +1,101 @@ +#!/bin/sh +set +e; + +#------------------------------------------------------------------------------ +# Autoconf variables - in a form suitable for sh, perl +# Generated automatically from autoconf.sh.in by configure. +#------------------------------------------------------------------------------ +# Variables for, and by, Autoconf (Don't touch these! edit config step) +PACKAGE_NAME="Sendmail"; +PACKAGE_VERSION="8.14.2"; +prefix="/usr"; +exec_prefix="/usr"; +bindir="/usr/bin"; +sbindir="/usr/sbin"; +libexecdir="/usr/lib/sm.bin"; +datadir="/usr/share"; +sysconfdir="/etc"; +sharedstatedir="/usr/com"; +localstatedir="/var"; +libdir="/usr/lib"; +includedir="/usr/include"; +infodir="/usr/share/info"; +mandir="/usr/share/man"; +docdir="/usr/share/doc"; +srcdir="."; + +copies=2; + +# backup "/etc/mail/sendmail.mc" +if [ -f ${sysconfdir}/mail/sendmail.mc ]; then + if [ ! -f ${localstatedir}/backups/sendmail.mc.bak ]; then + cp -pf ${sysconfdir}/mail/sendmail.mc \ + ${localstatedir}/backups/sendmail.mc.bak; + fi; + if ! cmp -s ${localstatedir}/backups/sendmail.mc.bak \ + ${sysconfdir}/mail/sendmail.mc ; then + cd ${localstatedir}/backups; + /usr/bin/savelog -p -c $copies sendmail.mc.bak > /dev/null; + cp -pf ${sysconfdir}/mail/sendmail.mc \ + ${localstatedir}/backups/sendmail.mc.bak; + fi; + fi; + +# backup "/etc/mail/submit.mc" +if [ -f ${sysconfdir}/mail/submit.mc ]; then + if [ ! -f ${localstatedir}/backups/submit.mc.bak ]; then + cp -pf ${sysconfdir}/mail/submit.mc \ + ${localstatedir}/backups/submit.mc.bak; + fi; + if ! cmp -s ${localstatedir}/backups/submit.mc.bak \ + ${sysconfdir}/mail/submit.mc ; then + cd ${localstatedir}/backups; + /usr/bin/savelog -p -c $copies submit.mc.bak > /dev/null; + cp -pf ${sysconfdir}/mail/submit.mc \ + ${localstatedir}/backups/submit.mc.bak; + fi; + fi; + +# while we're here, might as well do sendmail.cf +if [ -f ${sysconfdir}/mail/sendmail.cf ]; then + if [ ! -f ${localstatedir}/backups/sendmail.cf.bak ]; then + cp -pf ${sysconfdir}/mail/sendmail.cf \ + ${localstatedir}/backups/sendmail.cf.bak; + fi; + if ! cmp -s ${localstatedir}/backups/sendmail.cf.bak \ + ${sysconfdir}/mail/sendmail.cf ; then + cd ${localstatedir}/backups; + # save previous generation only if differences are significant + diff -bBwI "^\#\#\#\#\# " \ + ${localstatedir}/backups/sendmail.cf.bak \ + ${sysconfdir}/mail/sendmail.cf > /dev/null; + if [ $? -ne 0 ]; then + /usr/bin/savelog -p -c $copies sendmail.cf.bak \ + > /dev/null; + fi; + cp -pf ${sysconfdir}/mail/sendmail.cf \ + ${localstatedir}/backups/sendmail.cf.bak; + fi; + fi; + +# while we're here, might as well do submit.cf +if [ -f ${sysconfdir}/mail/submit.cf ]; then + if [ ! -f ${localstatedir}/backups/submit.cf.bak ]; then + cp -pf ${sysconfdir}/mail/submit.cf \ + ${localstatedir}/backups/submit.cf.bak; + fi; + if ! cmp -s ${localstatedir}/backups/submit.cf.bak \ + ${sysconfdir}/mail/submit.cf ; then + cd ${localstatedir}/backups; + # save previous generation only if differences are significant + diff -bBwI "^\#\#\#\#\# " \ + ${localstatedir}/backups/submit.cf.bak \ + ${sysconfdir}/mail/submit.cf > /dev/null; + if [ $? -ne 0 ]; then + /usr/bin/savelog -p -c $copies submit.cf.bak \ + > /dev/null; + fi; + cp -pf ${sysconfdir}/mail/submit.cf \ + ${localstatedir}/backups/submit.cf.bak; + fi; + fi; diff --git a/debian/sendmail.dirs b/debian/sendmail.dirs new file mode 100644 index 0000000..33b8058 --- /dev/null +++ b/debian/sendmail.dirs @@ -0,0 +1,4 @@ +./DEBIAN +./usr/share/doc/sendmail +./usr/share/bug +./usr/share/lintian/overrides diff --git a/debian/sendmail.init.d b/debian/sendmail.init.d new file mode 100644 index 0000000..c96c66f --- /dev/null +++ b/debian/sendmail.init.d @@ -0,0 +1,1321 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: sendmail +# Required-Start: $local_fs $network +# Required-Stop: $local_fs $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: powerful, efficient, and scalable Mail Transport Agent +# Description: Sendmail is an alternative Mail Transport Agent (MTA) +# for Debian. It is suitable for handling sophisticated +# mail configurations, although this means that its +# configuration can also be complex. Fortunately, simple +# thing can be done easily, and complex thing are possible, +# even if not easily understood ;) Sendmail is the *ONLY* +# MTA with a Turing complete language to control *ALL* +# aspects of delivery! +### END INIT INFO + +# Author: Marc-Christian Petersen <m.c.p@kernel.linux-systeme.com> + +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 + +#!/bin/sh +#----------------------------------------------------------------------------- +# $Sendmail: sm_helper.sh,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ +# +# Copyright (c) 1998-2007 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/sensible-mda.dirs b/debian/sensible-mda.dirs new file mode 100644 index 0000000..509a76d --- /dev/null +++ b/debian/sensible-mda.dirs @@ -0,0 +1,6 @@ +./DEBIAN +./usr/sbin +./usr/share/man +./usr/share/man/man8 +./usr/share/bug +./usr/share/lintian/overrides diff --git a/debian/sensible-mda.postrm b/debian/sensible-mda.postrm new file mode 100644 index 0000000..587f1c1 --- /dev/null +++ b/debian/sensible-mda.postrm @@ -0,0 +1,53 @@ +#!/bin/sh -e +# +# Debian post removal script +# +# Install of already installed package: +# 1) Upgrade of package: +# new-preinst upgrade old-version +# *) new-postrm abort-upgrade old-version +# 2) package had some configuration files from a previous version installed +# new-preinst install old-version +# *) new-postrm abort-install old-version +# 3) Otherwise (i.e., the package was completely purged) +# new-preinst install +# *) new-postrm abort-install +# +# Removal of a package: +# 1) prerm remove +# 2) The package's files are removed (except conffiles). +# 3) postrm remove +# 4) All the maintainer scripts except the postrm are removed. +# 5) The conffiles and any backup files +# (~-files, #*# files, %-files, .dpkg-{old,new,tmp}, etc.) are removed. +# 6) postrm purge +# 7) The package's file list is removed +# +set -e; + +PACKAGE=sensible-mda; + +case "$1" in + remove) + # /usr/share/doc/$PACKAGE is a symlink to /usr/share/doc/sendmail + rm -f /usr/share/doc/$PACKAGE 2>/dev/null || true; + rmdir /usr/share/doc/sendmail 2>/dev/null || true; + ;; + + purge) + ;; + + upgrade) + ;; + + failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "$PACKAGE postrm called with unknown argument \`$1'" >&2; + exit 1; + ;; + esac; + +#DEBHELPER# +exit 0; diff --git a/debian/sensible-mda.preinst b/debian/sensible-mda.preinst new file mode 100644 index 0000000..bfafed9 --- /dev/null +++ b/debian/sensible-mda.preinst @@ -0,0 +1,55 @@ +#!/bin/sh -e +# +# Debian pre install script +# +# Install of already installed package: +# 1) Upgrade of package: +# new-preinst upgrade old-version +# *) new-postrm abort-upgrade old-version +# 2) package had some configuration files from a previous version installed +# new-preinst install old-version +# *) new-postrm abort-install old-version +# 3) Otherwise (i.e., the package was completely purged) +# new-preinst install +# *) new-postrm abort-install +# +set -e; + +PACKAGE=sensible-mda; + +case "$1" in + install) + # DPKG doesn't overwrite directories with symlinks... + if [ -d /usr/share/doc/$PACKAGE ]; then + rm -rf /usr/share/doc/$PACKAGE; + fi; + if [ ! -d /usr/share/doc/sendmail ]; then + mkdir -p /usr/share/doc/sendmail; + chmod a+rx /usr/share/doc/sendmail; + fi; + ln -sf sendmail /usr/share/doc/$PACKAGE; + ;; + + upgrade) + # DPKG doesn't overwrite directories with symlinks... + if [ -d /usr/share/doc/$PACKAGE ]; then + rm -rf /usr/share/doc/$PACKAGE; + fi; + if [ ! -d /usr/share/doc/sendmail ]; then + mkdir -p /usr/share/doc/sendmail; + chmod a+rx /usr/share/doc/sendmail; + fi; + ln -sf sendmail /usr/share/doc/$PACKAGE; + ;; + + abort-upgrade) + ;; + + *) + echo "$PACKAGE preinst called with unknown argument \`$1'" >&2; + exit 1; + ;; + esac; + +#DEBHELPER# +exit 0; diff --git a/debian/sensible_mda/Makefile b/debian/sensible_mda/Makefile new file mode 100644 index 0000000..c712768 --- /dev/null +++ b/debian/sensible_mda/Makefile @@ -0,0 +1,587 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# sensible_mda/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 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 +sbin_PROGRAMS = sensible-mda$(EXEEXT) +subdir = sensible_mda +DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/sensible-mda.c.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/./build/mkinstalldirs +CONFIG_CLEAN_FILES = sensible-mda.c +am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)" +sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(sbin_PROGRAMS) +am_sensible_mda_OBJECTS = sensible-mda.$(OBJEXT) +sensible_mda_OBJECTS = $(am_sensible_mda_OBJECTS) +sensible_mda_LDADD = $(LDADD) +DEFAULT_INCLUDES = -I. +depcomp = $(SHELL) $(top_srcdir)/./build/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(sensible_mda_SOURCES) +DIST_SOURCES = $(sensible_mda_SOURCES) +man8dir = $(mandir)/man8 +NROFF = nroff +MANS = $(dist_man_MANS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run aclocal-1.10 +AMTAR = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run tar +AUTOCONF = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run autoconf +AUTOHEADER = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run autoheader +AUTOMAKE = ${SHELL} /home/src/sendmail/sendmail-8.14.2/debian/build/missing --run automake-1.10 +AWK = gawk +CC = cc +CCDEPMODE = depmode=none +CFLAGS = -g -Wall -O2 -fPIC -fstack-protector-all +CPP = cc -E +CPPFLAGS = +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.1\" -DPACKAGE_STRING=\"Sendmail\ 8.14.1\" -DPACKAGE_BUGREPORT=\"bug/reportbug\ or\ sendmail@packages.debian.org\" -DPACKAGE=\"sendmail\" -DVERSION=\"8.14.1\" -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_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 +LIBOBJS = +LIBS = +LN_S = ln -s +LTLIBOBJS = +MAINT = # +MAKEINFO = ${SHELL} /home/src/sendmail/sendmail-8.14.2/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.2 +PACKAGE_TARNAME = sendmail +PACKAGE_VERSION = 8.14.2 +PATH_SEPARATOR = : +SET_MAKE = +SHELL = /bin/sh +SM_CPYRT = 2007 +SM_DATE = 2007-10-04 21:42:00 +SM_MAXVERS = 9.0.0 +SM_MINVERS = 8.7.6 +SM_VERS = 8.14.1 +STRIP = +VERSION = 8.14.1 +abs_builddir = /home/src/sendmail/sendmail-8.14.2/debian/sensible_mda +abs_srcdir = /home/src/sendmail/sendmail-8.14.2/debian/sensible_mda +abs_top_builddir = /home/src/sendmail/sendmail-8.14.2/debian +abs_top_srcdir = /home/src/sendmail/sendmail-8.14.2/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.2 +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.2/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 = 2007-11-02 +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 +sm_libs = +sm_libsm_envdef = -fPIC -DHAVE_NANOSLEEP=1 -D_LDAP_EXAMPLE_ -DLDAP_REFERRALS -D_FFR_LDAP_URI -D_FFR_LDAP_SETVERSION -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 -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 | libsasl2-modules-plain | libsasl2-digestmd5-plain | libsasl2-digestmd5-des, openssl +sm_time = 22:20:56 +sm_utc = +0000 +sm_vacation_envdef = +sm_vacation_libs = -ldb-4.6 -lldap -llber +sm_version = 8.14.2 +sm_version_beta = +sm_version_major = 8.14 +sm_version_math = 527874 +sm_version_minor = 2 +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 = .. +# +# Shipped manpages +# +dist_man_MANS = sensible-mda.8 +# +# Program sources +# +sensible_mda_SOURCES = sensible-mda.c +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(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 sensible_mda/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu sensible_mda/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 +sensible-mda.c: $(top_builddir)/config.status $(srcdir)/sensible-mda.c.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +install-sbinPROGRAMS: $(sbin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)" + @list='$(sbin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-sbinPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(sbin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \ + rm -f "$(DESTDIR)$(sbindir)/$$f"; \ + done + +clean-sbinPROGRAMS: + -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) +sensible-mda$(EXEEXT): $(sensible_mda_OBJECTS) $(sensible_mda_DEPENDENCIES) + @rm -f sensible-mda$(EXEEXT) + $(LINK) $(sensible_mda_OBJECTS) $(sensible_mda_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +#include ./$(DEPDIR)/sensible-mda.Po + +.c.o: +# $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +# mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# source='$<' object='$@' libtool=no +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) + $(COMPILE) -c $< + +.c.obj: +# $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +# mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# source='$<' object='$@' libtool=no +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) + $(COMPILE) -c `$(CYGPATH_W) '$<'` +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 + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +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 $(PROGRAMS) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)"; 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 clean-sbinPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-exec-am: install-sbinPROGRAMS + +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 -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-man uninstall-sbinPROGRAMS + +uninstall-man: uninstall-man8 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-sbinPROGRAMS ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am 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-pdf \ + install-pdf-am install-ps install-ps-am install-sbinPROGRAMS \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-man uninstall-man8 \ + uninstall-sbinPROGRAMS + +# +# Debian targets, phase out +# +.PHONY: build-indep build-arch +.PHONY: install-indep install-arch +build-indep: +build-arch: sensible-mda +install-indep: +install-arch: install +# 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/sensible_mda/sensible-mda.c b/debian/sensible_mda/sensible-mda.c new file mode 100644 index 0000000..edea6b4 --- /dev/null +++ b/debian/sensible_mda/sensible-mda.c @@ -0,0 +1,350 @@ +/* + * $Sendmail: sensible-mda.c,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $ + * + * sensible-mda.c + * Copyright (c) 1998, Johnie Ingram. + * Copyright (c) 1998-2007 Richard Nelson <cowboy@debian.org>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef lint +static const char id[] = "@(#)$Id: sensible-mda.c,v 8.14.2 2007-11-02 22:20:56 cowboy Exp $"; +#endif /* ! lint */ + +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <limits.h> +#include <unistd.h> +#include <pwd.h> +#include <grp.h> +#include <sysexits.h> +#include <string.h> +#include <syslog.h> + +// TODO: declare -x TCPREMOTEIP="$3" + +# define min(a, b) ((a) < (b) ? (a) : (b)) + +#ifndef DEBUG + #define DEBUG 0 + #endif +#ifndef TESTING + #define TESTING 0 + #endif + +#define PROCMAIL "/etc/mail/smrsh/procmail" +#define MAILDROP "/etc/mail/smrsh/maildrop" +#define DELIVER "/etc/mail/smrsh/deliver" +#define MAIL_LOCAL "/etc/mail/smrsh/mail.local" + +#define PROCMAILRCS "/etc/procmailrcs/" + +static void help(void); +static int drop_privs(char *, uid_t, gid_t); +static void show_privs(void); +static unsigned char program[PATH_MAX]; + +static uid_t RealUid, RunAsUid; +static gid_t RealGid, RunAsGid; + +int +main (int argc, char *argv[]) { + + struct stat MDA_stat; + int done = 1; + struct passwd* passwd_entry; + + char *str_pos; + int exec_rc = EX_OK; + + #if DEBUG + int arg_index; + int str_len; + #endif + + (void) openlog( "sensible-mda", LOG_PID+LOG_PERROR, LOG_MAIL ); + + /*---------------------------------------------------------------- + * Obtain program name + *----------------------------------------------------------------*/ + str_pos = strrchr(argv[0], '/'); + if ( str_pos ) + str_pos++; + else + str_pos = argv[0]; + (void) strncpy(program, str_pos, + min(strlen(str_pos), sizeof(program)-1)); + program[sizeof(program)-1] = '\0'; + + #if DEBUG + str_len = 0; + for ( arg_index = 0; arg_index < argc; arg_index++ ) + str_len += strlen( argv[arg_index] ) + 1; + str_pos = malloc( str_len + 1); + str_pos[0] = '\0'; + for ( arg_index = 0; arg_index < argc; arg_index++ ) { + (void) strcat( str_pos, argv[arg_index] ); + (void) strcat( str_pos, " " ); + }; + (void) syslog( LOG_INFO, "Parms: %s\n", str_pos ); + (void) free(str_pos); + #endif + + /*---------------------------------------------------------------- + * Parse input to determine to whom to speak and who we are... + * Must have at least three parameters unless first is ?,-?,/?. + *----------------------------------------------------------------*/ + if (argc >= 2 && + (strcmp(argv[1],"?") == 0 || strcmp(argv[1],"-?") == 0 || + strcmp(argv[1],"/?") == 0 || strcmp(argv[1],"\\?") == 0 || + strcmp(argv[1],"-h") == 0 || strcmp(argv[1],"--help") == 0)) { + (void) printf( "%s - Help\n", program ); + help(); + (void) closelog(); + return (EX_USAGE); + }; + if (argc < 3) { + (void) syslog( LOG_ERR, "%s - Required parameters elided.\n", + program ); + help(); + (void) closelog(); + return (EX_USAGE); + }; + + /*---------------------------------------------------------------- + * Determine to whom we are delivering mail to, and set that + * as our real, effective, and saved {u,g}ids + *----------------------------------------------------------------*/ + RealUid = RunAsUid = geteuid(); + RealGid = RunAsGid = getegid(); + passwd_entry=getpwnam(argv[2]); + if (passwd_entry) { + RunAsUid = passwd_entry->pw_uid; + RunAsGid = passwd_entry->pw_gid; + } + else { + (void) syslog( LOG_ERR, "User(%s) does not exist!\n", + argv[2]); + (void) closelog(); + return (EX_TEMPFAIL); + }; + + /*---------------------------------------------------------------- + * 1st: try delivery via PROCMAIL (Keep SUID, works better that way) + *----------------------------------------------------------------*/ + if (!stat(PROCMAIL, &MDA_stat)) { + done = 0; + #if DEBUG + (void) syslog( LOG_INFO, "MDA: %s -t -f %s" + " -a %s -d %s\n", + PROCMAIL, argv[1], argv[3], argv[2]); + #endif + #if ! TESTING + exec_rc = execl (PROCMAIL, PROCMAIL, "-t", + "-f", argv[1], + "-a", argv[3], + "-d", argv[2], NULL); + (void) syslog( LOG_ERR, "%s did not execute %i,%i\n", + PROCMAIL, exec_rc, errno); + (void) closelog(); + return (EX_TEMPFAIL); + #endif + done = 1; + }; + + /*---------------------------------------------------------------- + * 2nd: try delivery via MAILDROP + *----------------------------------------------------------------*/ + if (done && !stat(MAILDROP, &MDA_stat)) { + done = 0; + #if DEBUG + (void) syslog( LOG_INFO, "MDA: %s -f %s -d %s %s\n", + MAILDROP, argv[1], argv[2], argv[3]); + #endif + if (drop_privs( argv[2], RunAsUid, RunAsGid )) { + (void) closelog(); + return (EX_TEMPFAIL); + }; + #if ! TESTING + exec_rc = execl (MAILDROP, MAILDROP, + "-f", argv[1], "-d", argv[2], argv[3], NULL); + (void) syslog( LOG_ERR, "%s did not execute %i,%i\n", + MAILDROP, exec_rc, errno); + (void) closelog(); + return (EX_TEMPFAIL); + #endif + done = 1; + }; + + /*---------------------------------------------------------------- + * 3rd: try delivery via DELIVER + *----------------------------------------------------------------*/ + if (done && !stat(DELIVER, &MDA_stat)) { + done = 0; + #if DEBUG + (void) syslog( LOG_INFO, "MDA: %s -r %s %s\n", + DELIVER, argv[1], argv[2]); + #endif + if (drop_privs( argv[2], RunAsUid, RunAsGid )) { + (void) closelog(); + return (EX_TEMPFAIL); + }; + #if ! TESTING + exec_rc = execl (DELIVER, DELIVER, + "-r", argv[1], argv[2], NULL); + (void) syslog( LOG_ERR, "%s did not execute %i,%i\n", + DELIVER, exec_rc, errno); + (void) closelog(); + return (EX_TEMPFAIL); + #endif + done = 1; + }; + + /*---------------------------------------------------------------- + * 4th: try delivery via MAIL.LOCAL (Needs SUID because of LMTP) + *----------------------------------------------------------------*/ + if (done && !stat(MAIL_LOCAL, &MDA_stat)) { + done = 0; + #if DEBUG + (void) syslog( LOG_INFO, "MDA: %s -f %s %s\n", + MAIL_LOCAL, argv[1], argv[2]); + #endif + #if ! TESTING + exec_rc = execl (MAIL_LOCAL, MAIL_LOCAL, + "-f", argv[1], argv[2], NULL); + (void) syslog( LOG_ERR, "%s did not execute %i,%i\n", + MAIL_LOCAL, exec_rc, errno); + (void) closelog(); + return (EX_TEMPFAIL); + #endif + done = 1; + }; + + (void) syslog( LOG_ERR, "No MDA was found! Tried: " + "%s, %s, %s, and %s.\n", + PROCMAIL, MAILDROP, DELIVER, MAIL_LOCAL ); + + (void) closelog(); + return (EX_TEMPFAIL); + }; + +/*------------------------------------------------------------------- + * drop_privs... + *-------------------------------------------------------------------*/ +static int +drop_privs(char * luser, uid_t new_uid, gid_t new_gid) { + gid_t emptygidset[1]; + uid_t EffUid; + gid_t EffGid; + int rval; + + rval = EX_OK; + EffUid = geteuid(); + EffGid = getegid(); + + /* reset group permissions; these can be set later */ + emptygidset[0] = (RunAsGid != 0) ? RunAsGid : EffGid; + if (setgroups(1, emptygidset) == -1 && EffUid == 0) { + (void) syslog( LOG_ERR, "drop_privs: setgroups(1, %d) failed\n", + (int) emptygidset[0]); + rval = EX_OSERR; + }; + + /* reset primary group id */ + if ((RunAsGid != 0) && EffGid != RunAsGid && setgid(RunAsGid) < 0) { + (void) syslog( LOG_ERR, "drop_privs: setgid(%d) failed\n", + (int) RunAsGid); + rval = EX_OSERR; + }; + + /* reset primary user id */ + if ((RunAsUid != 0) && EffUid != RunAsUid && setuid(RunAsUid) < 0) { + (void) syslog( LOG_ERR, "drop_privs: setuid(%d) failed\n", + (int) RunAsUid); + rval = EX_OSERR; + }; + + #if DEBUG + show_privs(); + (void) syslog( LOG_INFO, "drop_privs: rval = %d\n", rval); + #endif + + if (rval) { + (void) syslog( LOG_ERR, + "Can not setreuid to %d:%d for user(%s)!\n", + RunAsUid, RunAsGid, luser); + show_privs(); + }; + + return rval; + }; + +/*------------------------------------------------------------------- + * show_privs... + *-------------------------------------------------------------------*/ +static void +show_privs(void) { + + (void) syslog( LOG_INFO, "show_privs: RealUser = %d:%d\n", + (int) RealUid, (int) RealGid); + (void) syslog( LOG_INFO, "show_privs: " + "get[ug]id=%d:%d, gete[ug]id=%d:%d\n", + (int) getuid(), (int) getgid(), + (int) geteuid(), (int) getegid()); + (void) syslog( LOG_INFO, "show_privs: RunAsUser = %d:%d\n", + (int) RunAsUid, (int) RunAsGid); + return; + }; + +/*------------------------------------------------------------------- + * Help... + *-------------------------------------------------------------------*/ +static void +help(void) { + + (void) printf("\n%s - Help information.\n\n" + "%s:\n" + "\tA general MTA->MDA wrapper to isolate the MTA from\n" + "\tthe vagaries of MDA installation and invocation.\n" + "\nSupported MTAs:\n" + "\tsendmail\n" + "\nSupported MDAs:\n" + "\tprocmail, maildrop, deliver, mail.local\n" + "\nCalled by:\n" + "\tSendmail: \n" + "\tYou: " + "Go directly to jail, do not pass GO, " + "do not collect $200!\n" + "\nSyntax:\n" + "\t%s <from:$g> <user:$u> [<detail:$h>]" + "[<client:${client_addr}>]\n" + "\nCalls:\n" + "\tprocmail:\t procmail -t" + " -f <from>" + " -a <detail> -d <to>\n" + "\tmaildrop:\t maildrop -f <from> -d <to> <detail>\n" + "\tdeliver:\t deliver -r <from> <to>\n" + "\tmail.local:\t mail.local -f <from> <to>\n" + "\n" + ,program, program, program + ); + return; + }; + diff --git a/sendmail.8.14.1.tar.gz.cdbs-config_list b/sendmail.8.14.1.tar.gz.cdbs-config_list deleted file mode 100644 index 1089c76..0000000 --- a/sendmail.8.14.1.tar.gz.cdbs-config_list +++ /dev/null @@ -1,2 +0,0 @@ -sendmail-8.14.1/include/sm/config.h -sendmail-8.14.1/libsm/config.c diff --git a/sendmail.8.14.2.tar.gz.cdbs-config_list b/sendmail.8.14.2.tar.gz.cdbs-config_list new file mode 100644 index 0000000..ad9cc6d --- /dev/null +++ b/sendmail.8.14.2.tar.gz.cdbs-config_list @@ -0,0 +1,2 @@ +sendmail-8.14.2/include/sm/config.h +sendmail-8.14.2/libsm/config.c |