Skip to content

Latest commit

 

History

History
582 lines (556 loc) · 18 KB

logon1.pas

File metadata and controls

582 lines (556 loc) · 18 KB
 
Nov 18, 2000
Nov 18, 2000
1
2
3
4
5
6
7
(*****************************************************************************)
(*> <*)
(*> LOGON1 .PAS - Written by Eric Oman <*)
(*> <*)
(*> Logon functions -- Part 1. <*)
(*> <*)
(*****************************************************************************)
Nov 25, 2000
Nov 25, 2000
8
{$A+,B+,E+,F+,I+,L+,N-,O+,R-,S+,V-}
Nov 18, 2000
Nov 18, 2000
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
unit logon1;
interface
uses
crt, dos,
{rcg11172000 no overlay under Linux.}
{overlay,}
logon2, newusers,
mail0, mail1, mail2, mail3, mail4,
misc2, miscx,
cuser,
doors,
archive1,
menus, menus2,
common;
function getuser:boolean;
implementation
const
ilogon=^G'FAILED LOGON ATEMP'^G;
procedure getpws(var ok:boolean; var tries:integer);
var phone,pw,s:astr;
begin
ok:=TRUE; echo:=FALSE;
commandline('Password - "'+thisuser.pw+'"');
sprompt(#3#0+'User password : '+#3#5); input(pw,20);
if (systat.phonepw) then
begin
commandline('Phone # - "'+thisuser.ph+'"');
sprompt(#3#0+'Complete phone #: '+#3#5+'###-###-');
input(phone,4); echo:=TRUE;
end else
phone:=(copy(thisuser.ph,9,4));
echo:=TRUE;
if ((thisuser.pw<>pw) or (copy(thisuser.ph,9,4)<>phone)) then
begin
nl; print(ilogon); nl;
if (not hangup) and (usernum<>0) then begin
s:=#3#8+'>>'+#3#1+' Illegal logon attempt! Tried: '+
caps(thisuser.name)+' #'+cstr(usernum);
if (usernum<>1) then
begin
s:=s+' PW="'+pw+'"';
if (systat.phonepw) then s:=s+', PH#="'+phone+'"';
end;
sl1(s);
end;
inc(thisuser.illegal);
seek(uf,usernum); write(uf,thisuser);
inc(tries); if (tries>=systat.maxlogontries) then hangup:=TRUE;
ok:=FALSE;
end;
if ((aacs(systat.spw)) and (ok) and (incom) and (not hangup)) then
begin
echo:=FALSE;
sprompt(#3#0+'System password: '+#3#5);
input(pw,20);
if (pw<>systat.sysoppw) then
begin
nl; print(ilogon); nl;
sl1(#3#8+'>>'+#3#1+' Illegal System password'); inc(tries);
if (tries>=systat.maxlogontries) then hangup:=TRUE;
ok:=FALSE;
end;
echo:=TRUE;
end;
if ((ok) and (systat.shuttlelog) and (thisuser.lockedout)) then
begin
printf(thisuser.lockedfile);
sysoplog(#3#7+'['+#3#8+'*'+#3#7+'] '+#3#3+thisuser.name+#3#7+' --> '+#3#5+
'Attempt to access system when locked out'+#3#7+' <--');
hangup:=TRUE;
end;
end;
procedure doshuttle;
var s,cmd,pw,newmenucmd:astr;
tries,i,nocsave:integer;
loggedon,gotname,noneedname,ok,cmdnothid,cmdexists:boolean;
begin
nl;
print('[> Project Coyote / Shuttle Logon @ '+dat+' ('+spd+' bps)');
nl;
with thisuser do
begin
if pynq('Do you desire ANSI graphics? ') then ac:=ac+[ansi] else ac:=ac-[ansi];
ac:=ac-[avatar];
end;
nl; printf('preshutl'); last_menu:='shuttle.mnu';
curmenu:=systat.menupath+last_menu; readin;
loggedon:=FALSE; gotname:=FALSE; tries:=0;
chelplevel:=2;
repeat
tshuttlelogon:=0;
mainmenuhandle(cmd);
if ((not gotname) and (cmd<>'')) then
begin
noneedname:=TRUE; i:=0;
repeat
fcmd(cmd,i,noc,cmdexists,cmdnothid);
if (i<>0) then
if (cmdr[i].cmdkeys<>'OP') and (cmdr[i].cmdkeys<>'O1') and
(cmdr[i].cmdkeys<>'O2') and (cmdr[i].cmdkeys[1]<>'H') then
noneedname:=FALSE;
until (i=0);
if (not noneedname) then
begin
nl;
sprompt(#3#0+'Enter your user name or number : ');
finduser(s,usernum);
if (usernum>=1) then begin
reset(uf); seek(uf,usernum); read(uf,thisuser);
getpws(ok,tries);
gotname:=ok;
nl;
if (gotname) then
begin
readinmacros; readinzscan; useron:=TRUE;
schangewindow(TRUE,systat.curwindow); commandline('');
print('"'+thisuser.name+'" logged on.');
sysoplog('Logged on to Shuttle Menu as '+caps(thisuser.name)+' #'+
cstr(usernum));
if (thisuser.waiting<>0) then
begin
nl; nl;
sprint(#3#5+'NOTE: '+#3#3+'You have '+
#3#0+cstr(thisuser.waiting)+
#3#3+' pieces of mail waiting.');
nl;
if pynq('Read it now? ') then readmail;
nl;
end;
end;
end else
print('You are not a member of this BBS.');
end;
end;
if ((gotname) or (noneedname)) then
begin
newmenucmd:='';
repeat domenuexec(cmd,newmenucmd) until (newmenucmd='');
case tshuttlelogon of
1:if (systat.shuttlepw='') then loggedon:=TRUE
else begin
nl;
echo:=FALSE;
sprompt(#3#0+'Enter BBS Password: '); input(pw,20); nl;
echo:=TRUE;
if (pw=systat.shuttlepw) then loggedon:=TRUE
else begin
sl1(#3#8+'>>'+#3#1+' Illegal Shuttle Logon password: "'+pw+'"');
print(ilogon);
inc(tries);
end;
end;
2:if (gotname) then
begin
nl;
print('You already ARE a user!');
print('Why do you want to log on as new again!?');
print('Sheesshhhhh.....');
delay(1500);
end else
begin
nl;
if pynq('Log on as a NEW USER? ') then
begin
newuserinit('');
newuser;
if (usernum>0) and (not hangup) then
begin
gotname:=TRUE; useron:=TRUE; logon1st;
end;
end;
end;
3:if ((thisuser.sl>systat.newsl) or
(thisuser.dsl>systat.newdsl)) then
begin
sysoplog('Found out the Shuttle password.'); nl;
print('You are a validated member of this BBS.');
print('The BBS password is "'+systat.shuttlepw+'"');
sprint('^3Write it down ^1for faster logons in the future!');
nl; loggedon:=pynq('Log on now? ');
end else
begin
nl; print('Sorry, you have not been validated yet.');
sysoplog('Tried to find out Shuttle password - was not validated.');
end;
end;
end;
if (tries=systat.maxlogontries) then hangup:=TRUE;
until (loggedon) or (hangup);
end;
procedure getacsuser(eventnum:integer; acsreq:astr);
var user:userrec;
sr:smalrec;
r:real;
s,pw:astr;
cp,un,i:integer;
c:char;
sfo:boolean;
procedure dobackspace;
begin
dec(cp);
outkey(^H); outkey(' '); outkey(^H);
end;
begin
printf('acsea'+cstr(eventnum));
if (nofile) then begin
print('Restricted time zone.');
print('Only certain users allowed online at this time.');
end;
nl;
print('Current time: '+date+' '+time+'.');
print('Enter your user name/number *now*.');
print('If you do not enter within 20 seconds, you will be hung up.');
prt(':');
checkhangup;
if (hangup) then exit;
r:=timer; s:=''; cp:=1; echo:=TRUE;
repeat
checkhangup;
c:=inkey;
if (c<>#0) then
case c of
^H:if (cp>1) then dobackspace;
^X:while (cp<>1) do dobackspace;
#32..#255:
if (cp<=36) then begin
c:=upcase(c);
outkey(c);
s[cp]:=c; inc(cp);
end;
end;
if (timer-r>20.0) then hangup:=TRUE;
until ((c=^M) or (hangup));
s[0]:=chr(cp-1);
if (not hangup) then begin
nl; nl;
un:=value(s);
if (un<>0) then begin
reset(uf);
if (un>filesize(uf)-1) then un:=0
else begin
seek(uf,un);
read(uf,user);
end;
close(uf);
end else begin
sfo:=(filerec(sf).mode<>fmclosed);
if (not sfo) then reset(sf);
un:=0; i:=1;
while ((i<=filesize(sf)-1) and (un=0)) do begin
seek(sf,i); read(sf,sr);
if (s=sr.name) then un:=sr.number;
inc(i);
end;
if (un>filesize(sf)-1) then un:=0;
if (not sfo) then close(sf);
if (un<>0) then begin
reset(uf);
seek(uf,un); read(uf,user);
close(uf);
end;
end;
if (un<>0) then usernum:=un;
if ((user.deleted) or (not aacs1(user,usernum,acsreq))) then un:=0;
if (un=0) then begin
print('Invalid user account.'); nl;
printf('acseb'+cstr(eventnum));
if (nofile) then begin
print('This time window allows certain other users to get online.');
print('Please call back later, after it has ended.');
end;
hangup:=TRUE;
end else begin
print('Valid user account - Welcome.');
nl;
echo:=FALSE;
sprompt('Enter your password: '); input(pw,20);
if (pw<>user.pw) then begin
nl;
print('Invalid password. Hanging up.'); nl;
printf('acseb'+cstr(eventnum));
if (nofile) then begin
print('This time window allows certain other users to get online.');
print('Please call back later, after it has ended.');
end;
hangup:=TRUE;
end else
nl;
echo:=TRUE;
end;
end;
end;
function getuser:boolean;
var pw,s,phone,newusername,acsreq:astr;
lng:longint;
tries,i,ttimes,z,zz,eventnum:integer;
done,nu,ok,toomuch,wantnewuser,acsuser:boolean;
begin
wasnewuser:=FALSE; wasguestuser:=FALSE;
thisuser.tltoday:=15; { allow user 15 minutes to log on >MAX< }
extratime:=0.0; freetime:=0.0; choptime:=0.0;
with thisuser do begin
usernum:=-1;
name:='NO USER'; realname:='Not entered yet';
sl:=0; dsl:=0; ar:=[];
ac:=[onekey,pause,novice,color]; ac:=ac+systat.newac;
linelen:=80; pagelen:=25;
end;
getdatetime(timeon);
mread:=0; extratime:=0.0; freetime:=0.0;
realsl:=-1; realdsl:=-1;
newusername:='';
sl1('');
s:=#3#3+'Logon '+#3#5+'['+dat+']'+#3#4+' (';
if (spd<>'KB') then s:=s+spd+' baud)' else s:=s+'Keyboard)';
sl1(s);
wantnewuser:=FALSE;
macok:=FALSE; nu:=FALSE;
echo:=TRUE; nl;
pw:='';
if (spd='300') then
begin
if (systat.lock300) then
begin
printf('no300.msg');
if (nofile) then print('300 baud callers not allowed on this BBS.');
hangup:=TRUE;
end;
if ((systat.b300lowtime<>0) or (systat.b300hitime<>0)) then
if (not intime(timer,systat.b300lowtime,systat.b300hitime)) then begin
printf('no300h.msg');
if (nofile) then
print('300 baud calling hours are from '+ctim(systat.b300lowtime)+
' to '+ctim(systat.b300hitime));
hangup:=TRUE;
end;
if (not hangup) then
if ((systat.b300lowtime<>0) or (systat.b300hitime<>0)) then begin
printf('yes300h.msg');
if (nofile) then begin
print('NOTE: 300 baud calling times are');
print('restricted to the following hours ONLY:');
print(' '+ctim(systat.b300lowtime)+' to '+ctim(systat.b300hitime));
end;
end;
end;
acsuser:=FALSE;
for i:=0 to numevents do
with events[i]^ do
if ((etype='A') and (active) and (checkeventtime(i,0))) then begin
acsuser:=TRUE;
acsreq:=events[i]^.execdata;
eventnum:=i;
end;
if (acsuser) then getacsuser(eventnum,acsreq);
if ((systat.shuttlelog) and (not fastlogon) and (not hangup)) then doshuttle;
nl;
pver;
if (not wantnewuser) and (not fastlogon) then begin
if pynq(fstring.ansiq) then thisuser.ac:=thisuser.ac+[ansi]
else thisuser.ac:=thisuser.ac-[ansi];
thisuser.ac:=thisuser.ac-[avatar];
printf('welcome');
z:=0;
repeat
inc(z);
printf('welcome'+cstr(z));
until (z=9) or (nofile) or (hangup);
end;
ttimes:=0; tries:=0; s:='';
repeat
repeat
if (not wantnewuser) then begin
if (systat.multitask) then
print('[> System under Multitasking environment <]');
if (fstring.note[1]<>'') then sprint(fstring.note[1]);
if (fstring.note[2]<>'') then sprint(fstring.note[2]);
if ((systat.guestuser<>-1) and (fstring.guestline<>'')) then
sprint(fstring.guestline);
if (fstring.lprompt<>'') then sprompt(fstring.lprompt);
end;
if (systat.shuttlelog) and (wantnewuser) then begin
s:='';
usernum:=-1;
end else
finduser(s,usernum);
if (pos('@',s)<>0) then begin
nl;
print('Nice try, idiot - that no longer works.');
print('(SysOp has been notified.)');
sl1('Idiot tried to gain illegal system info with @@ MCI usage at logon');
hangup:=TRUE;
end;
if (not hangup) then begin
nl;
newusername:='';
if (usernum=0) then
if (s<>'') then begin
sprint(fstring.namenotfound);
if pynq('"'+s+'" - Log on as NEW? ') then usernum:=-1;
nl;
newusername:=s;
end else begin
inc(ttimes);
if (ttimes>systat.maxlogontries) then hangup:=TRUE;
end;
end;
until ((usernum<>0) or (hangup));
ok:=TRUE; done:=FALSE;
if (not hangup) then
case usernum of
-1:begin
newuserinit(newusername);
nu:=TRUE;
done:=TRUE; ok:=FALSE;
end;
-2:begin
reset(uf);
usernum:=systat.guestuser;
if (usernum>filesize(uf)-1) then begin
sl1(#3#8+'>>'+#3#1+' Guest user account unavailable!');
print('Guest user account unavailable.');
print('SysOp will be notified.');
hangup:=TRUE;
end else begin
seek(uf,systat.guestuser); read(uf,thisuser);
print('Terminal configuration:');
cstuff(11,1,thisuser);
cstuff(3,1,thisuser);
nl;
print('As a guest user we ask that you enter a unique name for our system records.');
cstuff(7,1,thisuser);
nl;
wasguestuser:=TRUE; done:=TRUE;
end;
close(uf);
end;
else
if (usernum=-3) then begin
nl;
print('Nice try, idiot - that no longer works.');
print('(SysOp has been notified.)');
sl1('Idiot tried to crash system with negative number entry at logon');
hangup:=TRUE;
end else begin
reset(uf);
seek(uf,usernum); read(uf,thisuser);
echo:=FALSE;
if (not systat.localsec) then begin
if (not useron) then begin
useron:=TRUE;
schangewindow(TRUE,systat.curwindow);
end else
schangewindow(FALSE,systat.curwindow);
commandline('Password - "'+thisuser.pw+'"');
useron:=FALSE;
end;
getpws(ok,tries);
if (ok) then
begin
done:=TRUE;
readinmacros; readinzscan;
end;
close(uf);
if (not ok) then begin
useron:=TRUE; sclearwindow; useron:=FALSE;
end;
end;
end;
until ((done) or (hangup));
if ((thisuser.lockedout) and (not hangup)) then begin
printf(thisuser.lockedfile);
sysoplog(#3#7+'['+#3#8+'*'+#3#7+'] '+#3#3+thisuser.name+#3#7+' --> '+#3#5+
'Attempt to access system when locked out'+#3#7+' <--');
hangup:=TRUE;
end;
if ((not nu) and (not hangup)) then
begin
toomuch:=FALSE;
if (thisuser.laston<>date) then begin
thisuser.ontoday:=0;
thisuser.tltoday:=systat.timeallow[thisuser.sl];
end;
if (((rlogon in thisuser.ac) or (systat.callallow[thisuser.sl]=1)) and
(thisuser.ontoday>=1) and (thisuser.laston=date)) then begin
printf('2manycal');
if (nofile) then print('You can only log on once per day.');
toomuch:=TRUE;
end else
if ((thisuser.ontoday>=systat.callallow[thisuser.sl]) and
(thisuser.laston=date)) then begin
printf('2manycal');
if (nofile) then
print('You can only log on '+cstr(systat.callallow[thisuser.sl])+' times per day.');
toomuch:=TRUE;
end else
if ((thisuser.tltoday<=0) and (thisuser.laston=date)) then begin
printf('notlefta');
if (nofile) then
prompt('You can only log on for '+cstr(systat.timeallow[thisuser.sl])+' minutes per day.');
toomuch:=TRUE;
if (thisuser.timebank>0) then begin
nl; nl;
sprint(#3#5+'However, you have '+cstrl(thisuser.timebank)+
' minutes left in your Time Bank.');
dyny:=TRUE;
if pynq('Withdraw from Time Bank? [Y] : ') then begin
prt('Withdraw how many minutes? '); inu(zz); lng:=zz;
if (lng>0) then begin
if (lng>thisuser.timebank) then lng:=thisuser.timebank;
dec(thisuser.timebankadd,lng);
if (thisuser.timebankadd<0) then thisuser.timebankadd:=0;
dec(thisuser.timebank,lng);
inc(thisuser.tltoday,lng);
sprint('^5In your account: ^3'+cstr(thisuser.timebank)+
'^5 Time left online: ^3'+cstr(trunc(nsl) div 60));
sysoplog('TimeBank: No time left at logon, withdrew '+cstrl(lng)+' minutes.');
end;
end;
if (nsl>=0) then toomuch:=FALSE else sprint(#3#7+'Hanging up.');
end;
end;
if (toomuch) then
begin
sl1(#3#7+' [*] '+#3#1+thisuser.name+' #'+cstr(usernum)+' tried logging on more than allowed.');
hangup:=TRUE;
end;
if (tries=systat.maxlogontries) then hangup:=TRUE;
if (not hangup) then inc(thisuser.ontoday);
end;
checkit:=FALSE;
if ((usernum>0) and (not hangup)) then
begin
getuser:=nu;
useron:=TRUE;
schangewindow(not cwindowon,systat.curwindow);
commandline('- Successful Logon -');
useron:=FALSE;
inittrapfile;
s:=#3#3+'Welcome to '+systat.bbsname+#3#3;
if (fidor.net<>0) then s:=s+' ('+cstr(fidor.zone)+':'+cstr(fidor.net)+'/'+
cstr(fidor.node)+'.'+cstr(fidor.point)+')';
s:=s+', '+nam;
nl; sprint(s); nl;
end;
if (hangup) then getuser:=FALSE;
end;
end.