Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Feb 2001 10:33:14 +0200
From:      Peter Pentchev <roam@orbitel.bg>
To:        "Jacques A. Vidrine" <n@nectar.com>
Cc:        Mike Heffner <mheffner@vt.edu>, freebsd-audit@freebsd.org
Subject:   Re: login: exporting PAM environment
Message-ID:  <20010209103314.A348@ringworld.oblivion.bg>
In-Reply-To: <20010208191818.A91745@spawn.nectar.com>; from n@nectar.com on Thu, Feb 08, 2001 at 07:18:18PM -0600
References:  <20010208151845.A58884@hamlet.nectar.com> <XFMail.20010208183547.mheffner@vt.edu> <20010208191818.A91745@spawn.nectar.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Feb 08, 2001 at 07:18:18PM -0600, Jacques A. Vidrine wrote:
> On Thu, Feb 08, 2001 at 06:35:47PM -0500, Mike Heffner wrote:
> > | +static int
> > | +ok_to_export(s)
> > | +     const char *s;
> > | +{
> > | +     static const char *noexport[] = {
> > | +             "SHELL", "HOME", "LOGNAME", "MAIL", "CDPATH",
> > | +             "IFS", "PATH", NULL
> > | +     };
> > | +     const char **pp;
> > | +
> > | +     if (strlen(s) > 1024 || strchr(s, '=') == NULL)
> > | +             return 0;
> > | +     if (strncmp(s, "LD_", 3) == 0)
> > | +             return 0;
> > | +     for (pp = noexport; *pp != NULL; pp++) {
> > | +             if (strcmp(s, *pp) == 0)
> > | +                     return 0;
> > 
> > This needs to be strncmp(s, *pp, strlen(*pp)), otherwise the comparison will
> > always fail.
> 
> Duh, oh yeah, thanks.  Good catch.  That's not quite right either,
> though.  Think MAILDIR, for example.  I'll fix it some other way.

Well, you could always tag a " && (s[strlen(pp)] == '=') " or something..
brrr.. ugly :(

G'luck,
Peter

-- 
If this sentence were in Chinese, it would say something else.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010209103314.A348>