Date: Thu, 08 Feb 2001 18:35:47 -0500 (EST) From: Mike Heffner <mheffner@vt.edu> To: "Jacques A. Vidrine" <n@nectar.com> Cc: freebsd-audit@freebsd.org Subject: RE: login: exporting PAM environment Message-ID: <XFMail.20010208183547.mheffner@vt.edu> In-Reply-To: <20010208151845.A58884@hamlet.nectar.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 08-Feb-2001 Jacques A. Vidrine wrote: | Hello, | | Please have a look at the following patch. This corrects login so | that it exports environmental variables set by PAM modules. This is | particularly important for certain options of pam_krb5. [ snip ] | +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. -- Mike Heffner <mheffner@vt.edu> Blacksburg, VA <mikeh@FreeBSD.org> http://filebox.vt.edu/users/mheffner 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?XFMail.20010208183547.mheffner>