From: Simon Schubert <2@0x2c.org> Date: Tue, 15 Nov 2011 21:44:08 +0000 (+0100) Subject: Merge commit 'refs/merge-requests/3' of git://gitorious.org/dma/dma X-Git-Url: http://git.ipfire.org/?p=people%2Fms%2Fdma.git;a=commitdiff_plain;h=804be35c0d56a8c9cd54ce90f6d8e0d909f1a423;hp=ec04827a270e68ff23194ea809223c7dfedbe3a4 Merge commit 'refs/merge-requests/3' of git://gitorious.org/dma/dma --- diff --git a/BSDmakefile b/BSDmakefile index 051f564..9042c8c 100644 --- a/BSDmakefile +++ b/BSDmakefile @@ -1,8 +1,11 @@ # $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}"' DPADD= ${LIBSSL} ${LIBCRYPTO} LDADD= -lssl -lcrypto @@ -12,6 +15,9 @@ 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 + BINOWN= root BINGRP= mail BINMODE=2555 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b89e5bc --- /dev/null +++ b/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 , 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 + +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 +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. diff --git a/Makefile b/Makefile index 266d0b4..0ae0db4 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,7 @@ aliases_scan.c: aliases_scan.l ${CC} ${CFLAGS} ${CPPFLAGS} -include dfcompat.h -o $@ -c $< dma: ${OBJS} - ${CC} ${LDFLAGS} ${LDADD} -o $@ ${OBJS} + ${CC} ${LDFLAGS} -o $@ ${OBJS} ${LDADD} dch: diff --git a/VERSION b/VERSION index 60fe1f2..a85e614 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v0.2 +v0.3 diff --git a/crypto.c b/crypto.c index 8e2d334..60837b1 100644 --- a/crypto.c +++ b/crypto.c @@ -80,7 +80,7 @@ int smtp_init_crypto(int fd, int feature) { SSL_CTX *ctx = NULL; - SSL_METHOD *meth = NULL; + const SSL_METHOD *meth = NULL; X509 *cert; int error; diff --git a/debian/changelog b/debian/changelog index 4d6a2de..41f0206 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,27 @@ +dma (0.3) unstable; urgency=low + + [ Simon Schubert ] + * todo: we create mboxes properly now + * dma-mbox-create: group mail only needs to write to mboxes + * errlog: preserve errno + * dma-mbox-create: add error/status logging + * dns_get_mx_list: handle errors properly + + [ Peter Pentchev ] + * Make add_host() really return an error code. + + [ Simon Schubert ] + * readmail: accept mail without newline at the end + + [ Peter Pentchev ] + * In OpenSSL 1.0, TLSv1_client_method() returns a const pointer. + + [ Simon Schubert ] + * make dma compile again on DragonFly + * parse_addrs: fix parsing for multiple + + -- Simon Schubert <2@0x2c.org> Sat, 09 Jul 2011 02:38:05 +0200 + dma (0.2) unstable; urgency=low * Update to dma 0.2 diff --git a/dns.c b/dns.c index ef78e64..ce80745 100644 --- a/dns.c +++ b/dns.c @@ -105,7 +105,7 @@ add_host(int pref, const char *host, int port, struct mx_hostentry **he, size_t } freeaddrinfo(res0); - return (*ps - onhosts); + return (0); out: if (res0 != NULL) diff --git a/local.c b/local.c index fd816dd..694dd84 100644 --- a/local.c +++ b/local.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include diff --git a/mail.c b/mail.c index 3c0ab1b..e0a22af 100644 --- a/mail.c +++ b/mail.c @@ -290,6 +290,16 @@ again: case ',': case ';': + /* + * Next address, copy previous one. + * However, we might be directly after + * a
, or have two consecutive + * commas. + * Skip the comma unless there is + * really something to copy. + */ + if (ps->pos == 0) + goto skip; s++; goto newaddr; @@ -341,6 +351,7 @@ readmail(struct queue *queue, int nodot, int recp_from_header) int had_from = 0; int had_messagid = 0; int had_date = 0; + int had_last_line = 0; int nocopy = 0; parse_state.state = NONE; @@ -360,12 +371,20 @@ readmail(struct queue *queue, int nodot, int recp_from_header) return (-1); while (!feof(stdin)) { - if (fgets(line, sizeof(line), stdin) == NULL) + if (fgets(line, sizeof(line) - 1, stdin) == NULL) break; + if (had_last_line) + errlogx(1, "bad mail input format"); linelen = strlen(line); if (linelen == 0 || line[linelen - 1] != '\n') { - errno = EINVAL; /* XXX mark permanent errors */ - return (-1); + /* + * This line did not end with a newline character. + * If we fix it, it better be the last line of + * the file. + */ + line[linelen] = '\n'; + line[linelen + 1] = 0; + had_last_line = 1; } if (!had_headers) { /* @@ -415,7 +434,7 @@ readmail(struct queue *queue, int nodot, int recp_from_header) snprintf(line, sizeof(line), "Message-Id: <%"PRIxMAX".%s.%"PRIxMAX"@%s>\n", (uintmax_t)time(NULL), queue->id, - random(), + (uintmax_t)random(), hostname()); } else if (!had_from) { had_from = 1; diff --git a/util.c b/util.c index b32919d..a139b20 100644 --- a/util.c +++ b/util.c @@ -51,6 +51,9 @@ const char * hostname(void) { +#ifndef HOST_NAME_MAX +#define HOST_NAME_MAX 255 +#endif static char name[HOST_NAME_MAX+1]; static int initialized = 0; char *s;