.TITLE LOGIN Login program .NLIST BEX .ENABL LC ; ; Login program ; ; This program is used to log a user on the system using a userid and ; password either passed in the chain area or solicited from the user. ; If the name and password are correct or the user is already logged in, ; the program exits successfully. Otherwise the user is reprompted for ; another try. Callers must handle possible abuse due to premature ; connection close or control-c. ; ; External symbols ; .GLOBL LOGIN ;user routine .GLOBL RDASC,TYPE ;char i/o routines ; ; Entry symbols ; .GLOBL PRBYT,RDBYT ;char i/o routines ; ; System definitions ; .ASECT .MCALL .COM,.CHR,.PSA,.CLP,.FLG,.IOD,.CHN,.LGD ;dcnlib definitions .MCALL .MSG ;dcnlib macros .MCALL .GVAL,.EXIT,.TTYIN,.TTYOU,.LOOKU,.READW,.PURGE ;rt-11 macros .MCALL CALL,FORMAT ;netlib definitions .COM ;common definitions .CHR ;ascii character codes .PSA ;supervisor psa and par definitions .CLP ;rt-11 monitor area definitions .FLG ;flag bit definitions .IOD ;emulator monitor area extension .CHN ;define argument area .LGD ;define login file entry ; ; Module definitions ; ; Procedure segment ; .PSECT $BOSI,RO,I ; ; Login program ; START: .GVAL #ARGBLK,#CONFIG ;fetch configuration word MOV R0,CONWRD BIT #CHAIN$,@#JSW ;is userid in chain area BEQ LOG12 ;branch if no MOV #512,R2 ;yes. point to argument string MOV #USERID,R1 ;copy userid 1$: MOVB (R2)+,R0 ;get next char BEQ LOG12 ;branch if end JSR PC,TYPE BEQ 1$ ;ignore if control BCS 1$ ;ignore if special 2$: MOVB R0,(R1)+ ;save char 3$: MOVB (R2)+,R0 ;get next char BEQ LOG11 ;branch if end JSR PC,TYPE BEQ 3$ ;ignore if control BCC 2$ ;save if nonspecial CMPB R0,#'- BEQ 2$ ;save if "-" CLRB (R1)+ ;plant userid backstop MOV #PASSWD,R1 ;copy password 4$: MOVB (R2)+,R0 ;get next char BEQ LOG11 ;branch if end JSR PC,TYPE BEQ 4$ ;ignore if control BCS 4$ ;ignore if special 5$: MOVB R0,(R1)+ ;save char 6$: MOVB (R2)+,R0 ;get next char BEQ LOG10 ;branch if end JSR PC,TYPE BEQ 6$ ;ignore if control BCC 5$ ;save if nonspecial BR LOG10 ; LOG12: FORMAT #COM40 ;login: MOV #USERID,R1 ;copy userid 1$: JSR PC,RDASC ;get next char BEQ LOG12 ;branch if end BCS 1$ ;ignore if special 2$: MOVB R0,(R1)+ ;save char JSR PC,RDASC ;get next char BEQ LOG11 ;branch if end BCC 2$ ;save if nonspecial CMPB R0,#'- BEQ 2$ ;save if "-" CLRB (R1)+ ;plant userid backstop MOV #PASSWD,R1 ;copy password 3$: JSR PC,RDASC ;get next char BEQ LOG11 ;branch if end BCS 3$ ;ignore if special 4$: MOVB R0,(R1)+ ;save char JSR PC,RDASC ;get next char BEQ LOG10 ;branch if end BCC 4$ ;save if nonspecial BR LOG10 ; LOG11: CLRB (R1)+ ;plant userid backstop BIS #TTSPC$,@#JSW ;disable echo FORMAT #COM41 ;password: MOV #PASSWD,R1 ;copy password 1$: JSR PC,RDASC ;get next char BEQ 2$ ;branch if end BCS 1$ ;ignore if special MOVB R0,(R1)+ ;nonspecial. save char BR 1$ ; 2$: BIC #TTSPC$,@#JSW ;enable echo FORMAT #COM03C ;cr/lf LOG10: CLRB (R1)+ ;plant password backstop CALL LOGIN,#USERID,#PASSWD,#PROFIL ;pass the buck ASL R0 MOV R0,R2 ;display info message FORMAT USETXT(R2),#PROFIL TST R2 BEQ 1$ BIT #FUZZY$,CONWRD ;is this a fuzzball BEQ LOG12 ;branch if no .MSG <#^RLOG> ;yes. log info message FORMAT ERRTXT(R2),#PROFIL .MSG <#^RTT > BR LOG12 ; 1$: .LOOKU #ARGBLK,#0,#MSGNAM ;open login message file BCS 5$ ;branch if cant CLR BLOCK ;copy login messages 2$: .READW #ARGBLK,#0,#BUFFER,#256.,BLOCK ;read next block BCS 5$ ;branch if error INC BLOCK ;ok. fiddle variables MOV R0,R2 ASL R2 MOV #BUFFER,R1 ;copy buffer to terminal 3$: MOVB (R1)+,R0 ;get next char BIC #^C177,R0 BEQ 4$ ;branch if nul CMPB R0,#DEL BEQ 4$ ;branch if del CMPB R0,#SUB BEQ 5$ ;branch if sub JSR PC,PRBYT ;neither. output char 4$: SOB R2,3$ ;round and round BR 2$ ; 5$: BIT #FUZZY$,CONWRD ;is this a fuzzball BEQ 7$ ;branch if no .MSG <#^RLOG> ;yes. log info message FORMAT #USE99,#PROFIL .MSG <#^RTT > MOV @#SYSPTR,R5 ;rebuild addressability BIT #OPEBIT,IOHFLG(R5) ;is telnet connection open BEQ 7$ ;branch if no BIS #CLSBIT,IOHFLG(R5) ;yes. do not close it just yet 7$: .EXIT ; ; Subroutine to read byte ; R0 = byte ; RDBYT: .TTYIN ;fetch byte CMPB R0,#LF ;set cc RTS PC ; ; Subroutine to write byte ; R0 = byte ; PRBYT: .TTYOU ;put byte RTS PC ; ; Data segments ; .PSECT $BOSD,RO,D ;read-only data ; ; User subroutine error codes ; USETXT: .WORD USE00 ;0 login message .WORD USE02 ;1 directory not found .WORD USE03 ;2 login file error .WORD USE04 ;3 login incorrect ; ERRTXT: .WORD USE00 ;0 login message .WORD USE12 ;1 directory not found .WORD USE13 ;2 login file error .WORD USE14 ;3 login incorrect ; ; Misc tables and chairs ; MSGNAM: .RAD50 'SY LOGIN MSG' ;name of login message file ; ; Text strings ; COM40: .ASCIZ 'Login: ^+' COM41: .ASCIZ 'Password:^+' COM03C: .BYTE 0 USE99: .ASCIZ '?LOGIN-I-User ^A'' login complete' USE00: .ASCIZ 'Login ^A'' ^LD ^LT (last login ^D'' ^T'')' USE02: .ASCIZ '?LOGIN-W-Directory not found' USE03: .ASCIZ '?LOGIN-W-Login file error' USE04: .ASCIZ '?LOGIN-W-Login incorrect' USE12: .ASCIZ '?LOGIN-W-Directory not found ^A' USE13: .ASCIZ '?LOGIN-W-Login file error ^A' USE14: .ASCIZ '?LOGIN-W-Login incorrect ^A' .EVEN ; .PSECT $DATA,RW,I ;read-write data ; CONWRD: .BLKW 1 ;configuration word BLOCK: .BLKW 1 ;login message file block ARGBLK: .BLKW 5 ;rt-11 argument block PROFIL: .BLKB LF.LEN ;login profile USERID: .BLKB 16. ;userid PASSWD: .BLKB 8. ;password .EVEN BUFFER: .BLKW 256. ;login message file buffer ; .END START p