[fa.info-vax] VAX/VMS Programming Exercise

info-vax (12/31/82)

>From EPS@JPL-VAX  Fri Dec 31 04:45:39 1982
Mail-From: ARPANET host JPL-VAX rcvd at 30-Dec-82 1735-PST
To: Info-VAX@SRI-CSL
Remailed-Date: 30 Dec 1982 2320-PST
Remailed-From: the tty of Geoffrey S. Goodfellow  <Geoff5 at SRI-CSL>
Remailed-To: Info-VAX@SRI-CSL: ;

An instructor wishes to establish accounts for students in his
class.  A natural troublemaker, he asks to be able to monitor
their usage.  A group number is assigned for the exclusive use of
this class.  The instructor has GROUP and GRPNAM.  He wishes
"exceptional" access to files in his group.

Design and code the new privilege "GRPPRV" that will allow the
instructor to have godly influence over his students.
-------
F11BACP calls EXE$GETACCESS to validate UIC-based protection.
This seems like the logical place to start.

Inputs:
	R0: Address of Access Rights Block
		+-------------------------------+
		|				|
		|      Current Privileges	|
		|				|
		+-------------------------------+
		|	    Reserved		|
		+-------------------------------+
		|      GRP   <-UIC->   MEM	|
		+-------------------------------+
	R1: Protection of object (bit set ==> access disallowed)
		+-------------------------------+
		|		WWWWGGGGOOOOSSSS|
		+-------------------------------+
	R2: Owner UIC of object
		+-------------------------------+
		|      GRP   <-UIC->   MEM	|
		+-------------------------------+
Outputs:
	R0: Allowed access (bit set ==> access permitted)
		+-------------------------------+
		|		WWWWGGGGOOOOSSSS|
		+-------------------------------+


EXE$GETACCESS:		BBS     #PRV$V_BYPASS,(R0),EXE$GETACCESS+49
			PUSHL   R3
			MOVZWL  #0F000,R3
			MOVZWL  B^0E(R0),-(SP)
			CMPZV   #10,#10,R2,(SP)+
			BNEQ    EXE$GETACCESS+2A
			INSV    #0F,#08,#04,R3
			CMPW    B^0C(R0),R2
			BNEQ    EXE$GETACCESS+2A
			INSV    #0F,#04,#04,R3
EXE$GETACCESS+2A:	BBS     #PRV$V_SYSPRV,(R0),EXE$GETACCESS+3C
			CMPW    L^EXE$GL_SYSUIC,B^0E(R0)
			BLSSU   EXE$GETACCESS+41
			INSV    #0F,#00,#04,R3
EXE$GETACCESS+41:	BICL3   R1,R3,R0
			MOVL    (SP)+,R3
			RSB     
EXE$GETACCESS+49:	MNEGL   #01,R0
			RSB     


(Replies to the list.  Happy hacking!  -=EPS=-)