retitle 649781 git: tolerate EMSGSIZE in ns_initparse from invalid response to 
DNS SRV query
severity 649781 wishlist
tags 649781 + patch
quit

Richard Hartmann wrote:

> If you need any more information, pcaps or anything, please let me know.

A tcpdump from running "dig -t SRV _git._tcp.git.kitenet.net" would be
interesting.
---
 srv.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/srv.c b/srv.c
index 2716206e..dce93b11 100644
--- a/srv.c
+++ b/srv.c
@@ -274,13 +274,20 @@ int get_srv(const char *host, struct host **hosts)
        if (len < 0)
                goto out;
 
+       /*
+        * Some broken DNS servers (think: captive portal) by some
+        * accident will handle A queries but do not provide anything
+        * sensible in response to other queries.  Warn and fall back
+        * to a plain A lookup.
+        */
+       if (ns_initparse(buf, len, &msg)) {
+               warning("cannot parse SRV response: %s", strerror(errno));
+               goto out;
+       }
+
        /* If a SRV RR cannot be parsed, give up. */
        ret = -1;
 
-       if (ns_initparse(buf, len, &msg)) {
-               error("cannot initialize DNS parser: %s", strerror(errno));
-               goto out;
-       }
        n = srv_parse(&msg, &rrs);
        if (n < 0)
                /* srv_parse writes a message */
-- 
1.7.8.rc3




-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to