;THE FOLLOWING PROGRAM USES AN UNSUPPORTED VMS INTERFACE. SEVERAL BITS ; IN A FILE'S HEADER UNUSED BY FILES-11 AT THIS WRITING ARE MODIFIED; THEY ; MAY BE USED BY FILES-11 IN FUTURE RELEASES ; .TITLE CLASSIFY ; ;CLASSIFY.MAR - Program to classify a disk file as TOP SECRET, SECRET, ; or CONFIDENTIAL or to display the classification of a ; disk file. The User Characteristics longword ; in the file header will be used to hold the class- ; ification in bits 24 and 25 as follows: ; TOP SECRET = 11 ; SECRET = 10 ; CONFIDENTIAL = 01 ; UNCLASSIFIED = 00 ; ; CLASSIFY.CLD defines the Command Language Editor commands ; needed to support the use of this code as a DCL command, e.g. ; ; $ CLASSIFY/TOP_SECRET DRB0:[USER]TEST.FIL ; $ CLASSIFY/SHOW TEST.FIL ; ; Four qualifiers are supported: /SHOW (default) ; /UNCLASSIFIED ; /CONFIDENTIAL ; /SECRET ; /TOP_SECRET ; ; NOTES: a. These bits are currently not being used by Files-11. ; They may be used in future releases. Bits 0-17 are currently ; in use as NO BACKUP, etc. Their use for this purpose is ; very UNSUPPORTED. ; ; b. $ DUMP/HEADER issued for the file will show the ; bit settings in the user char slot ; ; Written by: Clair Garman ; Educational Services ; Lanham, MD ; ; $FIBDEF ;Define offsets into File Information Block $ATRDEF ;Define offsets in the Attribute Control Block ; CLASSIFIC_POS = 24 ;Define the field for Classification in the CLASSIFIC_SIZ = 2 ; User Characteristics longword of the header ; UNCLASSIFIED = ^B00 ;Define values for the classifications CONFIDENTIAL = ^B01 SECRET = ^B10 TOP_SECRET = ^B11 ; .PSECT DATA PIC,NOEXE,LONG,NOSHR,WRT ; FAB: $FAB NAM=NAMBLK NAMBLK: $NAM RSA=FILNAM,RSS=80 ; FILE_FIB_DESC: .LONG 16 .LONG FILE_FIB FILE_FIB: .LONG FIB$M_WRITE ;Write access .BLKW 3 ;Unused output - File ID .BLKW 3 ;Input - File ID for directory ; ATR_DESC: .WORD 4 ;4 bytes to be modified .WORD ATR$C_UCHAR ;User characteristics .ADDRESS UCHAR_BUFFER .LONG 0 ;Terminator UCHAR_BUFFER: .LONG 0 ; FILNAM_DESC: .LONG .LONG FILNAM: .BLKB 80 DEVNAM: .LONG .ADDRESS NAMBLK+NAM$T_DVI+1 ; FILE_SPEC: .WORD .BYTE DSC$K_DTYPE_T,DSC$K_CLASS_D .LONG LABEL_P1: .ASCID /FILE_SPEC/ ; SHOW_DESC: .ASCID /SHOW/ UNCL_DESC: .ASCID /UNCLASSIFIED/ CONF_DESC: .ASCID /CONFIDENTIAL/ SECR_DESC: .ASCID /SECRET/ TOPS_DESC: .ASCID /TOP_SECRET/ ; UNCL_MSG: .ASCID /Classification: UNCLASSIFIED/ CONF_MSG: .ASCID /Classification: CONFIDENTIAL/ SECR_MSG: .ASCID /Classification: SECRET/ TOPS_MSG: .ASCID /Classification: TOP_SECRET/ ; IOSB: .BLKL 2 CHAN: .WORD ; .PSECT CODE PIC,EXE,LONG,SHR,NOWRT ; CLASSIFY: .WORD ; ;Read in the value from the command line of the file specification ; PUSHAL FILE_SPEC PUSHAL LABEL_P1 CALLS #2,CLI$GET_VALUE ; ;Move the file specification into the FAB ; MOVB FILE_SPEC,FAB+FAB$B_FNS MOVL FILE_SPEC+4,FAB+FAB$L_FNA ; ;Open the file using RMS in order to get the directory file ID ; $OPEN FAB=FAB BLBS R0,.+10 PUSHL R0 CALLS #1,G^LIB$STOP ; ;Store in the appropriate descriptors the length of the device name ; and the length and address of the file name, type and version ; MOVB NAMBLK+NAM$T_DVI,DEVNAM MOVB NAMBLK+NAM$B_NAME,FILNAM_DESC ADDB2 NAMBLK+NAM$B_TYPE,FILNAM_DESC ADDB2 NAMBLK+NAM$B_VER,FILNAM_DESC MOVL NAMBLK+NAM$L_NAME,FILNAM_DESC+4 ; ;Move the directory file ID into the FIB and close the file ; MOVC3 #6,NAMBLK+NAM$W_DID,FILE_FIB+FIB$W_DID $CLOSE FAB=FAB BLBS R0,.+10 PUSHL R0 CALLS #1,G^LIB$STOP ; ;Assign a channel number to the disk for the $QIOs to follow ; $ASSIGN_S CHAN=CHAN,DEVNAM=DEVNAM BLBS R0,.+10 PUSHL R0 CALLS #1,G^LIB$STOP ; ;Access the file to obtain the current setting of UCHAR bits ; $QIOW_S CHAN=CHAN,FUNC=#IO$_ACCESS!IO$M_ACCESS,IOSB=IOSB,- P1=FILE_FIB_DESC,P2=#FILNAM_DESC,P5=#ATR_DESC BLBS R0,.+10 PUSHL R0 CALLS #1,G^LIB$STOP CMPW #1,L^IOSB BEQL .+15 MOVZWL L^IOSB,-(SP) CALLS #1,G^LIB$STOP ; ;Determine which of the several possible qualifiers were used ; PUSHAL UNCL_DESC ;/UNCLASSIFIED? CALLS #1,CLI$PRESENT CMPL #CLI$_PRESENT,R0 BNEQ 5$ BRW MAKE_UNCL ; 5$: PUSHAL CONF_DESC ;/CONFIDENTIAL? CALLS #1,CLI$PRESENT CMPL #CLI$_PRESENT,R0 BEQL MAKE_CONF ; PUSHAL SECR_DESC ;/SECRET? CALLS #1,CLI$PRESENT CMPL #CLI$_PRESENT,R0 BEQL MAKE_SECR ; PUSHAL TOPS_DESC ;/TOP_SECRET? CALLS #1,CLI$PRESENT CMPL #CLI$_PRESENT,R0 BEQL MAKE_TOPS ; ;Then /SHOW is assumed ; CMPZV #CLASSIFIC_POS,#CLASSIFIC_SIZ,- ;Is file CONFIDENTIAL? UCHAR_BUFFER,#CONFIDENTIAL BNEQ 10$ ;Branch if not PUSHAL CONF_MSG BRB WRITE_MSG 10$: CMPZV #CLASSIFIC_POS,#CLASSIFIC_SIZ,- ;Is the file SECRET? UCHAR_BUFFER,#SECRET BNEQ 20$ ;Branch if not PUSHAL SECR_MSG BRB WRITE_MSG 20$: CMPZV #CLASSIFIC_POS,#CLASSIFIC_SIZ,- ;Is the file TOP_SECRET? UCHAR_BUFFER,#TOP_SECRET BNEQ 30$ ;Branch if not PUSHAL TOPS_MSG BRB WRITE_MSG 30$: PUSHAL UNCL_MSG ;Then it must be UCLASSIFIED WRITE_MSG: CALLS #1,G^LIB$PUT_OUTPUT BRB DONE ; MAKE_UNCL: INSV #UNCLASSIFIED,#CLASSIFIC_POS,- ;/UNCLASSIFIED file #CLASSIFIC_SIZ,UCHAR_BUFFER BRB WRITE_HEADER MAKE_CONF: ;CONFIDENTIAL file INSV #CONFIDENTIAL,#CLASSIFIC_POS,- #CLASSIFIC_SIZ,UCHAR_BUFFER BRB WRITE_HEADER MAKE_SECR: ;SECRET file INSV #SECRET,#CLASSIFIC_POS,- #CLASSIFIC_SIZ,UCHAR_BUFFER BRB WRITE_HEADER MAKE_TOPS: ;TOP_SECRET file INSV #TOP_SECRET,#CLASSIFIC_POS,- #CLASSIFIC_SIZ,UCHAR_BUFFER BRB WRITE_HEADER ; ;Deaccess the file in order to update the header ; WRITE_HEADER: $QIOW_S CHAN=CHAN,FUNC=#IO$_DEACCESS,IOSB=IOSB,- P1=FILE_FIB_DESC,P5=#ATR_DESC BLBS R0,.+10 PUSHL R0 CALLS #1,G^LIB$STOP CMPW #1,L^IOSB BEQL .+15 MOVZWL L^IOSB,-(SP) CALLS #1,G^LIB$STOP ; DONE: MOVL #SS$_NORMAL,R0 ;Status return RET ;Exit main routine ; .END CLASSIFY