on error goto EXIT !setup error trapping
? "Password: "; !prompt for password
!***********************************************************************
!Input - Grab one character. Check for carriage return or delete key. *
!If more than 6 chars have been entered, then ding bell. Make sure char*
!is between A and Z. If so, then add to char array. Output mask char *
!(*) and then go grab next character. *
!***********************************************************************
INPUT:
XCALL INKEY2,char
char = ucs(char) !convert to upper case
ascii'char = asc(char) !grab ascii value of char
if ascii'char = CR then goto VERIFY
if ascii'char = DEL then call DELETE
if length = 6 then ? chr(7); : goto INPUT
if ((ascii'char < 65) or (ascii'char > 90)) then goto INPUT
length = length + 1 : input'password(length) = ascii'char
? "*";
goto INPUT
!***********************************************************************
!Delete - Process delete key input. If no chars have been entered, then*
!just return. Otherwise, backup-print space-backup again. Delete char *
!from char array and set length back one *
!***********************************************************************
DELETE:
if length = 0 then RETURN
? chr(8); : ? " "; : ? chr(8);
input'password(length) = 0
length = length - 1
return
!***********************************************************************
!Verify - check input password (IP) against actual password (AP). Read *
!first char of AP. If 0 then we are at end of AP. Then if length of IP *
!and AP are the same, everything's ok. If not 0, then check IP char *
!against AP char. If not equal, bust them. Otherwise get next AP char *
!***********************************************************************
VERIFY:
read pass'char
if pass'char = 0 then if count = length then goto EXIT &
else goto CAUGHT
count = count + 1
if input'password(count) # pass'char then goto CAUGHT
goto VERIFY
!************************************************************************
!Caught - executes if wrong password. Grab date and time. Convert char *
!array to string. Open (or create) file to hold stats. Write date, time *
!and bad password to file. Close output file. Now chain to whatever *
!chain file has been specified. Just in case this file does not work, *
!chain to LOGOFF.LIT in the SYS: account *
!************************************************************************
CAUGHT:
xcall daytim,d,t
xcall userno,jobno
call CONVRT
lookup rpt'file,exists
if exists = FALSE then open #1,rpt'file,output &
else open #1,rpt'file,append
? #1,"Job #:";jobno,d,t,"Password: ";bad'pass
close #1
! CHAIN chn'file
! CHAIN "DSK0:LOGOFF.LIT[1,4]"
print "user would have been logged off"
!*********************************************************************
!Convrt - Convert char array to string. In the process, convert ascii*
!values to chars. *
!*********************************************************************
CONVRT:
for count = 1 to length
char = chr(input'password(count))
bad'pass = bad'pass + char
next count
return
!*********************************************************************
!Exit - if everything checks out then just exit. If a CTRL C is *
!entered, then ignore it and continue processing INPUT routine *
!*********************************************************************
EXIT:
if (err(0) = CTRL'C) then resume
? chr(13) !output carriage return if there is not a password
end
!*********************************************************************
!This is the password. A = 65, B = 66, C = 67,...., Z = 90 *
!Therefore, the password listed here is ABC. Note that you must *
!include a 0 at the end of the password and the password must not be *
!longer than 6 chars (excluding the 0) *
!*********************************************************************
DATA 65,66,67,0