Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 May 2001 04:19:14 -0700
From:      Kris Kennaway <kris@obsecurity.org>
To:        Maxime Henrion <mux@qualys.com>
Cc:        audit@FreeBSD.ORG, freebsd-i18n@FreeBSD.org
Subject:   Re: chpass patch to disallow non-printable characters in the passwd file
Message-ID:  <20010509041914.A36212@xor.obsecurity.org>
In-Reply-To: <20010509131550.A984@nebula.cybercable.fr>; from mux@qualys.com on Wed, May 09, 2001 at 01:15:50PM %2B0200
References:  <20010509131550.A984@nebula.cybercable.fr>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Wed, May 09, 2001 at 01:15:50PM +0200, Maxime Henrion wrote:
> 	Hi,
> 
> Here is another patch from OpenBSD taken from Kris mailbox.  It prevents
> users from putting non-printable characters in the passwd file.

I'm not sure whether isprint() is the canonical way to check this in
the face of different locales.  Can someone confirm the correct way to
do this?

Kris

> 
> Maxime
> -- 
> Don't be fooled by cheap finnish imitations ; BSD is the One True Code
> Key fingerprint = F9B6 1D5A 4963 331C 88FC  CA6A AB50 1EF2 8CBE 99D6
> Public Key : http://www.epita.fr/~henrio_m/

> *** /usr/src/usr.bin/chpass/edit.c	Wed Sep  6 20:16:46 2000
> --- edit.c	Wed May  9 13:12:05 2001
> ***************
> *** 184,193 ****
>   	struct passwd *pw;
>   {
>   	ENTRY *ep;
> ! 	char *p;
>   	struct stat sb;
>   	FILE *fp;
> ! 	int len, line;
>   	static char buf[LINE_MAX];
>   
>   	if (!(fp = fopen(tempname, "r")))
> --- 184,193 ----
>   	struct passwd *pw;
>   {
>   	ENTRY *ep;
> ! 	char *p, *q;
>   	struct stat sb;
>   	FILE *fp;
> ! 	unsigned int len, line;
>   	static char buf[LINE_MAX];
>   
>   	if (!(fp = fopen(tempname, "r")))
> ***************
> *** 225,231 ****
>   					goto bad;
>   				}
>   				while (isspace(*++p));
> ! 				if (ep->except && strpbrk(p, ep->except)) {
>   					warnx(
>   				   "illegal character in the \"%s\" field",
>   					    ep->prompt);
> --- 225,235 ----
>   					goto bad;
>   				}
>   				while (isspace(*++p));
> ! 				for (q = p; *q && isprint(*q); q++) {
> ! 				      if (ep->except && strchr(ep->except, *q))
> ! 					      break;
> ! 				}
> ! 				if (*q) {
>   					warnx(
>   				   "illegal character in the \"%s\" field",
>   					    ep->prompt);


[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.5 (FreeBSD)
Comment: For info see http://www.gnupg.org

iD8DBQE6+SeyWry0BWjoQKURAkMPAKDNwBU45ER+s3/ny8MoCYlSgDamJgCdHOJx
OAIS5Sg10yG5G2ZaXoX8rOE=
=BHX0
-----END PGP SIGNATURE-----

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