bug-fix for the <user> element

Kevin P. Fleming kpfleming at linuxfromscratch.org
Fri Nov 19 11:00:26 PST 2004

Alexander Lang wrote:

> +	if ((fp = fopen("/etc/passwd", "r"))) {
> +		/* getpwnam() is failing in chroot() */
> +		while ((pw = fgetpwent(fp))) {
> +			if (strcmp(pw->pw_name, user) == 0) {
> +				break;

This was intentionally changed in a previous nALFS release; the code 
used to look like this.

It was changed because if someone is running nALFS on a system using 
some source _other_ than /etc/passwd for user names (NIS, LDAP, etc.), 
then this code will fail because it cannot see those users.

You need to find out why getpwent() was failing in chapter 6, not change 
the code to use direct reads of /etc/passwd.

More information about the alfs-discuss mailing list