diff options
author | Gilles Chehade <gilles@poolp.org> | 2020-04-30 02:06:46 +0200 |
---|---|---|
committer | Gilles Chehade <gilles@poolp.org> | 2020-04-30 02:06:46 +0200 |
commit | d4180f85d53f7381da9fcc7257cf61d0b29497a0 (patch) | |
tree | 928f5541f702f22aec334cd7262d611821ff44cf /mk | |
parent | Merge remote-tracking branch 'portable/native' (diff) | |
download | OpenSMTPD-d4180f85d53f7381da9fcc7257cf61d0b29497a0.tar.xz OpenSMTPD-d4180f85d53f7381da9fcc7257cf61d0b29497a0.zip |
merge histories
Diffstat (limited to 'mk')
-rw-r--r-- | mk/Makefile.am | 4 | ||||
-rw-r--r-- | mk/mail/Makefile.am | 5 | ||||
-rw-r--r-- | mk/mail/mail.lmtp/Makefile.am | 22 | ||||
-rw-r--r-- | mk/mail/mail.maildir/Makefile.am | 22 | ||||
-rw-r--r-- | mk/mail/mail.mboxfile/Makefile.am | 22 | ||||
-rw-r--r-- | mk/mail/mail.mda/Makefile.am | 22 | ||||
-rw-r--r-- | mk/mdoc2man.awk | 391 | ||||
-rw-r--r-- | mk/pathnames | 10 | ||||
-rw-r--r-- | mk/smtp/Makefile.am | 59 | ||||
-rw-r--r-- | mk/smtpctl/Makefile.am | 99 | ||||
-rw-r--r-- | mk/smtpd/Makefile.am | 194 |
11 files changed, 850 insertions, 0 deletions
diff --git a/mk/Makefile.am b/mk/Makefile.am new file mode 100644 index 00000000..f49c5289 --- /dev/null +++ b/mk/Makefile.am @@ -0,0 +1,4 @@ +SUBDIRS = smtpd +SUBDIRS += smtpctl +SUBDIRS += mail +SUBDIRS += smtp diff --git a/mk/mail/Makefile.am b/mk/mail/Makefile.am new file mode 100644 index 00000000..cc6d96cb --- /dev/null +++ b/mk/mail/Makefile.am @@ -0,0 +1,5 @@ +SUBDIRS = mail.lmtp +SUBDIRS += mail.maildir +SUBDIRS += mail.mboxfile +SUBDIRS += mail.mda + diff --git a/mk/mail/mail.lmtp/Makefile.am b/mk/mail/mail.lmtp/Makefile.am new file mode 100644 index 00000000..9847dfdf --- /dev/null +++ b/mk/mail/mail.lmtp/Makefile.am @@ -0,0 +1,22 @@ +include $(top_srcdir)/mk/pathnames + +pkglibexec_PROGRAMS = mail.lmtp + +mail_lmtp_SOURCES = $(smtpd_srcdir)/mail.lmtp.c +mail_lmtp_SOURCES+= $(smtpd_srcdir)/log.c + +AM_CPPFLAGS= -I$(top_srcdir)/smtpd \ + -I$(top_srcdir)/openbsd-compat +if !NEED_ERR_H +AM_CPPFLAGS += -I$(top_srcdir)/openbsd-compat/err_h +endif + +LIBCOMPAT = $(top_builddir)/openbsd-compat/libopenbsd.a + +LDADD = $(LIBCOMPAT) + + + + +uninstall-hook: + rmdir $(DESTDIR)$(pkglibexecdir) 2> /dev/null || /bin/true diff --git a/mk/mail/mail.maildir/Makefile.am b/mk/mail/mail.maildir/Makefile.am new file mode 100644 index 00000000..d8f696ee --- /dev/null +++ b/mk/mail/mail.maildir/Makefile.am @@ -0,0 +1,22 @@ +include $(top_srcdir)/mk/pathnames + +pkglibexec_PROGRAMS = mail.maildir + +mail_maildir_SOURCES = $(smtpd_srcdir)/mail.maildir.c +mail_maildir_SOURCES+= $(smtpd_srcdir)/log.c + +AM_CPPFLAGS= -I$(top_srcdir)/smtpd \ + -I$(top_srcdir)/openbsd-compat +if !NEED_ERR_H +AM_CPPFLAGS += -I$(top_srcdir)/openbsd-compat/err_h +endif + +LIBCOMPAT = $(top_builddir)/openbsd-compat/libopenbsd.a + +LDADD = $(LIBCOMPAT) + + + + +uninstall-hook: + rmdir $(DESTDIR)$(pkglibexecdir) 2> /dev/null || /bin/true diff --git a/mk/mail/mail.mboxfile/Makefile.am b/mk/mail/mail.mboxfile/Makefile.am new file mode 100644 index 00000000..d57362c0 --- /dev/null +++ b/mk/mail/mail.mboxfile/Makefile.am @@ -0,0 +1,22 @@ +include $(top_srcdir)/mk/pathnames + +pkglibexec_PROGRAMS = mail.mboxfile + +mail_mboxfile_SOURCES = $(smtpd_srcdir)/mail.mboxfile.c +mail_mboxfile_SOURCES+= $(smtpd_srcdir)/log.c + +AM_CPPFLAGS= -I$(top_srcdir)/smtpd \ + -I$(top_srcdir)/openbsd-compat +if !NEED_ERR_H +AM_CPPFLAGS += -I$(top_srcdir)/openbsd-compat/err_h +endif + +LIBCOMPAT = $(top_builddir)/openbsd-compat/libopenbsd.a + +LDADD = $(LIBCOMPAT) + + + + +uninstall-hook: + rmdir $(DESTDIR)$(pkglibexecdir) 2> /dev/null || /bin/true diff --git a/mk/mail/mail.mda/Makefile.am b/mk/mail/mail.mda/Makefile.am new file mode 100644 index 00000000..b04aefda --- /dev/null +++ b/mk/mail/mail.mda/Makefile.am @@ -0,0 +1,22 @@ +include $(top_srcdir)/mk/pathnames + +pkglibexec_PROGRAMS = mail.mda + +mail_mda_SOURCES = $(smtpd_srcdir)/mail.mda.c +mail_mda_SOURCES+= $(smtpd_srcdir)/log.c + +AM_CPPFLAGS= -I$(top_srcdir)/smtpd \ + -I$(top_srcdir)/openbsd-compat +if !NEED_ERR_H +AM_CPPFLAGS += -I$(top_srcdir)/openbsd-compat/err_h +endif + +LIBCOMPAT = $(top_builddir)/openbsd-compat/libopenbsd.a + +LDADD = $(LIBCOMPAT) + + + + +uninstall-hook: + rmdir $(DESTDIR)$(pkglibexecdir) 2> /dev/null || /bin/true diff --git a/mk/mdoc2man.awk b/mk/mdoc2man.awk new file mode 100644 index 00000000..726f628c --- /dev/null +++ b/mk/mdoc2man.awk @@ -0,0 +1,391 @@ +#!/usr/bin/awk +# +# Copyright (c) 2003 Peter Stuge <stuge-mdoc2man@cdy.org> +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +# Dramatically overhauled by Tim Kientzle. This version almost +# handles library-style pages with Fn, Ft, etc commands. Still +# a lot of problems... + +BEGIN { + displaylines = 0 + trailer = "" + out = "" + sep = "" + nextsep = " " +} + +# Add a word with appropriate preceding whitespace +# Maintain a short queue of the expected upcoming word separators. +function add(str) { + out=out sep str + sep = nextsep + nextsep = " " +} + +# Add a word with no following whitespace +# Use for opening punctuation such as '(' +function addopen(str) { + add(str) + sep = "" +} + +# Add a word with no preceding whitespace +# Use for closing punctuation such as ')' or '.' +function addclose(str) { + sep = "" + add(str) +} + +# Add a word with no space before or after +# Use for separating punctuation such as '=' +function addpunct(str) { + sep = "" + add(str) + sep = "" +} + +# Emit the current line so far +function endline() { + addclose(trailer) + trailer = "" + if(length(out) > 0) { + print out + out="" + } + if(displaylines > 0) { + displaylines = displaylines - 1 + if (displaylines == 0) + dispend() + } + # First word on next line has no preceding whitespace + sep = "" +} + +function linecmd(cmd) { + endline() + add(cmd) + endline() +} + +function breakline() { + linecmd(".br") +} + +# Start an indented display +function dispstart() { + linecmd(".RS 4") +} + +# End an indented display +function dispend() { + linecmd(".RE") +} + +# Collect rest of input line +function wtail() { + retval="" + while(w<nwords) { + if(length(retval)) + retval=retval " " + retval=retval words[++w] + } + return retval +} + +function splitwords(l, dest, n, o, w) { + n = 1 + delete dest + while (length(l) > 0) { + sub("^[ \t]*", "", l) + if (match(l, "^\"")) { + l = substr(l, 2) + o = index(l, "\"") + if (o > 0) { + w = substr(l, 1, o-1) + l = substr(l, o+1) + dest[n++] = w + } else { + dest[n++] = l + l = "" + } + } else { + o = match(l, "[ \t]") + if (o > 0) { + w = substr(l, 1, o-1) + l = substr(l, o+1) + dest[n++] = w + } else { + dest[n++] = l + l = "" + } + } + } + return n-1 +} + +! /^\./ { + out = $0 + endline() + next +} + +/^\.\\"/ { next } + +{ + sub("^\\.","") + nwords=splitwords($0, words) + # TODO: Instead of iterating 'w' over the array, have a separate + # function that returns 'next word' and use that. This will allow + # proper handling of double-quoted arguments as well. + for(w=1;w<=nwords;w++) { + if(match(words[w],"^Li$")) { # Literal; rest of line is unformatted + dispstart() + displaylines = 1 + } else if(match(words[w],"^Dl$")) { # Display literal + dispstart() + displaylines = 1 + } else if(match(words[w],"^Bd$")) { # Begin display + if(match(words[w+1],"-literal")) { + dispstart() + linecmd(".nf") + displaylines=10000 + w=nwords + } + } else if(match(words[w],"^Ed$")) { # End display + displaylines = 0 + dispend() + } else if(match(words[w],"^Ns$")) { # Suppress space after next word + nextsep = "" + } else if(match(words[w],"^No$")) { # Normal text + add(words[++w]) + } else if(match(words[w],"^Dq$")) { # Quote + addopen("``") + add(words[++w]) + while(w<nwords&&!match(words[w+1],"^[\\.,]")) + add(words[++w]) + addclose("''") + } else if(match(words[w],"^Do$")) { + addopen("``") + } else if(match(words[w],"^Dc$")) { + addclose("''") + } else if(match(words[w],"^Oo$")) { + addopen("[") + } else if(match(words[w],"^Oc$")) { + addclose("]") + } else if(match(words[w],"^Ao$")) { + addopen("<") + } else if(match(words[w],"^Ac$")) { + addclose(">") + } else if(match(words[w],"^Dd$")) { + date=wtail() + next + } else if(match(words[w],"^Dt$")) { + id=wtail() + next + } else if(match(words[w],"^Ox$")) { + add("OpenBSD") + } else if(match(words[w],"^Fx$")) { + add("FreeBSD") + } else if(match(words[w],"^Nx$")) { + add("NetBSD") + } else if(match(words[w],"^St$")) { + if (match(words[w+1], "^-p1003.1$")) { + w++ + add("IEEE Std 1003.1 (``POSIX.1'')") + } else if(match(words[w+1], "^-p1003.1-96$")) { + w++ + add("ISO/IEC 9945-1:1996 (``POSIX.1'')") + } else if(match(words[w+1], "^-p1003.1-88$")) { + w++ + add("IEEE Std 1003.1-1988 (``POSIX.1'')") + } else if(match(words[w+1], "^-p1003.1-2001$")) { + w++ + add("IEEE Std 1003.1-2001 (``POSIX.1'')") + } else if(match(words[w+1], "^-susv2$")) { + w++ + add("Version 2 of the Single UNIX Specification (``SUSv2'')") + } + } else if(match(words[w],"^Ex$")) { + if (match(words[w+1], "^-std$")) { + w++ + add("The \\fB" name "\\fP utility exits 0 on success, and >0 if an error occurs.") + } + } else if(match(words[w],"^Os$")) { + add(".TH " id " \"" date "\" \"" wtail() "\"") + } else if(match(words[w],"^Sh$")) { + section=wtail() + add(".SH " section) + linecmd(".ad l") + } else if(match(words[w],"^Xr$")) { + add("\\fB" words[++w] "\\fP(" words[++w] ")" words[++w]) + } else if(match(words[w],"^Nm$")) { + if(match(section,"SYNOPSIS")) + breakline() + if(w >= nwords) + n=name + else if (match(words[w+1], "^[A-Z][a-z]$")) + n=name + else if (match(words[w+1], "^[.,;:]$")) + n=name + else { + n=words[++w] + if(!length(name)) + name=n + } + if(!length(n)) + n=name + add("\\fB\\%" n "\\fP") + } else if(match(words[w],"^Nd$")) { + add("\\- " wtail()) + } else if(match(words[w],"^Fl$")) { + add("\\fB\\-" words[++w] "\\fP") + } else if(match(words[w],"^Ar$")) { + addopen("\\fI") + if(w==nwords) + add("file ...\\fP") + else + add(words[++w] "\\fP") + } else if(match(words[w],"^Cm$")) { + add("\\fB" words[++w] "\\fP") + } else if(match(words[w],"^Op$")) { + addopen("[") + option=1 + trailer="]" trailer + } else if(match(words[w],"^Pp$")) { + linecmd(".PP") + } else if(match(words[w],"^An$")) { + endline() + } else if(match(words[w],"^Ss$")) { + add(".SS") + } else if(match(words[w],"^Ft$")) { + if (match(section, "SYNOPSIS")) { + breakline() + } + add("\\fI" wtail() "\\fP") + if (match(section, "SYNOPSIS")) { + breakline() + } + } else if(match(words[w],"^Fn$")) { + ++w + F = "\\fB\\%" words[w] "\\fP(" + Fsep = "" + while(w<nwords) { + ++w + if (match(words[w], "^[.,:]$")) { + --w + break + } + gsub(" ", "\\ ", words[w]) + F = F Fsep "\\fI\\%" words[w] "\\fP" + Fsep = ", " + } + add(F ")") + if (match(section, "SYNOPSIS")) { + addclose(";") + } + } else if(match(words[w],"^Fo$")) { + w++ + F = "\\fB\\%" words[w] "\\fP(" + Fsep = "" + } else if(match(words[w],"^Fa$")) { + w++ + gsub(" ", "\\ ", words[w]) + F = F Fsep "\\fI\\%" words[w] "\\fP" + Fsep = ", " + } else if(match(words[w],"^Fc$")) { + add(F ")") + if (match(section, "SYNOPSIS")) { + addclose(";") + } + } else if(match(words[w],"^Va$")) { + w++ + add("\\fI" words[w] "\\fP") + } else if(match(words[w],"^In$")) { + w++ + add("\\fB#include <" words[w] ">\\fP") + } else if(match(words[w],"^Pa$")) { + addopen("\\fI") + w++ + if(match(words[w],"^\\.")) + add("\\&") + add(words[w] "\\fP") + } else if(match(words[w],"^Dv$")) { + add(".BR") + } else if(match(words[w],"^Em|Ev$")) { + add(".IR") + } else if(match(words[w],"^Pq$")) { + addopen("(") + trailer=")" trailer + } else if(match(words[w],"^Aq$")) { + addopen("\\%<") + trailer=">" trailer + } else if(match(words[w],"^Brq$")) { + addopen("{") + trailer="}" trailer + } else if(match(words[w],"^S[xy]$")) { + add(".B " wtail()) + } else if(match(words[w],"^Ic$")) { + add("\\fB") + trailer="\\fP" trailer + } else if(match(words[w],"^Bl$")) { + oldoptlist=optlist + linecmd(".RS 5") + if(match(words[w+1],"-bullet")) + optlist=1 + else if(match(words[w+1],"-enum")) { + optlist=2 + enum=0 + } else if(match(words[w+1],"-tag")) + optlist=3 + else if(match(words[w+1],"-item")) + optlist=4 + else if(match(words[w+1],"-bullet")) + optlist=1 + w=nwords + } else if(match(words[w],"^El$")) { + linecmd(".RE") + optlist=oldoptlist + } else if(match(words[w],"^It$")&&optlist) { + if(optlist==1) + add(".IP \\(bu") + else if(optlist==2) + add(".IP " ++enum ".") + else if(optlist==3) { + add(".TP") + endline() + if(match(words[w+1],"^Pa$|^Ev$")) { + add(".B") + w++ + } + } else if(optlist==4) + add(".IP") + } else if(match(words[w],"^Xo$")) { + # TODO: Figure out how to handle this + } else if(match(words[w],"^Xc$")) { + # TODO: Figure out how to handle this + } else if(match(words[w],"^[=]$")) { + addpunct(words[w]) + } else if(match(words[w],"^[[{(]$")) { + addopen(words[w]) + } else if(match(words[w],"^[\\])}.,;:]$")) { + addclose(words[w]) + } else { + add(words[w]) + } + } + if(match(out,"^\\.[^a-zA-Z]")) + sub("^\\.","",out) + endline() +} diff --git a/mk/pathnames b/mk/pathnames new file mode 100644 index 00000000..b233ec33 --- /dev/null +++ b/mk/pathnames @@ -0,0 +1,10 @@ +smtpd_srcdir = $(top_srcdir)/smtpd +compat_srcdir = $(top_srcdir)/openbsd-compat +regress_srcdir = $(top_srcdir)/regress/bin + +PATHS= -DSMTPD_CONFDIR=\"$(sysconfdir)\" \ + -DPATH_CHROOT=\"$(PRIVSEP_PATH)\" \ + -DPATH_SMTPCTL=\"$(sbindir)/smtpctl\" \ + -DPATH_MAILLOCAL=\"$(pkglibexecdir)/mail.local\" \ + -DPATH_MAKEMAP=\"$(sbindir)/makemap\" \ + -DPATH_LIBEXEC=\"$(pkglibexecdir)\" diff --git a/mk/smtp/Makefile.am b/mk/smtp/Makefile.am new file mode 100644 index 00000000..e955a271 --- /dev/null +++ b/mk/smtp/Makefile.am @@ -0,0 +1,59 @@ +include $(top_srcdir)/mk/pathnames + +bin_PROGRAMS= smtp + +smtp_SOURCES= $(smtpd_srcdir)/iobuf.c +smtp_SOURCES+= $(smtpd_srcdir)/ioev.c +smtp_SOURCES+= $(smtpd_srcdir)/log.c +smtp_SOURCES+= $(smtpd_srcdir)/smtp_client.c +smtp_SOURCES+= $(smtpd_srcdir)/smtpc.c +smtp_SOURCES+= $(smtpd_srcdir)/ssl.c +smtp_SOURCES+= $(smtpd_srcdir)/ssl_verify.c + +smtp_CFLAGS= -DIO_TLS + +AM_CPPFLAGS= -I$(top_srcdir)/smtpd \ + -I$(top_srcdir)/openbsd-compat +if !NEED_ERR_H +AM_CPPFLAGS += -I$(top_srcdir)/openbsd-compat/err_h +endif + +LIBCOMPAT= $(top_builddir)/openbsd-compat/libopenbsd.a + +LDADD= $(LIBCOMPAT) + +# need to define _GNU_SOURCE to get: +# EAI_NODATA defined +# {v,}asprintf +# setres{g,u}id +CFLAGS+= -D_GNU_SOURCE +CPPFLAGS= -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@ + +MANPAGES= smtp.1.out +MANPAGES_IN= $(smtpd_srcdir)/smtp.1 + +EXTRA_DIST= $(MANPAGES_IN) + +PATHSUBS= -e 's|/var/run/smtpd.sock|$(sockdir)/smtpd.sock|g' \ + -e 's|/usr/libexec|$(libexecdir)|g' \ + -e 's|/etc/mail/|$(sysconfdir)/|g' + +FIXPATHSCMD= $(SED) $(PATHSUBS) + + +$(MANPAGES): $(MANPAGES_IN) + manpage=$(smtpd_srcdir)/`echo $@ | sed 's/\.out$$//'`; \ + if test "$(MANTYPE)" = "man"; then \ + $(FIXPATHSCMD) $${manpage} | $(AWK) -f $(srcdir)/../mdoc2man.awk > $@; \ + else \ + $(FIXPATHSCMD) $${manpage} > $@; \ + fi + +install-exec-hook: $(CONFIGFILES) $(MANPAGES) + $(MKDIR_P) $(DESTDIR)$(mandir)/$(mansubdir)1 + $(INSTALL) -m 644 smtp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/smtp.1 + rm smtp.1.out + +uninstall-hook: + rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/smtp.1 + rmdir $(DESTDIR)$(mandir)/$(mansubdir)1 2> /dev/null || /bin/true diff --git a/mk/smtpctl/Makefile.am b/mk/smtpctl/Makefile.am new file mode 100644 index 00000000..3aac9bd7 --- /dev/null +++ b/mk/smtpctl/Makefile.am @@ -0,0 +1,99 @@ +include $(top_srcdir)/mk/pathnames + +sbin_PROGRAMS= smtpctl + +smtpctl_SOURCES= $(smtpd_srcdir)/enqueue.c +smtpctl_SOURCES+= $(smtpd_srcdir)/parser.c +smtpctl_SOURCES+= $(smtpd_srcdir)/log.c +smtpctl_SOURCES+= $(smtpd_srcdir)/envelope.c +smtpctl_SOURCES+= $(smtpd_srcdir)/queue_backend.c +smtpctl_SOURCES+= $(smtpd_srcdir)/queue_fs.c +smtpctl_SOURCES+= $(smtpd_srcdir)/smtpctl.c +smtpctl_SOURCES+= $(smtpd_srcdir)/spfwalk.c +smtpctl_SOURCES+= $(smtpd_srcdir)/util.c +smtpctl_SOURCES+= $(smtpd_srcdir)/unpack_dns.c +smtpctl_SOURCES+= $(smtpd_srcdir)/compress_backend.c +smtpctl_SOURCES+= $(smtpd_srcdir)/compress_gzip.c +smtpctl_SOURCES+= $(smtpd_srcdir)/to.c +smtpctl_SOURCES+= $(smtpd_srcdir)/expand.c +smtpctl_SOURCES+= $(smtpd_srcdir)/tree.c +smtpctl_SOURCES+= $(smtpd_srcdir)/dict.c + +if HAVE_DB_API +smtpctl_SOURCES+= $(smtpd_srcdir)/config.c +smtpctl_SOURCES+= $(smtpd_srcdir)/parse.y +smtpctl_SOURCES+= $(smtpd_srcdir)/limit.c +smtpctl_SOURCES+= $(smtpd_srcdir)/table.c +smtpctl_SOURCES+= $(smtpd_srcdir)/table_static.c +smtpctl_SOURCES+= $(smtpd_srcdir)/table_db.c +smtpctl_SOURCES+= $(smtpd_srcdir)/table_getpwnam.c +smtpctl_SOURCES+= $(smtpd_srcdir)/table_proc.c +smtpctl_SOURCES+= $(smtpd_srcdir)/mailaddr.c +smtpctl_SOURCES+= $(smtpd_srcdir)/makemap.c +endif + +smtpctl_SOURCES+= $(smtpd_srcdir)/crypto.c + +smtpctl_CFLAGS= -DNO_IO -DCONFIG_MINIMUM +smtpctl_CFLAGS+= -DPATH_GZCAT=\"$(ZCAT)\" \ + -DPATH_ENCRYPT=\"$(pkglibexecdir)/encrypt\" + +AM_CPPFLAGS= -I$(top_srcdir)/smtpd \ + -I$(top_srcdir)/openbsd-compat +if !NEED_ERR_H +AM_CPPFLAGS += -I$(top_srcdir)/openbsd-compat/err_h +endif + +LIBCOMPAT= $(top_builddir)/openbsd-compat/libopenbsd.a + +LDADD= $(LIBCOMPAT) +if HAVE_DB_API +LDADD+= $(DB_LIB) +endif + +# need to define _GNU_SOURCE to get: +# EAI_NODATA defined +# {v,}asprintf +# setres{g,u}id +CFLAGS+= -D_GNU_SOURCE +CPPFLAGS= -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@ + +MANPAGES= smtpctl.8.out sendmail.8.out makemap.8.out newaliases.8.out +MANPAGES_IN= $(smtpd_srcdir)/smtpctl.8 $(smtpd_srcdir)/sendmail.8 $(smtpd_srcdir)/makemap.8 $(smtpd_srcdir)/newaliases.8 + +EXTRA_DIST= $(MANPAGES_IN) + +PATHSUBS= -e 's|/var/run/smtpd.sock|$(sockdir)/smtpd.sock|g' \ + -e 's|/usr/libexec|$(libexecdir)|g' \ + -e 's|/etc/mail/|$(sysconfdir)/|g' + +FIXPATHSCMD= $(SED) $(PATHSUBS) + +if NEED_LIBASR +AM_CPPFLAGS+= -I$(top_srcdir)/openbsd-compat/libasr +endif + +$(MANPAGES): $(MANPAGES_IN) + manpage=$(smtpd_srcdir)/`echo $@ | sed 's/\.out$$//'`; \ + if test "$(MANTYPE)" = "man"; then \ + $(FIXPATHSCMD) $${manpage} | $(AWK) -f $(srcdir)/../mdoc2man.awk > $@; \ + else \ + $(FIXPATHSCMD) $${manpage} > $@; \ + fi + +install-exec-hook: $(CONFIGFILES) $(MANPAGES) + $(MKDIR_P) $(DESTDIR)$(mandir)/$(mansubdir)8 + chgrp $(SMTPD_QUEUE_USER) $(DESTDIR)$(sbindir)/smtpctl || true + chmod 2555 $(DESTDIR)$(sbindir)/smtpctl || true + $(INSTALL) -m 644 smtpctl.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/smtpctl.8 + $(INSTALL) -m 644 sendmail.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sendmail.8 + $(INSTALL) -m 644 makemap.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/makemap.8 + $(INSTALL) -m 644 newaliases.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/newaliases.8 + rm smtpctl.8.out sendmail.8.out makemap.8.out newaliases.8.out + +uninstall-hook: + rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/smtpctl.8 + rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/sendmail.8 + rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/makemap.8 + rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/newaliases.8 + rmdir $(DESTDIR)$(mandir)/$(mansubdir)8 2> /dev/null || /bin/true diff --git a/mk/smtpd/Makefile.am b/mk/smtpd/Makefile.am new file mode 100644 index 00000000..bf7a483b --- /dev/null +++ b/mk/smtpd/Makefile.am @@ -0,0 +1,194 @@ +# In OpenBSD, smtpd's files are installed this way: +# +# /etc/mail/smtpd.conf +# /usr/sbin/smtpd +# +# +# For OpenSMTPD portable, here's where files are installed: +# (assuming PREFIX=/usr/local) +# +# /usr/local/etc/smtpd.conf +# /usr/local/sbin/smtpd + +include $(top_srcdir)/mk/pathnames + +sbin_PROGRAMS= smtpd + +smtpd_SOURCES= $(smtpd_srcdir)/aliases.c +smtpd_SOURCES+= $(smtpd_srcdir)/bounce.c +smtpd_SOURCES+= $(smtpd_srcdir)/ca.c +smtpd_SOURCES+= $(smtpd_srcdir)/cert.c +smtpd_SOURCES+= $(smtpd_srcdir)/compress_backend.c +smtpd_SOURCES+= $(smtpd_srcdir)/config.c +smtpd_SOURCES+= $(smtpd_srcdir)/control.c +smtpd_SOURCES+= $(smtpd_srcdir)/dict.c +smtpd_SOURCES+= $(smtpd_srcdir)/dns.c +smtpd_SOURCES+= $(smtpd_srcdir)/esc.c +smtpd_SOURCES+= $(smtpd_srcdir)/envelope.c +smtpd_SOURCES+= $(smtpd_srcdir)/expand.c +smtpd_SOURCES+= $(smtpd_srcdir)/forward.c +smtpd_SOURCES+= $(smtpd_srcdir)/iobuf.c +smtpd_SOURCES+= $(smtpd_srcdir)/ioev.c +smtpd_SOURCES+= $(smtpd_srcdir)/limit.c +smtpd_SOURCES+= $(smtpd_srcdir)/lka.c +smtpd_SOURCES+= $(smtpd_srcdir)/lka_filter.c +smtpd_SOURCES+= $(smtpd_srcdir)/lka_session.c +smtpd_SOURCES+= $(smtpd_srcdir)/log.c +smtpd_SOURCES+= $(smtpd_srcdir)/mda.c +smtpd_SOURCES+= $(smtpd_srcdir)/mda_mbox.c +smtpd_SOURCES+= $(smtpd_srcdir)/mda_unpriv.c +smtpd_SOURCES+= $(smtpd_srcdir)/mda_variables.c +smtpd_SOURCES+= $(smtpd_srcdir)/mproc.c +smtpd_SOURCES+= $(smtpd_srcdir)/mailaddr.c +smtpd_SOURCES+= $(smtpd_srcdir)/mta.c +smtpd_SOURCES+= $(smtpd_srcdir)/mta_session.c +smtpd_SOURCES+= $(smtpd_srcdir)/parse.y +smtpd_SOURCES+= $(smtpd_srcdir)/pony.c +smtpd_SOURCES+= $(smtpd_srcdir)/proxy.c +smtpd_SOURCES+= $(smtpd_srcdir)/queue.c +smtpd_SOURCES+= $(smtpd_srcdir)/queue_backend.c +smtpd_SOURCES+= $(smtpd_srcdir)/report_smtp.c +smtpd_SOURCES+= $(smtpd_srcdir)/resolver.c +smtpd_SOURCES+= $(smtpd_srcdir)/rfc5322.c +smtpd_SOURCES+= $(smtpd_srcdir)/ruleset.c +smtpd_SOURCES+= $(smtpd_srcdir)/runq.c +smtpd_SOURCES+= $(smtpd_srcdir)/scheduler.c +smtpd_SOURCES+= $(smtpd_srcdir)/scheduler_backend.c +smtpd_SOURCES+= $(smtpd_srcdir)/smtp.c +smtpd_SOURCES+= $(smtpd_srcdir)/smtp_session.c +smtpd_SOURCES+= $(smtpd_srcdir)/smtpd.c +smtpd_SOURCES+= $(smtpd_srcdir)/srs.c +smtpd_SOURCES+= $(smtpd_srcdir)/ssl.c +smtpd_SOURCES+= $(smtpd_srcdir)/ssl_smtpd.c +smtpd_SOURCES+= $(smtpd_srcdir)/ssl_verify.c +smtpd_SOURCES+= $(smtpd_srcdir)/stat_backend.c +smtpd_SOURCES+= $(smtpd_srcdir)/table.c +smtpd_SOURCES+= $(smtpd_srcdir)/to.c +smtpd_SOURCES+= $(smtpd_srcdir)/tree.c +smtpd_SOURCES+= $(smtpd_srcdir)/unpack_dns.c +smtpd_SOURCES+= $(smtpd_srcdir)/util.c +smtpd_SOURCES+= $(smtpd_srcdir)/waitq.c + +# backends +smtpd_SOURCES+= $(smtpd_srcdir)/crypto.c +smtpd_SOURCES+= $(smtpd_srcdir)/compress_gzip.c +if HAVE_DB_API +smtpd_SOURCES+= $(smtpd_srcdir)/table_db.c +endif +smtpd_SOURCES+= $(smtpd_srcdir)/table_getpwnam.c +smtpd_SOURCES+= $(smtpd_srcdir)/table_proc.c +smtpd_SOURCES+= $(smtpd_srcdir)/table_static.c +smtpd_SOURCES+= $(smtpd_srcdir)/queue_fs.c +smtpd_SOURCES+= $(smtpd_srcdir)/queue_null.c +smtpd_SOURCES+= $(smtpd_srcdir)/queue_proc.c +smtpd_SOURCES+= $(smtpd_srcdir)/queue_ram.c +smtpd_SOURCES+= $(smtpd_srcdir)/scheduler_null.c +smtpd_SOURCES+= $(smtpd_srcdir)/scheduler_proc.c +smtpd_SOURCES+= $(smtpd_srcdir)/scheduler_ramqueue.c +smtpd_SOURCES+= $(smtpd_srcdir)/stat_ramstat.c + + +smtpd_CFLAGS= -DIO_TLS +smtpd_CFLAGS+= -DCA_FILE=\"$(CA_FILE)\" + +AM_CPPFLAGS= -I$(smtpd_srcdir) \ + -I$(compat_srcdir) +if !NEED_ERR_H +AM_CPPFLAGS += -I$(top_srcdir)/openbsd-compat/err_h +endif +if !SUPPORT_PATHS_H +AM_CPPFLAGS += -I$(top_srcdir)/openbsd-compat/paths_h +endif + +LIBCOMPAT= $(top_builddir)/openbsd-compat/libopenbsd.a +if NEED_LIBASR +AM_CPPFLAGS+= -I$(top_srcdir)/openbsd-compat/libasr +endif + +LDADD= $(LIBCOMPAT) $(DB_LIB) $(ASR_LIB) + +# need to define _GNU_SOURCE to get: +# EAI_NODATA defined +# {v,}asprintf +# setres{g,u}id +CFLAGS+= -D_GNU_SOURCE -DNEED_EVENT_ASR_RUN +CPPFLAGS= -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@ + +MANPAGES= aliases.5.out forward.5.out smtpd.8.out \ + smtpd.conf.5.out table.5.out + +MANPAGES_IN= $(smtpd_srcdir)/aliases.5 +MANPAGES_IN+= $(smtpd_srcdir)/forward.5 +MANPAGES_IN+= $(smtpd_srcdir)/smtpd.8 +MANPAGES_IN+= $(smtpd_srcdir)/smtpd.conf.5 +MANPAGES_IN+= $(smtpd_srcdir)/table.5 + +CONFIGFILES= smtpd.conf.out +CONFIGFILES_IN= $(smtpd_srcdir)/smtpd.conf + +EXTRA_DIST= $(CONFIGFILES_IN) $(MANPAGES_IN) + + +EXTRA_DIST+= $(smtpd_srcdir)/smtpd.h +EXTRA_DIST+= $(smtpd_srcdir)/smtpd-api.h +EXTRA_DIST+= $(smtpd_srcdir)/smtpd-defines.h +EXTRA_DIST+= $(smtpd_srcdir)/ioev.h +EXTRA_DIST+= $(smtpd_srcdir)/iobuf.h +EXTRA_DIST+= $(smtpd_srcdir)/log.h +EXTRA_DIST+= $(smtpd_srcdir)/ssl.h +EXTRA_DIST+= $(smtpd_srcdir)/parser.h + +EXTRA_DIST+= $(backends_srcdir)/queue_utils.h +EXTRA_DIST+= $(filters_srcdir)/asr_event.h + +PATHSUBS= -e 's|/etc/mail/|$(sysconfdir)/|g' \ + -e 's|/var/run/smtpd.sock|$(sockdir)/smtpd.sock|g' \ + -e 's|/usr/local/libexec/smtpd/|$(pkglibexecdir)|g' + +FIXPATHSCMD= $(SED) $(PATHSUBS) + +$(MANPAGES): $(MANPAGES_IN) + manpage=$(smtpd_srcdir)/`echo $@ | sed 's/\.out$$//'`; \ + if test "$(MANTYPE)" = "man"; then \ + $(FIXPATHSCMD) $${manpage} | $(AWK) -f $(srcdir)/../mdoc2man.awk > $@; \ + else \ + $(FIXPATHSCMD) $${manpage} > $@; \ + fi + +$(CONFIGFILES): $(CONFIGFILES_IN) + conffile=$(smtpd_srcdir)/`echo $@ | sed 's/.out$$//'`; \ + $(CAT) $(srcdir)/$${conffile} > $@ + + +# smtpd.conf +# newaliases makemap +install-exec-hook: $(CONFIGFILES) $(MANPAGES) + $(MKDIR_P) $(DESTDIR)$(sysconfdir) + $(MKDIR_P) $(DESTDIR)$(bindir) + $(MKDIR_P) $(DESTDIR)$(mandir)/$(mansubdir)5 + $(MKDIR_P) $(DESTDIR)$(mandir)/$(mansubdir)8 + + @if [ ! -f $(DESTDIR)$(sysconfdir)/smtpd.conf ]; then \ + $(INSTALL) -m 644 smtpd.conf.out $(DESTDIR)$(sysconfdir)/smtpd.conf; \ + else \ + echo "$(DESTDIR)$(sysconfdir)/smtpd.conf already exists, install will not overwrite"; \ + fi + + $(INSTALL) -m 644 aliases.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/aliases.5 + $(INSTALL) -m 644 forward.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/forward.5 + $(INSTALL) -m 644 table.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/table.5 + $(INSTALL) -m 644 smtpd.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/smtpd.8 + $(INSTALL) -m 644 smtpd.conf.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/smtpd.conf.5 + rm aliases.5.out forward.5.out table.5.out \ + smtpd.8.out smtpd.conf.5.out smtpd.conf.out + +uninstall-hook: +# XXX to make "make distcheck" happy we need to rm smtpd.conf +# rm $(DESTDIR)$(sysconfdir)/smtpd.conf + rm -f $(DESTDIR)$(mandir)/$(mansubdir)5/aliases.5 \ + $(DESTDIR)$(mandir)/$(mansubdir)5/forward.5 \ + $(DESTDIR)$(mandir)/$(mansubdir)5/table.5 \ + $(DESTDIR)$(mandir)/$(mansubdir)5/smtpd.conf.5 \ + $(DESTDIR)$(mandir)/$(mansubdir)8/smtpd.8 + rmdir $(DESTDIR)$(mandir)/$(mansubdir)5 \ + $(DESTDIR)$(mandir)/$(mansubdir)8 2> /dev/null || /bin/true |