diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-08-10 23:35:28 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-08-10 23:35:28 +0100 |
commit | 3d6388791666c5f13524cce3f428b875bbdaa345 (patch) | |
tree | 9a5eb7740e7a60942eeb90801e9d8b1c159384d9 /contrib | |
parent | 8016c9bf588a47c6fc382bba8486b2222a5fdf65 (diff) | |
download | rspamd-3d6388791666c5f13524cce3f428b875bbdaa345.tar.gz rspamd-3d6388791666c5f13524cce3f428b875bbdaa345.zip |
[Minor] Add experimental support of CNAME RR type
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/librdns/parse.c | 9 | ||||
-rw-r--r-- | contrib/librdns/rdns.h | 4 | ||||
-rw-r--r-- | contrib/librdns/util.c | 3 |
3 files changed, 13 insertions, 3 deletions
diff --git a/contrib/librdns/parse.c b/contrib/librdns/parse.c index e9fb85e98..f9025e159 100644 --- a/contrib/librdns/parse.c +++ b/contrib/librdns/parse.c @@ -438,9 +438,12 @@ rdns_parse_rr (struct rdns_resolver *resolver, parsed = true; break; case DNS_T_CNAME: - /* Skip cname records */ - p += datalen; - *remain -= datalen; + if (! rdns_parse_labels (resolver, in, &elt->content.cname.name, &p, + rep, remain, true)) { + rdns_info ("invalid labels in CNAME record; domain %s", rep->requested_name); + return -1; + } + parsed = true; break; default: rdns_info ("unexpected RR type: %d; domain %s", type, rep->requested_name); diff --git a/contrib/librdns/rdns.h b/contrib/librdns/rdns.h index 2e00951ea..c0da5ed29 100644 --- a/contrib/librdns/rdns.h +++ b/contrib/librdns/rdns.h @@ -48,6 +48,7 @@ enum rdns_request_type { RDNS_REQUEST_INVALID = -1, RDNS_REQUEST_A = 1, RDNS_REQUEST_NS = 2, + RDNS_REQUEST_CNAME = 5, RDNS_REQUEST_SOA = 6, RDNS_REQUEST_PTR = 12, RDNS_REQUEST_MX = 15, @@ -101,6 +102,9 @@ union rdns_reply_element_un { uint16_t datalen; uint8_t *data; } tlsa; + struct { + char *name; + } cname; }; struct rdns_reply_entry { diff --git a/contrib/librdns/util.c b/contrib/librdns/util.c index e09eb2007..b20b327bc 100644 --- a/contrib/librdns/util.c +++ b/contrib/librdns/util.c @@ -457,6 +457,9 @@ rdns_reply_free (struct rdns_reply *rep) free (entry->content.soa.mname); free (entry->content.soa.admin); break; + case RDNS_REQUEST_CNAME: + free(entry->content.cname.name); + break; default: break; } |