Be more careful about a usermgmt.conf file that doesn't exist. Problem

noticed by Thomas Klausner.
This commit is contained in:
garbled 2002-02-08 08:48:21 +00:00
parent 787dd8e0e3
commit f83456b035
1 changed files with 29 additions and 5 deletions

View File

@ -1,8 +1,13 @@
#!/bin/sh
# $NetBSD: script1,v 1.1 2001/03/06 21:26:27 garbled Exp $
# $NetBSD: script1,v 1.2 2002/02/08 08:48:21 garbled Exp $
if [ "$1" = "inactive" ]; then
DATA=`grep $1 /etc/usermgmt.conf | sed -e "s@$1 *@@"`
if [ -f "/etc/usermgmt.conf" ]; then
DATA=`grep $1 /etc/usermgmt.conf | sed -e "s@$1 *@@"`
else
echo "0"
exit 0
fi
if [ "$?" = "0" ]; then
expr $DATA / 86400
else
@ -10,7 +15,12 @@ if [ "$1" = "inactive" ]; then
fi
exit 0
fi
DATA=`grep $1 /etc/usermgmt.conf | sed -e "s@$1 *@@"`
if [ -f "/etc/usermgmt.conf" ]; then
DATA=`grep $1 /etc/usermgmt.conf | sed -e "s@$1 *@@"`
else
DATA="FILE_DOESNT_EXIST"
/usr/bin/false
fi
if [ "$?" = "0" ]; then
echo "$DATA"
else
@ -21,8 +31,23 @@ else
fi
if [ "$1" = "expire" ]; then
echo "Null (unset)"
else
exit 0
fi
if [ "$1" = "password" ]; then
echo " "
exit 0
fi
if [ "$1" = "base_dir" ]; then
echo "/home"
exit 0
fi
if [ "$1" = "skel_dir" ]; then
echo "/etc/skel"
exit 0
fi
if [ "$1" = "range" ]; then
echo "1000..60000"
exit 0
fi
fi
@ -39,4 +64,3 @@ if [ "$1" = "preserve" ]; then
echo "true"
fi
fi