diff options
author | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2009-02-15 09:58:32 +0000 |
---|---|---|
committer | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2009-02-15 09:58:32 +0000 |
commit | 877d1aa70b2c58e7d05e67975931b87ad6006172 (patch) | |
tree | 322f10c4b6cca273e5bb2b09607e41ff91d3ba8c /usr.sbin | |
parent | 6b3508dfb6d818fe42eaa123f8c68562a9713619 (diff) |
Fix a bug where list of 6 MXs or more was not handled correctly.
Pointed out by & ok sthen@, ok gilles@.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/smtpd/dns.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/smtpd/dns.c b/usr.sbin/smtpd/dns.c index b738cfdbed3..d0a933b7d9e 100644 --- a/usr.sbin/smtpd/dns.c +++ b/usr.sbin/smtpd/dns.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dns.c,v 1.7 2009/01/01 16:15:47 jacekm Exp $ */ +/* $OpenBSD: dns.c,v 1.8 2009/02/15 09:58:31 jacekm Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -73,7 +73,7 @@ getmxbyname(char *name, char ***result) u_int8_t expbuf[PACKETSZ]; u_int16_t type; u_int16_t n; - u_int16_t priority, tprio; + u_int16_t priority; size_t mxnb; struct mxrecord mxarray[MXARRAYSIZE]; size_t chunklen; @@ -128,10 +128,10 @@ getmxbyname(char *name, char ***result) MAXHOSTNAMELEN) >= MAXHOSTNAMELEN) return 0; mxarray[mxnb].priority = priority; - if (tprio < priority) - tprio = priority; } else { + int tprio = 0; + for (i = j = 0; i < sizeof(mxarray) / sizeof(struct mxrecord); ++i) { |