Jump to page titleUNITED STATES
hp.com home products and services support and drivers solutions how to buy
» contact hp

:

more options
 

hp.com home
End of Jump to page title
Example-PLI Determining User's Authorized Privileges with $GETUAI
Jump to content



» 

business support center

Home & Home Office Support:
» HP branded products
» Presario branded products
» Services & Warranties
Small & Medium Business Support:
» Small & Medium Business products
» Small & Medium Business services
Support for IT Professionals:
» Enterprise products (IT Resource Center)
» NonStop enterprise products
» Business & IT Services
Content starts here
Copyright (c) Compaq Computer Corporation 1999. All rights reserved.

PRODUCT:    DIGITAL VAX PL/I
            DIGITAL DEC PL/I for OpenVMS Alpha

OP/SYS:     DIGITAL OpenVMS VAX
            DIGITAL OpenVMS Alpha

SOURCE:     Compaq Computer Corporation


OVERVIEW:

This program demonstrates the use of the system service $GETUAI to
obtain a user's authorized privileges.


*** CAUTION ***

This sample program has been tested using VAX PL/I V3.5-124 on OpenVMS
VAX V7.2 and DEC PL/I V4.0-5 on OpenVMS Alpha V7.2.  However, we cannot
guarantee its effectiveness because of the possibility of error in
transmitting or implementing it. It is meant to be used as a template for
writing your own program and may require modification for use on your
system.


PROGRAM NOTES:

This program passes the item code UAI$_PRIV to system service $GETUAI to
return the authorized privileges for a specified user.  Extract and
execute the following command procedure to create the example program.


PROGRAM:

$ CREATE show_privs.pli

/*                           COPYRIGHT (C) 1999 BY
**                     COMPAQ COMPUTER CORPORATION, HOUSTON
**                        TEXAS.  ALL RIGHTS RESERVED.
**
**  THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
**  ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE INCLUSION
**  OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY OTHER COPIES
**  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER
**  PERSON.  NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY TRANSFERRED.
**
**  THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND
**  SHOULD NOT BE CONSTRUED AS A COMMITMENT BY COMPAQ COMPUTER CORPORATION.
**
**  COMPAQ ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS
**  SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY COMPAQ.
**
**  NO RESPONSIBILITY IS ASSUMED FOR THE USE OR RELIABILITY OF SOFTWARE
**  ON EQUIPMENT THAT IS NOT SUPPLIED BY COMPAQ COMPUTER CORPORATION.
**
**  SUPPORT FOR THIS SOFTWARE IS NOT COVERED UNDER ANY COMPAQ SOFTWARE
**  PRODUCT SUPPORT CONTRACT, BUT MAY BE PROVIDED UNDER THE TERMS OF THE
**  CONSULTING AGREEMENT UNDER WHICH THIS SOFTWARE WAS DEVELOPED.
*/

SHOW_PRIVS: procedure options(main);

%include SYS$GETUAI;
%include $ssdef;
%include $stsdef;
%include $uaidef;
%include $prvdef;

/*  Set up item list.
*/

dcl 1 item_list,
      2 part1,
        3 buffer_length1        fixed bin(15) initial(8),
        3 item_code1            fixed bin(15) initial(uai$_priv),
        3 buffer_addr1          pointer,
        3 retlen_addr1          pointer,
      2 terminator              fixed bin(31) initial(0);

dcl username                    char(12) init(' ');
dcl 1  privs union,
    2  privs_char               char(8),
    2  privs_bit                bit(64);
dcl privslen                    fixed bin(31);

buffer_addr1 = addr(privs);
retlen_addr1 = addr(privslen);

/*  Prompt for User Name
*/

put skip list('Enter the Username for which UAI$_PRIV info will be returned: ');
get list(username);

/* Call SYS$GETUAI to get user's authorized privileges.
*/

STS$VALUE = SYS$GETUAI(,,username,item_list,,,);
if ^STS$SUCCESS
    then signal vaxcondition(sts$value);

put skip (2) list('Privilege Bit mask:');
put skip edit (privs_bit) (a,b1);
put skip (2) list('Authorized Privs for this user are:');

/*  Translate the quadword bit string, and display names of authorized
**  privileges that are enabled for this SYSUAF.DAT user record.
*/

