svn commit: r262266 - in vendor/dma: . dist dist/debian dist/debian/migrate dist/debian/source dist/test
Baptiste Daroussin
bapt at FreeBSD.org
Thu Feb 20 22:39:58 UTC 2014
Author: bapt
Date: Thu Feb 20 22:39:55 2014
New Revision: 262266
URL: http://svnweb.freebsd.org/changeset/base/262266
Log:
Import dma 89702b7f14 (2013-02-13) into vendors
Added:
vendor/dma/
vendor/dma/dist/
vendor/dma/dist/BSDmakefile
vendor/dma/dist/INSTALL
vendor/dma/dist/LICENSE
vendor/dma/dist/Makefile (contents, props changed)
vendor/dma/dist/Makefile.etc (contents, props changed)
vendor/dma/dist/README.markdown
vendor/dma/dist/TODO
vendor/dma/dist/VERSION
vendor/dma/dist/aliases_parse.y
vendor/dma/dist/aliases_scan.l
vendor/dma/dist/auth.conf (contents, props changed)
vendor/dma/dist/base64.c (contents, props changed)
vendor/dma/dist/conf.c (contents, props changed)
vendor/dma/dist/crypto.c (contents, props changed)
vendor/dma/dist/debian/
vendor/dma/dist/debian/NEWS
vendor/dma/dist/debian/README.Debian
vendor/dma/dist/debian/changelog
vendor/dma/dist/debian/compat
vendor/dma/dist/debian/control
vendor/dma/dist/debian/copyright
vendor/dma/dist/debian/dma-migrate.dirs
vendor/dma/dist/debian/dma-migrate.install
vendor/dma/dist/debian/dma-migrate.manpages
vendor/dma/dist/debian/dma.dirs
vendor/dma/dist/debian/dma.links
vendor/dma/dist/debian/dma.lintian-overrides
vendor/dma/dist/debian/migrate/
vendor/dma/dist/debian/migrate/Makefile (contents, props changed)
vendor/dma/dist/debian/migrate/NEWS
vendor/dma/dist/debian/migrate/dma-migrate.8 (contents, props changed)
vendor/dma/dist/debian/migrate/dma-migrate.c (contents, props changed)
vendor/dma/dist/debian/rules (contents, props changed)
vendor/dma/dist/debian/source/
vendor/dma/dist/debian/source/format
vendor/dma/dist/debian/source/options
vendor/dma/dist/dfcompat.c (contents, props changed)
vendor/dma/dist/dfcompat.h (contents, props changed)
vendor/dma/dist/dma-mbox-create.c (contents, props changed)
vendor/dma/dist/dma.8 (contents, props changed)
vendor/dma/dist/dma.c (contents, props changed)
vendor/dma/dist/dma.conf (contents, props changed)
vendor/dma/dist/dma.h (contents, props changed)
vendor/dma/dist/dns.c (contents, props changed)
vendor/dma/dist/get-version.sh (contents, props changed)
vendor/dma/dist/local.c (contents, props changed)
vendor/dma/dist/mail.c (contents, props changed)
vendor/dma/dist/net.c (contents, props changed)
vendor/dma/dist/spool.c (contents, props changed)
vendor/dma/dist/test/
vendor/dma/dist/test/quote.rfc2822
vendor/dma/dist/util.c (contents, props changed)
Added: vendor/dma/dist/BSDmakefile
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/dma/dist/BSDmakefile Thu Feb 20 22:39:55 2014 (r262266)
@@ -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>
Added: vendor/dma/dist/INSTALL
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/dma/dist/INSTALL Thu Feb 20 22:39:55 2014 (r262266)
@@ -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
Added: vendor/dma/dist/LICENSE
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/dma/dist/LICENSE Thu Feb 20 22:39:55 2014 (r262266)
@@ -0,0 +1,109 @@
+Copyright (c) 2008 The DragonFly Project.
+Copyright (c) 2008-2011, Simon Schubert <2 at 0x2c.org>.
+All rights reserved.
+
+This code is derived from software contributed to The DragonFly Project
+by Simon Schubert <2 at 0x2c.org>.
+
+This code is derived from software contributed to The DragonFly Project
+by Matthias Schmidt <matthias at 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 at 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 at 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.
Added: vendor/dma/dist/Makefile
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/dma/dist/Makefile Thu Feb 20 22:39:55 2014 (r262266)
@@ -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
Added: vendor/dma/dist/Makefile.etc
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/dma/dist/Makefile.etc Thu Feb 20 22:39:55 2014 (r262266)
@@ -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>
Added: vendor/dma/dist/README.markdown
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/dma/dist/README.markdown Thu Feb 20 22:39:55 2014 (r262266)
@@ -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 at 0x2c.org>
Added: vendor/dma/dist/TODO
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/dma/dist/TODO Thu Feb 20 22:39:55 2014 (r262266)
@@ -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
Added: vendor/dma/dist/VERSION
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/dma/dist/VERSION Thu Feb 20 22:39:55 2014 (r262266)
@@ -0,0 +1 @@
+v0.9
Added: vendor/dma/dist/aliases_parse.y
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/dma/dist/aliases_parse.y Thu Feb 20 22:39:55 2014 (r262266)
@@ -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;
+ }
+ ;
+
+%%
Added: vendor/dma/dist/aliases_scan.l
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/dma/dist/aliases_scan.l Thu Feb 20 22:39:55 2014 (r262266)
@@ -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;
+
+%%
Added: vendor/dma/dist/auth.conf
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/dma/dist/auth.conf Thu Feb 20 22:39:55 2014 (r262266)
@@ -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
Added: vendor/dma/dist/base64.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/dma/dist/base64.c Thu Feb 20 22:39:55 2014 (r262266)
@@ -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;
+}
+
Added: vendor/dma/dist/conf.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/dma/dist/conf.c Thu Feb 20 22:39:55 2014 (r262266)
@@ -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 at 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);
+}
Added: vendor/dma/dist/crypto.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/dma/dist/crypto.c Thu Feb 20 22:39:55 2014 (r262266)
@@ -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 at 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 ***
More information about the svn-src-vendor
mailing list