Date: Fri, 21 Feb 2014 07:26:49 +0000 (UTC) From: Baptiste Daroussin <bapt@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r262282 - in head: contrib/dma contrib/dma/debian contrib/dma/debian/migrate contrib/dma/debian/source contrib/dma/test etc/mtree libexec libexec/dma share/mk tools/build/mk tools/build... Message-ID: <201402210726.s1L7QnBP007144@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bapt Date: Fri Feb 21 07:26:49 2014 New Revision: 262282 URL: http://svnweb.freebsd.org/changeset/base/262282 Log: Import Dragonfly Mail Agent into base system It is a small and lightweight Mail Transport Agent. It accepts mails from locally installed Mail User Agents (MUA) and delivers the mails either locally or to a remote destination. Remote delivery includes several features like TLS/SSL support, SMTP authentication and NULLCLIENT. Make dma conditional to new WITHOUT_DMA option and make it respect WITHOUT_MAIL Reviewed by: peter Discussed with: emaste, bz, peter Added: head/contrib/dma/ - copied from r262281, vendor/dma/dist/ head/libexec/dma/ head/libexec/dma/Makefile (contents, props changed) head/tools/build/options/WITHOUT_DMA (contents, props changed) Replaced: head/contrib/dma/BSDmakefile - copied unchanged from r262281, vendor/dma/dist/BSDmakefile head/contrib/dma/INSTALL - copied unchanged from r262281, vendor/dma/dist/INSTALL head/contrib/dma/LICENSE - copied unchanged from r262281, vendor/dma/dist/LICENSE head/contrib/dma/Makefile - copied unchanged from r262281, vendor/dma/dist/Makefile head/contrib/dma/Makefile.etc - copied unchanged from r262281, vendor/dma/dist/Makefile.etc head/contrib/dma/README.markdown - copied unchanged from r262281, vendor/dma/dist/README.markdown head/contrib/dma/TODO - copied unchanged from r262281, vendor/dma/dist/TODO head/contrib/dma/VERSION - copied unchanged from r262281, vendor/dma/dist/VERSION head/contrib/dma/aliases_parse.y - copied unchanged from r262281, vendor/dma/dist/aliases_parse.y head/contrib/dma/aliases_scan.l - copied unchanged from r262281, vendor/dma/dist/aliases_scan.l head/contrib/dma/auth.conf - copied unchanged from r262281, vendor/dma/dist/auth.conf head/contrib/dma/base64.c - copied unchanged from r262281, vendor/dma/dist/base64.c head/contrib/dma/conf.c - copied unchanged from r262281, vendor/dma/dist/conf.c head/contrib/dma/crypto.c - copied unchanged from r262281, vendor/dma/dist/crypto.c head/contrib/dma/debian/ - copied from r262281, vendor/dma/dist/debian/ head/contrib/dma/debian/NEWS - copied unchanged from r262281, vendor/dma/dist/debian/NEWS head/contrib/dma/debian/README.Debian - copied unchanged from r262281, vendor/dma/dist/debian/README.Debian head/contrib/dma/debian/changelog - copied unchanged from r262281, vendor/dma/dist/debian/changelog head/contrib/dma/debian/compat - copied unchanged from r262281, vendor/dma/dist/debian/compat head/contrib/dma/debian/control - copied unchanged from r262281, vendor/dma/dist/debian/control head/contrib/dma/debian/copyright - copied unchanged from r262281, vendor/dma/dist/debian/copyright head/contrib/dma/debian/dma-migrate.dirs - copied unchanged from r262281, vendor/dma/dist/debian/dma-migrate.dirs head/contrib/dma/debian/dma-migrate.install - copied unchanged from r262281, vendor/dma/dist/debian/dma-migrate.install head/contrib/dma/debian/dma-migrate.manpages - copied unchanged from r262281, vendor/dma/dist/debian/dma-migrate.manpages head/contrib/dma/debian/dma.dirs - copied unchanged from r262281, vendor/dma/dist/debian/dma.dirs head/contrib/dma/debian/dma.links - copied unchanged from r262281, vendor/dma/dist/debian/dma.links head/contrib/dma/debian/dma.lintian-overrides - copied unchanged from r262281, vendor/dma/dist/debian/dma.lintian-overrides head/contrib/dma/debian/migrate/ - copied from r262281, vendor/dma/dist/debian/migrate/ head/contrib/dma/debian/migrate/Makefile - copied unchanged from r262281, vendor/dma/dist/debian/migrate/Makefile head/contrib/dma/debian/migrate/NEWS - copied unchanged from r262281, vendor/dma/dist/debian/migrate/NEWS head/contrib/dma/debian/migrate/dma-migrate.8 - copied unchanged from r262281, vendor/dma/dist/debian/migrate/dma-migrate.8 head/contrib/dma/debian/migrate/dma-migrate.c - copied unchanged from r262281, vendor/dma/dist/debian/migrate/dma-migrate.c head/contrib/dma/debian/rules - copied unchanged from r262281, vendor/dma/dist/debian/rules head/contrib/dma/debian/source/ - copied from r262281, vendor/dma/dist/debian/source/ head/contrib/dma/debian/source/format - copied unchanged from r262281, vendor/dma/dist/debian/source/format head/contrib/dma/debian/source/options - copied unchanged from r262281, vendor/dma/dist/debian/source/options head/contrib/dma/dfcompat.c - copied unchanged from r262281, vendor/dma/dist/dfcompat.c head/contrib/dma/dfcompat.h - copied unchanged from r262281, vendor/dma/dist/dfcompat.h head/contrib/dma/dma-mbox-create.c - copied unchanged from r262281, vendor/dma/dist/dma-mbox-create.c head/contrib/dma/dma.8 - copied unchanged from r262281, vendor/dma/dist/dma.8 head/contrib/dma/dma.c - copied unchanged from r262281, vendor/dma/dist/dma.c head/contrib/dma/dma.conf - copied unchanged from r262281, vendor/dma/dist/dma.conf head/contrib/dma/dma.h - copied unchanged from r262281, vendor/dma/dist/dma.h head/contrib/dma/dns.c - copied unchanged from r262281, vendor/dma/dist/dns.c head/contrib/dma/get-version.sh - copied unchanged from r262281, vendor/dma/dist/get-version.sh head/contrib/dma/local.c - copied unchanged from r262281, vendor/dma/dist/local.c head/contrib/dma/mail.c - copied unchanged from r262281, vendor/dma/dist/mail.c head/contrib/dma/net.c - copied unchanged from r262281, vendor/dma/dist/net.c head/contrib/dma/spool.c - copied unchanged from r262281, vendor/dma/dist/spool.c head/contrib/dma/test/ - copied from r262281, vendor/dma/dist/test/ head/contrib/dma/test/quote.rfc2822 - copied unchanged from r262281, vendor/dma/dist/test/quote.rfc2822 head/contrib/dma/util.c - copied unchanged from r262281, vendor/dma/dist/util.c Modified: head/etc/mtree/BSD.root.dist head/etc/mtree/BSD.var.dist head/libexec/Makefile head/share/mk/bsd.own.mk head/tools/build/mk/OptionalObsoleteFiles.inc Copied: head/contrib/dma/BSDmakefile (from r262281, vendor/dma/dist/BSDmakefile) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/dma/BSDmakefile Fri Feb 21 07:26:49 2014 (r262282, copy of r262281, vendor/dma/dist/BSDmakefile) @@ -0,0 +1,28 @@ +# $DragonFly: src/libexec/dma/Makefile,v 1.5 2008/09/19 00:36:57 corecode Exp $ +# + +version!= sh get-version.sh + +CFLAGS+= -I${.CURDIR} +CFLAGS+= -DHAVE_REALLOCF -DHAVE_STRLCPY -DHAVE_GETPROGNAME +CFLAGS+= -DLIBEXEC_PATH='"${LIBEXEC}"' -DDMA_VERSION='"${version}"' +CFLAGS+= -DCONF_PATH='"${CONFDIR}"' + +DPADD= ${LIBSSL} ${LIBCRYPTO} +LDADD= -lssl -lcrypto + +PROG= dma +SRCS= aliases_parse.y aliases_scan.l base64.c conf.c crypto.c +SRCS+= dma.c dns.c local.c mail.c net.c spool.c util.c +MAN= dma.8 + +PREFIX?= /usr/local +LIBEXEC?= ${PREFIX}/libexec +CONFDIR?= ${PREFIX}/etc/dma + +BINOWN= root +BINGRP= mail +BINMODE=2555 +WARNS?= 6 + +.include <bsd.prog.mk> Copied: head/contrib/dma/INSTALL (from r262281, vendor/dma/dist/INSTALL) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/dma/INSTALL Fri Feb 21 07:26:49 2014 (r262282, copy of r262281, vendor/dma/dist/INSTALL) @@ -0,0 +1,28 @@ +Installing DMA: +=============== + +On most systems (with a development environment installed) you should be able to compile DMA with: + make + +Once it have compiled it successfully, you can install it with: + make install sendmail-link mailq-link install-spool-dirs install-etc + +Troubleshooting: +---------------- +On systems that do not default to a compatible "make" version, try using "gmake" or "pmake" instead of "make". Some known examples of this: +* Solaris 9 +* Solaris 10 + +Check that you have the following commands installed: +* cc - gcc is known to work +* lex - flex is known to work +* yacc - bison is kjnown to work +* make - BSD make and GNU make is knwon to work +* sh - Need to be POSIX compliant, dash, bash known to work +* install - GNU and BSD versions known to work +* openssl - Add the header location to C_INCLUDE_PATH if you get errors about "err.h" + +If you have all of these tools installed, set the CC, YACC, INSTALL, LEX and SH variable to point to the relevant location and command. + +Example: + make CC=gcc YACC=bison LEX=/usr/bin/flex SH=/bin/bash INSTALL=/usr/bin/install Copied: head/contrib/dma/LICENSE (from r262281, vendor/dma/dist/LICENSE) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/dma/LICENSE Fri Feb 21 07:26:49 2014 (r262282, copy of r262281, vendor/dma/dist/LICENSE) @@ -0,0 +1,109 @@ +Copyright (c) 2008 The DragonFly Project. +Copyright (c) 2008-2011, Simon Schubert <2@0x2c.org>. +All rights reserved. + +This code is derived from software contributed to The DragonFly Project +by Simon Schubert <2@0x2c.org>. + +This code is derived from software contributed to The DragonFly Project +by Matthias Schmidt <matthias@dragonflybsd.org>, University of Marburg, +Germany. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. +3. Neither the name of The DragonFly Project nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific, prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + + +Copyright (c) 1995-2001 Kungliga Tekniska Högskolan +(Royal Institute of Technology, Stockholm, Sweden). +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. Neither the name of the Institute nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + + +Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> + +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. + + +Copyright (c) 1998, M. Warner Losh <imp@freebsd.org> +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. Copied: head/contrib/dma/Makefile (from r262281, vendor/dma/dist/Makefile) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/dma/Makefile Fri Feb 21 07:26:49 2014 (r262282, copy of r262281, vendor/dma/dist/Makefile) @@ -0,0 +1,111 @@ +# +# Depending on your operating system, you might want to influence +# the conditional inclusion of some helper functions: +# +# Define HAVE_* (in caps) if your system already provides: +# reallocf +# strlcpy +# getprogname +# + +SH?= sh + +version= $(shell ${SH} get-version.sh) +debversion= $(shell ${SH} get-version.sh | sed -Ee 's/^v//;s/[.]([[:digit:]]+)[.](g[[:xdigit:]]+)$$/+\1+\2/') + +CC?= gcc +CFLAGS?= -O -pipe +LDADD?= -lssl -lcrypto -lresolv + +CFLAGS+= -Wall -DDMA_VERSION='"${version}"' -DLIBEXEC_PATH='"${LIBEXEC}"' -DCONF_PATH='"${CONFDIR}"' + +INSTALL?= install -p +CHGRP?= chgrp +CHMOD?= chmod + +PREFIX?= /usr/local +SBIN?= ${PREFIX}/sbin +LIBEXEC?= ${PREFIX}/lib +CONFDIR?= /etc/dma +MAN?= ${PREFIX}/share/man +VAR?= /var +DMASPOOL?= ${VAR}/spool/dma +VARMAIL?= ${VAR}/mail +SYMLINK?= -s # or empty to create hard link + +YACC?= yacc +LEX?= lex +LN?= ln + +OBJS= aliases_parse.o aliases_scan.o base64.o conf.o crypto.o +OBJS+= dma.o dns.o local.o mail.o net.o spool.o util.o +OBJS+= dfcompat.o + +all: dma dma-mbox-create + +clean: + -rm -f .depend dma dma-mbox-create *.[do] + -rm -f aliases_parse.[ch] aliases_scan.c + +install: all + ${INSTALL} -d ${DESTDIR}${SBIN} + ${INSTALL} -d ${DESTDIR}${MAN}/man8 ${DESTDIR}${LIBEXEC} + ${INSTALL} -m 2755 -o root -g mail dma ${DESTDIR}${SBIN} + ${INSTALL} -m 4754 -o root -g mail dma-mbox-create ${DESTDIR}${LIBEXEC} + ${INSTALL} -m 0644 dma.8 ${DESTDIR}${MAN}/man8/ + +sendmail-link: + cd ${DESTDIR}${SBIN} && ${LN} ${SYMLINK} dma sendmail + +mailq-link: + cd ${DESTDIR}${SBIN} && ${LN} ${SYMLINK} dma mailq + +install-spool-dirs: + ${INSTALL} -d -m 2775 -o root -g mail ${DESTDIR}${DMASPOOL} + ${INSTALL} -d -m 2775 -o root -g mail ${DESTDIR}${VARMAIL} + +permissions: + -${CHGRP} mail ${DESTDIR}${VARMAIL}/* + -${CHMOD} g+w ${DESTDIR}${VARMAIL}/* + -${CHMOD} 660 ${DESTDIR}${DMASPOOL}/flush + +install-etc: + ${INSTALL} -d ${DESTDIR}${CONFDIR} + @if [ -e ${DESTDIR}${CONFDIR}/dma.conf ]; then \ + echo "Not overwriting ${DESTDIR}${CONFDIR}/dma.conf."; \ + else \ + echo ${INSTALL} -m 644 -o root -g mail dma.conf ${DESTDIR}${CONFDIR}; \ + ${INSTALL} -m 644 -o root -g mail dma.conf ${DESTDIR}${CONFDIR}; \ + fi + @if [ -e ${DESTDIR}${CONFDIR}/auth.conf ]; then \ + echo "Not overwriting ${DESTDIR}${CONFDIR}/auth.conf."; \ + else \ + echo ${INSTALL} -m 640 -o root -g mail auth.conf ${DESTDIR}${CONFDIR}; \ + ${INSTALL} -m 640 -o root -g mail auth.conf ${DESTDIR}${CONFDIR}; \ + fi + +aliases_parse.c: aliases_parse.y + ${YACC} -d -o aliases_parse.c aliases_parse.y + +aliases_scan.c: aliases_scan.l + ${LEX} -t aliases_scan.l > aliases_scan.c + +.SUFFIXES: .c .o + +.c.o: + ${CC} ${CFLAGS} ${CPPFLAGS} -include dfcompat.h -o $@ -c $< + +dma: ${OBJS} + ${CC} ${LDFLAGS} -o $@ ${OBJS} ${LDADD} + + +dch: + dch --release-heuristic changelog -v ${debversion} + + +ppa: + @if [ -z '${DEB_DIST}' ]; then echo "please set DEB_DIST to build"; exit 1; fi + dch -v "${debversion}~${DEB_DIST}" -D ${DEB_DIST} "${DEB_DIST} build" -b + debuild -S -sa + ver=$$(dpkg-parsechangelog -n1 | awk '$$1 == "Version:" { print $$2 }'); \ + dput ppa:corecode/dma ../dma_$${ver}_source.changes Copied: head/contrib/dma/Makefile.etc (from r262281, vendor/dma/dist/Makefile.etc) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/dma/Makefile.etc Fri Feb 21 07:26:49 2014 (r262282, copy of r262281, vendor/dma/dist/Makefile.etc) @@ -0,0 +1,15 @@ +# $DragonFly: src/etc/dma/Makefile,v 1.3 2008/02/12 22:10:20 matthias Exp $ + +FILESDIR= /etc/dma +SHAREOWN= root +SHAREGRP= mail +FILESMODE= 640 + +.if !exists(${DESTDIR}/etc/dma/auth.conf) +FILES+= auth.conf +.endif +.if !exists(${DESTDIR}/etc/dma/dma.conf) +FILES+= dma.conf +.endif + +.include <bsd.prog.mk> Copied: head/contrib/dma/README.markdown (from r262281, vendor/dma/dist/README.markdown) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/dma/README.markdown Fri Feb 21 07:26:49 2014 (r262282, copy of r262281, vendor/dma/dist/README.markdown) @@ -0,0 +1,32 @@ +dma -- DragonFly Mail Agent +=========================== + +dma is a small Mail Transport Agent (MTA), designed for home and +office use. It accepts mails from locally installed Mail User Agents (MUA) +and delivers the mails either locally or to a remote destination. +Remote delivery includes several features like TLS/SSL support and +SMTP authentication. + +dma is not intended as a replacement for real, big MTAs like sendmail(8) +or postfix(1). Consequently, dma does not listen on port 25 for +incoming connections. + + +Building +-------- + + make + + +Installation +------------ + + make install sendmail-link mailq-link install-spool-dirs install-etc + +See INSTALL for requirements and configuration options. + + +Contact +------- + +Simon Schubert <2@0x2c.org> Copied: head/contrib/dma/TODO (from r262281, vendor/dma/dist/TODO) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/dma/TODO Fri Feb 21 07:26:49 2014 (r262282, copy of r262281, vendor/dma/dist/TODO) @@ -0,0 +1,5 @@ +- unquote/handle quoted local recipients +- use proper sysexit codes +- handle/use ESMTP extensions +- .forward support +- suggest way to run a queue flush on boot Copied: head/contrib/dma/VERSION (from r262281, vendor/dma/dist/VERSION) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/dma/VERSION Fri Feb 21 07:26:49 2014 (r262282, copy of r262281, vendor/dma/dist/VERSION) @@ -0,0 +1 @@ +v0.9 Copied: head/contrib/dma/aliases_parse.y (from r262281, vendor/dma/dist/aliases_parse.y) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/dma/aliases_parse.y Fri Feb 21 07:26:49 2014 (r262282, copy of r262281, vendor/dma/dist/aliases_parse.y) @@ -0,0 +1,112 @@ +%{ + +#include <err.h> +#include <string.h> +#include <syslog.h> +#include "dma.h" + +extern int yylineno; +static void yyerror(const char *); +int yywrap(void); +int yylex(void); + +static void +yyerror(const char *msg) +{ + /** + * Because we do error '\n' below, we need to report the error + * one line above of what yylineno points to. + */ + syslog(LOG_CRIT, "aliases line %d: %s", yylineno - 1, msg); + fprintf(stderr, "aliases line %d: %s\n", yylineno - 1, msg); +} + +int +yywrap(void) +{ + return (1); +} + +%} + +%union { + char *ident; + struct stritem *strit; + struct alias *alias; +} + +%token <ident> T_IDENT +%token T_ERROR +%token T_EOF 0 + +%type <strit> dests +%type <alias> alias aliases + +%% + +start : aliases T_EOF + { + LIST_FIRST(&aliases) = $1; + } + +aliases : /* EMPTY */ + { + $$ = NULL; + } + | alias aliases + { + if ($2 != NULL && $1 != NULL) + LIST_INSERT_AFTER($2, $1, next); + else if ($2 == NULL) + $2 = $1; + $$ = $2; + } + ; + +alias : T_IDENT ':' dests '\n' + { + struct alias *al; + + if ($1 == NULL) + YYABORT; + al = calloc(1, sizeof(*al)); + if (al == NULL) + YYABORT; + al->alias = $1; + SLIST_FIRST(&al->dests) = $3; + $$ = al; + } + | error '\n' + { + YYABORT; + } + ; + +dests : T_IDENT + { + struct stritem *it; + + if ($1 == NULL) + YYABORT; + it = calloc(1, sizeof(*it)); + if (it == NULL) + YYABORT; + it->str = $1; + $$ = it; + } + | T_IDENT ',' dests + { + struct stritem *it; + + if ($1 == NULL) + YYABORT; + it = calloc(1, sizeof(*it)); + if (it == NULL) + YYABORT; + it->str = $1; + SLIST_NEXT(it, next) = $3; + $$ = it; + } + ; + +%% Copied: head/contrib/dma/aliases_scan.l (from r262281, vendor/dma/dist/aliases_scan.l) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/dma/aliases_scan.l Fri Feb 21 07:26:49 2014 (r262282, copy of r262281, vendor/dma/dist/aliases_scan.l) @@ -0,0 +1,24 @@ +%{ + +#include <string.h> +#include "aliases_parse.h" + +#define YY_NO_INPUT + +int yylex(void); +%} + +%option yylineno +%option nounput + +%% + +[^:,#[:space:][:cntrl:]]+ {yylval.ident = strdup(yytext); return T_IDENT;} +^([[:blank:]]*(#.*)?\n)+ ;/* ignore empty lines */ +[:,\n] return yytext[0]; +(\n?[[:blank:]]+|#.*)+ ;/* ignore whitespace and continuation */ +\\\n ;/* ignore continuation. not allowed in comments */ +. return T_ERROR; +<<EOF>> return T_EOF; + +%% Copied: head/contrib/dma/auth.conf (from r262281, vendor/dma/dist/auth.conf) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/dma/auth.conf Fri Feb 21 07:26:49 2014 (r262282, copy of r262281, vendor/dma/dist/auth.conf) @@ -0,0 +1,4 @@ +# $DragonFly: src/etc/dma/auth.conf,v 1.1 2008/02/02 18:24:00 matthias Exp $ +# +# SMTP authentication entries (currently AUTH LOGIN only) +# Format: user|my.smarthost.example.com:password Copied: head/contrib/dma/base64.c (from r262281, vendor/dma/dist/base64.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/dma/base64.c Fri Feb 21 07:26:49 2014 (r262282, copy of r262281, vendor/dma/dist/base64.c) @@ -0,0 +1,135 @@ +/* + * Copyright (c) 1995-2001 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <stdlib.h> +#include <string.h> + +#include "dma.h" + +static char base64_chars[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +static int +pos(char c) +{ + char *p; + for (p = base64_chars; *p; p++) + if (*p == c) + return p - base64_chars; + return -1; +} + + +int +base64_encode(const void *data, int size, char **str) +{ + char *s, *p; + int i; + int c; + const unsigned char *q; + + p = s = (char *) malloc(size * 4 / 3 + 4); + if (p == NULL) + return -1; + q = (const unsigned char *) data; + i = 0; + for (i = 0; i < size;) { + c = q[i++]; + c *= 256; + if (i < size) + c += q[i]; + i++; + c *= 256; + if (i < size) + c += q[i]; + i++; + p[0] = base64_chars[(c & 0x00fc0000) >> 18]; + p[1] = base64_chars[(c & 0x0003f000) >> 12]; + p[2] = base64_chars[(c & 0x00000fc0) >> 6]; + p[3] = base64_chars[(c & 0x0000003f) >> 0]; + if (i > size) + p[3] = '='; + if (i > size + 1) + p[2] = '='; + p += 4; + } + *p = 0; + *str = s; + return strlen(s); +} + +#define DECODE_ERROR 0xffffffff + +static unsigned int +token_decode(const char *token) +{ + int i; + unsigned int val = 0; + int marker = 0; + if (strlen(token) < 4) + return DECODE_ERROR; + for (i = 0; i < 4; i++) { + val *= 64; + if (token[i] == '=') + marker++; + else if (marker > 0) + return DECODE_ERROR; + else + val += pos(token[i]); + } + if (marker > 2) + return DECODE_ERROR; + return (marker << 24) | val; +} + +int +base64_decode(const char *str, void *data) +{ + const char *p; + unsigned char *q; + + q = data; + for (p = str; *p && (*p == '=' || strchr(base64_chars, *p)); p += 4) { + unsigned int val = token_decode(p); + unsigned int marker = (val >> 24) & 0xff; + if (val == DECODE_ERROR) + return -1; + *q++ = (val >> 16) & 0xff; + if (marker < 2) + *q++ = (val >> 8) & 0xff; + if (marker < 1) + *q++ = val & 0xff; + } + return q - (unsigned char *) data; +} + Copied: head/contrib/dma/conf.c (from r262281, vendor/dma/dist/conf.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/dma/conf.c Fri Feb 21 07:26:49 2014 (r262282, copy of r262281, vendor/dma/dist/conf.c) @@ -0,0 +1,246 @@ +/* + * Copyright (c) 2008 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Matthias Schmidt <matthias@dragonflybsd.org>, University of Marburg, + * Germany. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <err.h> +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <syslog.h> +#include <stdarg.h> + +#include "dma.h" + +#define DP ": \t" +#define EQS " \t" + + +/* + * Remove trailing \n's + */ +void +trim_line(char *line) +{ + size_t linelen; + char *p; + + if ((p = strchr(line, '\n'))) + *p = (char)0; + + /* Escape leading dot in every case */ + linelen = strlen(line); + if (line[0] == '.') { + if ((linelen + 2) > 1000) { + syslog(LOG_CRIT, "Cannot escape leading dot. Buffer overflow"); + exit(1); + } + memmove((line + 1), line, (linelen + 1)); + line[0] = '.'; + } +} + +static void +chomp(char *str) +{ + size_t len = strlen(str); + + if (len == 0) + return; + if (str[len - 1] == '\n') + str[len - 1] = 0; +} + +/* + * Read the SMTP authentication config file + * + * file format is: + * user|host:password + * + * A line starting with # is treated as comment and ignored. + */ +void +parse_authfile(const char *path) +{ + char line[2048]; + struct authuser *au; + FILE *a; + char *data; + int lineno = 0; + + a = fopen(path, "r"); + if (a == NULL) { + errlog(1, "can not open auth file `%s'", path); + /* NOTREACHED */ + } + + while (!feof(a)) { + if (fgets(line, sizeof(line), a) == NULL) + break; + lineno++; + + chomp(line); + + /* We hit a comment */ + if (*line == '#') + continue; + /* Ignore empty lines */ + if (*line == 0) + continue; + + au = calloc(1, sizeof(*au)); + if (au == NULL) + errlog(1, NULL); + + data = strdup(line); + au->login = strsep(&data, "|"); + au->host = strsep(&data, DP); + au->password = data; + + if (au->login == NULL || + au->host == NULL || + au->password == NULL) { + errlogx(1, "syntax error in authfile %s:%d", + path, lineno); + /* NOTREACHED */ + } + + SLIST_INSERT_HEAD(&authusers, au, next); + } + + fclose(a); +} + +/* + * XXX TODO + * Check for bad things[TM] + */ +void +parse_conf(const char *config_path) +{ + char *word; + char *data; + FILE *conf; + char line[2048]; + int lineno = 0; + + conf = fopen(config_path, "r"); + if (conf == NULL) { + /* Don't treat a non-existing config file as error */ + if (errno == ENOENT) + return; + errlog(1, "can not open config `%s'", config_path); + /* NOTREACHED */ + } + + while (!feof(conf)) { + if (fgets(line, sizeof(line), conf) == NULL) + break; + lineno++; + + chomp(line); + + /* We hit a comment */ + if (strchr(line, '#')) + *strchr(line, '#') = 0; + + data = line; + word = strsep(&data, EQS); + + /* Ignore empty lines */ + if (word == NULL || *word == 0) + continue; + + if (data != NULL && *data != 0) + data = strdup(data); + else + data = NULL; + + if (strcmp(word, "SMARTHOST") == 0 && data != NULL) + config.smarthost = data; + else if (strcmp(word, "PORT") == 0 && data != NULL) + config.port = atoi(data); + else if (strcmp(word, "ALIASES") == 0 && data != NULL) + config.aliases = data; + else if (strcmp(word, "SPOOLDIR") == 0 && data != NULL) + config.spooldir = data; + else if (strcmp(word, "AUTHPATH") == 0 && data != NULL) + config.authpath= data; + else if (strcmp(word, "CERTFILE") == 0 && data != NULL) + config.certfile = data; + else if (strcmp(word, "MAILNAME") == 0 && data != NULL) + config.mailname = data; + else if (strcmp(word, "MASQUERADE") == 0 && data != NULL) { + char *user = NULL, *host = NULL; + if (strrchr(data, '@')) { + host = strrchr(data, '@'); + *host = 0; + host++; + user = data; + } else { + host = data; + } + if (host && *host == 0) + host = NULL; + if (user && *user == 0) + user = NULL; + config.masquerade_host = host; + config.masquerade_user = user; + } else if (strcmp(word, "STARTTLS") == 0 && data == NULL) + config.features |= STARTTLS; + else if (strcmp(word, "OPPORTUNISTIC_TLS") == 0 && data == NULL) + config.features |= TLS_OPP; + else if (strcmp(word, "SECURETRANSFER") == 0 && data == NULL) + config.features |= SECURETRANS; + else if (strcmp(word, "DEFER") == 0 && data == NULL) + config.features |= DEFER; + else if (strcmp(word, "INSECURE") == 0 && data == NULL) + config.features |= INSECURE; + else if (strcmp(word, "FULLBOUNCE") == 0 && data == NULL) + config.features |= FULLBOUNCE; + else if (strcmp(word, "NULLCLIENT") == 0 && data == NULL) + config.features |= NULLCLIENT; + else { + errlogx(1, "syntax error in %s:%d", config_path, lineno); + /* NOTREACHED */ + } + } + + if ((config.features & NULLCLIENT) && config.smarthost == NULL) { + errlogx(1, "%s: NULLCLIENT requires SMARTHOST", config_path); + /* NOTREACHED */ + } + + fclose(conf); +} Copied: head/contrib/dma/crypto.c (from r262281, vendor/dma/dist/crypto.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/dma/crypto.c Fri Feb 21 07:26:49 2014 (r262282, copy of r262281, vendor/dma/dist/crypto.c) @@ -0,0 +1,312 @@ +/* + * Copyright (c) 2008 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Matthias Schmidt <matthias@dragonflybsd.org>, University of Marburg, + * Germany. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <openssl/x509.h> +#include <openssl/md5.h> +#include <openssl/ssl.h> +#include <openssl/err.h> +#include <openssl/pem.h> +#include <openssl/rand.h> + +#include <syslog.h> + +#include "dma.h" + +static int +init_cert_file(SSL_CTX *ctx, const char *path) +{ + int error; + + /* Load certificate into ctx */ + error = SSL_CTX_use_certificate_chain_file(ctx, path); + if (error < 1) { + syslog(LOG_ERR, "SSL: Cannot load certificate `%s': %s", path, ssl_errstr()); + return (-1); + } + + /* Add private key to ctx */ + error = SSL_CTX_use_PrivateKey_file(ctx, path, SSL_FILETYPE_PEM); + if (error < 1) { + syslog(LOG_ERR, "SSL: Cannot load private key `%s': %s", path, ssl_errstr()); + return (-1); + } + + /* + * Check the consistency of a private key with the corresponding + * certificate + */ + error = SSL_CTX_check_private_key(ctx); + if (error < 1) { + syslog(LOG_ERR, "SSL: Cannot check private key: %s", ssl_errstr()); + return (-1); + } + + return (0); +} + +int +smtp_init_crypto(int fd, int feature) +{ + SSL_CTX *ctx = NULL; +#if (OPENSSL_VERSION_NUMBER >= 0x00909000L) + const SSL_METHOD *meth = NULL; +#else + SSL_METHOD *meth = NULL; +#endif + X509 *cert; + int error; + + /* XXX clean up on error/close */ + /* Init SSL library */ + SSL_library_init(); + SSL_load_error_strings(); + + meth = TLSv1_client_method(); + + ctx = SSL_CTX_new(meth); + if (ctx == NULL) { + syslog(LOG_WARNING, "remote delivery deferred: SSL init failed: %s", ssl_errstr()); + return (1); + } + + /* User supplied a certificate */ + if (config.certfile != NULL) { + error = init_cert_file(ctx, config.certfile); + if (error) { + syslog(LOG_WARNING, "remote delivery deferred"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201402210726.s1L7QnBP007144>