[glib/halfline/test-case-pipe-confusion: 1/5] gthreadedresolver: Comment on name expansion for SRV targets




commit 17bbb311e56a855bd9de5a691b4932f9e2ef7e36
Author: Philip Withnall <pwithnall endlessos org>
Date:   Mon Oct 17 12:45:19 2022 +0100

    gthreadedresolver: Comment on name expansion for SRV targets
    
    See the commit contents. This clarifies the existing code’s behaviour
    and doesn’t change it.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Fixes: #2622

 gio/gthreadedresolver.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
---
diff --git a/gio/gthreadedresolver.c b/gio/gthreadedresolver.c
index 7453c0f253..68b5c20d7e 100644
--- a/gio/gthreadedresolver.c
+++ b/gio/gthreadedresolver.c
@@ -579,6 +579,22 @@ parse_res_srv (const guint8  *answer,
   GETSHORT (weight, *p);
   GETSHORT (port, *p);
 
+  /* RFC 2782 says (on page 4) that “Unless and until permitted by future
+   * standards action, name compression is not to be used for this field.”, so
+   * technically we shouldn’t be expanding names here for SRV records.
+   *
+   * However, other DNS resolvers (such as systemd[1]) do, and it seems in
+   * keeping with the principle of being liberal in what you accept and strict
+   * in what you emit. It also seems harmless.
+   *
+   * An earlier version of the RFC, RFC 2052 (now obsolete) specified that name
+   * compression *was* to be used for SRV targets[2].
+   *
+   * See discussion on https://gitlab.gnome.org/GNOME/glib/-/issues/2622.
+   *
+   * [1]: 
https://github.com/yuwata/systemd/blob/2d23cc3c07c49722ce93170737b3efd2692a2d08/src/resolve/resolved-dns-packet.c#L1674
+   * [2]: https://datatracker.ietf.org/doc/html/rfc2052#page-3
+   */
   if (!expand_name ("SRV", answer, end, p, namebuf, sizeof (namebuf), error))
     return NULL;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]