From f83456b035a2072f749307fe43cfc3deddf92900 Mon Sep 17 00:00:00 2001 From: garbled Date: Fri, 8 Feb 2002 08:48:21 +0000 Subject: [PATCH] Be more careful about a usermgmt.conf file that doesn't exist. Problem noticed by Thomas Klausner. --- share/sushi/system/usermgmtconf/script1 | 34 +++++++++++++++++++++---- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/share/sushi/system/usermgmtconf/script1 b/share/sushi/system/usermgmtconf/script1 index 7ec289f4a88a..048c5c98760f 100755 --- a/share/sushi/system/usermgmtconf/script1 +++ b/share/sushi/system/usermgmtconf/script1 @@ -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 -