mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
sed -i destroys symlinks
If /etc/passwd is a symlink, sed -i on same file will replace the symlink with a new file. Prevent that by adding --follow-symlinks option to sed (From OE-Core rev: 6ec004b2e7b4342465af8e5e6cc66041834821a0) Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
35fa9488cb
commit
a2ea2cb8d9
@@ -160,7 +160,7 @@ perform_passwd_expire () {
|
||||
local username=`echo "$opts" | awk '{ print $NF }'`
|
||||
local user_exists="`grep "^$username:" $rootdir/etc/passwd || true`"
|
||||
if test "x$user_exists" != "x"; then
|
||||
eval flock -x $rootdir${sysconfdir} -c \"$PSEUDO sed -i \''s/^\('$username':[^:]*\):[^:]*:/\1:0:/'\' $rootdir/etc/shadow \" || true
|
||||
eval flock -x $rootdir${sysconfdir} -c \"$PSEUDO sed -follow-symlinks -i \''s/^\('$username':[^:]*\):[^:]*:/\1:0:/'\' $rootdir/etc/shadow \" || true
|
||||
local passwd_lastchanged="`grep "^$username:" $rootdir/etc/shadow | cut -d: -f3`"
|
||||
if test "x$passwd_lastchanged" != "x0"; then
|
||||
bbfatal "${PN}: passwd --expire operation did not succeed."
|
||||
|
||||
Reference in New Issue
Block a user