From:	CSBVAX::MRGATE!@SRI.Com:OBERMAN@lll-icdc.arpa@SMTP  2-AUG-1987 16:20
To:	EVERHART
Subj:	Checking for identifiers

Received: from lll-icdc.arpa by KL.SRI.COM with TCP; Fri 31 Jul 87 12:08:32-PDT
Date: Fri, 31 Jul 87 12:03 PDT
From: "Kevin Oberman, 422-6955, L-156" <OBERMAN@lll-icdc.arpa>
Subject: Checking for identifiers
To: info-vax@kl.sri.COM
X-VMS-To: IN::"info-vax@kl.sri.com"

>Can someone give me any pointers where to find a way to test by a
>program or commandprocedure if a process have been granted a specific
>identifier. I've tried to find it in the manuals (microVMS) but
>haven't (obviously i have looked in the wrong place).
>
>I would like to segregate some user's on a LAVC to some specific
>nodes (processors), by granting a user an identifier that allows
>him/her to use one or all nodes.  The cluster has a common
>sysuaf-file.
>
>The simples way to do this is to create a file with ACL's and then
>try to access it, but I would like to do it directly from DCL or
>from a program. Or is there a other way to do it without separate
>SYSUAF-files?

The following code should do the job. (It's not very long.)

					R. Kevin Oberman
					Lawrence Livermore National Laboratory
					arpa: oberman@lll-icdc.arpa
   					(415) 422-6955

Disclaimer: Neither my employer nor myself can take resposibility for
the accuracy of this information. I believe it is correct, but if it's not I
can only say "Sorry". I'm a rotten typist and a worse speller, so forgive
any silly errors.

$ ! CHECK_CPU.COM
$ Create CONFIRM_CPU.FOR
$ DECK/DOLLAR
C     DECLARE SYSTEM SERVICE RELATED SYMBOLS
      INTEGER*4    SYS$GETSYIW
      INTEGER*4    SYS$GETJPIW
      INTEGER*4    SYS$ASCTOID
      INTEGER*4    STATUS
C
C
C     EXTERNAL DECLARATION IS AN ALTERNATIVE TO INCLUDING $SYIDEF
      EXTERNAL SYI$_NODENAME
      EXTERNAL JPI$_UIC
      EXTERNAL SS$_NORMAL
      EXTERNAL SS$_NOSUCHID
C
C
C     DEFINE ITEM LIST STRUCTURE
      STRUCTURE     /ITMLST/
          UNION
              MAP
                  INTEGER*2 BUFLEN
                  INTEGER*2 ITMCOD
                  INTEGER*4 BUFADR
                  INTEGER*4 RETADR
              END MAP
              MAP
                  INTEGER*4 END_LIST
              END MAP
          END UNION
      END STRUCTURE
C
C
C     DEFINE I/O STATUS BLOCK STRUCTURE
      STRUCTURE    /IOSBLK/
          INTEGER*4    STS,RESERVED
      END STRUCTURE
C
C
C     DEFINE UIC AND HOLDER IDENTIFIER
      STRUCTURE     /HOLDER/
          INTEGER*4    UIC,RESERVED
      END STRUCTURE
C
C
C     DEFINE NODE NAME AS TEXT STRING
      STRUCTURE     /NODE_STRING/
          INTEGER*4 LENGTH,ADDRESS
      END STRUCTURE
C
C
C     DECLARE $GETSYIW ITEM LIST AND I/O STATUS BLOCK AND HOLDER
      RECORD /ITMLST/ GETSYI_LIST(2)
      RECORD /IOSBLK/ IOSB
      RECORD /HOLDER/ HOLDER
      RECORD /NODE_STRING/ NODE_NAME_STRING
C
C
C     DECLARE VARIABLES USED IN $GETSYIW ITEM LIST
      CHARACTER*15   NODENAME
      INTEGER*2      UIC_LEN
      INTEGER*4      ID,THIS_ID
      INTEGER*4      CONTEXT
C
C
C     INITIALIZE ITEM LIST FOR GETTING THE CLUSTER NODE NAME
      GETSYI_LIST(1).BUFLEN = 15
      GETSYI_LIST(1).ITMCOD = %LOC(SYI$_NODENAME)
      GETSYI_LIST(1).BUFADR = %LOC(NODENAME)
      GETSYI_LIST(1).RETADR = %LOC(NODE_NAME_STRING.LENGTH)
      GETSYI_LIST(2).END_LIST = 0
C
C
C     GET THE NODENAME
      STATUS = SYS$GETSYIW(,,,GETSYI_LIST,IOSB,,)
C     ZERO LENGTH STRING - NO CLUSTER NAME - CALL IT AUTOMATIC SUCCESS
      IF ( NODE_NAME_STRING.LENGTH .EQ. 0 ) CALL EXIT(%LOC(SS$_NORMAL))
C
C
C     FINISH SETTING UP THE NODE NAME STRING DESCIPTOR
      NODE_NAME_STRING.ADDRESS = %LOC(NODENAME)
C
C
C     MAP THE NODE NAME INTO A RIGHTS IDENTIFIER
      STATUS = SYS$ASCTOID(NODE_NAME_STRING,ID,)
C     ID = 0 ==> NO SUCH ID - CALL IT AUTOMATIC SUCCESS
      IF (ID .EQ. 0) CALL EXIT(%LOC(SS$_NORMAL))
C
C
C     INITIALIZE THE ITEM LIST FOR GETTING THE UIC
      GETSYI_LIST(1).BUFLEN = 4
      GETSYI_LIST(1).ITMCOD = %LOC(JPI$_UIC)
      GETSYI_LIST(1).BUFADR = %LOC(HOLDER.UIC)
      GETSYI_LIST(1).RETADR = %LOC(UIC_LEN)
      GETSYI_LIST(2).END_LIST = 0
C
C
C     GET THE UIC
      STATUS = SYS$GETJPIW(,,,GETSYI_LIST,IOSB,,)
C
C
C     NOW SEARCH FOR CPU NAME IN THE USERS LIST OF IDS
100   STATUS = SYS$FIND_HELD(HOLDER,THIS_ID,,CONTEXT)
C     TESTING CONTEXT IS CORRECT ONLY BECAUSE IT WORKS
      IF (CONTEXT .EQ. 0) CALL EXIT(%LOC(SS$_NOSUCHID))
      IF (THIS_ID .NE. ID) GOTO 100
      CALL EXIT(%LOC(SS$_NORMAL))
      END
$ EOD
$ Check CONFIRM_CPU.FOR
$ If CHECKSUM$CHECKSUM .eqs. "1627664138" Then GoTo OK
$ Write SYS$OUTPUT "Checksum error. CONFIRM_CPU.FOR may be corrupt!
$ Exit
$OK:
$ Write SYS$OUTPUT "CONFIRM_CPU.FOR has been created."
$ Exit
