aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGilles Chehade <gilles@poolp.org>2013-10-25 12:17:28 +0200
committerGilles Chehade <gilles@poolp.org>2013-10-25 12:17:28 +0200
commit9789e1146b7e59074a280d21373bc9d7bc382a07 (patch)
tree54994ee79ae5a6da10d1f115b6140c59ee8f3f26
parentlog debug if not using last version's loader (diff)
downloadOpenSMTPD-9789e1146b7e59074a280d21373bc9d7bc382a07.tar.xz
OpenSMTPD-9789e1146b7e59074a280d21373bc9d7bc382a07.zip
- remove spurious \n in log_debug
- relay url format has changed between v1 and v2, convert
-rw-r--r--smtpd/bounce.c1
-rw-r--r--smtpd/envelope.c3
-rw-r--r--smtpd/envelope_v1.c26
3 files changed, 28 insertions, 2 deletions
diff --git a/smtpd/bounce.c b/smtpd/bounce.c
index fce4506e..bd59cd42 100644
--- a/smtpd/bounce.c
+++ b/smtpd/bounce.c
@@ -172,6 +172,7 @@ bounce_add(uint64_t evpid)
be->id = evpid;
be->report = xstrdup(buf, "bounce_add");
TAILQ_INSERT_TAIL(&msg->envelopes, be, entry);
+ be->report[strcspn(be->report, "\n")] = '\0';
log_debug("debug: bounce: adding report %16"PRIx64": %s", be->id,
be->report);
diff --git a/smtpd/envelope.c b/smtpd/envelope.c
index c94de969..263bd37e 100644
--- a/smtpd/envelope.c
+++ b/smtpd/envelope.c
@@ -147,7 +147,8 @@ envelope_load_buffer(struct envelope *ep, const char *ibuf, size_t buflen)
log_debug("debug: using envelope loader v%s", loaders[i].version);
bzero(ep, sizeof *ep);
ret = loaders[i].loader(ep, &d);
-
+ if (ret)
+ ep->version = SMTPD_ENVELOPE_VERSION;
end:
while (dict_poproot(&d, NULL, NULL))
;
diff --git a/smtpd/envelope_v1.c b/smtpd/envelope_v1.c
index e68c2f99..52f3927c 100644
--- a/smtpd/envelope_v1.c
+++ b/smtpd/envelope_v1.c
@@ -43,6 +43,7 @@
#include "smtpd.h"
#include "log.h"
+static int envelope_ascii_load_mta_relay_url_v1(struct relayhost *, char *);
static int envelope_ascii_load_v1(const char *, struct envelope *, char *);
int envelope_load_buffer_v1(struct envelope *, struct dict *);
@@ -57,6 +58,11 @@ envelope_load_buffer_v1(struct envelope *ep, struct dict *d)
while (dict_iter(d, &hdl, &field, (void **)&value))
if (! envelope_ascii_load_v1(field, ep, value))
goto err;
+
+ /* Transition for old envelopes */
+ if (ep->smtpname[0] == 0)
+ strlcpy(ep->smtpname, env->sc_hostname, sizeof(ep->smtpname));
+
return (1);
err:
@@ -133,7 +139,7 @@ envelope_ascii_load_v1(const char *field, struct envelope *ep, char *buf)
sizeof ep->agent.mta.relay.helotable);
if (strcasecmp("mta-relay", field) == 0)
- return envelope_ascii_load_mta_relay_url(&ep->agent.mta.relay, buf);
+ return envelope_ascii_load_mta_relay_url_v1(&ep->agent.mta.relay, buf);
if (strcasecmp("ctime", field) == 0)
return envelope_ascii_load_time(&ep->creation, buf);
@@ -164,3 +170,21 @@ envelope_ascii_load_v1(const char *field, struct envelope *ep, char *buf)
return 0;
}
+
+static int
+envelope_ascii_load_mta_relay_url_v1(struct relayhost *relay, char *buf)
+{
+ char buffer[1024];
+
+ if (strncasecmp("ssl://", buf, 6) == 0) {
+ if (! bsnprintf(buffer, sizeof buffer, "secure://%s", buf+6))
+ return 0;
+ buf = buffer;
+ }
+ else if (strncasecmp("ssl+auth://", buf, 11) == 0) {
+ if (! bsnprintf(buffer, sizeof buffer, "secure+auth://%s", buf+11))
+ return 0;
+ buf = buffer;
+ }
+ return envelope_ascii_load_mta_relay_url(relay, buf);
+}