-
Notifications
You must be signed in to change notification settings - Fork 6
/
express.e
32248 lines (28005 loc) · 894 KB
/
express.e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-> Ami Express 5
OPT LARGE,OSVERSION=37,PURE
#ifndef EVO_3_4_0
FATAL 'Ami-Express should only be compiled with E-VO Amiga E Compiler'
#endif
/*
missing Door port commands
FULLEDIT (not implemented in /X3 or 4)
node tooltypes
FREE_RESUMING - see /X4 docs (LVL_ALLOW_FREE_RESUMING & ACS_ALLOW_FREE_RESUMING) - not implemented in /X3 or 4
RIPSCRIPT - unknown (cant see any code that uses this value)
NODBLBUFFER - don't allow double buffer size during serial xfer
HDTRANSBUFFER - see /X4 docs
*/
MODULE 'intuition/screens','intuition/intuition','intuition/gadgetclass','exec/ports','exec/nodes','exec/memory','exec/alerts','exec/semaphores',
'devices/console','devices/serial','graphics/view','gadtools','libraries/gadtools','dos/dos','dos/var','dos/dosextens','dos/datetime',
'dos/dostags','graphics/text','libraries/diskfont','diskfont','devices/timer','exec/io','exec/tasks','amigalib/io','amigalib/ports',
'icon','workbench/workbench','commodities','exec/libraries','exec/lists','libraries/commodities','asl','workbench/startup','rexx/storage',
'rexxsyslib','libraries/asl','devices/serial','xproto','xpr_lib','socket','net/socket','net/netdb','net/in','fifo','owndevunit','asyncio',
'libraries/asyncio'
MODULE '*axcommon','*axconsts','*axenums','*axobjects','*miscfuncs','*stringlist','*ftpd','*httpd','*errors','*mailssl','*zmodem',
'*xymodem','*hydra','*bcd','*pwdhash','*sha256','*tooltypes','*expversion'
DEF masterMsg:acpMessage
DEF resmp: PTR TO mp
DEF rexxmp: PTR TO mp
DEF serverRP=0:PTR TO mp
DEF currentStat=0
DEF rexxPortName[20]:STRING
DEF resPortName[12]:STRING
DEF servercmd=-1
DEF serverin
DEF singleNode=0: PTR TO singlePort
DEF masterNode=0: PTR TO multiPort
DEF consoleDebugLevel=LOG_NONE
DEF debugLogLevel=LOG_ERROR
DEF inputLogging=FALSE
DEF inac=FALSE
DEF state=-1, stateData, reqState,instantLogon=FALSE
DEF windowClose=NIL:PTR TO window
DEF windowStat=NIL:PTR TO window
DEF windowZmodem=NIL:PTR TO window
DEF expMenu:PTR TO menu
DEF consoleReadMP=NIL: PTR TO mp
DEF titlebar[255]:STRING
DEF ititlebar[255]:STRING
DEF consoleIO=NIL: PTR TO iostd
DEF statWriteMP=NIL: PTR TO mp
DEF statWriteIO=NIL: PTR TO iostd
DEF zModemStatWriteMP=NIL: PTR TO mp
DEF zModemStatWriteIO=NIL: PTR TO iostd
DEF hydraWindow1=NIL:PTR TO window
DEF hydraWindow2=NIL:PTR TO window
DEF hydraWindow3=NIL:PTR TO window
DEF hydraStatWriteMP1=NIL: PTR TO mp
DEF hydraStatWriteIO1=NIL: PTR TO iostd
DEF hydraStatWriteMP2=NIL: PTR TO mp
DEF hydraStatWriteIO2=NIL: PTR TO iostd
DEF hydraStatWriteMP3=NIL: PTR TO mp
DEF hydraStatWriteIO3=NIL: PTR TO iostd
DEF hydraConsoleReadMP=NIL: PTR TO mp
DEF hydraConsoleReadIO=NIL: PTR TO iostd
DEF serialReadIO=NIL: PTR TO ioextser
DEF serialReadMP=NIL: PTR TO mp
DEF serialWriteMP=NIL: PTR TO mp
DEF serialWriteIO=NIL: PTR TO ioextser
DEF timerport=NIL: PTR TO mp
DEF timermsg=NIL: PTR TO timerequest
DEF readQueued=FALSE
DEF timerQueued=FALSE
DEF ibuf, serbuff, inControl
DEF conbuf[1]:ARRAY OF CHAR
DEF commandText[255]:STRING
DEF loggedOnUser=NIL: PTR TO user ->shared with tooltypes.e
DEF loggedOnUserKeys=NIL: PTR TO userKeys
DEF loggedOnUserMisc=NIL: PTR TO userMisc
DEF tempAccess: tempAccess
DEF tempAccessGranted=FALSE
DEF sopt=NIL: PTR TO startOption
DEF mailOptions=NIL: PTR TO mailConfig ->shared with mailssl.e
DEF node ->shared with tooltypes.e
DEF ringCount
DEF nodeScreenDir[255]:STRING
DEF confScreenDir[255]:STRING
DEF nodeWorkDir[255]:STRING
DEF reservedName[255]:STRING
DEF consoleOutputDeviceName[255]:STRING
DEF consoleInputDeviceName[255]:STRING
DEF bgCheckPortName[20]:STRING
DEF currentConf=0 ->shared with tooltypes.e
DEF currentMsgBase=0
DEF relConfNum=0
DEF callerNum=0
DEF currentConfName[255]:STRING
DEF currentConfDir[255]:STRING ->shared with tooltypes.e
DEF msgBaseLocation[255]:STRING
DEF userDataFile[255]:STRING
DEF userKeysFile[255]:STRING
DEF userMiscFile[255]:STRING
DEF maxDirs
DEF ansi: ansi
DEF quickFlag=FALSE
DEF ripMode=FALSE
DEF ansiColour=TRUE
DEF lineCount=0
DEF nonStopDisplayFlag=FALSE
DEF logonType=LOGON_TYPE_LOGGED_OFF
DEF timeoutOverride=-1
DEF sysopAvail=TRUE
DEF pagedFlag=FALSE
DEF doorTimeout=INPUT_TIMEOUT
DEF doorExtSig=NIL
DEF expressVer[15]:STRING
DEF expressDate[15]:STRING
DEF regKey[100]:STRING
DEF mailStat=NIL: PTR TO mailStat
DEF mailHeader=NIL: PTR TO mailHeader
DEF cmds=NIL: PTR TO commands ->shared with tooltyles.e
DEF mybbsLoc[255]:STRING
DEF parsedParams: PTR TO stringlist
DEF confBases: PTR TO stdlist
DEF newSinceFlag
DEF computerEntries
DEF computerTypes: PTR TO stringlist
DEF onlineEdit=0
DEF quietFlag=FALSE
DEF chatFlag=FALSE
DEF blockOLM=TRUE
DEF chatF=0
DEF pagesAllowed=-1
DEF ownPartFiles=FALSE
DEF localUpload=FALSE
DEF bytesADL=0
DEF tTEFF=0
DEF tTCPS=0
->DEF tTTM=0
DEF ulTTTM=0
DEF dlTTTM=0
DEF dTBT[8]:ARRAY OF CHAR
DEF uTBT[8]:ARRAY OF CHAR
DEF beenUDd=FALSE
DEF lcFileXfr=0
DEF recFileNames:PTR TO stringlist
DEF skipdFiles:PTR TO stringlist
DEF checksym=0
DEF purgeScanNM[31]:STRING
DEF validUser=0
DEF uucp=0
DEF freeDownloads=FALSE
DEF acsLevel=-1
DEF overrideDefaultAccess=FALSE
DEF userSpecificAccess=FALSE
DEF connectString[20]:STRING
DEF ioFlags[7]:ARRAY OF CHAR
DEF trapConnect[100]:STRING
DEF confDBName[255]:STRING
DEF captureFP = NIL
DEF nofkeys=0
DEF relogon=FALSE
DEF lostCarrier=FALSE
DEF timeoutLC=FALSE
DEF messageMenuChar=0
DEF disallowFileAttach=FALSE
DEF floatMsgRecNum
DEF doormsgcode=0
DEF nonStopMail=FALSE
DEF kMsgFlag=FALSE
DEF noDirF
DEF tempFlag
DEF replyFlag, numOfZMsgs
DEF fwdFlag
DEF fwdDir
DEF msgNum
DEF fwdToMsg
DEF currentSeekPos
DEF fileattach=TRUE, newmailsearch = FALSE
DEF attachedFiles: PTR TO stringlist
DEF privateFlag=0
DEF alreadyRecvd
DEF delMsgNum
DEF lastMsgReadConf=0
DEF lastNewReadConf=0
DEF msgBuf: PTR TO stringlist
DEF maxMsgLines = 800
DEF confNames: PTR TO stringlist
DEF confDirs: PTR TO stringlist ->shared with tooltyles.e
DEF historyFolder[255]:STRING
DEF userNotesFolder[255]:STRING
DEF historyBuf : PTR TO stringlist
DEF historyNum
DEF historyCycle
DEF comment=0
DEF menuPrompt[255]:STRING
DEF mciViewSafe=TRUE
DEF mcioff=FALSE
DEF newFilesPauseFlag =FALSE
DEF confNameType=NAME_TYPE_USERNAME
DEF editor: editor
DEF editorFileName[80]:STRING
DEF editorFileInclude[80]:STRING
DEF xprLib: PTR TO stringlist ->shared with tooltypes.e
DEF xprTitle: PTR TO stringlist
DEF screenTypeTitle: PTR TO stringlist
DEF screenTypeExt: PTR TO stringlist
DEF scomment:PTR TO stringlist
DEF fCheckDir[255]:STRING ->shared with tooltypes.e
DEF hostLanguage[255]:STRING
DEF userLanguage[255]:STRING
DEF translatorMode=TRANS_NONE
DEF translatorLanguage[255]:STRING
DEF confMailName[31]:STRING
DEF lines=0
DEF rzmsg=0
DEF tempUser: PTR TO user
DEF tempUserKeys: PTR TO userKeys
DEF tempUserMisc: PTR TO userMisc
DEF flagFilesList:PTR TO stdlist
DEF onlineBaud,onlineBaudR
DEF idRate[15]:STRING
DEF idDate[15]:STRING
DEF idTime[15]:STRING
DEF idNmbr[41]:STRING
DEF idName[41]:STRING
DEF hostName[200]:STRING
DEF hostIP[20]:STRING
DEF dlFileCount=0
DEF ulFileCount=0
DEF timeLimit
DEF logonTime
DEF lastTimeUpdate
DEF bitPlanes=3
DEF ximPort=0
DEF slowmo=0
DEF slowmoCount=0
DEF resetSerOut=FALSE
DEF mimicVersion[255]:STRING
DEF namePrompt[255]:STRING
DEF passwordPrompt[255]:STRING
DEF mciterminator[1]:STRING
DEF customMsgParam1=0
DEF customMsgParam2=0
DEF customMsgCmd[255]:STRING
DEF transfering=FALSE
DEF binaryRaw=FALSE
DEF doorSilent=FALSE
DEF cancelTransferOffHook=FALSE
DEF aeGoodFile=0
DEF sysopdl,numFiles,fsize
DEF dtfsize[8]:ARRAY OF CHAR
DEF zModemInfo: zModem
DEF chatSerFlag=0,chatConFlag=0
DEF serShared=FALSE
DEF zresume=0
DEF scropen=FALSE
DEF wantzwin=FALSE
DEF statWinType=0
DEF screen=NIL:PTR TO screen
DEF window=NIL:PTR TO window
DEF defaultfontattr: textattr
DEF fontName[255]:STRING
DEF fontHandle=NIL
DEF dStatBar=NIL
DEF consoleMP=NIL: PTR TO mp
DEF consoleReadIO=NIL: PTR TO iostd
DEF rawArrow=FALSE
DEF broker=NIL, broker_mp=NIL:PTR TO mp, cxsigflag=0
DEF securityNames
DEF securityFlags[255]:STRING
DEF secOverride[255]:STRING
DEF shutDownMsg[255]:STRING
DEF shutDownFlag=0
DEF olmBuf: PTR TO stringlist
DEF olmQueue: PTR TO stringlist
DEF lastOlmNode=-1
DEF translators: PTR TO translator
DEF managedTranslators=FALSE
DEF doorExpertMode = FALSE
DEF amixnetOutboundDir[255]:STRING
DEF netMailTransfer=FALSE
DEF sysopUploading=FALSE
DEF autoDeactivateDays=-1
DEF sdReplyRexx=NIL: PTR TO rexxmsg
DEF bgData:bgCheckData
DEF bgFileCheck=FALSE
DEF diskObjectCache:PTR TO stdlist ->shared with tooltypes.e
DEF cacheResetOn=CACHE_RESET_NEVER
DEF cacheTests=0 ->shared with tooltypes.e
DEF cacheHits=0 ->shared with tooltypes.e
DEF serialLocked=FALSE
DEF ownDevSignal=0
DEF netTrans=0
DEF arg1[255]:STRING
DEF arg2[255]:STRING
DEF arg3[255]:STRING
DEF holdAccessLevel=201
DEF max_desclines=15
DEF serialCacheSize=0
DEF serialCacheCurrentSize=0
DEF serialCacheLastFlush1=0
DEF serialCacheLastFlush2=0
DEF serialCache=0
DEF serialCacheEnabled=FALSE
DEF includeDeact=FALSE
DEF bgChecking=FALSE
DEF ftptime1=0
DEF ftptime2=0
DEF nativeTelnet=FALSE
DEF nativeFtp=FALSE
DEF ftpConn=FALSE
DEF telnetSocket=-1
DEF offHookFlag=TRUE
DEF lastIAC=FALSE
DEF lastIAC2=FALSE
DEF iaccmd=0
DEF nawsMode=0
DEF willsent=FALSE
DEF dosent=FALSE
DEF nodeStart=0
DEF cntr=0
DEF userLineLen=0
DEF iemsiUsername[255]:STRING
DEF iemsiPassword[255]:STRING
DEF fds=NIL:PTR TO LONG
DEF zmodemRxBuffer=0
DEF zModemRxBufferSize=65536
DEF bufferedBytes=0
DEF bufferReadOffset=0
DEF lastCarrierCheck=0
DEF cmdShortcuts=FALSE
DEF shortcuts:PTR TO stringlist
DEF currentMenuName[255]:STRING
DEF defaultMenuName[255]:STRING
DEF menuPause=TRUE
DEF telnetUsername[100]:STRING
DEF telnetPassword[100]:STRING
DEF telnetUsernamePrompt[100]:STRING
DEF telnetPasswordPrompt[100]:STRING
DEF quietDownload=FALSE
DEF unknownValue=0
DEF memConf=0:PTR TO LONG ->shared with tooltypes.e
RAISE ERR_BRKR IF CxBroker()=NIL,
ERR_PORT IF CreateMsgPort()=NIL,
ERR_ASL IF AllocAslRequest()=NIL
PROC calcEfficiency(cps,baud)
DEF res
IF cps>21474836
res:=Mul(Div(cps,Div(baud,10)),100)
ELSE
res:=Div(Mul(cps,100),Div(baud,10))
ENDIF
ENDPROC res
PROC configFileExists(fname:PTR TO CHAR)
DEF lh
DEF fn[255]:STRING
StringF(fn,'\s.info',fname)
IF lh:=Lock(fn,ACCESS_READ)
UnLock(lh)
RETURN TRUE
ENDIF
StringF(fn,'\s.cfg',fname)
IF lh:=Lock(fn,ACCESS_READ)
UnLock(lh)
RETURN TRUE
ENDIF
StringF(fn,'\s.txt',fname)
IF lh:=Lock(fn,ACCESS_READ)
UnLock(lh)
RETURN TRUE
ENDIF
ENDPROC FALSE
PROC convertAccess()
DEF tempStr[255]:STRING
acsLevel:=findAcsLevel()
getUserAccessFilename(tempStr)
userSpecificAccess:=configFileExists(tempStr);
StringF(tempStr,'\sAccess',cmds.bbsLoc)
IF configFileExists(tempStr)=FALSE THEN overrideDefaultAccess:=TRUE ELSE overrideDefaultAccess:=checkSecurity(ACS_OVERRIDE_DEFAULTS)
StrCopy(securityFlags,'')
ENDPROC
PROC isConfAccessAreaName(user:PTR TO user)
DEF i,c=0,ca
FOR i:=0 TO StrLen(user.conferenceAccess)-1
ca:=user.conferenceAccess[i]
IF (ca<>"X") AND (ca<>"_") THEN c++
ENDFOR
ENDPROC c<>0
PROC checkOnlineStatus()
DEF stat
IF(state=STATE_AWAIT) THEN RETURN RESULT_SUCCESS
IF(reqState=REQ_STATE_LOGOFF) THEN RETURN RESULT_NO_CARRIER
IF(logonType>=LOGON_TYPE_REMOTE)
stat:=checkCarrier()
IF(stat=FALSE) THEN RETURN RESULT_NO_CARRIER
ENDIF
ENDPROC RESULT_SUCCESS
PROC modemOffHook()
DEF ni:PTR TO nodeInfo
offHookFlag:=TRUE
IF (telnetSocket>=0)
CloseSocket(telnetSocket)
CloseLibrary(socketbase)
socketbase:=NIL
waitSocketLib(TRUE)
telnetSocket:=-1
IF sopt.toggles[TOGGLES_MULTICOM]
ObtainSemaphore(masterNode)
ni:=(masterNode.myNode[node])
ni.netSocket:=-1
ni.offHook:=TRUE
ReleaseSemaphore(masterNode)
ENDIF
ioFlags[IOFLAG_SER_IN]:=0
ioFlags[IOFLAG_SER_OUT]:=0
ioFlags[IOFLAG_SCR_OUT]:=-1
ioFlags[IOFLAG_KBD_IN]:=-1
ENDIF
IF(StrLen(cmds.serDev)>0)
IF serShared=FALSE
serShared:=TRUE
IF(sopt.toggles[TOGGLES_SERIALRESET])
resetSystem()
intDoReset(sopt.offHook)
ioFlags[IOFLAG_SER_IN]:=0
ioFlags[IOFLAG_SER_OUT]:=0
ioFlags[IOFLAG_SCR_OUT]:=-1
ioFlags[IOFLAG_KBD_IN]:=-1
ELSE
dropDTR();Delay(25)->//Reset_System(0)
intDoReset(sopt.offHook)
Delay(5)
->droppedHook:=1
ioFlags[IOFLAG_SER_IN]:=0
ioFlags[IOFLAG_SER_OUT]:=0
ioFlags[IOFLAG_SCR_OUT]:=-1
ioFlags[IOFLAG_KBD_IN]:=-1
ENDIF
ENDIF
ENDIF
ENDPROC
PROC updateTimeUsed()
DEF currDay,logonDay,currTime
DEF string[255]:STRING
currTime:=getSystemTime()
currDay:=Div(currTime-21600,86400)
logonDay:=Div(logonTime-21600,86400)
IF (currDay<>logonDay)
StringF(string,'timeused debug: \s new day reset, currday \d, lastday \d',loggedOnUser.name, currDay,logonDay)
debugLog(LOG_DEBUG,string)
loggedOnUser.timeTotal:=loggedOnUser.timeLimit
loggedOnUser.dailyBytesDld:=0
loggedOnUser.timeUsed:=0
loggedOnUser.chatRemain:=loggedOnUser.chatLimit
timeLimit:=loggedOnUser.timeTotal-loggedOnUser.timeUsed
logonTime:=Mul(currDay,86400)+21600
lastTimeUpdate:=logonTime
ENDIF
IF (currTime-lastTimeUpdate)>0
IF(chatFlag=0)
loggedOnUser.timeUsed:=loggedOnUser.timeUsed+(currTime-lastTimeUpdate)
timeLimit:=timeLimit-(currTime-lastTimeUpdate)
ELSE
IF loggedOnUser.chatLimit>0
loggedOnUser.chatRemain:=loggedOnUser.chatRemain-(currTime-lastTimeUpdate)
ENDIF
ENDIF
lastTimeUpdate:=currTime
ENDIF
ENDPROC
PROC checkTimeUsed()
IF (timeLimit<0) AND (state<>STATE_LOGGING_OFF) AND (checkSecurity(ACS_OVERRIDE_TIMELIMIT)=FALSE)
IF displayScreen(SCREEN_LOGON24)=FALSE
aePuts('You have exceeded your time limit\b\n')
aePuts('Goodbye\b\n\b\n')
aePuts('Disconnecting..\b\n')
ENDIF
modemOffHook()
quickFlag:=TRUE
saveFlagged()
IF StrLen(historyFolder)>0 THEN saveHistory()
reqState:=REQ_STATE_LOGOFF
setEnvStat(ENV_LOGOFF)
ENDIF
ENDPROC
PROC checkMailConfScan(conf,msgBase)
DEF cb: PTR TO confBase
DEF res=TRUE
IF((checkToolTypeExists(TOOLTYPE_CONF,conf,'FORCE_NEWSCAN')))
RETURN TRUE
ELSEIF (checkToolTypeExists(TOOLTYPE_CONF,conf,'NO_NEWSCAN'))
RETURN FALSE
ENDIF
cb:=confBases.item(getConfIndex(conf,msgBase))
IF cb<>NIL
IF (cb.handle[0] AND MAIL_SCAN_MASK)<>0 THEN res:=TRUE ELSE res:=FALSE
ELSE
res:=TRUE
ENDIF
ENDPROC res
PROC checkFileConfScan(conf)
DEF cb: PTR TO confBase
DEF res
IF((checkToolTypeExists(TOOLTYPE_CONF,conf,'SHOW_NEW_FILES')))
RETURN TRUE
ELSEIF (checkToolTypeExists(TOOLTYPE_CONF,conf,'NO_NEW_FILES'))
RETURN FALSE
ENDIF
cb:=confBases.item(getConfIndex(conf,1))
IF cb<>NIL
IF (cb.handle[0] AND FILE_SCAN_MASK)<>0 THEN res:=TRUE ELSE res:=FALSE
ELSE
res:=TRUE
ENDIF
ENDPROC res
PROC closeSerial()
IF serialReadIO<>NIL
IF CheckIO(serialReadIO)=FALSE THEN AbortIO(serialReadIO)
CloseDevice(serialReadIO)
deleteExtIO(serialReadIO)
serialReadIO:=NIL
ENDIF
IF serialReadMP<>NIL
deletePort(serialReadMP)
serialReadMP:=NIL
ENDIF
IF serialWriteIO<>NIL
CloseDevice(serialWriteIO)
deleteExtIO(serialWriteIO)
serialWriteIO:=NIL
ENDIF
IF serialWriteMP<>NIL
deletePort(serialWriteMP)
serialWriteMP:=NIL
ENDIF
IF serialCache<>NIL
Dispose(serialCache)
ENDIF
ENDPROC
PROC setNRAMS()
DEF nramName[255]:STRING
DEF nramData[255]:STRING
DEF n=1
StringF(nramName,'NRAM.\d',1)
IF readToolType(TOOLTYPE_NRAMS,node,nramName,nramData) AND (serialWriteIO<>NIL)
ioFlags[IOFLAG_SER_IN]:=-1
ioFlags[IOFLAG_SER_OUT]:=0
ioFlags[IOFLAG_SCR_OUT]:=0
ioFlags[IOFLAG_KBD_IN]:=-1
dropDTR()
intDoReset(sopt.offHook)
setEnvMsg('Setting NRAMS')
REPEAT
StringF(nramName,'Setting NRAM.\d',n)
setEnvMsg(nramName)
intDoReset(nramData)
Delay(60)
n++
StringF(nramName,'NRAM.\d',n)
UNTIL readToolType(TOOLTYPE_NRAMS,node,nramName,nramData)=FALSE
resetSystem()
setEnvStat(ENV_AWAITCONNECT)
ELSE
setEnvMsg('NO NRAM.DEF')
Delay(30)
setEnvStat(ENV_AWAITCONNECT)
ENDIF
ENDPROC
PROC reInitModem()
dropDTR()
Delay(20)
intDoReset(sopt.offHook)
Delay(60)
serPuts(cmds.mInit)
serPutChar("\b")
Delay(60)
purgeLine()
ENDPROC
PROC openSerial(baud, dataLen, stopBits)
DEF flags,rcount=0,error
DEF errorstr[255]:STRING
IF serialReadIO<>NIL THEN RETURN FALSE
IF(StrLen(cmds.serDev)>0)
IF (serialCacheSize>0) THEN serialCache:=New(serialCacheSize+1)
serialCacheLastFlush1,serialCacheLastFlush2:=getSystemTime()
IF (serialCacheSize<=0) OR (serialCache<>NIL)
IF(serialReadMP:=createPort(0,0))
IF(serialReadIO:=createExtIO(serialReadMP,SIZEOF ioextser))
IF(serialWriteMP:=createPort(0,0))
IF(serialWriteIO:=createExtIO(serialWriteMP,SIZEOF ioextser))
flags:=SERF_SHARED
IF checkToolTypeExists(TOOLTYPE_NODE,node,'NORADBOOGIE')=FALSE THEN flags:=flags OR SERF_XDISABLED OR SERF_RAD_BOOGIE
IF (cmds.acLvl[LVL_VARYING_LINK_RATE]=0) THEN flags:=flags OR SERF_7WIRE
serialWriteIO.serflags:=flags
serialReadIO.serflags:=flags
retry:
IF((OpenDevice(cmds.serDev,cmds.serDevUnit,serialReadIO,0)))=FALSE
IF((OpenDevice(cmds.serDev,cmds.serDevUnit,serialWriteIO,0)))=FALSE
Delay(10)
serialWriteIO.baud:=baud
serialWriteIO.readlen:=dataLen
serialWriteIO.writelen:=dataLen
serialWriteIO.serflags:=flags
serialWriteIO.stopbits:=stopBits
serialWriteIO.ctlchar:=286457856 ->0x11130000
serialWriteIO.rbuflen:=16384
serialWriteIO.iostd.command:=SDCMD_SETPARAMS
error:=DoIO(serialWriteIO)
IF error
StringF(errorstr,'error write setparams: \d',error)
debugLog(LOG_ERROR,errorstr)
ENDIF
serialReadIO.baud:=baud
serialReadIO.readlen:=dataLen
serialReadIO.writelen:=dataLen
serialReadIO.serflags:=flags
serialReadIO.stopbits:=stopBits
serialReadIO.ctlchar:=286457856 ->0x11130000
serialReadIO.rbuflen:=16384
serialReadIO.iostd.command:=SDCMD_SETPARAMS
error:=DoIO(serialReadIO)
IF error
StringF(errorstr,'error read setparams: \d',error)
debugLog(LOG_ERROR,errorstr)
ENDIF
queueSerialRead({serbuff})
RETURN FALSE
ENDIF
ELSE
Delay(30)
rcount++
IF rcount<120 THEN JUMP retry
ENDIF
deleteExtIO(serialWriteIO)
serialWriteIO:=NIL
ENDIF
deletePort(serialWriteMP)
serialWriteMP:=NIL
ENDIF
deleteExtIO(serialReadIO)
serialReadIO:=NIL
ENDIF
deletePort(serialReadMP)
serialReadMP:=NIL
ENDIF
Dispose(serialCache)
serialCache:=NIL
ENDIF
RETURN TRUE
ENDIF
ENDPROC FALSE
PROC setBaud(rate)
IF serialReadIO<>NIL
purgeLine() /* Flush recieve buffer */
AbortIO(serialReadIO) /* Abort PurgeLine's read req */
WaitIO(serialReadIO)
serialReadIO.baud:=rate /* set baud rate */
serialReadIO.iostd.command:=SDCMD_SETPARAMS
DoIO(serialReadIO)
serialReadIO.iostd.command:=CMD_READ /* Restart read req */
SendIO(serialReadIO)
ENDIF
ENDPROC
PROC intDoReset(s: PTR TO CHAR)
DEF loop,i
i:=StrLen(s)
FOR loop:=0 TO i-1
IF(s[loop]="~")
Delay(110)
ELSE
IF(s[loop]="|")
serPutChar("\b")
Delay(60)
ELSE
serPutChar(s[loop])
ENDIF
ENDIF
ENDFOR
serPutChar("\b")
ENDPROC
PROC dropDTR()
DEF ni:PTR TO nodeInfo
IF telnetSocket>=0
CloseSocket(telnetSocket)
CloseLibrary(socketbase)
socketbase:=NIL
waitSocketLib(TRUE)
telnetSocket:=-1
IF sopt.toggles[TOGGLES_MULTICOM]
ObtainSemaphore(masterNode)
ni:=(masterNode.myNode[node])
ni.netSocket:=-1
ReleaseSemaphore(masterNode)
ENDIF
ENDIF
IF(serialReadIO<>NIL)
IF(CheckIO(serialReadIO))=FALSE
AbortIO(serialReadIO)
ENDIF
WaitIO(serialReadIO)
closeSerial() ->// this was not resetting SEROUT Mon Jun 8 04:02:50 1992
Delay(60)
IF(openSerial(cmds.openingBaud,8,1)<>0)
debugLog(LOG_ERROR,'Can''t re-open Serial Device!')
ENDIF
Delay(60)
ENDIF
offHookFlag:=FALSE
IF sopt.toggles[TOGGLES_MULTICOM]
ObtainSemaphore(masterNode)
ni:=(masterNode.myNode[node])
ni.offHook:=FALSE
ReleaseSemaphore(masterNode)
ENDIF
ENDPROC
PROC rePurge()
WHILE(checkSer())
WaitIO(serialReadIO)
serialReadIO.iostd.command:=CMD_READ
SendIO(serialReadIO)
ENDWHILE
ENDPROC
PROC resetSystem()
DEF tempStr[255]:STRING
DEF ni:PTR TO nodeInfo
ioFlags[IOFLAG_KBD_IN]:=-1
ioFlags[IOFLAG_SER_IN]:=0
IF(ioFlags[IOFLAG_FIL_IN]) THEN ioFlags[IOFLAG_FIL_IN]:=0
ioFlags[IOFLAG_SCR_OUT]:=0
ioFlags[IOFLAG_SER_OUT]:=-1
IF (telnetSocket>=0)
CloseSocket(telnetSocket)
CloseLibrary(socketbase)
socketbase:=NIL
waitSocketLib(TRUE)
telnetSocket:=-1
IF sopt.toggles[TOGGLES_MULTICOM]
ObtainSemaphore(masterNode)
ni:=(masterNode.myNode[node])
ni.netSocket:=-1
ReleaseSemaphore(masterNode)
ENDIF
ENDIF
IF(StrLen(cmds.serDev)<>0)
purgeLine()
dropDTR()
Delay(25)
IF(cmds.acLvl[LVL_VARYING_LINK_RATE]=1)
setBaud(cmds.openingBaud)
Delay(25)
ENDIF
intDoReset(cmds.mReset)
IF(sopt.toggles[TOGGLES_TRUERESET])
Delay(30)
serPuts('ATZ\b')
lineInput('','',50,5,tempStr)
IF(StriCmp(tempStr,'ATZ',3))
Delay(50)
ENDIF
reInitModem()
intDoReset(cmds.mReset)
ENDIF
Delay(30)
IF(sopt.toggles[TOGGLES_NOPURGE]) THEN RETURN
IF(sopt.toggles[TOGGLES_REPURGE])
rePurge()
RETURN
ENDIF
purgeLine()
ioFlags[IOFLAG_SER_OUT]:=0
ENDIF
offHookFlag:=FALSE
IF sopt.toggles[TOGGLES_MULTICOM]
ObtainSemaphore(masterNode)
ni:=(masterNode.myNode[node])
ni.offHook:=FALSE
ReleaseSemaphore(masterNode)
ENDIF
ENDPROC
PROC checkPasswordStrength(newPass:PTR TO CHAR)
DEF min,act,lower=0,upper=0,num=0,sym=0,i
min:=readToolTypeInt(TOOLTYPE_BBSCONFIG,0,'MIN_PASSWORD_LENGTH')
IF min>0
IF StrLen(newPass)<min THEN RETURN 1
ENDIF
min:=readToolTypeInt(TOOLTYPE_BBSCONFIG,0,'MIN_PASSWORD_STRENGTH')
IF min>0
act:=0
IF min>4 THEN min:=4
FOR i:=0 TO StrLen(newPass)-1
IF (newPass[i]>=48) AND (newPass[i]<=57)
num:=1
ELSEIF (newPass[i]>=65) AND (newPass[i]<=90)
upper:=1
ELSEIF (newPass[i]>=97) AND (newPass[i]<=122)
lower:=1
ELSE
sym:=1
ENDIF
ENDFOR
act:=lower+upper+num+sym
IF act<min THEN RETURN 2
ENDIF
ENDPROC TRUE
PROC setNewPassword(user:PTR TO user, userMisc:PTR TO userMisc, newpass:PTR TO CHAR)
DEF passType
IF checkToolType(TOOLTYPE_BBSCONFIG,0,'PASSWORD_SECURITY','LEGACY')
passType:=PWD_LEGACY
ELSEIF checkToolType(TOOLTYPE_BBSCONFIG,0,'PASSWORD_SECURITY','PBKDF2_5')
passType:=PWD_PBKDF2_5
ELSEIF checkToolType(TOOLTYPE_BBSCONFIG,0,'PASSWORD_SECURITY','PBKDF2_50')
passType:=PWD_PBKDF2_50
ELSEIF checkToolType(TOOLTYPE_BBSCONFIG,0,'PASSWORD_SECURITY','PBKDF2_100')
passType:=PWD_PBKDF2_100
ELSEIF checkToolType(TOOLTYPE_BBSCONFIG,0,'PASSWORD_SECURITY','PBKDF2_1000')
passType:=PWD_PBKDF2_1000
ELSEIF checkToolType(TOOLTYPE_BBSCONFIG,0,'PASSWORD_SECURITY','PBKDF2_10000')
passType:=PWD_PBKDF2_10000
ELSE
passType:=PWD_LEGACY
ENDIF
userMisc.pwdType:=passType
SELECT passType
CASE PWD_LEGACY
UpperStr(newpass)
user.pwdHash:=calcPasswordHash(newpass)
MemFill(userMisc.pwdHash,32,0)
CASE PWD_PBKDF2_5
calcPasswordSalt(userMisc.salt)
pkcs5_pbkdf2(newpass,StrLen(newpass), userMisc.salt,8, userMisc.pwdHash, 32, 5)
user.pwdHash:=-1
CASE PWD_PBKDF2_50
calcPasswordSalt(userMisc.salt)
pkcs5_pbkdf2(newpass,StrLen(newpass), userMisc.salt,8, userMisc.pwdHash, 32, 50)
user.pwdHash:=-1
CASE PWD_PBKDF2_100
calcPasswordSalt(userMisc.salt)
pkcs5_pbkdf2(newpass,StrLen(newpass), userMisc.salt,8, userMisc.pwdHash, 32, 100)
user.pwdHash:=-1
CASE PWD_PBKDF2_1000
calcPasswordSalt(userMisc.salt)
pkcs5_pbkdf2(newpass,StrLen(newpass), userMisc.salt,8, userMisc.pwdHash, 32, 1000)
user.pwdHash:=-1
CASE PWD_PBKDF2_10000
calcPasswordSalt(userMisc.salt)
pkcs5_pbkdf2(newpass,StrLen(newpass), userMisc.salt,8, userMisc.pwdHash, 32, 10000)
user.pwdHash:=-1
ENDSELECT
ENDPROC
PROC checkUserPassword(user:PTR TO user, userMisc:PTR TO userMisc, testpass:PTR TO CHAR)
DEF tmpHash[32]:ARRAY OF CHAR
DEF tempPass[100]:STRING
DEF res,maxAttempts
SELECT userMisc.pwdType
CASE PWD_LEGACY
StrCopy(tempPass,testpass)
UpperStr(tempPass)
res:=(user.pwdHash=calcPasswordHash(tempPass))
CASE PWD_PBKDF2_5
pkcs5_pbkdf2(testpass,StrLen(testpass), userMisc.salt,8, tmpHash, 32, 5)
res:=(StrCmp(tmpHash,userMisc.pwdHash,32))
CASE PWD_PBKDF2_50
pkcs5_pbkdf2(testpass,StrLen(testpass), userMisc.salt,8, tmpHash, 32, 50)
res:=(StrCmp(tmpHash,userMisc.pwdHash,32))
CASE PWD_PBKDF2_100
pkcs5_pbkdf2(testpass,StrLen(testpass), userMisc.salt,8, tmpHash, 32, 100)
res:=(StrCmp(tmpHash,userMisc.pwdHash,32))