summaryrefslogtreecommitdiff
path: root/src/test/test-dns-domain.c
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* shared: normalize the root domain to "." rather than ""Lennart Poettering2016-01-261-9/+17
| | | | | | Let's make sure the root domain is normalized to ".", rather than then empty string, so that there's actually something to see on screen. Normally, we don't append a trailing dot to normalized domain names, but do so in the one exception of the root domain, taking inspiration from UNIX file system paths.
* resolved add dns_name_apply_idna() to convert a domain name into its IDNA ↵Lennart Poettering2016-01-181-0/+21
| | | | equivalent
* resolved: on negative NODATA replies, properly deal with empty non-terminalsLennart Poettering2016-01-171-0/+21
| | | | | | empty non-terminals generally lack NSEC RRs, which means we can deduce their existance only from the fact that there are other RRs that contain them in their suffix. Specifically, the NSEC proof for NODATA on ENTs works by sending the NSEC whose next name is a suffix of the queried name to the client. Use this information properly.
* shared: add new dns_name_startswith() callLennart Poettering2016-01-131-0/+20
| | | | dns_name_startswith() is to dns_name_endswith() as startswith() is to endswith().
* shared: relax restrictions on valid domain name characters a bitLennart Poettering2015-12-281-3/+3
| | | | | | | Previously, we'd not allow control characters to be embedded in domain names, even when escaped. Since cloudflare uses \000 however to implement its synthethic minimally covering NSEC RRs, we should allow them, as long as they are properly escaped.
* shared: fix handling of suffix "." in dns_name_compare_func()Lennart Poettering2015-12-271-2/+16
| | | | | | | All our other domain name handling functions make no destinction between domain names that end in a dot plus a NUL, or those just ending in a NUL. Make sure dns_name_compare_func() and dns_label_unescape_suffix() do the same.
* resolved: tighten search for NSEC3 RRs a bitLennart Poettering2015-12-261-0/+32
| | | | | | | Be stricter when searching suitable NSEC3 RRs for proof: generalize the check we use to find suitable NSEC3 RRs, in nsec3_is_good(), and add additional checks, such as checking whether all NSEC3 RRs use the same parameters, have the same suffix and so on.
* resolved: properly implement RRSIG validation of wildcarded RRsetsLennart Poettering2015-12-261-0/+42
| | | | | | Note that this is still not complete, one additional step is still missing: when we verified that a wildcard RRset is properly signed, we still need to do an NSEC/NSEC3 proof that no more specific RRset exists.
* util-lib: update dns_name_to_wire_format() to optionally generate DNSSEC ↵Lennart Poettering2015-12-021-1/+1
| | | | | | | canonical names We'll need this later when putting together RR serializations to checksum.
* dns-domain: change error codes when dealing with too short buffers to ENOBUFSLennart Poettering2015-11-301-2/+2
| | | | | Some calls used ENOBUFS to indicate too-short result buffers, others used ENOSPC. Let's unify this on ENOBUFS.
* dns-domain: check resulting domain name length in dns_name_to_wire_format()Lennart Poettering2015-11-301-4/+33
| | | | Let's better be safe than sorry.
* dns-domain: make sure dns_name_to_wire_format() may properly encode the root ↵Lennart Poettering2015-11-301-1/+2
| | | | | | | domain The root domain consists of zero labels, and we should be able to encode that.
* dns-domain: don't accept overly long hostnamesLennart Poettering2015-11-301-0/+18
| | | | | | Make sure dns_name_normalize(), dns_name_concat(), dns_name_is_valid() do not accept/generate invalidly long hostnames, i.e. longer than 253 characters.
* dns-domain: be more strict when encoding/decoding labelsLennart Poettering2015-11-301-1/+1
| | | | | | Labels of zero length are not OK, refuse them early on. The concept of a "zero-length label" doesn't exist, a zero-length full domain name however does (representing the root domain). See RFC 2181, Section 11.
* dns-domain: rework dns_label_escape() to not imply memory allocationLennart Poettering2015-11-251-1/+1
| | | | | | The new dns_label_escape() call now operates on a buffer passed in, similar to dns_label_unescape(). This should make decoding a bit faster, and nicer.
* dns-domain: change dns_srv_type_is_valid() return value to boolLennart Poettering2015-11-251-22/+22
| | | | | For similar reasons as dns_name_is_root() got changed in the previous commit.
* dns-domain: simplify dns_name_is_root() and dns_name_is_single_label()Lennart Poettering2015-11-251-15/+15
| | | | | | | | | | | | | | Let's change the return value to bool. If we encounter an error while parsing, return "false" instead of the actual parsing error, after all the specified hostname does not qualify for what the function is supposed to test. Dealing with the additional error codes was always cumbersome, and easily misused, like for example in the DHCP code. Let's also rename the functions from dns_name_root() to dns_name_is_root(), to indicate that this function checks something and returns a bool. Similar for dns_name_is_signal_label().
* resolved: implement client-side DNAME resolutionLennart Poettering2015-11-241-0/+20
| | | | | | Most servers apparently always implicitly convert DNAME to CNAME, but some servers don't, hence implement this properly, as this is required by edns0.
* dns-domain: add calls to join/split SRV/DNS-SD service domainsLennart Poettering2015-11-231-1/+61
| | | | | | | | | | | This adds dns_service_join() and dns_service_split() which may be used to concatenate a DNS-SD service name, am SRV service type string, and a domain name into a full resolvable DNS domain name string. If the service name is specified as NULL, only the type and domain are appended, to implement classic, non-DNS-SD SRV lookups. The reverse is dns_service_split() which takes the full name, and split it into the three components again.
* dns-domain: add code for verifying validity of DNS-SD service names and typesLennart Poettering2015-11-231-0/+36
|
* dns-domain: add dns_name_to_wire_format()Beniamino Galvani2015-11-171-0/+31
| | | | | The function converts a domain name string to the wire format described in RFC 1035 Section 3.1.
* util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2015-10-241-1/+2
| | | | | | | | | | | | | | string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
* dns-domain: add call for concatenating two domain namesLennart Poettering2015-08-211-0/+35
| | | | | This is specifically useful for appending the mDNS ".local" suffix to a single-label hostname in the most correct way. (used in later commit)
* resolved: never attempt to resolve loopback addresses via DNS/LLMNR/mDNSLennart Poettering2015-07-291-0/+2
| | | | | We already refuse to resolve "localhost", hence we should also refuse resolving "127.0.0.1" and friends.
* shared: dns-name - add dns_name_between()Tom Gundersen2015-07-281-0/+33
| | | | | | | Given three DNS names this function indicates if the second argument lies strictly between the first and the third according to the canonical DNS name order. Note that the order is circular, so the last name is considered to be before the first.
* shared: dns-name - introduce dns_label_unescape_suffix()Tom Gundersen2015-07-281-0/+41
| | | | | | | | | | Intended to be called repeatedly, and returns then successive unescaped labels from the most to the least significant (left to right). This is slightly inefficient as it scans the string three times (two would be sufficient): once to find the end of the string, once to find the beginning of each label and lastly once to do the actual unescaping. The latter two could be done in one go, but that seemed unnecessarily convoluted.
* resolve: move dns routines into sharedNick Owens2015-06-101-0/+192