From: Alexander Monakov <amonakov@ispras.ru>
To: musl@lists.openwall.com
Subject: Re: [PATCH v3] Add RES_OPTIONS support for resolv.conf options overriding
Date: Tue, 25 Apr 2017 23:49:50 +0300 (MSK) [thread overview]
Message-ID: <alpine.LNX.2.20.13.1704252330570.1313@monopod.intra.ispras.ru> (raw)
In-Reply-To: <20170425194557.8520-1-stefan.sedich@gmail.com>
I see a couple of pre-existing issues in options parsing
(not your problem, just questions for Rich):
On Tue, 25 Apr 2017, Stefan Sedich wrote:
> +void __parse_resolv_opts(struct resolvconf *conf, char *opts)
> +{
> + char *p, *z;
> +
> + p = strstr(opts, "ndots:");
This accepts xndots, _ndots, etc. I think this is undesirable, prefixing a
character could be seen by some users as a way to "comment-out" an option
without deleting it, and such loose matching lays a trap for them. It also
breaks if a valid option ending in 'ndots' appears in the future.
> + p = strstr(opts, "timeout:");
> + if (p && (isdigit(p[8]) || p[8]=='.')) {
> + p += 8;
> + unsigned long x = strtoul(p, &z, 10);
Either stroul should be strtod, or accepting p[8]=='.' is pointless.
This was introduced in commit d6cb08bcaca4ff1f921375510ca72bccea969c75
that moved this chunk of code from res_msend.c to resolvconf.c and
introduced p[8]=='.' check en passant.
> @@ -89,5 +96,11 @@ no_resolv_conf:
>
> conf->nns = nns;
>
> + char *res_opts_env = NULL;
> + if (!libc.secure) res_opts_env = getenv("RES_OPTIONS");
> + if (res_opts_env) {
> + __parse_resolv_opts(conf, res_opts_env);
> + }
This might look slightly cleaner if written as
if (!libc.secure) {
const char *opts = getenv("RES_OPTIONS");
if (opts) __parse_resolve_opts(conf, opts);
}
Alexander
next prev parent reply other threads:[~2017-04-25 20:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-25 19:45 Stefan Sedich
2017-04-25 20:49 ` Alexander Monakov [this message]
2017-04-25 20:56 ` Stefan Sedich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LNX.2.20.13.1704252330570.1313@monopod.intra.ispras.ru \
--to=amonakov@ispras.ru \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).