cap_net: fix error propagation for ENOTCAPABLE in cap_getaddrinfo
Fixes: b60053fde1 ("libcasper: Fix inconsistent error codes of cap_get{addr,name}info()")
This commit is contained in:
@@ -1011,12 +1011,12 @@ net_getaddrinfo(const nvlist_t *limits, const nvlist_t *nvlin, nvlist_t *nvlout)
|
||||
}
|
||||
|
||||
if (!net_allowed_family(funclimit, family)) {
|
||||
errno = ENOTCAPABLE;
|
||||
serrno = ENOTCAPABLE;
|
||||
error = EAI_SYSTEM;
|
||||
goto out;
|
||||
}
|
||||
if (!net_allowed_hosts(funclimit, hostname, servname)) {
|
||||
errno = ENOTCAPABLE;
|
||||
serrno = ENOTCAPABLE;
|
||||
error = EAI_SYSTEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ test_getnameinfo_v4(cap_channel_t *chan, int family, const char *ip)
|
||||
|
||||
capret = cap_getnameinfo(chan, (struct sockaddr *)&ipaddr, sizeof(ipaddr),
|
||||
capfn, sizeof(capfn), NULL, 0, NI_NAMEREQD);
|
||||
if (capret != 0 && capret == ENOTCAPABLE)
|
||||
if (capret == EAI_SYSTEM && errno == ENOTCAPABLE)
|
||||
return (ENOTCAPABLE);
|
||||
|
||||
sysret = getnameinfo((struct sockaddr *)&ipaddr, sizeof(ipaddr), origfn,
|
||||
@@ -102,7 +102,7 @@ test_getnameinfo_v6(cap_channel_t *chan, const char *ip)
|
||||
|
||||
capret = cap_getnameinfo(chan, (struct sockaddr *)&ipaddr, sizeof(ipaddr),
|
||||
capfn, sizeof(capfn), NULL, 0, NI_NAMEREQD);
|
||||
if (capret != 0 && capret == ENOTCAPABLE)
|
||||
if (capret == EAI_SYSTEM && errno == ENOTCAPABLE)
|
||||
return (ENOTCAPABLE);
|
||||
|
||||
sysret = getnameinfo((struct sockaddr *)&ipaddr, sizeof(ipaddr), origfn,
|
||||
@@ -196,8 +196,8 @@ test_getaddrinfo(cap_channel_t *chan, int family, const char *domain,
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
|
||||
capret = cap_getaddrinfo(chan, domain, servname, &hints, &capres);
|
||||
if (capret != 0 && capret == ENOTCAPABLE)
|
||||
return (capret);
|
||||
if (capret == EAI_SYSTEM && errno == ENOTCAPABLE)
|
||||
return (ENOTCAPABLE);
|
||||
|
||||
sysret = getaddrinfo(domain, servname, &hints, &origres);
|
||||
if (sysret != 0)
|
||||
|
||||
Reference in New Issue
Block a user