From 12947f6e96220896cace1bdcef2818ed1d04ace9 Mon Sep 17 00:00:00 2001 From: Nathaniel Clark Date: Wed, 9 Mar 2016 17:14:15 -0500 Subject: [PATCH] LU-7859 tests: Use getent instead of /etc/passwd Use getent passwd instead of directly reading form /etc/passwd to prevent missing user checks if users come from ldap or another auth source that isn't /etc/passwd. Signed-off-by: Nathaniel Clark Change-Id: Ia2831c777c7c3f8bae5a634fa897744954d14c1e Reviewed-on: http://review.whamcloud.com/18846 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin --- lustre/tests/conf-sanity.sh | 2 +- lustre/tests/sanity-sec.sh | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index 7254a2f..221f2ac 100755 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -2992,7 +2992,7 @@ test_43a() { [ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root" ID1=${ID1:-501} - USER1=$(cat /etc/passwd | grep :$ID1:$ID1: | cut -d: -f1) + USER1=$(getent passwd | grep :$ID1:$ID1: | cut -d: -f1) [ -z "$USER1" ] && skip_env "missing user with uid=$ID1 gid=$ID1" && return diff --git a/lustre/tests/sanity-sec.sh b/lustre/tests/sanity-sec.sh index 9f303c2..7fc381d 100755 --- a/lustre/tests/sanity-sec.sh +++ b/lustre/tests/sanity-sec.sh @@ -50,14 +50,14 @@ clients_arr=($clients) ID0=${ID0:-500} ID1=${ID1:-501} -USER0=$(grep :$ID0:$ID0: /etc/passwd | cut -d: -f1) -USER1=$(grep :$ID1:$ID1: /etc/passwd | cut -d: -f1) +USER0=$(getent passwd | grep :$ID0:$ID0: | cut -d: -f1) +USER1=$(getent passwd | grep :$ID1:$ID1: | cut -d: -f1) [ -z "$USER0" ] && - skip "need to add user0 ($ID0:$ID0) to /etc/passwd" && exit 0 + skip "need to add user0 ($ID0:$ID0)" && exit 0 [ -z "$USER1" ] && - skip "need to add user1 ($ID1:$ID1) to /etc/passwd" && exit 0 + skip "need to add user1 ($ID1:$ID1)" && exit 0 IDBASE=${IDBASE:-60000} -- 1.8.3.1