summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2011-10-08 10:17:22 +0200
committerJonas Smedegaard <dr@jones.dk>2011-10-08 10:17:22 +0200
commit1168e12a96d77c83be8a0a8b5e11c7e8e0a401ef (patch)
tree077620a05cab5c4746ee2b5a591425db42580c14
parent18ef75ad88d37b01776f916f27d2d5282b56288e (diff)
Use getent (not grep shadow file).
-rwxr-xr-xlocalnotifypwexp8
1 files changed, 2 insertions, 6 deletions
diff --git a/localnotifypwexp b/localnotifypwexp
index e6e2ef6..29811a7 100755
--- a/localnotifypwexp
+++ b/localnotifypwexp
@@ -30,9 +30,7 @@ declare -r aged=21 # minimum days after expiration before admins are emailed, se
hostname=$(hostname --fqdn)
domainname=$(hostname --domain)
-# /etc/shadow is system dependent
-shadowfile="/etc/shadow"
-# fields in /etc/shadow
+# fields in shadow file (system dependent)
declare -r last=2
#declare -r may=3 # not used in this script
declare -r must=4
@@ -50,10 +48,8 @@ declare -r unamefield=1
declare -r uidmin=1000
declare -r uidmax=65534 # exclusive
-# remove the hardcoded path from these progs to use them via $PATH
# mailx is system dependent
notifyprog="mailx"
-grepprog="grep"
awkprog="awk"
dateprog="date"
@@ -109,7 +105,7 @@ for user in $users;
do
IFS=":"
- usershadow=$($grepprog ^$user $shadowfile)
+ usershadow=$(getent shadow $user)
# make an array out of it
usershadow=($usershadow)