reading passwd file with gdm

Glenn Johnson gjohnson at srrc.ars.usda.gov
Tue Jun 10 08:27:41 PDT 2003


I am trying to parse the master.passwd file during gdm logins to see if
the passwd has reached its expiration time.  The following command works
on the command line and in a simple sh script that I tested:

CHANGE=`perl -e "print join(':', getpwnam ('$USER'));" | awk -F: '{print $5}'`

However, it does not work when put into gdm/PreSession/Default.

Here is my PreSession/Default file.  I put in an echo command to see the
values.

--begin gdm/PreSession/Default--

#!/bin/sh
#
# Note that any setup should come before the sessreg command as
# that must be 'exec'ed for the pid to be correct (sessreg uses the parent
# pid)
#
# Note that output goes into the .xsession-errors file for easy debugging
#
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
xrdb /etc/X11/Xresources
xmessage -nearmouse -file /etc/motd -default okay

if /usr/bin/which -s xsetroot > /dev/null 2>&1; then
	xsetroot -cursor_name left_ptr -solid "#363047"
fi

TIME=`date +%s`
CHANGE=`perl -e "print join(':', getpwnam ('$USER'));" | awk -F: '{print $5}'`
echo TIME is $TIME CHANGE is $CHANGE EXPIRED is $EXPIRED > ~/aging
if [ "$EXPIRED" = "yes" ]; then
    xterm -e passwd
fi

if /usr/bin/which -s sessreg > /dev/null 2>&1; then
	# some output for easy debugging
	echo "$0: Registering your session with wtmp and utmp"
	echo "$0: running: sessreg -a -w /var/log/wtmp -u /var/run/utmp -x \"$X_SERVERS\" -h \"$REMOTE_HOST\" -l $DISPLAY $USER"

	exec sessreg -a -w /var/log/wtmp -u /var/run/utmp -x "$X_SERVERS" -h "$REMOTE_HOST" -l $DISPLAY $USER
	# this is not reached
fi

# some output for easy debugging
echo "$0: could not find the sessreg utility, cannot update wtmp and utmp"
exit 0

--end gdm/PreSession/Default--

Here are the contents of the ~/aging file:

TIME is 1055258058 CHANGE is EXPIRED is

Does any one have any idea why that perl command is not working when run
in the gdm PreSession/Default script?

Thanks.

-- 
Glenn Johnson
USDA, ARS, SRRC			 Phone: (504) 286-4252
New Orleans, LA 70124		e-mail: gjohnson at srrc.ars.usda.gov


More information about the freebsd-gnome mailing list