Wind River Support Network

HomeDefectsLIN6-585
Fixed

LIN6-585 : [userspace] /etc/passwd is incorrect on intel-x86-32

Created: Nov 29, 2013    Updated: Dec 3, 2018
Resolved Date: Dec 18, 2013
Found In Version: 6.0
Fix Version: 6.0.0.2
Severity: Severe
Applicable for: Wind River Linux 6
Component/s: Userspace

Description

Problem Description
======================
/etc/passwd is not as same as other platform.

when run command "cat /etc/passwd | grep ftp", it will show

ftp:x:998:997::/home/ftp:/bin/sh

on other platform, the result is:

ftp:x:999:999::/var/lib/ftp:/bin/false

logs
root@server01:~# cat /etc/passwd | grep ftp
ftp:x:998:997::/home/ftp:/bin/sh

Root cause is package proftd will add user "ftp" with "/bin/sh",

Below is the relevant codes:

cat ./bitbake_build/tmp/work/i686-wrs-linux/vsftpd/3.0.0-r0/vsftpd.spec
if test "x$D" != "x"; then
	# Installing into a sysroot
	SYSROOT="$D"
	OPT="--root $D"

	# Add groups and users defined for all recipe packages
	GROUPADD_PARAM="-r ftp"
	USERADD_PARAM="--system --home-dir /var/lib/ftp --no-create-home -g ftp                        --shell /bin/false ftp "
	GROUPMEMS_PARAM=""
else
	# Installing onto a target
	# Add groups and users defined only for this package
	GROUPADD_PARAM="-r ftp"
	USERADD_PARAM="--system --home-dir /var/lib/ftp --no-create-home -g ftp                        --shell /bin/false ftp "
	GROUPMEMS_PARAM="${GROUPMEMS_PARAM}"
fi

cat ./bitbake_build/tmp/work/i686-wrs-linux/proftpd/1.3.4b-r3/proftpd.spec
perform_useradd () {
	local rootdir="$1"
	local opts="$2"
	local retries="$3"
	bbnote "Performing useradd with [$opts] and $retries times of retry"
	local username=`echo "$opts" | awk '{ print $NF }'`
	local user_exists="`grep "^$username:" $rootdir/etc/passwd || true`"
	if test "x$user_exists" = "x"; then
	       local count=0
	       while true; do
		       eval $PSEUDO useradd $opts || true
		       user_exists="`grep "^$username:" $rootdir/etc/passwd || true`"
		       if test "x$user_exists" = "x"; then
			       bbwarn "useradd command did not succeed. Retrying..."
			       sleep 1
		       else
			       break
		       fi
		       count=`expr $count + 1`
		       if test $count = $retries; then
				bbfatal "Tried running useradd command $retries times without scucess, giving up"
		       fi
	       done
	else
		bbwarn "user $username already exists, not re-creating it"
	fi
}

Expected Behavior
======================
the /etc/passwd is correct as other platform.

Observed Behavior
======================
See above

Logs
======================
See above

Misc Info
======================
N/A

Steps to Reproduce

1

1) configure
/product/installation/path/wrlinux-6/wrlinux/configure --enable-board=intel-x86-32 --enable-kernel=standard --enable-rootfs=glibc-std  --with-template=feature/valgrind,feature/lttng2,feature/acl,feature/nfsd,feature/mysql,feature/mysql-odbc --enable-test=yes --enable-prelink=no --enable-build=profiling --enable-jobs=2 --enable-parallel-pkgbuilds=12


2) build
$ make fs

3) boot the target

2 run "cat /etc/passwd | grep ftp"

Other Downloads


Live chat
Online