summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2012-10-12 08:51:03 +0000
committerEric Faurot <eric@cvs.openbsd.org>2012-10-12 08:51:03 +0000
commit9bb324f9ade4d6e1d5a7f4b8b5be6a1357e0cc5c (patch)
tree7d223c48bbf9170d629836c5c7d2b881aa23b547 /usr.sbin/smtpd
parent843db7a8c30d575ac8db12fcd6a07599e3517056 (diff)
Extend the "retry" field to 16 bits. The new quadratic retry formula
makes the maximum retry delay a bit to small on 8 bits. ok gilles@ chl@
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r--usr.sbin/smtpd/envelope.c22
-rw-r--r--usr.sbin/smtpd/smtpd.h6
2 files changed, 8 insertions, 20 deletions
diff --git a/usr.sbin/smtpd/envelope.c b/usr.sbin/smtpd/envelope.c
index ab390513507..27a19e19b09 100644
--- a/usr.sbin/smtpd/envelope.c
+++ b/usr.sbin/smtpd/envelope.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: envelope.c,v 1.16 2012/10/11 21:49:11 gilles Exp $ */
+/* $OpenBSD: envelope.c,v 1.17 2012/10/12 08:51:02 eric Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@openbsd.org>
@@ -44,7 +44,6 @@
#include "smtpd.h"
#include "log.h"
-static int ascii_load_uint8(uint8_t *, char *);
static int ascii_load_uint16(uint16_t *, char *);
static int ascii_load_uint32(uint32_t *, char *);
static int ascii_load_time(time_t *, char *);
@@ -56,7 +55,7 @@ static int ascii_load_mailaddr(struct mailaddr *, char *);
static int ascii_load_flags(enum delivery_flags *, char *);
static int ascii_load_mta_relay_flags(uint8_t *, char *);
-static int ascii_dump_uint8(uint8_t, char *, size_t);
+static int ascii_dump_uint16(uint16_t, char *, size_t);
static int ascii_dump_uint32(uint32_t, char *, size_t);
static int ascii_dump_time(time_t, char *, size_t);
static int ascii_dump_string(char *, char *, size_t);
@@ -371,7 +370,7 @@ envelope_ascii_load(enum envelope_field field, struct envelope *ep, char *buf)
case EVP_EXPIRE:
return ascii_load_time(&ep->expire, buf);
case EVP_RETRY:
- return ascii_load_uint8(&ep->retry, buf);
+ return ascii_load_uint16(&ep->retry, buf);
case EVP_LASTTRY:
return ascii_load_time(&ep->lasttry, buf);
case EVP_FLAGS:
@@ -431,7 +430,7 @@ envelope_ascii_dump(enum envelope_field field, struct envelope *ep,
case EVP_EXPIRE:
return ascii_dump_time(ep->expire, buf, len);
case EVP_RETRY:
- return ascii_dump_uint8(ep->retry, buf, len);
+ return ascii_dump_uint16(ep->retry, buf, len);
case EVP_LASTTRY:
return ascii_dump_time(ep->lasttry, buf, len);
case EVP_FLAGS:
@@ -441,17 +440,6 @@ envelope_ascii_dump(enum envelope_field field, struct envelope *ep,
}
static int
-ascii_load_uint8(uint8_t *dest, char *buf)
-{
- const char *errstr;
-
- *dest = strtonum(buf, 0, 0xff, &errstr);
- if (errstr)
- return 0;
- return 1;
-}
-
-static int
ascii_load_uint16(uint16_t *dest, char *buf)
{
const char *errstr;
@@ -597,7 +585,7 @@ ascii_load_mta_relay_flags(uint8_t *dest, char *buf)
}
static int
-ascii_dump_uint8(uint8_t src, char *dest, size_t len)
+ascii_dump_uint16(uint16_t src, char *dest, size_t len)
{
return bsnprintf(dest, len, "%d", src);
}
diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h
index 76302dcaf8e..0d13040caed 100644
--- a/usr.sbin/smtpd/smtpd.h
+++ b/usr.sbin/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.387 2012/10/11 21:43:11 gilles Exp $ */
+/* $OpenBSD: smtpd.h,v 1.388 2012/10/12 08:51:02 eric Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -420,7 +420,7 @@ struct envelope {
time_t creation;
time_t lasttry;
time_t expire;
- uint8_t retry;
+ uint16_t retry;
enum delivery_flags flags;
};
@@ -818,7 +818,7 @@ struct scheduler_info {
time_t creation;
time_t lasttry;
time_t expire;
- uint8_t retry;
+ uint16_t retry;
};
struct id_list {