diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-08-18 00:05:41 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-08-21 12:41:07 +0200 |
commit | 9ca45586e67c6d061d0db7bdf5b05d30e37e368d (patch) | |
tree | 0a9c3677c7a49602f715d93dc678228c8b077680 /src/shared/dns-domain.h | |
parent | 46a5e0e7421bcc47755ae15d430c15a16dc9e03e (diff) |
dns-domain: add call for concatenating two domain names
This is specifically useful for appending the mDNS ".local" suffix to a
single-label hostname in the most correct way. (used in later commit)
Diffstat (limited to 'src/shared/dns-domain.h')
-rw-r--r-- | src/shared/dns-domain.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/shared/dns-domain.h b/src/shared/dns-domain.h index bd50ad3e6d..8e73d9c20f 100644 --- a/src/shared/dns-domain.h +++ b/src/shared/dns-domain.h @@ -35,9 +35,17 @@ int dns_label_escape(const char *p, size_t l, char **ret); int dns_label_apply_idna(const char *encoded, size_t encoded_size, char *decoded, size_t decoded_max); int dns_label_undo_idna(const char *encoded, size_t encoded_size, char *decoded, size_t decoded_max); -int dns_name_normalize(const char *s, char **_ret); +int dns_name_concat(const char *a, const char *b, char **ret); + +static inline int dns_name_normalize(const char *s, char **ret) { + /* dns_name_concat() normalizes as a side-effect */ + return dns_name_concat(s, NULL, ret); +} + static inline int dns_name_is_valid(const char *s) { int r; + + /* dns_name_normalize() verifies as a side effect */ r = dns_name_normalize(s, NULL); if (r == -EINVAL) return 0; |