home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / PACKET / RLI120.ARK / LOGIN.MAC < prev    next >
Text File  |  1987-05-11  |  4KB  |  183 lines

  1. ; LOGIN.MAC - 5/11/87 - Log user onto system.
  2.  
  3.     .z80
  4.     maclib    TNC.LIB
  5.  
  6.     entry    login,motd,mbbsq
  7.     entry    bbsa,bbsb,bbsl,illdig,excill,ndigia,ndigib,gm15
  8.  
  9.     external    getusr,usopt,ushbbs,iscall,ynbq
  10.     external    usobbs,usoexp,usoloc,usosys,usoexa,usoexb
  11.     external    mode,cmd,cmdlen,@prtx
  12.     external    $memry,exclud,parse,flds,f3st,f3l
  13.     external    @cmp,@mcmd,scall,mcall,newmsg,tnca,tncb,movcal
  14.     external    log,logo,logtxt,llogtxt,event
  15.  
  16.     tncdefs
  17.     asciictl
  18.  
  19.     dseg
  20. motd:    ds    2        ; Address of message of the day
  21. mbbsq:    ds    2        ; Msg to ask for his home BBS
  22. ndigia:    ds    1
  23. ndigib:    ds    1
  24. bbsa:    ds    1
  25. bbsb:    ds    1
  26. bbsl:    ds    1
  27. excill:    ds    1
  28. illdig:    ds    1
  29. ndigi:    ds    1
  30. start:    ds    2
  31. len:    ds    1
  32. f3ptr:    ds    2
  33. f3left:    ds    1
  34. gm15:    ds    2
  35.     cseg
  36.  
  37. ; If this digi call is illegal, Sorry Charlie.
  38.  
  39. ckildi:    cmpm    illdig,true    ; Allow illegal digi call?
  40.     ret    z        ; Yes
  41. ; *** Temp at K1BC
  42.     ld hl,    (start)        ; Point at call of digi
  43.     comp    ,refdig,6    ; The one causing digipeater disaster?
  44.     jp z,    exclud        ; If so, refuse connection.
  45. ; *** Temp at K1BC
  46.     ld    de,($memry)
  47.     ld    hl,(start)
  48.     ld    a,(len)
  49.     call    movcal
  50.     ld    hl,($memry)
  51.     call    iscall
  52.     jp    c,exclud
  53.     ret
  54.  
  55. ; Following patch is for a local problem at K1BC.  You can put
  56. ; a callsign in here to prevent connects which digipeat to you
  57. ; via a particular digipeater. I had to do it to reduce the
  58. ; level of Digipeater Disaster on my 2-meter port.
  59.  
  60. refdig:    db    'BADDIG'    ; *** Temp at K1BC
  61.  
  62. ; Check that user not using too many digipeats.
  63. ; If illegal digi calls exclude, check them.
  64.  
  65. ckdigi:    call    parse
  66.     ld    a,(flds)
  67.     dec    a        ; Is a "VIA"?
  68.     ret    z        ; No, no digi
  69.     ld    hl,(f3st)
  70.     ld    (f3ptr),hl
  71.     ld    (start),hl
  72.     movb    f3left,f3l
  73.     xor    a
  74.     ld    (len),a
  75.     inc    a
  76.     ld    (ndigi),a    ; Count the initial digi
  77. ckdiga:    ld    hl,(f3ptr)
  78.     ld    a,(hl)        ; Get char
  79.     inc    hl
  80.     ld    (f3ptr),hl
  81.     cp    ','        ; Is a comma?
  82.     jr    nz,ckdigb    ; No
  83.     ld    hl,ndigi
  84.     inc    (hl)        ; Count the comma
  85.     call    ckildi        ; Illegal digi call?
  86.     movw    start,f3ptr
  87.     mvim    len,0
  88.     jr    ckdigc
  89. ckdigb:    ld    hl,len
  90.     inc    (hl)        ; Count char in this call
  91. ckdigc:    ld    hl,f3left
  92.     dec    (hl)        ; More chars to check?
  93.     jr    nz,ckdiga    ; Yes
  94.     call    ckildi        ; Illegal digi call?
  95.  
  96.     ld    hl,ndigia
  97.     ld    a,(iobyte)
  98.     cp    raiob
  99.     jr    z,ckdigd
  100.     ld    hl,ndigib
  101. ckdigd:    ld    a,(ndigi)
  102.     ld    c,a
  103.     ld    a,(hl)
  104.     cp    c
  105.     jp    c,exclud    ; Too many digi
  106.     ret
  107.  
  108. ; Log the user in.
  109. ; Call with (B)=TNC ID, user call and connect path in cmd.
  110.  
  111. login:    mvim    event,'C'
  112.     ld    hl,logtxt
  113.     ld    (hl),b        ; TNC ID (A, B, L)
  114.     inc    hl
  115.     ld    (hl),' '
  116.     inc    hl
  117.     movcmd    ,0,llogtxt-3
  118.     ld    (hl),cr
  119.     zmov    scall,mcall,6    ; Save call adjacent bbs
  120.     ld    de,mcall
  121.     ld    hl,cmd
  122.     ld    a,(cmdlen)
  123.     call    movcal        ; Save call of station that connected
  124.     mvim    mode,umode    ; Set user mode
  125.     call    log        ; Log the connect
  126.     cmpm    excill,true    ; Exclude illegal calls?
  127.     jr    nz,logina    ; No, allow anything
  128.     ld    hl,mcall    ; Point to call
  129.     call    iscall        ; Is it legal?
  130.     jp    c,exclud    ; No, Sorry Charlie
  131. logina:    call    getusr        ; Get user record in
  132.     ld    a,(usopt)
  133.     and    usobbs        ; Is bbs?
  134.     ret    nz        ; Yes, can do lotsa things
  135.  
  136.     ld    a,(usopt)
  137.     and    usosys        ; Is sysop?
  138.     jp nz,    cknewm        ; Yes, tell if new mail, bypass checks.
  139.  
  140.     ld    a,(logtxt)    ; TNC ID (A,B,L)
  141.     cp    'L'        ; Linked?
  142.     jr    z,loginl    ; See if allowed
  143.     ld    b,usoexa
  144.     cp    'A'        ; On port A?
  145.     jr    z,xx        ; Yes
  146.     ld    b,usoexb
  147. xx:    ld    a,(usopt)
  148.     and    b
  149.     jp    nz,exclud    ; Sorry Charlie
  150.     call    ckdigi        ; Check if too many digi
  151.     ld    a,(usopt)
  152.     and    usoloc        ; Local user?
  153.     jr    nz,loginc    ; Yes, can connect if only bbs set
  154.     ld    hl,bbsa        ; Point to COMM port flag
  155.     cmpm    iobyte,raiob    ; On COMM port?
  156.     jr    z,loginb    ; Yes
  157.     ld    hl,bbsb        ; Point to PRINTER port flag
  158. loginb:    ld    a,(hl)        ; Get flag
  159.     call    ynbq        ; Only bbs this port at this time?
  160.     jp    nz,exclud    ; Sorry Charlie
  161. loginc:    ld    hl,(motd)
  162.     ld    a,(usopt)
  163.     and    usoexp        ; Expert user?
  164.     call    z,@prtx        ; Show msg of day if not
  165. cknewm:    ld a,    (ushbbs)    ; Do we know his home BBS?
  166.     cp    ' '
  167.     ld hl,    (mbbsq)        ; If not, print msg requesting it
  168.     call z,    @prtx
  169.     jp    newmsg        ; Show any new mail
  170.  
  171. loginl:    ld a,    (bbsl)        ; BBS only on Links now?
  172.     call    ynbq        ; ..
  173.     jr z,    loginm        ; If so, see if it's an excluded guy
  174.     prtx    gm15        ; If not, tell him so
  175.     jp    exclud        ; And flush the connection
  176.  
  177. loginm:    ld a,    (usopt)        ; See if a bad guy
  178.     and    usoexa+usoexb    ;  excluded on both ports?
  179.     xor    usoexa+usoexb
  180.     jp z,    exclud        ; If so, don't let him on in a link
  181.     jr    loginc        ; OK, let him in
  182.     end
  183.