From 204abc232de98b70790d97771bfc50bf40e0cd21 Mon Sep 17 00:00:00 2001 From: alexhudson Date: Thu, 6 Sep 2007 16:28:06 +0000 Subject: [PATCH] Fix up some DNS packet boundary checking --- src/agents/smtp/smtpd.c | 6 +++--- src/libs/xpl/dns.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/agents/smtp/smtpd.c b/src/agents/smtp/smtpd.c index 4b414a5..147c20f 100644 --- a/src/agents/smtp/smtpd.c +++ b/src/agents/smtp/smtpd.c @@ -2018,8 +2018,8 @@ DeliverSMTPMessage (ConnectionStruct * Client, unsigned char *Sender, continue; } else { - Log(LOG_INFO, "Message failed delivery from %s to %s Flags %d Status %d", - Sender, Recips[i].To, Client->Flags, status); + Log(LOG_INFO, "Message failed delivery from %s to %s Flags %d Status %d: %s", + Sender, Recips[i].To, Client->Flags, status, Reply); if (status == 550) { Recips[i].Result = DELIVER_USER_UNKNOWN; if ((unsigned long) ResultLen > strlen (Reply)) { @@ -2281,7 +2281,6 @@ DeliverRemoteMessage (ConnectionStruct * Client, unsigned char *Sender, goto finish; } - // TODO: honour max MX server setting while ((list = XplDnsNextMxLookupIpList(mx)) != NULL) { int x; @@ -2325,6 +2324,7 @@ DeliverRemoteMessage (ConnectionStruct * Client, unsigned char *Sender, if (RetVal == DELIVER_SUCCESS) { goto finish; } + // TODO: Should take into account max MX setting here if (RetVal == DELIVER_FAILURE) { goto finish; } diff --git a/src/libs/xpl/dns.c b/src/libs/xpl/dns.c index 8fa94bb..d8a50c6 100644 --- a/src/libs/xpl/dns.c +++ b/src/libs/xpl/dns.c @@ -394,7 +394,7 @@ _XplDns_ParseQuery(const char *answer_buffer, int answer_len, XplDns_Result *res XplDns_RecordList *item; char answer_domain[XPLDNS_NAMELEN + 1]; - item = MemMalloc(sizeof(XplDns_RecordList)); + item = MemMalloc(sizeof(XplDns_RecordList)); answer_domain[0] = '\0'; res = _XplDns_ParseName(answer_buffer, answer_len, @@ -461,7 +461,7 @@ _XplDns_ParseQuery(const char *answer_buffer, int answer_len, XplDns_Result *res } response += ntohs(dns_answer->size); - if (response >= response_end) return; + if (response > response_end) return; } // don't make the result 'success' until we've really done everything