.TITLE READACCESS CHECK .IDENT /V1.01/ .NLIST TOC,SYM .ENABL LC ; Part of Sira Paper Tape Punch Despooler. ; ; Sira Institute Ltd., ; South Hill, Chislehurst, Kent, BR7 5EH, England. ; ; Author: C.J. Doran ; Based on DEC "RSX-11M Software Dispatch" article 5.7.10.4, June 1980, ; with improvements by CJD. ; ; Assemble as: ; >MAC PPPREADAC=PPPREADAC ;+ ; Check that the user has read access privilege to the file just opened. ; If not, print a privilege violation error message, and exit with carry set, ; so that the caller can refuse to read the file. Return with carry clear ; if all is in order. ; Save relevant access bits in FILACC for later delete check. ;- .MCALL DIR$ ; Macro to get specified file attributes .MACRO GETATT TYPE,SIZE,ERR MOV #!,RATATT DIR$ #RATQIO,ERR .ENDM GETATT .PSECT CODE,I,RO READAC::GETATT -1,4,QIOERR ; Get owner UIC and file protection MOV #BUFFER,%0 ; Address reply MOV (%0)+,%1 ; Get UIC to %1 MOV @%0,%2 ; and protection to %2 COM %2 ; 1's now mean access allowed CMPB JOBUIC+1,#7 ; Job spooled under system UIC? BLOS 5$ ; Yes, keep system bits BIC #17,%2 ; No, turn them off 5$: CMP JOBUIC,%1 ; File owner? BEQ 10$ ; Yes, keep owner and group bits BIC #360,%2 ; No, turn owner bits off CMPB JOBUIC+1,-(%0) ; Job UIC? (CMPB JOBUIC+1,BUFFER+1) BEQ 10$ ; Yes, keep group bits BIC #7400,%2 ; No, turn them off 10$: MOV %2,FILACC ; Save relevant bits for delete check BIT #^B0001000100010001,%2 ; Any read bits set? CLC ; Assume so BNE 30$ ; Yes, read access allowed MOV #IE.PRI&377,FDB+F.ERR ; All read bits clear forbids it JSR PC,FCSERR ; Say error SEC ; Warn the caller 30$: RTS PC ; Return to him .END