From:	CSBVAX::MRGATE!@SRI.Com:marque!mucsd!8004SLB@csd1.milw.wisc.edu@SMTP  5-AUG-1987 03:25
To:	EVERHART
Subj:	Re: Checking for identifiers

Received: from csd1.milw.wisc.edu by KL.SRI.COM with TCP; Tue 4 Aug 87 10:21:40-PDT
Received: by csd1.milw.wisc.edu; id AA17465; Tue, 4 Aug 87 12:05:09 cdt
Message-Id: <8708041705.AA17465@csd1.milw.wisc.edu>
Received: by marque.UUCP (smail2.3)
	id AA07001; 4 Aug 87 11:11:46 EDT (Tue)
Date: Tue,  4 Aug 87 11:09:10 CDT
From: Sandy <mucsd!8004SLB@csd1.milw.wisc.edu>
Subject: Re: Checking for identifiers
To: marque!uwmcsd1!SRI-KL.ARPA!INFO-VAX
X-Vms-Mail-To: UUCP%"marque!uwmcsd1!SRI-KL.ARPA!INFO-VAX",8004SLB     

Here is another program that we use on our VAXCluster to restrict one of the
nodes to a given set of users. Users who are allowed to access the VAX have the
identifier ENGVAX granted to their username with authorize or a program we've
written here that allows authorized non-privileged users to grant and revoke
identifiers for which they are responsible to/from other users. In SYLOGIN, if
the current node is the one that has restrictions, this program is run. If the
user has OPER privilege or holds the ENGVAX identifier, the program exits
quietly. If not, the user is given a terse error message and logged off the
system.

This program is a bit different from a previous program in that the identifer
is checked immediately and may have been granted by a privileged program as
opposed to searching the rights data base for the identifier. To change this
program for an identifier with a name other than ENGVAX, simply change the one
line at label AIDENT:.

Here's the code:

	Sandy Berger
	Marquette University
	Computer Services Division
	Technical Services
	Milwaukee, WI

UUCP:	...!seismo!uwvax!uwmcsd1!marque!mucsd!8004slb
ARPA:	marque!mucsd!8004slb@csd1.milw.wisc.edu


---------------------------CUT HERE------------------------------------
	.TITLE	CHKPRO - TEST FOR ACCESS TO ENGINEERING VAX
;
; Written by:	Sanford L. Berger
;		Marquette University
;		Computer Services Division
;		Technical Services
;		Milwaukee, WI
;
; This program checks to see if the user currently holds the given identifier.
; If he does the program simply exits. If not, a message is given and the
; user is logged out. Users with OPER privilege are exempt from the
; identifier check.
;
	.LIBRARY /SYS$LIBRARY:LIB/
	$ACEDEF
	$ARMDEF
	$CHPDEF
	$JPIDEF
	$PRVDEF
	.PSECT	DATA,LONG,NOEXE
BMES:	.ASCID	/You are not allowed to access this VAX./
;
; Don't use the user's privileges in the $CHKPRO service.
;
PRVS:	.QUAD	0
;
; Following is the ACL which we use in $CHKPRO.
;
ACL:	.BYTE	12			; length of ACE
	.BYTE	ACE$C_KEYID		; type of ACE
	.WORD	0			; ACE flags
	.LONG	ACE$M_READ		; ACE access flags
IDENT:	.BLKL	1			; identifier to check for
;
ACCESS:	.LONG	ARM$M_READ		; longword for read access
;
; Next is the item list for $CHKPRO.
;
ITMLST:	.WORD	4
	.WORD	CHP$_ACCESS		; read access
	.ADDRESS ACCESS
	.LONG	0
	.WORD	8
	.WORD	CHP$_PRIV		; no privileges
	.ADDRESS PRVS
	.LONG	0                                               
ACLEN:	.WORD	12
	.WORD	CHP$_ACL		; use our generated ACL
	.ADDRESS ACL
	.LONG	0
	.LONG	CHP$_END		; end of item list
;
CPRIV:	.BLKQ	1			; user's current privileges
;
; Item list for $GETJPI to get current privileges
;
JPILST:	.WORD	8
	.WORD	JPI$_CURPRIV
	.ADDRESS CPRIV
	.LONG	0
	.LONG	0
;
; Next is the identifier we are checking for.
;
AIDENT:	.ASCID	/ENGVAX/
;
 	.PSECT	INST,LONG,NOWRT
	.ENTRY	START,^M<>
 	$GETJPIW_S ITMLST=JPILST	; get user's privileges
	BBS	#PRV$V_OPER,CPRIV,OK	; if OPER then exit
	$ASCTOID_S NAME=AIDENT,ID=IDENT	; convert identifier to binary
	$CHKPRO_S ITMLST=ITMLST		; check to see if ACL passes check
	BLBS	R0,OK			; yes, he's got the identifier, exit
 	PUSHAQ	BMES
	CALLS	#1,G^LIB$PUT_OUTPUT	; no, give him the message
	$DELPRC_S			;   and do away with him
OK:	$EXIT_S
	.END	START

