mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Stefan Sedich <stefan.sedich@gmail.com>
To: musl@lists.openwall.com
Subject: Re: [PATCH v3] Add RES_OPTIONS support for resolv.conf options overriding
Date: Tue, 25 Apr 2017 20:56:39 +0000	[thread overview]
Message-ID: <CACOXvnjxMTJB_8NSdbckLAaU+CybsvX+dWN8PNRqcU-Ld9ZvqA@mail.gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.20.13.1704252330570.1313@monopod.intra.ispras.ru>

[-- Attachment #1: Type: text/plain, Size: 1809 bytes --]

On Tue, Apr 25, 2017 at 1:50 PM Alexander Monakov <amonakov@ispras.ru>
wrote:

> 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
>

Alexander,

I agree on the cleaner version :), I will await Rich to comment on the rest
before opening another patch as perhaps I can address some of these as part
of this commit if desired?

[-- Attachment #2: Type: text/html, Size: 2463 bytes --]

      reply	other threads:[~2017-04-25 20:56 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
2017-04-25 20:56   ` Stefan Sedich [this message]

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=CACOXvnjxMTJB_8NSdbckLAaU+CybsvX+dWN8PNRqcU-Ld9ZvqA@mail.gmail.com \
    --to=stefan.sedich@gmail.com \
    --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).