I had used this method in AIX 4.3.2.0 to successfully add custom
authentication to limit the number of login sessions. Recently
upgrade the box and the OS to AIX 5.2.0.0 and the custom
authentication fails. Can not even log in as 'root'.


/etc/security/login.cfg :
auth_method:
program = /usr/bin/user_limit.scp


/etc/security/user ("default" section):
auth1 = SYSTEM,auth_method


#/usr/bin/user_limit.scp
#!/bin/ksh
USER=$1
LOGNUM=`cat /logins.dat | grep $USER | awk '{print $2}'`

if [[ $LOGNUM = '' ]]
then
LOGNUM=1
fi

NUM=`who | grep -w -c $USER`

if [[ $NUM -lt $LOGNUM ]]
then
exit 0
fi
echo "permission denied ... you already have $NUM login(s) for" $USER
"."
exit 255


Problem:
After entering the user name and password, the following error is
shown:

AIX Version 5
(C) Copyrights by IBM and by others 1982, 2005.
login: root
root's Password:
3004-007 You entered an invalid login name or password.
login:


Thanks in advance for you help.

Jack