[comp.os.vms] Accessing the System Authorization File

SMITHP@WHARTON.UPENN.EDU (07/23/87)

I am attempting to validate usernames from a COBOL program using the
system authorization file (sys$system:sysuaf.dat). Any information
or suggestion related to the following would be welcomed and appreciated.

1. Is there a DEC supplied subroutine that can be invoked from a CALL
   statement that will return a value verifying the existence of an account
   given a username as one of its arguments.

2. Does anyone know where I can find documentation relating to the file
   structure and record layout of the SYSUAF file. One of my options
   would be to read the file as a keyed file by username directly.

Thank you.

MCGUIRE@GRIN2.BITNET (07/24/87)

> Date:         Thu, 23 Jul 87 10:02 EST
> From:         SMITHP@wharton-10.arpa
> Subject:      Accessing the System Authorization File
>
> I am attempting to validate usernames from a COBOL program using the
> system authorization file (sys$system:sysuaf.dat). Any information
> or suggestion related to the following would be welcomed and appreciated.
>
> 1. Is there a DEC supplied subroutine that can be invoked from a CALL
>    statement that will return a value verifying the existence of an account
>    given a username as one of its arguments.

Sure is.  Look up $GETUAI in the System Services Reference Manual.  Note
that, although the manual does not say so, the service returns RMS
condition codes if the username search fails.

Attached is my first BASIC program to call $GETUAI, modified to try a bogus
user and show what happens.  Translate to COBOL and try it.  You must link
your program with a two-line MACRO program containing the following lines
which make the global symbol UAI$_UIC available to the linker.
        $UAIDEF <GLOBAL>
        .END

Ed

------------------------------ Cut here ------------------------------
1
 !+
 ! Program to experiment with $GETUAI.
 !-
        OPTION TYPE=EXPLICIT
        RECORD ITEM_LIST_3
                WORD BUFLEN, ITECOD
                LONG BUFADD, RETLENADD
                END RECORD ITEM_LIST_3
        DECLARE LONG UIC, S
        DECLARE STRING USRNAM
        DECLARE ITEM_LIST_3 ITMLST(5%)
        EXTERNAL LONG CONSTANT UAI$_UIC, SS$_NORMAL
        EXTERNAL LONG FUNCTION SYS$GETUAI (LONG BY VALUE, LONG BY VALUE, &
          STRING, ITEM_LIST_3, LONG BY VALUE, LONG BY VALUE, LONG BY VALUE)
        EXTERNAL SUB LIB$SIGNAL (LONG BY VALUE)

        ITMLST(0%)::BUFLEN = 4%
        ITMLST(0%)::ITECOD = UAI$_UIC
        ITMLST(0%)::BUFADD = LOC (UIC)
        ITMLST(0%)::RETLENADD = 0%
        ITMLST(1%)::ITECOD = 0%

        USRNAM = "MCGUIRE"
        UIC = 0%
        S = SYS$GETUAI (, , USRNAM, ITMLST(0%), , , )
        CALL LIB$SIGNAL (S) IF S <> SS$_NORMAL
        PRINT "MCGUIRE's UIC ="; UIC

        USRNAM = "JRANDOM"
        UIC = 0%
        S = SYS$GETUAI (, , USRNAM, ITMLST(0%), , , )
        CALL LIB$SIGNAL (S) IF S <> SS$_NORMAL
        PRINT "JRANDOM's UIC ="; UIC

        END
------------------------------ Cut here ------------------------------