* [PATCH] nss_dns: Do not call res_dnok in getnetby* implementation
@ 2019-03-08 20:44 Florian Weimer
2019-03-11 19:35 ` DJ Delorie
2020-06-04 13:08 ` Carlos O'Donell via Libc-alpha
0 siblings, 2 replies; 3+ messages in thread
From: Florian Weimer @ 2019-03-08 20:44 UTC (permalink / raw)
To: libc-alpha
The argument to res_dnok was produced by ns_name_ntop, so it
is a syntactically valid domain name which, in textual format,
only consists of printable characters. Therefore, the res_dnok
check always passes.
2019-03-08 Florian Weimer <fweimer@redhat.com>
* resolv/nss_dns/dns-network.c (getanswer_r): Do not call
res_dnok.
diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
index 4b81b1bfdc..4617b165db 100644
--- a/resolv/nss_dns/dns-network.c
+++ b/resolv/nss_dns/dns-network.c
@@ -348,7 +348,7 @@ getanswer_r (const querybuf *answer, int anslen, struct netent *result,
if (n > 0 && bp[0] == '.')
bp[0] = '\0';
- if (n < 0 || res_dnok (bp) == 0)
+ if (n < 0)
break;
cp += n;
@@ -382,7 +382,7 @@ getanswer_r (const querybuf *answer, int anslen, struct netent *result,
n = -1;
}
- if (n < 0 || !res_hnok (bp))
+ if (n < 0)
{
/* XXX What does this mean? The original form from bind
returns NULL. Incrementing cp has no effect in any case.
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nss_dns: Do not call res_dnok in getnetby* implementation
2019-03-08 20:44 [PATCH] nss_dns: Do not call res_dnok in getnetby* implementation Florian Weimer
@ 2019-03-11 19:35 ` DJ Delorie
2020-06-04 13:08 ` Carlos O'Donell via Libc-alpha
1 sibling, 0 replies; 3+ messages in thread
From: DJ Delorie @ 2019-03-11 19:35 UTC (permalink / raw)
To: Florian Weimer; +Cc: libc-alpha
Florian Weimer <fweimer@redhat.com> writes:
> 2019-03-08 Florian Weimer <fweimer@redhat.com>
>
> * resolv/nss_dns/dns-network.c (getanswer_r): Do not call
> res_dnok.
I checked and it does seem that *bp only comes from ns_name_ntop, so as
long as the assumption that ns_name_ntop always produces a valid name is
valid, this patch looks OK to me.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nss_dns: Do not call res_dnok in getnetby* implementation
2019-03-08 20:44 [PATCH] nss_dns: Do not call res_dnok in getnetby* implementation Florian Weimer
2019-03-11 19:35 ` DJ Delorie
@ 2020-06-04 13:08 ` Carlos O'Donell via Libc-alpha
1 sibling, 0 replies; 3+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2020-06-04 13:08 UTC (permalink / raw)
To: Florian Weimer, libc-alpha
On 3/8/19 3:44 PM, Florian Weimer wrote:
> The argument to res_dnok was produced by ns_name_ntop, so it
> is a syntactically valid domain name which, in textual format,
> only consists of printable characters. Therefore, the res_dnok
> check always passes.
>
> 2019-03-08 Florian Weimer <fweimer@redhat.com>
>
> * resolv/nss_dns/dns-network.c (getanswer_r): Do not call
> res_dnok.
LGTM.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
> diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
> index 4b81b1bfdc..4617b165db 100644
> --- a/resolv/nss_dns/dns-network.c
> +++ b/resolv/nss_dns/dns-network.c
> @@ -348,7 +348,7 @@ getanswer_r (const querybuf *answer, int anslen, struct netent *result,
> if (n > 0 && bp[0] == '.')
> bp[0] = '\0';
>
> - if (n < 0 || res_dnok (bp) == 0)
> + if (n < 0)
> break;
> cp += n;
>
> @@ -382,7 +382,7 @@ getanswer_r (const querybuf *answer, int anslen, struct netent *result,
> n = -1;
> }
>
> - if (n < 0 || !res_hnok (bp))
> + if (n < 0)
> {
> /* XXX What does this mean? The original form from bind
> returns NULL. Incrementing cp has no effect in any case.
>
--
Cheers,
Carlos.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-04 13:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-08 20:44 [PATCH] nss_dns: Do not call res_dnok in getnetby* implementation Florian Weimer
2019-03-11 19:35 ` DJ Delorie
2020-06-04 13:08 ` Carlos O'Donell via Libc-alpha
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).