if bool (privs_bit, PRV$M_CMKRNL, '0001'B) then put skip list('  CMKRNL');
if bool (privs_bit, PRV$M_CMEXEC, '0001'B) then put skip list('  CMEXEC');
if bool (privs_bit, PRV$M_SYSNAM, '0001'B) then put skip list('  SYSNAM');
if bool (privs_bit, PRV$M_GRPNAM, '0001'B) then put skip list('  GRPNAM');
if bool (privs_bit, PRV$M_ALLSPOOL, '0001'B) then put skip list('  ALLSPOOL');
if bool (privs_bit, PRV$M_DETACH, '0001'B) then put skip list('  DETACH');
if bool (privs_bit, PRV$M_DIAGNOSE, '0001'B) then put skip list('  DIAGNOSE');
if bool (privs_bit, PRV$M_LOG_IO, '0001'B) then put skip list('  LOG_IO');
if bool (privs_bit, PRV$M_GROUP, '0001'B) then put skip list('  GROUP');
if bool (privs_bit, PRV$M_NOACNT, '0001'B) then put skip list('  NOACNT');
if bool (privs_bit, PRV$M_PRMCEB, '0001'B) then put skip list('  PRMCEB');
if bool (privs_bit, PRV$M_PRMMBX, '0001'B) then put skip list('  PRMMBX');
if bool (privs_bit, PRV$M_PSWAPM, '0001'B) then put skip list('  PSWAPM');
if bool (privs_bit, PRV$M_SETPRI, '0001'B) then put skip list('  SETPRI');
if bool (privs_bit, PRV$M_SETPRV, '0001'B) then put skip list('  SETPRV');
if bool (privs_bit, PRV$M_TMPMBX, '0001'B) then put skip list('  TMPMBX');
if bool (privs_bit, PRV$M_WORLD, '0001'B) then put skip list('  WORLD');
if bool (privs_bit, PRV$M_MOUNT, '0001'B) then put skip list('  MOUNT');
if bool (privs_bit, PRV$M_OPER, '0001'B) then put skip list('  OPER');
if bool (privs_bit, PRV$M_EXQUOTA, '0001'B) then put skip list('  EXQUOTA');
if bool (privs_bit, PRV$M_NETMBX, '0001'B) then put skip list('  NETMBX');
if bool (privs_bit, PRV$M_VOLPRO, '0001'B) then put skip list('  VOLPRO');
if bool (privs_bit, PRV$M_PHY_IO, '0001'B) then put skip list('  PHY_IO');
if bool (privs_bit, PRV$M_BUGCHK, '0001'B) then put skip list('  BUGCHK');
if bool (privs_bit, PRV$M_PRMGBL, '0001'B) then put skip list('  PRMGBL');
if bool (privs_bit, PRV$M_SYSGBL, '0001'B) then put skip list('  SYSGBL');
if bool (privs_bit, PRV$M_PFNMAP, '0001'B) then put skip list('  PFNMAP');
if bool (privs_bit, PRV$M_SHMEM, '0001'B) then put skip list('  SHMEM');
if bool (privs_bit, PRV$M_SYSPRV, '0001'B) then put skip list('  SYSPRV');
if bool (privs_bit, PRV$M_BYPASS, '0001'B) then put skip list('  BYPASS');
if bool (privs_bit, PRV$M_SYSLCK, '0001'B) then put skip list('  SYSLCK');
if bool (privs_bit, PRV$M_SHARE, '0001'B) then put skip list('  SHARE');
if bool (privs_bit, PRV$M_ACNT, '0001'B) then put skip list('  ACNT');
if bool (privs_bit, PRV$M_ALTPRI, '0001'B) then put skip list('  ALTPRI');
if bool (privs_bit, PRV$M_UPGRADE, '0001'B) then put skip list('  UPGRADE');
if bool (privs_bit, PRV$M_DOWNGRADE, '0001'B) then put skip list('  DOWNGRADE');
if bool (privs_bit, PRV$M_GRPPRV, '0001'B) then put skip list('  GRPPRV');
if bool (privs_bit, PRV$M_READALL, '0001'B) then put skip list('  READALL');
if bool (privs_bit, PRV$M_TMPJNL, '0001'B) then put skip list('  TMPJNL');
if bool (privs_bit, PRV$M_PRMJNL, '0001'B) then put skip list('  PRMJNL');
if bool (privs_bit, PRV$M_SECURITY, '0001'B) then put skip list('  SECURITY');

end SHOW_PRIVS;

$ PLI show_privs
$ LINK show_privs
$ DEFINE/USER sys$input sys$command
$ RUN show_privs


REFERENCE:

   "System Services Reference Manual:  A-GETMSG", (AA-QSBMC-TE), January
   1999.


buy online or call 1.800.AT.COMPAQ
privacy statementusing this site means you accept its terms