home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 35 Internet
/
35-Internet.zip
/
telnetd.zip
/
TELNETD.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1997-10-11
|
3KB
|
107 lines
/* Security feature for IBM TCP/IP Telnet login. */
/* reads the last Username entry from the Telnetd-logfile */
/* and set the name to the Environment (Telnet_User). */
/* */
/* Written 09.10.1997 by Marc Schneider <macke@avalon.teuto.de> */
/* Trap detection */
SIGNAL OFF HALT
SIGNAL ON ERROR NAME EXIT
SIGNAL ON FAILURE NAME EXIT
SIGNAL ON SYNTAX NAME EXIT
SIGNAL ON NOTREADY NAME EXIT
/* Load the functions we need */
CALL rxfuncadd 'sysloadfuncs', 'rexxutil', 'sysloadfuncs'
CALL sysloadfuncs
/* Set the definitions */
env = 'OS2ENVIRONMENT'
Telnet_log = value('ATLPAC_LOG_FILE',,env)
process_file = value('ETC',,env)'\PROCESS.CNF'
hostname = value('hostname',,env)
nothing = value('prompt', '[$l'hostname'$g-$p]', env)
if value('term',,env) = 'dumb' then do
'keys off' /* If the terminal 'dumb' */
end /* if do */ /* then disable the history keys */
/* Read the logfile into an array */
do Counter = 1 until lines(Telnet_log) = 0
current_line.Counter = linein(Telnet_log)
end /* do until */
current_line.0 = Counter
/* Look for the last username entry into ATLPAC_LOG_FILE */
Do Counter = current_line.0 by -1 to Counter = 0 until LEFT(current_line.Counter,8) = 'Username'
end /* Do Counter */
/* Set Telnet_User=Username to the Environment */
parse value current_line.Counter with nul ': ' Username
nul = value('Telnet_User', Username, env)
/* Read the process information for the user from the process file */
do Counter = 1 until lines(process_file) = 0
process_line.Counter = linein(process_file)
process_line.Counter = SPACE(process_line.Counter,0)
if LEFT(process_line.Counter, LENGTH(Username)) = Username then do
parse value process_line.Counter with nul '=' process
end /* if do */
end Counter /* do until */
If process = 'PROCESS' then Signal NoName
say ''
say ''
say ' Hello 'Username 'your process is 'process
say ''
say ' Press a key to continue'
say ''
nul = SysGetKey(NOECHO)
'@call 'process
say ''
say ' Press a key to exit'
say ''
nul = SysGetKey(NOECHO)
'@exit'
exit 0
NoName:
say ''
say ''
say 'No process found for UserID 'Username '...'
EXIT:
say ''
say ''
say 'I can not continue. There may be an error'
say 'in 'process_file' or in TELNETD.CMD'
say ''
say 'Contact the system administrator of this host by telling him your login.'
nul = SysGetKey(NOECHO)
If nul = 'd' then do
say 'ENVIRONMENT = 'env
say 'Telnet-Logfile = 'Telnet_log
say 'Process file = 'process_file
say 'Hostname = 'hostname
say 'Prompt = 'nothing
say 'Terminal = 'value('term',,env)
say 'Username = 'Username
say 'Process = 'process
nul = SysGetKey(NOECHO)
end /* do */
'@exit'