 |
» |
|
 |
|
 |

Copyright (c) Digital Equipment Corporation 1990, 1991. All rights reserved
LAYERED PRODUCT: VAX PL/I, V3.4 OP/SYS: VMS, V5.4
SOURCE: Digital Customer Support Center
OVERVIEW:
This example program uses SYS$PARSE_ACL to parse a specified text
string and convert it into the binary representation for an access
control list entry. Then SYS$CHANGE_ACL is called to add that ACE
to a specified file.
*** CAUTION ***
This sample program has been tested using VAX PL/I V3.4 on VMS V5.4.
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 it may require modification for
use on your system.
To run this program extract the following commands into a command
procedure called CHANGE_ACL.COM. Invoke it by entering @CHANGE_ACL.
PROGRAM:
$create acl.pli
acl: proc options(main);
%include sys$change_acl;
%include sys$parse_acl;
%include $stsdef;
%include $acldef;
%include $acedef;
%include str$trim;
dcl trmd_acl char(255);
dcl trmd_acl_len fixed bin(15);
dcl acl_objtyp fixed bin(31);
acl_objtyp = acl$c_file;
dcl acl_objnam char(50);
dcl aclstr char(255);
dcl 1 aclent union,
2 acl_struct,
3 ace_length fixed bin(7),
3 ace_type fixed bin(7),
3 filler char(61),
2 aclents char(63);
dcl 1 item_list,
2 buf_len fixed bin(15) init(0),
2 item_code fixed bin(15),
2 buf_adr pointer,
2 buf_adr_len fixed bin(31) init(0);
item_code = acl$c_addaclent;
buf_adr = addr(aclents);
/*get the file specification */
put skip list ('Enter file specification ');
get list (acl_objnam) ;
put skip list ('Enter ace, must include the parens: ');
put skip list ('For example: (identifier=user,options=default,access=....)');
get list (aclstr);
/* remove trailing spaces */
sts$value = str$trim(trmd_acl,aclstr,trmd_acl_len);
if ^sts$success
then signal vaxcondition(sts$value);
sts$value = sys$parse_acl(substr(trmd_acl,1,trmd_acl_len), aclents,,);
if ^sts$success
then signal vaxcondition(sts$value);
buf_len = ace_length;
sts$value = sys$change_acl (,acl_objtyp,acl_objnam,item_list,,,);
if ^sts$success
then signal vaxcondition(sts$value);
end acl;
$pli acl.pli
$link acl.obj
$create infile.dat
THIS IS A TEST FOR CHANGE_ACL DEMO
$run acl.exe
'INFILE.DAT'
'(IDENTIFIER=NETWORK,OPTIONS=DEFAULT,ACCESS=READ+WRITE+EXECUTE+DELETE)'
$DIR/ACL INFILE.DAT
$delete infile.dat;
$delete acl.obj;
$delete acl.exe;
|
buy online or call 1.800.AT.COMPAQ
|
|