Subject: Re: useradd: spaces and $ in usernames
To: Hubert Feyrer <hubert.feyrer@informatik.fh-regensburg.de>
From: Alan Barrett <apb@cequrux.com>
List: tech-userlevel
Date: 11/16/2001 21:16:10
On Fri, 16 Nov 2001, Hubert Feyrer wrote:
>  	(void) seteuid(uid);
>  	/* we add the "|| true" to keep asystem() quiet if there is a non-zero exit status. */
> -	(void) asystem("%s -rf %s > /dev/null 2>&1 || true", RM, dir);
> +	(void) asystem("%s -rf '%s' > /dev/null 2>&1 || true", RM, dir);
>  	(void) seteuid(0);

This fails if dir contains a single-quote (') character.  NetBSD's libc
contains a shquote() function that can be used to solve this problem.

--apb (Alan Barrett)