mirror of
https://github.com/systemd/systemd.git
synced 2024-12-26 03:22:00 +03:00
Merge pull request #17854 from poettering/dns-domain-ret-fix
dns-domain: fix some coding style issues
This commit is contained in:
commit
fea909c1b9
@ -743,12 +743,12 @@ int dns_name_reverse(int family, const union in_addr_union *a, char **ret) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dns_name_address(const char *p, int *family, union in_addr_union *address) {
|
||||
int dns_name_address(const char *p, int *ret_family, union in_addr_union *ret_address) {
|
||||
int r;
|
||||
|
||||
assert(p);
|
||||
assert(family);
|
||||
assert(address);
|
||||
assert(ret_family);
|
||||
assert(ret_address);
|
||||
|
||||
r = dns_name_endswith(p, "in-addr.arpa");
|
||||
if (r < 0)
|
||||
@ -777,11 +777,11 @@ int dns_name_address(const char *p, int *family, union in_addr_union *address) {
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
*family = AF_INET;
|
||||
address->in.s_addr = htobe32(((uint32_t) a[3] << 24) |
|
||||
((uint32_t) a[2] << 16) |
|
||||
((uint32_t) a[1] << 8) |
|
||||
(uint32_t) a[0]);
|
||||
*ret_family = AF_INET;
|
||||
ret_address->in.s_addr = htobe32(((uint32_t) a[3] << 24) |
|
||||
((uint32_t) a[2] << 16) |
|
||||
((uint32_t) a[1] << 8) |
|
||||
(uint32_t) a[0]);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -822,11 +822,14 @@ int dns_name_address(const char *p, int *family, union in_addr_union *address) {
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
*family = AF_INET6;
|
||||
address->in6 = a;
|
||||
*ret_family = AF_INET6;
|
||||
ret_address->in6 = a;
|
||||
return 1;
|
||||
}
|
||||
|
||||
*ret_family = AF_UNSPEC;
|
||||
*ret_address = IN_ADDR_NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1308,18 +1311,19 @@ int dns_name_apply_idna(const char *name, char **ret) {
|
||||
if (r != IDN2_OK) {
|
||||
log_debug("idn2_to_unicode_8z8z(\"%s\") failed: %d/%s",
|
||||
t, r, sym_idn2_strerror(r));
|
||||
*ret = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!streq_ptr(name, s)) {
|
||||
log_debug("idn2 roundtrip failed: \"%s\" → \"%s\" → \"%s\", ignoring.",
|
||||
name, t, s);
|
||||
*ret = NULL;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
*ret = TAKE_PTR(t);
|
||||
|
||||
return 1; /* *ret has been written */
|
||||
}
|
||||
|
||||
@ -1329,6 +1333,7 @@ int dns_name_apply_idna(const char *name, char **ret) {
|
||||
return 0;
|
||||
if (IN_SET(r, IDN2_TOO_BIG_DOMAIN, IDN2_TOO_BIG_LABEL))
|
||||
return -ENOSPC;
|
||||
|
||||
return -EINVAL;
|
||||
#elif HAVE_LIBIDN
|
||||
_cleanup_free_ char *buf = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user