Import Dragonfly Mail agent snapshot from 2016-08-16

This commit is contained in:
Baptiste Daroussin 2016-08-20 16:28:17 +00:00
parent 21301f7354
commit eb8bc5621c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/dma/dist/; revision=304533
svn path=/vendor/dma/20160806/; revision=304534; tag=vendor/dma/20160806
7 changed files with 13 additions and 9 deletions

View File

@ -1 +1 @@
v0.10
v0.11

View File

@ -142,7 +142,7 @@ main(int argc, char **argv)
logfail(EX_CANTCREAT, "cannot build mbox path for `%s/%s'", _PATH_MAILDIR, user);
}
f = open(fn, O_RDONLY|O_CREAT, 0600);
f = open(fn, O_RDONLY|O_CREAT|O_NOFOLLOW, 0600);
if (f < 0)
logfail(EX_NOINPUT, "cannt open mbox `%s'", fn);

4
dma.c
View File

@ -321,7 +321,7 @@ deliver(struct qitem *it)
snprintf(errmsg, sizeof(errmsg), "unknown bounce reason");
retry:
syslog(LOG_INFO, "trying delivery");
syslog(LOG_INFO, "<%s> trying delivery", it->addr);
if (it->remote)
error = deliver_remote(it);
@ -331,7 +331,7 @@ retry:
switch (error) {
case 0:
delqueue(it);
syslog(LOG_INFO, "delivery successful");
syslog(LOG_INFO, "<%s> delivery successful", it->addr);
exit(EX_OK);
case 1:

2
dma.h
View File

@ -49,7 +49,7 @@
#define VERSION "DragonFly Mail Agent " DMA_VERSION
#define BUF_SIZE 2048
#define ERRMSG_SIZE 200
#define ERRMSG_SIZE 1024
#define USERNAME_SIZE 50
#define MIN_RETRY 300 /* 5 minutes */
#define MAX_RETRY (3*60*60) /* retry at least every 3 hours */

1
dns.c
View File

@ -34,6 +34,7 @@
*/
#include <sys/types.h>
#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>

View File

@ -196,7 +196,7 @@ retry:
goto out;
}
error = snprintf(line, sizeof(line), "%sFrom %s\t%s", newline, sender, ctime(&now));
error = snprintf(line, sizeof(line), "%sFrom %s %s", newline, sender, ctime(&now));
if (error < 0 || (size_t)error >= sizeof(line)) {
syslog(LOG_NOTICE, "local delivery deferred: can not write header: %m");
goto out;

9
net.c
View File

@ -372,11 +372,13 @@ deliver_to_host(struct qitem *it, struct mx_hostentry *host)
host->host, host->addr, c, neterr); \
snprintf(errmsg, sizeof(errmsg), "%s [%s] did not like our %s:\n%s", \
host->host, host->addr, c, neterr); \
return (-1); \
error = -1; \
goto out; \
} else if (res != exp) { \
syslog(LOG_NOTICE, "remote delivery deferred: %s [%s] failed after %s: %s", \
host->host, host->addr, c, neterr); \
return (1); \
error = 1; \
goto out; \
}
/* Check first reply from remote host */
@ -426,7 +428,8 @@ deliver_to_host(struct qitem *it, struct mx_hostentry *host)
syslog(LOG_ERR, "remote delivery failed:"
" SMTP login failed: %m");
snprintf(errmsg, sizeof(errmsg), "SMTP login to %s failed", host->host);
return (-1);
error = -1;
goto out;
}
/* SMTP login is not available, so try without */
else if (error > 0) {