PPP has standardized two types of automatic authentication. They are
described somewhere in the TCP/IP files. They are fairly safe challenge
and response methods with many options. Instead of relying on PAP files,
I have included the simple userid / password used by my ISP in the
command file I use to log in. Note that there seems to be a bug in
Souper - it is necessary to log in with the 'Dial other...' program the
first time after the system has been started or Souper will not find
the mail password.=20
Dial script (used from nightly mail run started by IBM Works):
/* PPP REXX Script */
SAY 'Setting constants'
bCR =3D '0d'x
bESC =3D '1B'x
abNL =3D '0a0d'x
usWaits =3D 15
sSecret =3D 'y'
sUser =3D 'x'
sNr =3D '12345678'
SAY 'Init'
CALL Init
'ppp com2 115200 defaultroute notify exit user '||sUser||' secret '||sSec=
ret||' connect "slattach ATZ OK ATDT'||sNr||' NNECT"'
call SysSleep 2
exit 0
/*********************/
Init:
/* */
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
SAY 'Funcs loaded'
RETURN
Job that lurks in the background and transfers mail if the line
is open and Yarn is not active. Switches between two servers.
/*************************************************************/
/* Mailboy REXX background job */
/* Author: Bj=F8rn Vermo, 1997 */
/* Version: 0.4b */
/* Added: */
/* Will shut automatically after midnight */
/* To do: */
/* Needs semaphores to avoid conflicts with other mail jobs */
/*************************************************************/
SAY 'Setting constants'
bCR =3D '0d'x
bESC =3D '1B'x
abNL =3D '0a0d'x
usWaits =3D 15
usMaxTry =3D 42
abUploadFile =3D "G:\ETC\UPLOAD\BBUNIX."
abBaseId =3D 'BBUNIX'
abLogg =3D 'C:\WK\Mailboy.log'
iTimer =3D 60
bUpload =3D 1
'set PATH=3DG:\Yarn;%PATH%'
'set YARN=3DG:\Yarn'
'set HOME=3DG:\etc'
'set MAILCAP=3DG:\etc\MAILCAP'
'set MM_CHARSET=3Diso-8859-1'
'set MM_DEBUG=3D1'
SAY 'Initialiserer'
CALL Init
'G:'
'cd \Etc\Download'
RC =3D STREAM(abLogg, 'C', 'OPEN WRITE APPEND')
SAY 'Starter logg: '||RC
CALL LINEOUT abLogg, TIME()||' **** Start '
bEnd =3D 0
DO until bEnd =3D 1
SAY TIME()||' U=3D '||bUpload||' t=3D '||iTimer
IF bUpload =3D 1 then
DO
CALL PingHost
IF (fConnected =3D 1)&(STREAM('G:\Yarn\news.dat', 'C', 'OPEN')=3D'REA=
DY:') then do=20
fFault =3D 0
IF STREAM(abUploadFile, 'C', 'QUERY EXISTS') > '' then
do
'unzip -o G:\etc\Upload\bbunix.out'
'G:\Yarn\Souper\souper -s -N G:\Yarn\Souper\newsrc -K G:\etc\KILL=
\Killfile 2>'||abStatus
SAY abStatus||'CLOSE: '||STREAM(abStatus, 'C', 'CLOSE')
SAY STREAM(abStatus, 'C', 'OPEN')
DO WHILE LINES(abStatus)
abWk =3D LINEIN(abStatus)=20
SAY '**>'||abWk
IF POS('Cannot connect', abWk) > 0 then do
fFault =3D 1
CALL LINEOUT abLogg, TIME()||' Send: '||abWk
END
END
SAY STREAM(abStatus, 'C', 'CLOSE')
CALL LINEOUT abLogg, TIME()||' Send fault =3D '||fFault
CALL SysFileDelete(abStatus)
'unzip -o G:\etc\Upload\bbunix.out'
'set nntpserver=3Dnntp.eunet.no'
'G:\Yarn\Souper\souper -m -s -N G:\Yarn\Souper\newsrc -K G:\etc\K=
ILL\Killfile 2>'||abStatus
SAY abStatus||'CLOSE: '||STREAM(abStatus, 'C', 'CLOSE')
SAY STREAM(abStatus, 'C', 'OPEN')
DO WHILE LINES(abStatus)
abWk =3D LINEIN(abStatus)=20
SAY '**>'||abWk
IF POS('Cannot connect', abWk) > 0 then do
fFault =3D 1
CALL LINEOUT abLogg, TIME()||' Send: '||abWk
END
END
SAY STREAM(abStatus, 'C', 'CLOSE')
CALL LINEOUT abLogg, TIME()||' Send fault =3D '||fFault
IF fFault =3D 0 then=20
do
CALL SysFileDelete('G:\etc\Upload\bbunix.out')
CALL LINEOUT abLogg, TIME()||' Delete G:\etc\Upload\bbunix.out =
'||RC
end
CALL SysFileDelete(abStatus)
'set nntpserver=3D'
end /* if AbUploadFile exists */
end /* IF fConnected */
SAY STREAM('G:\Yarn\news.dat', 'C', 'CLOSE')
bUpload =3D 0
end /* IF bUpload */
IF fConnected =3D 1 then do=20
'G:\Yarn\Souper\souper -N G:\Yarn\Souper\newsrc -K G:\etc\KILL\Killf=
ile 2>'||abStatus
RC =3D STREAM(abStatus, 'C', 'CLOSE')
CALL SysFileDelete(abStatus)
CALL LINEOUT abLogg, TIME()||' Receive bigblue '||RC||' <*'
sWaitmsg =3D ''
iWait =3D 0
do until STREAM('G:\Yarn\news.dat', 'C', 'OPEN')=3D'READY:'=20
CALL SysSleep 20
iWait =3D iWait + 20
sWaitmsg =3D ' Waiting '||iWait||'s for Yarn. '
end
RC =3D STREAM('G:\Yarn\news.dat', 'C', 'CLOSE')
'G:\Yarn\Import -u'
CALL LINEOUT abLogg, TIME()||sWaitmsg||' - Imported rc=3D'||RC
iTimer =3D 1800
CALL PingHost
IF fConnected =3D 1 then do=20
'set nntpserver=3Dnntp.eunet.no'
'G:\Yarn\Souper\souper -N G:\Yarn\Souper\newsrc.eu -m -K G:\etc\K=
ILL\Killfile 2>'||abStatus
RC =3D STREAM(abStatus, 'C', 'CLOSE')
CALL SysFileDelete(abStatus)
CALL LINEOUT abLogg, TIME()||' Receive eunet '||RC||' <*'
sWaitmsg =3D ''
iWait =3D 0
do until STREAM('G:\Yarn\Souper\news.dat', 'C', 'OPEN')=3D'READY:'=
=20
CALL SysSleep 20
iWait =3D iWait + 20
sWaitmsg =3D ' Waiting '||iWait||'s for Yarn. '
end
RC =3D STREAM('G:\Yarn\news.dat', 'C', 'CLOSE')
'G:\Yarn\Import -u'
CALL LINEOUT abLogg, TIME()||sWaitmsg||' - Imported rc=3D'||RC
'set nntpserver=3D'
iTimer =3D 3600
end
end /* IF fConnected */
else=20
do
iTimer =3D (120 + iTimer) / 2
bUpload =3D 1
end
IF TIME('H') =3D '0' then LEAVE
RC =3D STREAM(abLogg, 'C', 'CLOSE') =20
CALL SysSleep iTimer
RC =3D STREAM(abLogg, 'C', 'OPEN WRITE APPEND')
end /* do */
CALL LINEOUT abLogg, TIME()||' **** Shutdown '
RC =3D STREAM(abLogg, 'C', 'CLOSE')
call SysSleep 2
exit 0
/*********************/
Init:
/*****************************************************/
/* This routine will initialize global variables, */
/* so it is not declared as a PROCEDURE */
/* */
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
SAY 'Funcs loaded'
abUploadFile =3D 'G:\etc\UPLOAD\BBUNIX.OUT'
abAreaFile =3D 'G:\etc\DOWNLOAD\AREAS'
abPingback =3D 'pingback'
abStatus =3D 'SendStatus'
fConnected =3D 0
RETURN
/*****************************************/
PingHost:
fConnected =3D 0
'PING bigblue.no 16 2 >'||abPingback
CALL SysSleep 2
RC =3D STREAM(abPingback, 'C', 'CLOSE')
SAY STREAM(abPingback, 'C', 'query datetime')
RC =3D STREAM(abPingback, 'C', 'OPEN')
iCnt =3D 0 =20
DO WHILE LINES(abPingback)
PARSE VALUE LINEIN(abPingback) WITH abWk':'abWktail
IF POS('received', abWk) > 0 then do=20
SAY '**>'||abWk
fConnected =3D 1
end /* Do */
END /* DO */
RC =3D STREAM(abPingback, 'C', 'CLOSE')
CALL SysFileDelete(abPingback)
CALL LINEOUT abLogg, TIME()||' Ping: '||abWk||' '||abWktail
if fConnected =3D 0 then 'PING www.nb.no 16 2 '
RETURN