diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-06-10 20:43:06 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-06-10 20:43:06 +0200 |
commit | ad091530b30bfbbc94159c17f3ea434a835ad3c9 (patch) | |
tree | a22b274eae94d3edfbe262c91a047a723ac29947 /src/libsystemd-network/sd-dhcp-lease.c | |
parent | 4061eed4d91226f1f75e79350c5e1bdd4529d578 (diff) | |
parent | 37de250906222211d2bf1755c41191a06d2126dd (diff) |
Merge pull request #151 from mischief/dns-shared-3
move dns code from resolve to shared v3
Diffstat (limited to 'src/libsystemd-network/sd-dhcp-lease.c')
-rw-r--r-- | src/libsystemd-network/sd-dhcp-lease.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c index 8a4220621b..d8bc76edda 100644 --- a/src/libsystemd-network/sd-dhcp-lease.c +++ b/src/libsystemd-network/sd-dhcp-lease.c @@ -32,6 +32,7 @@ #include "dhcp-lease-internal.h" #include "sd-dhcp-lease.h" #include "network-internal.h" +#include "dns-domain.h" int sd_dhcp_lease_get_address(sd_dhcp_lease *lease, struct in_addr *addr) { assert_return(lease, -EINVAL); @@ -504,9 +505,18 @@ int dhcp_lease_parse_options(uint8_t code, uint8_t len, const uint8_t *option, if (e) *e = 0; - if (!hostname_is_valid(domainname) || is_localhost(domainname)) + if (is_localhost(domainname)) break; + r = dns_name_is_valid(domainname); + if (r <= 0) { + if (r < 0) + log_error_errno(r, "Failed to validate domain name: %s: %m", domainname); + if (r == 0) + log_warning("Domain name is not valid, ignoring: %s", domainname); + break; + } + free(lease->domainname); lease->domainname = domainname; domainname = NULL; |