svn commit: r289122 - in vendor/dma/0.10: . debian
Baptiste Daroussin
bapt at FreeBSD.org
Sat Oct 10 23:22:57 UTC 2015
Author: bapt
Date: Sat Oct 10 23:22:55 2015
New Revision: 289122
URL: https://svnweb.freebsd.org/changeset/base/289122
Log:
Tag import of dma 0.10
Added:
vendor/dma/0.10/
- copied from r286801, vendor/dma/dist/
Replaced:
vendor/dma/0.10/LICENSE
- copied unchanged from r289121, vendor/dma/dist/LICENSE
vendor/dma/0.10/README.markdown
- copied unchanged from r289121, vendor/dma/dist/README.markdown
vendor/dma/0.10/TODO
- copied unchanged from r289121, vendor/dma/dist/TODO
vendor/dma/0.10/VERSION
- copied unchanged from r289121, vendor/dma/dist/VERSION
vendor/dma/0.10/aliases_parse.y
- copied unchanged from r289121, vendor/dma/dist/aliases_parse.y
vendor/dma/0.10/aliases_scan.l
- copied unchanged from r289121, vendor/dma/dist/aliases_scan.l
vendor/dma/0.10/conf.c
- copied unchanged from r289121, vendor/dma/dist/conf.c
vendor/dma/0.10/dma-mbox-create.c
- copied unchanged from r289121, vendor/dma/dist/dma-mbox-create.c
vendor/dma/0.10/dma.8
- copied unchanged from r289121, vendor/dma/dist/dma.8
vendor/dma/0.10/dma.c
- copied unchanged from r289121, vendor/dma/dist/dma.c
vendor/dma/0.10/dma.h
- copied unchanged from r289121, vendor/dma/dist/dma.h
vendor/dma/0.10/dns.c
- copied unchanged from r289121, vendor/dma/dist/dns.c
vendor/dma/0.10/get-version.sh
- copied unchanged from r289121, vendor/dma/dist/get-version.sh
vendor/dma/0.10/local.c
- copied unchanged from r289121, vendor/dma/dist/local.c
vendor/dma/0.10/mail.c
- copied unchanged from r289121, vendor/dma/dist/mail.c
vendor/dma/0.10/net.c
- copied unchanged from r289121, vendor/dma/dist/net.c
vendor/dma/0.10/spool.c
- copied unchanged from r289121, vendor/dma/dist/spool.c
vendor/dma/0.10/util.c
- copied unchanged from r289121, vendor/dma/dist/util.c
Deleted:
vendor/dma/0.10/BSDmakefile
vendor/dma/0.10/debian/
Copied: vendor/dma/0.10/LICENSE (from r289121, vendor/dma/dist/LICENSE)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/dma/0.10/LICENSE Sat Oct 10 23:22:55 2015 (r289122, copy of r289121, vendor/dma/dist/LICENSE)
@@ -0,0 +1,109 @@
+Copyright (c) 2008-2014, Simon Schubert <2 at 0x2c.org>.
+Copyright (c) 2008 The DragonFly Project.
+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.
Copied: vendor/dma/0.10/README.markdown (from r289121, vendor/dma/dist/README.markdown)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/dma/0.10/README.markdown Sat Oct 10 23:22:55 2015 (r289122, copy of r289121, vendor/dma/dist/README.markdown)
@@ -0,0 +1,37 @@
+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
+--------
+
+In Linux:
+
+ make
+
+In BSD:
+
+ cd bsd && 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>
Copied: vendor/dma/0.10/TODO (from r289121, vendor/dma/dist/TODO)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/dma/0.10/TODO Sat Oct 10 23:22:55 2015 (r289122, copy of r289121, vendor/dma/dist/TODO)
@@ -0,0 +1,4 @@
+- unquote/handle quoted local recipients
+- handle/use ESMTP extensions
+- .forward support
+- suggest way to run a queue flush on boot
Copied: vendor/dma/0.10/VERSION (from r289121, vendor/dma/dist/VERSION)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/dma/0.10/VERSION Sat Oct 10 23:22:55 2015 (r289122, copy of r289121, vendor/dma/dist/VERSION)
@@ -0,0 +1 @@
+v0.10
Copied: vendor/dma/0.10/aliases_parse.y (from r289121, vendor/dma/dist/aliases_parse.y)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/dma/0.10/aliases_parse.y Sat Oct 10 23:22:55 2015 (r289122, copy of r289121, vendor/dma/dist/aliases_parse.y)
@@ -0,0 +1,110 @@
+%{
+
+#include <err.h>
+#include <string.h>
+#include <syslog.h>
+#include "dma.h"
+
+extern int yylineno;
+static void yyerror(const char *);
+
+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: vendor/dma/0.10/aliases_scan.l (from r289121, vendor/dma/dist/aliases_scan.l)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/dma/0.10/aliases_scan.l Sat Oct 10 23:22:55 2015 (r289122, copy of r289121, vendor/dma/dist/aliases_scan.l)
@@ -0,0 +1,24 @@
+%{
+
+#include <string.h>
+#include "dma.h"
+#include "aliases_parse.h"
+
+#define YY_NO_INPUT
+
+%}
+
+%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: vendor/dma/0.10/conf.c (from r289121, vendor/dma/dist/conf.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/dma/0.10/conf.c Sat Oct 10 23:22:55 2015 (r289122, copy of r289121, vendor/dma/dist/conf.c)
@@ -0,0 +1,245 @@
+/*
+ * 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(EX_DATAERR);
+ }
+ 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(EX_NOINPUT, "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(EX_OSERR, 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(EX_CONFIG, "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(EX_NOINPUT, "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(EX_CONFIG, "syntax error in %s:%d", config_path, lineno);
+ /* NOTREACHED */
+ }
+ }
+
+ if ((config.features & NULLCLIENT) && config.smarthost == NULL) {
+ errlogx(EX_CONFIG, "%s: NULLCLIENT requires SMARTHOST", config_path);
+ /* NOTREACHED */
+ }
+
+ fclose(conf);
+}
Copied: vendor/dma/0.10/dma-mbox-create.c (from r289121, vendor/dma/dist/dma-mbox-create.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/dma/0.10/dma-mbox-create.c Sat Oct 10 23:22:55 2015 (r289122, copy of r289121, vendor/dma/dist/dma-mbox-create.c)
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2010-2014, Simon Schubert <2 at 0x2c.org>.
+ * Copyright (c) 2008 The DragonFly Project. All rights reserved.
+ *
+ * This code is derived from software contributed to The DragonFly Project
+ * by Simon Schubert <2 at 0x2c.org>.
+ *
+ * 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.
+ */
+
+/*
+ * This binary is setuid root. Use extreme caution when touching
+ * user-supplied information. Keep the root window as small as possible.
+ */
+
+#include <sys/param.h>
+#include <sys/stat.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <grp.h>
+#include <paths.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <syslog.h>
+#include <unistd.h>
+
+#include "dma.h"
+
+
+static void
+logfail(int exitcode, const char *fmt, ...)
+{
+ int oerrno = errno;
+ va_list ap;
+ char outs[1024];
+
+ outs[0] = 0;
+ if (fmt != NULL) {
+ va_start(ap, fmt);
+ vsnprintf(outs, sizeof(outs), fmt, ap);
+ va_end(ap);
+ }
+
+ errno = oerrno;
+ if (*outs != 0)
+ syslog(LOG_ERR, errno ? "%s: %m" : "%s", outs);
+ else
+ syslog(LOG_ERR, errno ? "%m" : "unknown error");
+
+ exit(exitcode);
+}
+
+/*
+ * Create a mbox in /var/mail for a given user, or make sure
+ * the permissions are correct for dma.
+ */
+
+int
+main(int argc, char **argv)
+{
+ const char *user;
+ struct passwd *pw;
+ struct group *gr;
+ uid_t user_uid;
+ gid_t mail_gid;
+ int error;
+ char fn[PATH_MAX+1];
+ int f;
+
+ openlog("dma-mbox-create", 0, LOG_MAIL);
+
+ errno = 0;
+ gr = getgrnam(DMA_GROUP);
+ if (!gr)
+ logfail(EX_CONFIG, "cannot find dma group `%s'", DMA_GROUP);
+
+ mail_gid = gr->gr_gid;
+
+ if (setgid(mail_gid) != 0)
+ logfail(EX_NOPERM, "cannot set gid to %d (%s)", mail_gid, DMA_GROUP);
+ if (getegid() != mail_gid)
+ logfail(EX_NOPERM, "cannot set gid to %d (%s), still at %d", mail_gid, DMA_GROUP, getegid());
+
+ /*
+ * We take exactly one argument: the username.
+ */
+ if (argc != 2) {
+ errno = 0;
+ logfail(EX_USAGE, "no arguments");
+ }
+ user = argv[1];
+
+ syslog(LOG_NOTICE, "creating mbox for `%s'", user);
+
+ /* the username may not contain a pathname separator */
+ if (strchr(user, '/')) {
+ errno = 0;
+ logfail(EX_DATAERR, "path separator in username `%s'", user);
+ exit(1);
+ }
+
+ /* verify the user exists */
+ errno = 0;
+ pw = getpwnam(user);
+ if (!pw)
+ logfail(EX_NOUSER, "cannot find user `%s'", user);
+
+ user_uid = pw->pw_uid;
+
+ error = snprintf(fn, sizeof(fn), "%s/%s", _PATH_MAILDIR, user);
+ if (error < 0 || (size_t)error >= sizeof(fn)) {
+ if (error >= 0) {
+ errno = 0;
+ logfail(EX_USAGE, "mbox path too long");
+ }
+ logfail(EX_CANTCREAT, "cannot build mbox path for `%s/%s'", _PATH_MAILDIR, user);
+ }
+
+ f = open(fn, O_RDONLY|O_CREAT, 0600);
+ if (f < 0)
+ logfail(EX_NOINPUT, "cannt open mbox `%s'", fn);
+
+ if (fchown(f, user_uid, mail_gid))
+ logfail(EX_OSERR, "cannot change owner of mbox `%s'", fn);
+
+ if (fchmod(f, 0620))
+ logfail(EX_OSERR, "cannot change permissions of mbox `%s'", fn);
+
+ /* file should be present with the right owner and permissions */
+
+ syslog(LOG_NOTICE, "successfully created mbox for `%s'", user);
+
+ return (0);
+}
Copied: vendor/dma/0.10/dma.8 (from r289121, vendor/dma/dist/dma.8)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/dma/0.10/dma.8 Sat Oct 10 23:22:55 2015 (r289122, copy of r289121, vendor/dma/dist/dma.8)
@@ -0,0 +1,364 @@
+.\"
+.\" Copyright (c) 2008-2014, Simon Schubert <2 at 0x2c.org>.
+.\" Copyright (c) 2008
+.\" The DragonFly Project. 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 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.
+.\"
+.Dd February 13, 2014
+.Dt DMA 8
+.Os
+.Sh NAME
+.Nm dma
+.Nd DragonFly Mail Agent
+.Sh SYNOPSIS
+.Nm
+.Op Fl DiOt
+.Op Fl A Ns Ar mode
+.Op Fl b Ns Ar mode
+.Op Fl f Ar sender
+.Op Fl L Ar tag
+.Op Fl o Ns Ar option
+.Op Fl r Ar sender
+.Op Fl q Ns Op Ar arg
+.Op Ar recipient ...
+.Sh DESCRIPTION
+.Nm
+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.
+.Pp
+.Nm
+is not intended as a replacement for real, big MTAs like
+.Xr sendmail 8
+or
+.Xr postfix 1 .
+Consequently,
+.Nm
+does not listen on port 25 for incoming connections.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl A Ns Ar mode
+.Fl \&Ac
+acts as a compatibility option for sendmail.
+.It Fl b Ns Ar mode
+.Bl -tag -width indent
+.It Fl bp
+List all mails currently stored in the mail queue.
+.It Fl bq
+Queue the mail, but don't attempt to deliver it.
+See also the
+.Sq DEFER
+config file setting below.
+.El
+.Pp
+All other
+.Ar mode Ns
+s are are ignored.
+.It Fl D
+Don't run in the background.
+Useful for debugging.
+.It Fl f Ar sender
+Set sender address (envelope-from) to
+.Ar sender .
+This overrides the value of the environment variable
+.Ev EMAIL .
+.It Fl i
+Ignore dots alone on lines by themselves in incoming messages.
+This should be set if you are reading data from a file.
+.It Fl L Ar tag
+Set the identifier used in syslog messages to the supplied
+.Ar tag .
+This is a compatibility option for sendmail.
+.It Fl O
+This is a compatibility option for sendmail.
+.It Fl o Ns Ar option
+Specifying
+.Fl oi
+is synonymous to
+.Fl i .
+All other options are ignored.
+.It Fl q Ns Op Ar arg
+Process saved messages in the queue.
+The argument is optional and ignored.
+.It Fl r Ar sender
+Same as
+.Fl f .
+.It Fl t
+Obtain recipient addresses from the message header.
+.Nm
+will parse the
+.Li To: ,
+.Li Cc: ,
+and
+.Li Bcc:
+headers.
+The
+.Li Bcc:
+header will be removed independent of whether
+.Fl t
+is specified or not.
+.El
+.Sh CONFIGURATION
+.Nm
+can be configured with two config files:
+.Pp
+.Bl -bullet -compact
+.It
+auth.conf
+.It
+dma.conf
+.El
+.Pp
+These two files are stored per default in
+.Pa /etc/dma .
+.Sh FILE FORMAT
+Every file contains parameters of the form
+.Sq name value .
+Lines containing boolean values are set to
+.Sq NO
+if the line is commented and to
+.Sq YES
+if the line is uncommented.
+Empty lines or lines beginning with a
+.Sq #
+are ignored.
+Parameter names and their values are case sensitive.
+.Sh PARAMETERS
+.Ss auth.conf
+SMTP authentication can be configured in
+.Pa auth.conf .
+Each line has the format
+.Dq Li user|smarthost:password .
+.Ss dma.conf
+Most of the behaviour of
+.Nm
+can be configured in
+.Pa dma.conf .
+.Bl -tag -width 4n
+.It Ic SMARTHOST Xo
+(string, default=empty)
+.Xc
+If you want to send outgoing mails via a smarthost, set this variable to
+your smarthosts address.
+.It Ic PORT Xo
+(numeric, default=25)
+.Xc
+Use this port to deliver remote emails.
+Only useful together with the
+.Sq SMARTHOST
+option, because
+.Nm
+will deliver all mails to this port, regardless of whether a smarthost is set
+or not.
+.It Ic ALIASES Xo
+(string, default=/etc/aliases)
+.Xc
+Path to the local aliases file.
+Just stick with the default.
+The aliases file is of the format
+.Dl nam: dest1 dest2 ...
+In this case, mails to
+.Li nam
+will instead be delivered to
+.Li dest1
+and
+.Li dest2 ,
+which in turn could be entries in
+.Pa /etc/aliases .
+The special name
+.Ql *
+can be used to create a catch-all alias, which gets used if no other
+matching alias is found.
+Use the catch-all alias only if you don't want any local mail to be
+delivered.
+.It Ic SPOOLDIR Xo
+(string, default=/var/spool/dma)
+.Xc
+Path to
+.Nm Ap s
+spool directory.
+Just stick with the default.
+.It Ic AUTHPATH Xo
+(string, default=not set)
+.Xc
+Path to the
+.Sq auth.conf
+file.
+.It Ic SECURETRANS Xo
+(boolean, default=commented)
+.Xc
+Uncomment if you want TLS/SSL secured transfer.
+.It Ic STARTTLS Xo
+(boolean, default=commented)
+.Xc
+Uncomment if you want to use STARTTLS.
+Only useful together with
+.Sq SECURETRANS .
+.It Ic OPPORTUNISTIC_TLS Xo
+(boolean, default=commented)
+.Xc
+Uncomment if you want to allow the STARTTLS negotiation to fail.
+Most useful when
+.Nm
+is used without a smarthost, delivering remote messages directly to
+the outside mail exchangers; in opportunistic TLS mode, the connection will
+be encrypted if the remote server supports STARTTLS, but an unencrypted
+delivery will still be made if the negotiation fails.
+Only useful together with
+.Sq SECURETRANS
+and
+.Sq STARTTLS .
+.It Ic CERTFILE Xo
+(string, default=empty)
+.Xc
+Path to your SSL certificate file.
+.It Ic SECURE Xo
+(boolean, default=commented)
+.Xc
+Uncomment this entry and change it to
+.Sq INSECURE
+to use plain text SMTP login over an insecure connection.
+You have to rename this variable manually to prevent that you send your
+password accidentally over an insecure connection.
+.It Ic DEFER Xo
+(boolean, default=commented)
+.Xc
+Uncomment if you want that
+.Nm
+defers your mail.
+You have to flush your mail queue manually with the
+.Fl q
+option.
+This option is handy if you are behind a dialup line.
+.It Ic FULLBOUNCE Xo
+(boolean, default=commented)
+.Xc
+Uncomment if you want the bounce message to include the complete original
+message, not just the headers.
+.It Ic MAILNAME Xo
+(string, default=empty)
+.Xc
+The internet hostname
+.Nm
+uses to identify the host.
+If not set or empty, the result of
+.Xr gethostname 3
+is used.
+If
+.Sq MAILNAME
+is an absolute path to a file, the first line of this file will be used
+as the hostname.
+.It Ic MASQUERADE Xo
+(string, default=empty)
+.Xc
+Masquerade the envelope-from addresses with this address/hostname.
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-all
mailing list