$! ------------------ CUT HERE ----------------------- $ v='f$verify(f$trnlnm("SHARE_UNPACK_VERIFY"))' $! $! This archive created by VMS_SHARE Version 8.2 $! On 5-FEB-1993 14:53:00.95 By user GOATHUNTER (@WKUVX1.BITNET) $! $! The VMS_SHARE software that created this archive $! was written by Andy Harper, Kings College London UK $! -- December 1992 $! $! Credit is due to these people for their original ideas: $! James Gray, Michael Bednarek $! $! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER $! AND EXECUTE AS A COMMAND PROCEDURE ( @name ) $! $! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING: $! 1. BUILD.TXT;1 $! 2. PRCPRV.COM;1 $! 3. PRCPRV.DESC;1 $! $set="set" $set symbol/scope=(nolocal,noglobal) $f=f$parse("SHARE_UNPACK_TEMP","SYS$SCRATCH:."+f$getjpi("","PID")) $e="write sys$error ""%UNPACK"", " $w="write sys$output ""%UNPACK"", " $ if .not. f$trnlnm("SHARE_UNPACK_LOG") then $ w = "!" $ ve=f$getsyi("version") $ if ve-f$extract(0,1,ve) .ges. "4.4" then $ goto start $ e "-E-OLDVER, Must run at least VMS 4.4" $ v=f$verify(v) $ exit 44 $unpack: subroutine ! P1=filename, P2=checksum, P3=attributes $ if f$parse(P1) .nes. "" then $ goto dirok $ dn=f$parse(P1,,,"DIRECTORY") $ w "-I-CREDIR, Creating directory ''dn'" $ create/dir 'dn' $ if $status then $ goto dirok $ e "-E-CREDIRFAIL, Unable to create ''dn' File skipped" $ delete 'f'* $ exit $dirok: $ x=f$search(P1) $ if x .eqs. "" then $ goto file_absent $ e "-W-EXISTS, File ''P1' exists. Skipped" $ delete 'f'* $ exit $file_absent: $ w "-I-UNPACK, Unpacking file ", P1 $ n=P1 $ if P3 .nes. "" then $ n=f $ if .not. f$verify() then $ define/user sys$output nl: $ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='n' PROCEDURE GetHex(s,p)LOCAL x1,x2;x1:=INDEX(t,SUBSTR(s,p,1))-1;x2:=INDEX(t, SUBSTR(s,p+1,1))-1;RETURN 16*x1+x2;ENDPROCEDURE; PROCEDURE SkipPartsep LOOP EXITIF MARK(NONE)=END_OF(b);EXITIF INDEX(ERASE_LINE, "-+-+-+-+-+-+-+-+")=1;ENDLOOP;ENDPROCEDURE;PROCEDURE ProcessLine LOCAL c,s,l,b, n,p;c := ERASE_CHARACTER(1);s := ERASE_LINE;IF c = "X" THEN SPLIT_LINE; ENDIF; MOVE_HORIZONTAL(-1);l := LENGTH(s);p := 1;LOOP EXITIF p > l;c := SUBSTR(s,p,1); p := p+1;CASE c FROM ' ' TO '`' ['`']: COPY_TEXT(ASCII(GetHex(s,p))); p:=p+2;[ ' ']: p:=p+1;[INRANGE,OUTRANGE]: COPY_TEXT(c);ENDCASE;ENDLOOP;ENDPROCEDURE; PROCEDURE Decode POSITION(BEGINNING_OF(b));LOOP EXITIF MARK(NONE)=END_OF(b); IF INDEX(CURRENT_LINE,"+-+-+-+-+-+-+-+-")=1 THEN SkipPartSep;ELSE ProcessLine; MOVE_HORIZONTAL(1);ENDIF;ENDLOOP;ENDPROCEDURE;SET(FACILITY_NAME,"UNPACK");SET( SUCCESS,OFF);SET(INFORMATIONAL,OFF);t:="0123456789ABCDEF";f:=GET_INFO( COMMAND_LINE,"file_name");b:=CREATE_BUFFER(f,f);Decode;WRITE_FILE(b,GET_INFO( COMMAND_LINE,"output_file"));QUIT; $ if p3 .eqs. "" then $ goto dl $ open/write fdl &f $ write fdl "RECORD" $ write fdl P3 $ close fdl $ w "-I-CONVRFM, Converting record format to ", P3 $ convert/fdl=&f &f-1 &P1 $dl: delete 'f'* $ checksum 'P1' $ if checksum$checksum .nes. P2 then $ - e "-E-CHKSMFAIL, Checksum of ''P1' failed." $ exit $ endsubroutine $start: $! $ create 'f' XFigure`203:`20Getting`20it`20all`20to`20work X X`091.`20Build`20the`20necessary`20executable: X`09`20`20`20$`20@PRCPRV.COM X X`092.`20Define`20a`20symbol,`20making`20it`20a`20foreign`20command: X`09`20`20`20$`20PRCPRV`20==`20"$DISK$TOOLS:`5BPRCPRV`5DPRCPRV.EXE" X X`093.`20Use`20the`20command`20of`20the`20format X`09`09$`20PRCPRV`20/IDENTIFICATION=n`20/PRIVILEGES=privilege-list X X`09`20`20`20Examples: X`09`09$`20PRCPRV/IDENT=22003344/PRIV=(NOALL,TMPMBX,NETMBX) X`09`09$`20PRCPRV/IDENT=22003344/PRIV=(SYSPRV,WORLD) X`09`09$`20PRCPRV/IDENT=22003344/PRIV=ALL X X`09Note`20that`20CMKRNL`20privilege`20is`20required`20for`20PRCPRV`20to`20work V. X`09It`20is`20linked`20/NOTRACE,`20so`20it`20can`20be`20installed`20with`20that V X`09privilege`20if`20ordinary`20users`20are`20to`20use`20it. $ call unpack BUILD.TXT;1 1702852055 "" $! $ create 'f' X$`20lib/extract=$PRVDEF/out=prvdef.mar`20sys$library:starlet.mlb X$`20open`20infile`20prvdef.mar X X`09Then`20a`20template`20is`20created`20which`20copied`20to`20the`20start`20of V`20 X`09PRCPRV_CLI.MAR. X X$`20create`20prcprv_cld_mar.mar X$`20deck/dollars="$EOD" X;`20PRCPRV_CLI_TEMPLATE.MAR`09-`20Ehud`20Gavron`20-`09`0920-Sep-1991 X. X. X`09This`20template`20file`20contains`20a`20macro`20which`20is`20pased`20a`20ke Vyword X`09(name`20of`20a`20privilege)`20plus`20a`20symbolic`20value`20of`20the`20bit V`20location X`09in`20the`20quadword`20privilege`20mask.`20`20It`20then`20generates`20a`20pi Vece`20of X`09code`20which`20sets`20the`20appropriate`20privilege`20bits,`20or`20all`20of V`20them X`09if`20the`20symbolic`20value`20is`2064`20(PRIV=ALL`20or`20NOALL).`20`20It V`20changes X`09two`20masks,`20ENBMSK`20and`20DISMSK`20which`20are`20used`20by`20the`20main V`20code X`09to`20determine`20which`20privileges`20to`20enable`20and`20disable. X X.macro`20cli_check`20keyword,symbol`20?l`20?l2`20?l3`20?l4`20?a X X`09keyword`20is`20the`20name`20of`20the`20privilege`20(eg.`20ALLSPOOL) X`09symbol`20is`20the`20symbolic`20bit`20location`20(eg.`204) X`09l,`20l2,`20l3,`20and`20l4`20are`20labels`20for`20internal`20branches X`09a`20is`20a`20label`20to`20a`20descriptor`20constructed`20by`20the`20macro V`20which X`09`20`20contains`20the`20keyword. X`09 X`09First`20it`20checks`20if`20the`20keyword`20is`20present: X`09 X`20`20`20`20pushal`09a`09`09`09`09;`20Push`20address`20of`20keyword`20desc X`20`20`20`20calls`09#1,g`5Ecli$present`09`09;`20Is`20it`20here? X`20`20`20`20cmpl`09r0,#cli$_present`09`09;`20Yes? X`20`20`20`20beql`09l`09`09`09`09;`20If`20so`20goto`20l X X`09If`20the`20keyword`20is`20not`20present`20in`20affirmative`20form,`20it X`09checks`20to`20see`20if`20it`20is`20negated: X X`20`20`20`20cmpl`09r0,#cli$_negated`09`09;`20Is`20it`20negated? X`20`20`20`20bneq`09l2`09`09`09`09;`20No`20-`20not`20here,`20exit X X`09Then`20it`20checks`20to`20see`20if`20the`20negation`20is`20for`20the`20ALL V`20keyword X`09(symbolic`20value`2064) X X`20`20`20`20cmpl`09#symbol,#64`09`09`09;`20Is`20ALL`20negated? X`20`20`20`20bneq`09l4`09`09`09`09;`20no,`20something`20else`20is X X`09Since`20ALL`20is`20being`20negated`20(NOALL)`20then`20the`20entire`20privil Vege X`09disable`20mask`20is`20set: X X`20`20`20`20mnegl`09#1,(r4)`09`09`09`09;`20negate`20all`20of`20dismsk X`20`20`20`20mnegl`09#1,4(r4) X`20`20`20`20brb`09`09l2`09`09`09`09;`20and`20exit X X`09L4`20is`20the`20branch`20when`20a`20specific`20privilege`20is`20being`20neg Vated. X`09We`20negate`20the`20right`20bit`20and`20exit: X Xl4:`20bbss`09#symbol,(r4),l2`09`09`09;`20Something`20is`20negated X`20`20`20`20brb`09`20`20`20`09l2`09`09`09`09;`20so`20do`20it X X`09L`20is`20the`20branch`20when`20something`20is`20being`20affirmed. X`09We`20first`20check`20to`20see`20if`20it`20was`20ALL: X Xl:`20`20cmpl`09#symbol,#64`09`09`09;`20is`20ALL`20here? X`20`20`20`20bneq`09l3`09`09`09`09;`20no,`20something`20is`20here X X`09ALL`20is`20being`20set,`20so`20we`20set`20all`20bits`20in`20the`20enable V`20mask: X X`20`20`20mnegl`09#1,(r5)`09`09`09`09;`20set`20all`20bits`20on X`20`20`20mnegl`09#1,4(r5)`09`09`09;`20in`20enbmsk X`20`20`20brb`09l2`09`09`09`09;`20and`20exit X X`09L3`20is`20the`20branch`20for`20affirming`20a`20particular`20privilege. X`09We`20set`20the`20appropriate`20bit`20and`20exit: X Xl3:`20bbss`09#symbol,(r5),l2`09`09`09;`20enable`20something X`20`20`20brb`09l2`09`09`09`09;`20exit X X`09Here`20we`20build`20the`20descriptor`20which`20includes`20the X`09keyword`20privilege`20name: X Xa:`20.ascid`09/keyword/ X X`09Finally,`20the`20branch`20that`20all`20parts`20of`20the`20macro X`09end`20at,`20the`20end: Xl2: X`20`20`20.endm X X`09We`20then`20provide`20a`20main`20entry`20point,`20and`20the`20code`20to`20m Vove X`09the`20addresses`20of`20both`20masks`20into`20the`20appropriate`20registers. V X`09This`20will`20allow`20the`20CLI_CHECK`20macro`20to`20be`20able`20to`20set V`20them: X X`20`20`20.entry`09parse_keywords,`5Em X`20`20`20movl`09`094(ap),r4`09`09;`20address`20of`20dismsk X`20`20`20movl`09`098(ap),r5`09`09;`20address`20of`20enbmsk X; X;`20End`20of`20template!!! X; X$EOD X X X`09We`20then`20open`20the`20template`20for`20writing`20to`20it,`20and`20assign V X`09a`20channel`20(OUTMAR)`20to`20it: X X$`20open/append`20outmar`20prcprv_cld_mar.mar X X`09Then`20we`20create`20the`20template`20of`20the`20command`20language`20defin Vition X`09file.`20 X X$`20create`20prcprv_cld.cld X$DECK/dollars="$EOD" X X`09First`20we`20define`20the`20verbs`20and`20the`20qualifiers X Xdefine`20verb`20PRCPRV X`20`20qualifier`20IDENTIFICATION X`20`20`20`20`20value`20(required) X`20`20qualifier`20PRIVILEGES X`20`20`20`20`20value`20(required,list,type=PRIVILEGES) X X`09Then`20we`20define`20the`20privileges`20themselves,`20only`20putting`20in V`20the X`09ALL`20keyword.`20`20The`20reason`20is`20that`20ALL`20is`20a`20construct`20u Vsed`20by X`09the`20DCL`20SET`20command`20and`20is`20not`20a`20true`20privilege`20in`20th Ve`20sense X`09that`20it`20has`20no`20bit`20position`20or`20mask. X Xdefine`20type`20PRIVILEGES X`20`20`20keyword`20ALL,negatable X$EOD X X`09We`20now`20open`20a`20channel`20to`20this`20routine,`20calling`20it`20OUTCL VD. X`09 X$`20open/append`20outcld`20prcprv_cld.cld X X`09In`20order`20to`20generate`20the`20code,`20we`20must`20now`20loop`20through V X`09INFILE,`20parsing`20entries`20and`20placing`20lines`20in`20OUTMAR`20and X`09OUTCLD.`20`20First`20though`20a`20special`20case`20call`20for`20the`20ALL X`09keyword: X X$`20write`20outmar`20"`09cli_check`20ALL,64" X X`09Then`20we`20start`20the`20loop: X X$rloop: X$`20read/end=eof`20infile`20line X`09 X`09We`20trim`20and`20convert`20the`20line`20to`20uppercase,`20making`20sure V`20that X`09it's`20a`20symbol`20definition`20line: X X$`20upcase`20=`20f$edit(line,"upcase,compress,trim") X$`20if`20f$element(0,"`20",upcase)`20.nes.`20"$EQU"`20then`20goto`20rloop X X`09We`20then`20extract`20the`20symbol`20name`20of`20the`20format`20PRV$x_y X`09and`20make`20sure`20that`20we're`20not`20using`20the`20x="V"`20symbols. X`09This`20gives`20us`20PRV$M_y`20symbols,`20which`20indicate`20the`20bit X`09position`20of`20the`20privilege.`20`20We`20do`20this`20for`20greater X`09ease,`20since`20some`20privileges`20reside`20in`20the`20second`20longword X`09and`20would`20be`20difficult`20to`20set`20otherwise. X X$`20symbol`20`20=`20f$element(1,"`20",upcase) X$`20under`20`20`20=`20f$locate("_",symbol) X$`20m`20=`20f$extract(under-1,1,symbol) X$`20if`20m`20.eqs.`20"M"`20then`20goto`20rloop X X`09We`20then`20get`20the`20keyword`20from`20using`20the`20y`20part`20of`20PRV$ VM_y. X`09We`20do`20not`20use`20F$ELEMENT(1,"_",symbol)`20because`20some`20of`20the X`09privileges`20have`20an`20underscore`20in`20their`20name`20(PHY_IO,`20LOG_IO V...) X X$`20length`20`20=`20f$length(symbol) X$`20keyword`20=`20f$extract(under+1,length-under,symbol) X$`20value`20`20`20=`20f$element(2,"`20",upcase) X$`20write`20sys$output`20"Inserting`20keyword`20''keyword'..." X X`09We`20place`20the`20keyword`20in`20the`20CLD`20file: X X$`20write`20outcld`20"`20`20`20keyword`20''keyword',`20negatable" X X`09We`20then`20are`20ready`20to`20put`20it`20into`20the`20Macro`20code.`20`20H Vowever, X`09it`20is`20necessary`20to`20check`20if`20we`20are`20dealing`20with`20the`20s Vecond X`09longword.`20`20If`20we`20are,`20then`20we`20should`20temporarily`20incremen Vt X`09the`20address`20of`20the`20masks`20such`20that`20they`20will`20point`20to V`20the X`09second`20longword: X X$`20if`20value`20.lt.`2032`20then`20goto`20writeit X`09 X`09Value`20is`20greater`20than`20or`20equal`20to`2032,`20indicating`20the`20se Vcond X`09longword.`20`20We`20get`20the`20offset`20in`20the`20second`20longword: X X$`20val`20=`20value`20-`2032 X X`09Increment`20the`20addresses`20of`20the`20masks: X X$`20write`20outmar`20"`09addl`09#4,r4" X$`20write`20outmar`20"`09addl`09#4,r5" X X`09Call`20the`20macro: X X$`20write`20outmar`20"`09cli_check`20''keyword',''val'" X X`09And`20return`20the`20addresses`20to`20what`20they`20were. X X$`20write`20outmar`20"`09subl`09#4,r4" X$`20write`20outmar`20"`09subl`09#4,r5" X$`20goto`20rloop X X`09If`20the`20bit`20position`20was`20in`20the`20first`20longword,`20we`20just X`09call`20the`20macro: X X$writeit: X$`20write`20outmar`20"`09cli_check`20''keyword',''symbol'" X$`20goto`20rloop X$! X X`09Finally`20we`20terminate`20all`20files`20and`20close`20all`20channels: X X$eof: X$`20write`20outmar`20"`09ret" X$`20write`20outmar`20"`09.end" X$`20close`20outmar X$`20close`20outcld X$`20close`20infile X X`09At`20the`20point`20we`20have`20the`20following`20files: X`09`09PRCPRV.MAR`20`20`20`20`20`20`20`20`20-`20the`20mainline`20code X`09`09PRCPRV_CLD.CLD`20`20`20`20`20-`20our`20recently`20created`20.CLD`20file X`09`09PRCPRV_CLD_MAR.MAR`20-`20our`20recently`20created`20.MAR`20parser X`09`09 X`09The`20assembly`20and`20linking`20then`20takes`20place: X X$`20mac`20prcprv X$`20mac`20prcprv_cld_mar X$`20set`20command/obj`20prcprv_cld X$`20link`20prcprv,prcprv_cld,prcprv_cld_mar X X`09In`20our`20code`20we`20will`20parse`20the`20command`20line,`20get`20the`20i Vdentification X`09and`20privileges`20qualifiers,`20and`20then`20build`20and`20trigger`20an V`20AST. X X`09The`20code`20begins`20by`20establishing`20a`20condition`20handler: X Xmoval`20`20`20g`5Elib$sig_to_ret,(fp) X X`09We`20do`20this`20because`20the`20CLI$`20routines`20will`20signal`20errors V`20 X`09themselves`20if`20no`20condition`20handler`20is`20set.`20`20As`20we'd`20rat Vher X`09exit`20gracefully,`20lib$sig_to_ret`20will`20convert`20any`20signal`20to X`09a`20return`20status`20we`20can`20check. X X`09We`20then`20get`20the`20command`20line: X Xpushl`20`20`20#0`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20 V`20`20;`20flags Xpushal`20`20cmd_desc`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20;`20result Vant-length Xpushl`20`20`20#0`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20 V`20`20;`20prompt Xpushal`20`20cmd_desc`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20;`20result Vant-string Xcalls`20`20`20#4,g`5Elib$get_foreign X X`09The`20cmd_desc`20descriptor`20will`20include`20all`20elements`20of`20the V`20original X`09command`20line`20except`20the`20original`20verb`20or`20command.`20`20We`20a Vdd`20this X`09manually`20by`20concatenating`20it`20in`20front`20of`20the`20line: X Xpushal`20`20cmd_desc Xpushal`20`20cmd_name Xpushal`20`20cld_desc Xcalls`20`20`20#3,g`5Estr$concat X X`09We`20then`20call`20CLI$DCL_PARSE`20which`20will`20scan`20the`20line`20and V`20properly X`09be`20able`20to`20identify`20qualifiers`20and`20keywords: X Xpushal`20`20g`5Elib$get_input`20`20`20`20`20`20`20`20`20;`20prompt_routine Xpushl`20`20`20#0`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20 V`20`20;`20param_routine Xpushal`20`20prcprv_cld`20`20`20`20`20`20`20`20`20`20`20`20`20`20;`20table Xpushal`20`20cld_desc`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20;`20comman Vd_string Xcalls`20`20`20#5,g`5Ecli$dcl_parse X X`09As`20the`20image`20is`20called`20with`20a`20foreign`20command`20symbol,`20w Ve`20must X`09manually`20enforce`20the`20required`20qualifier`20(/PRIVILEGES): X Xpushal`20`20priv_desc`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20;`20entity_d Vesc Xcalls`20`20`20#1,g`5Ecli$present Xcheck X`09 X`09Check`20is`20used`20here`20not`20only`20to`20make`20sure`20the`20call`20com Vpleted X`09successfully,`20but`20also`20to`20make`20sure`20the`20returned`20status`20 V`09 X`09indicates`20the`20qualifier`20is`20present.`20 X X`09We`20then`20get`20the`20/IDENTIFICATION`20qualifier`20value: Xpushal`20`20pid_desc`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20;`20retlen Vgth Xpushal`20`20pid_desc`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20;`20retdes Vc Xpushal`20`20ident_desc`20`20`20`20`20`20`20`20`20`20`20`20`20`20;`20entity Xcalls`20`20`20#3,g`5Ecli$get_value X X`09That`20value`20is`20in`20the`20form`20of`20a`20string`20descriptor`20contai Vning X`09a`20hexadecimal`20number`20(eg`20"22003344").`20`20We`20need`20to`20convert V X`09this`20to`20an`20unsigned`20longword: Xpushal`20`20pid_long`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20;`20output V-value Xpushal`20`20pid_desc`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20;`20input- Vstring Xcalls`20`20`20#2,g`5Eots$cvt_tz_l X X`09We`20then`20call`20our`20pre-built`20routine`20to`20parse`20the`20keywords V`20and X`09set`20the`20privilege`20enable`20and`20disable`20masks: Xpushal`20`20enbmsk Xpushal`20`20dismsk Xcalls`20`20`20#2,parse_keywords X X`09Now`20we're`20ready`20to`20work`20with`20the`20AST.`20`20Since`20we`20inten Vd`20to X`09raise`20IPL`20(Interrupt`20Priority`20Level)`20to`20synchronize`20with X`09VMS`20memory`20management`20structures,`20we`20need`20to`20make`20sure`20th Vat X`09our`20code`20is`20entirely`20memory`20resident.`20`20That`20way`20we`20will V`20not X`09incur`20any`20page`20faults`20at`20high`20IPL`20and`20thereby`20crash`20the V`20system. X`09We`20do`20this`20by`20locking`20all`20the`20code`20pages`20into`20our`20wor Vking`20set: X Xlock_adr:`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20 V`20`20`20`20`20`20`20`20`20;`20Lock`20information`20to`20lock`20down`20the X`20`20`20`20`20`20`20`20.address`20`20`20`20`20`20`20`20lock_start`20`20`20 V`20`20`20;`20code`20pages`20in`20memory`20so`20we`20don't X`20`20`20`20`20`20`20`20.address`20`20`20`20`20`20`20`20lock_end`20`20`20`20 V`20`20`20`20;`20fault`20at`20high`20IPL X X$lkwset_s`20`20`20`20`20`20`20inadr=lock_adr X X`09We`20then`20jump`20into`20kernel`20mode`20to`20allocate`20the`20memory,`20b Vuild X`09an`20ACB`20(AST`20Control`20Block)`20and`20queue`20that`20AST`20to`20our V`20target`20 X`09process: X$cmkrnl_s`20`20`20`20`20`20`20routin=prcprv_k,arglst=k_arg X X`09Inside`20the`20kernel`20mode`20routine`20we`20first`20label`20the`20start V`20of`20our X`09locked`20pages`20range`20and`20then`20get`20the`20requested`20PID: Xlock_start: X`20`20`20`09jsb`20`20g`5Eexe$nampid X X`09EXE$NAMPID`20will`20raise`20IPL`20to`208,`20acquire`20the`20SCHED`20spinloc Vk, X`09and`20return`20an`20internal`20PID`20(IPID)`20in`20R1. X X`09We`20then`20store`20that`20on`20the`20stack`20for`20later`20use: Xpushl`09r1`09`09`09;`20Save`20the`20IPID`20for`20the`20ACB X X`09We`20allocate`20a`20region`20of`20nonpaged`20pool`20to`20contain`20both`20t Vhe X`09ACB`20and`20the`20code: Xmovl`20`20`20`20#prcprv_ast_size,r1`20`20`20`20`20;`20Size`20of`20ACB`20and V`20code Xjsb`20`20`20`20`20g`5Eexe$alononpaged`20`20`20`20`20`20`20;`20Allocate`20nonpa Vged`20dynamic`20memory Xblbc`20`20`20`20r0,scram`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20;`20Fa Viled`20allocation X X`09We`20move`20our`20entire`20code`20in`20there.`20`20(Note`20that`20as`20MOVC V3 X`09affects`20general`20registers`200-5,`20we`20save`20them`20and`20restore X`09them`20around`20it): Xpushr`20`20`20#`5Em`20`20;`20Save`20registers`20across`20MO VVC3 Xmovc3`20`20`20#prcprv_ast_size,prcprv_ast,(r2)`20`20`20`20`20`20`20`20;`20Do V`20the`20copy Xpopr`20`20`20`20#`5Em`20`20;`20restore`20registers X X`09We`20then`20fill`20in`20the`20size`20and`20type`20of`20the`20dynamic`20memo Vry`20 X`09structure`20we`20are`20building`20(the`20ACB)`20so`20that`20it`20can`20be X`09easily`20deallocated`20later: Xmovw`09r1,acb$w_size(r2)`09;`20Fill`20in`20size`20for`20later`20deallocation Xmovb`09#dyn$c_acb,-`09`09;`20Set`20dynamic`20memory`20type`20as`20an`20ACB X`09acb$b_type(r2)`20 X X`09We`20then`20plug`20in`20the`20address`20of`20the`20executable`20code,`20and V X`09move`20the`20privilege`20masks`20into`20the`20AST: Xmoval`09(r2),-`20;`20Put`20pointer`20to`20code`20in`20ACB V X`09acb$l_kast(r2) Xmovq`09@enbadr(ap),-`09`09;`20Put`20enable`20mask`20in`20ast X`09(r2) Xmovq`09@disadr(ap),-`09`09;`20Put`20disable`20mask`20in`20ast X`09(r2) X X`09We`20then`20set`20it`20up`20to`20be`20a`20special`20kernel`20mode`20AST: Xclrb`09acb$b_rmod(r2)`09`09;`20Clear`20request`20mode`20bits Xbisb`09#acb$m_kast,-`09`09;`20And`20set`20as`20a`20special`20kernel`20mode`20A VST X`09acb$b_rmod(r2) X X`09We`20take`20the`20target`20PID`20off`20of`20the`20stack`20and`20stick`20it V`20in`20the`20ACB: Xpopl`20`20`20`20acb$l_pid(r2)`20`20`20`20`20`20`20`20`20`20`20;`20Copy`20targe Vt`20PID`20into`20ACB X X`09Finally`20to`20queue`20the`20ast`20we`20make`20R5`20point`20to`20the`20ACB, V`20make`20R2 X`09contain`20the`20priority`20boost`20upon`20AST`20delivery,`20and`20queue`20i Vt: Xmovl`20`20`20`20r2,r5`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20 V`20;`20R5`20must`20point`20to`20ACB`20for`20SCH$QAST Xmovl`20`20`20`20#pri$_ticom,r2`20`20`20`20`20`20`20`20`20`20;`20Boost`20proces Vs`20priority`20upon`20delivery Xjsb`20`20`20`20`20g`5Esch$qast`20`20`20`20`20`20`20`20`20`20`20`20`20`20;`20Qu Veue`20the`20AST X X`09That`20being`20done,`20we`20set`20a`20success`20status: Xmovl`20`20`20`20#ss$_normal,r0`20`20`20`20`20`20`20`20`20`20;`20Set`20success V`20status X X`09Now`20we`20release`20our`20spinlocks,`20lower`20IPL,`20and`20preserve`20R0 X`09across`20the`20call,`20just`20in`20case`20we`20got`20here`20via`20the`20Scr Vam X`09label`20on`20an`20earlier`20error: Xscram: X`20`20`20`20unlock`20lockanme=SCHED,-`09;`20Release`20spinlock`20and`20lower V`20IPL X`20`20`20`20`09`20`20`20newipl`20`20=`20(sp)+,-`09;`20(preserve`20status`20in V`20case`20we`20got`20here X`09`20`20`20preserve=`20YES`09;`20as`20a`20result`20of`20an`20error) X X`09Then`20we`20provide`20the`20termination`20point`20for`20the`20locked`20page Vs,`20and X`09return`20back`20to`20user`20mode:`09 Xlock_end: X`20`20`20`20`20ret`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20 V`20`20`20`20`20`20`20 X X`09The`20AST`20part`20is`20also`20equally`20simple.`20`20We`20allocate`20enoug Vh`20space X`09for`20the`20ACB,`20our`20two`20privilege`20masks`20(enable`20and`20disable V`20masks), X`09and`20then`20write`20the`20AST: Xprcprv_ast: Xacb:`20`20`20`20`20`20.blkb`20`20`20acb$k_length`20`20`20`20`20`20`20`20`20 V`20`20`20;`20Allocate`20storage`20for`20ACB Xenbmsk_a:`20.blkq`20`20`201`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20 V`20`20`20`20`20`20`20;`20Privilege`20Mask`20enable`20quadword Xdismsk_a:`20.blkq`20`20`201`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20 V`20`20`20`20`20`20`20;`20Privilege`20Mask`20disable`20quadword Xprcprv_ast_code: X X`09We`20first`20call`20the`20code`20to`20disable`20privileges`20listed`20in V`20the`20disable X`09mask,`20and`20then`20the`20enable`20mask.`20`20We`20do`20this`20so`20that V`20the`20combination X`09of`20/PRIVILEGES=(NOALL,TMPMBX,NETMBX)`20will`20have`20the`20desired`20effe Vct. X`09A`20more`20correct,`20yet`20significantly`20slower`20method`20would`20be V`20to`20loop X`09through`20every`20element`20in`20the`20original`20privileges`20keyword`20li Vst,`20and X`09issue`20a`20separate`20$SETPRV`20for`20it.`20`20Instead`20we`20just`20do V`20it`20for`20the`20masks: X$setprv_s`20`20`20`20`20`20`20enbflg=#0,prmflg=#1,prvadr=dismsk_a X$setprv_s`20`20`20`20`20`20`20enbflg=#1,prmflg=#1,prvadr=enbmsk_a X X`09Finally`20we`20move`20the`20pointer`20to`20the`20ACB`20into`20R0`20and`20go V`20deallocate X`09the`20chunk:`20`20`20`20`20`20`20`20 Xmovl`20`20`20`20r5,r0`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20 V`20;`20Set`20up`20pointer`20for`20deallocation Xjmp`20`20`20`20`20g`5Eexe$deanonpaged`20`20`20`20`20`20`20;`20Deallocate`20poo Vl`20and`20cease`20execution X X`09Note`20that`20the`20JMP`20at`20the`20end`20also`20dismisses`20the`20AST. V`20`20That's X`09all`20it`20takes`20to`20modify`20another`20process'`20privileges. X X`09All`20in`20all,`20it`20takes`20two`20original`20files,`20PRCPRV.MAR`20and X`09BUILD.COM`20to`20put`20together`20the`20current`20VMS`20version.`20`20If X`09a`20future`20VMS`20version`20introduces`20new`20privileges,`20or`20changes X`09old`20ones,`20all`20that`20will`20be`20needed`20is`20a`20new`20invocation V`20of X`09the`20command`20@BUILD.COM. X X`09The`20inherent`20simplicity`20of`20VAX`20MACRO-32`20and`20DCL`20allow X`09building`20any`20complex`20procedure`20as`20a`20superset`20of`20simpler X`09building`20blocks. X X X X`0C X`09.title`09prcprv`09Set`20Process`20Privs`20(for`20someone`20else) X`09.ident`20/V1.1-14Jul92/ X;++ X; X;`20I'm`20tired`20of`20trying`20to`20demonstrate`20software,`20and`20telling V`20someone`20to X;`20run`20this`20and`20that,`20only`20to`20have`20to`20give`20them`20privs, V`20have`20them`20log X;`20in`20and`20out,`20etc.`20`20Why`20can't`20I`20set`20the`20privilegs`20of V`20another`20process? X;`20Well...`20now`20I`20can`20:-) X; X;`09V1.0.0`0919-Sep-1991`09Ehud`20Gavron`09Created X;`09`09`09`09gavron@ACES.COM X; X;`09V1.1.0`0914-Jul-1992`09Ehud`20Gavron`09Modified X;`09`09`09`09gavron@ACES.COM X; X;`09`09`09-`20Enforce`20the`20required`20/PRIVILEGES`20qualifier X;`09`09`09-`20Gracefully`20signal`20invalid`20keywords`20in`20CLI$DCL_PARSE X;`09`09`09-`20Cleaned`20up`20code`20moving`20quadword`20masks`20into`20the`20A VST X;`09`09`09-`20Replaced`20PCB`20vector`20table`20search`20with`20EXE$NAMPID`20c Vall X;`09`09`09-`20Cleaned`20up`20and`20fixed`20inconsistent`20symbols`20and`20name Vs X;`09`09`09-`20Removed`20spaghetti`20code`20in`20kernel`20mode`20error`20handli Vng X; X;-- X`09.library`20"sys$library:lib.mlb"`09`09`09;`20Give`20me`20$xxxdefs X`09.link`09`20"sys$system:sys.stb"/selective_search`09;`20Give`20me`20xxx$xx_x Vxxs X X`09$pcbdef`09`09;Process`20Control`20Block`20offsets X`09$dyndef`09`09;Dynamic`20Memory`20types`20 X`09$ipldef`09`09;Interrupt`20Priority`20Level X`09$acbdef`09`09;AST`20Control`20block`20offsets X`09$pridef`09`09;Priority`20boost`20classes X`09$spldef`09`09;Spinlock`20types X X`09.macro`09check`09?l X`09blbs`09r0,l X`09$exit_s`09r0 Xl: X`09.endm`09check X Xcmd_len`20=`2080 Xcmd_desc:`09.long`09cmd_len X`09`09.address`20cmd_buf Xcmd_buf:`09.blkl`09cmd_len X Xcld_len`20=`20cmd_len`20+`2010 Xcld_desc:`09.long`09cld_len X`09`09.address`20cld_buf Xcld_buf:`09.blkl`09cld_len X Xcmd_name:`09.ascid`20"PRCPRV" Xident_desc:`09.ascid`20"IDENTIFICATION" Xpriv_desc:`09.ascid`20"PRIVILEGES" X Xenbmsk:`09`09.blkq`091`09`09;`20Enable`20privs`20mask Xdismsk:`09`09.blkq`091`09`09;`20Disable`20privs`20mask Xpid_desc:`09.ascid`09"00000000"`09;`20A`20PID`20descriptor.`20`20Filled`20with V`200's Xpid_long:`09.blkl`091`09`09;`20Longword`20PID Xk_arg:`09`09`09`09`09;`20argument`20list`20for`20kernel`20mode`20routine X`09.long`094`09`09`09;`20to`20pass`20the`20PID`20address,`20a`20null`20for X`09.address`09pid_long`09;`20process`20name,`20and`20privilege`20enable X`09.long`09`090`09`09;`20and`20disable`20masks X`09.address`09enbmsk X`09.address`09dismsk Xlock_adr:`09`09`09`09;`20Lock`20information`20to`20lock`20down`20the X`09.address`09lock_start`09;`20code`20pages`20in`20memory`20so`20we`20don't X`09.address`09lock_end`09;`20fault`20at`20high`20IPL X X`09.entry`09prcprv,`5Em<> X; X;`20Establish`20a`20condition`20handler`20for`20CLI$`20calls`20that`20will`20r Veturn`20to`20us X; X`09moval`09g`5Elib$sig_to_ret,(fp) X; X;`20Get`20the`20command`20line X; X`09pushl`09#0`09`09`09;`20flags X`09pushal`09cmd_desc`09`09;`20resultant-length X`09pushl`09#0`09`09`09;`20prompt X`09pushal`09cmd_desc`09`09;`20resultant-string X`09calls`09#4,g`5Elib$get_foreign X`09check X; X;`20Append`20the`20newly`20gotten`20string`20to`20the`20command`20name X; X`09pushal`09cmd_desc X`09pushal`09cmd_name X`09pushal`09cld_desc X`09calls`09#3,g`5Estr$concat X`09check X; X;`20Get`20DCL`20to`20parse`20it`20for`20us X; X`09pushl`09#0`09`09`09;`20prompt_string X`09pushal`09g`5Elib$get_input`09`09;`20prompt_routine X`09pushl`09#0`09`09`09;`20param_routine X`09pushal`09prcprv_cld`09`09;`20table X`09pushal`09cld_desc`09`09;`20command_string X`09calls`09#5,g`5Ecli$dcl_parse X`09check X; X;`20Make`20sure`20that`20the`20PRIVILEGES`20qualifier`20was`20entered X; X`09pushal`09priv_desc`09`09;`20entity_desc X`09calls`09#1,g`5Ecli$present X`09check X; X;`20Now`20get`20the`20process`20ID`20we're`20interested`20in X; X`09pushal`09pid_desc`09`09;`20retlength X`09pushal`09pid_desc`09`09;`20retdesc X`09pushal`09ident_desc`09`09;`20entity X`09calls`09#3,g`5Ecli$get_value X`09check X; X;`20Convert`20from`20hexadecimal`20text`20to`20binary`20longword X; X`09pushal`09pid_long`09`09;`20output-value X`09pushal`09pid_desc`09`09;`20input-string X`09calls`09#2,g`5Eots$cvt_tz_l X`09check X; X;`20Parse`20the`20privilege`20keywords`20to`20set`20the`20masks X; X`09pushal`09enbmsk X`09pushal`09dismsk X`09calls`09#2,parse_keywords X; X;`20Make`20sure`20we`20don't`20fault`20at`20high`20IPL`20by`20locking`20down V`20pages`20in`20working`20set X; X`09$lkwset_s`09inadr=lock_adr X`09check X; X;`20Call`20routine`20to`20allocate`20memory,`20put`20ACB`20there,`20and`20queu Ve`20AST X; X`09$cmkrnl_s`09routin=prcprv_k,arglst=k_arg X`09$exit_s`09r0 X X; X;`20Kernel`20mode`20routine`20to`20do`20the`20dirty`20deeds.`20`20Some`20of V`20this`20is`20based`20on X;`20Bruce`20Ellis'`20WSBLASTER`20routine. X; X`09.entry`09prcprv_k,`5Em<> X; X;`20PRCPRV_K`20-`20The`20kernel`20mode`20routine`20to`20create`20an`20AST`20an Vd`20queue`20it`20to X;`09`20`20`20`20`20the`20target`20process. X; X;`20Calling: X;`09PIDADR(AP)`09-`20Address`20of`20target`20PID`09 X;`09PRCNAM(AP)`09-`20Address`20of`20process`20name`20(not`20used) X;`09ENBADR(AP)`09-`20Address`20of`20enable-privs`20mask`20 X;`09DISADR(AP)`09-`20Address`20of`20disable-privs`20mask X; X XPIDADR`20=`204 XPRCNAM`20=`208`09;`20<--`20unused`20except`20to`20force`20exe$nampid`20to`20pa Vrse`20a`20PID`20of`200 XENBADR`20=`2012 XDISADR`20=`2016 X X Xlock_start: X; X;`20Use`20EXE$NAMPID`20to`20convert`20our`20target`20PID`20to`20a`20PCB`20addr Vess.`20`20Note`20that`20 X;`20IPL`20will`20be`20at`20IPL$_SYNCH`20with`20the`20SCHED`20spinlock`20held V`20as`20a`20result`20of X;`20this`20call.`20`20(The`20only`20two`20exceptions`20to`20an`20IPL`20raise V`20would`20be`20an`20invalid X;`20process`20name`20or`20unreadable`20PID`20on`20stack.`20`20Neither`20of`20t Vhese`20can`20occur`20here.) X; X`09jsb`09g`5Eexe$nampid X`09blbs`09r0,10$ X`09ret X10$: X`09pushl`09r1`09`09`09;`20Save`20the`20IPID`20for`20the`20ACB X; X;`20Allocate`20memory`20for`20the`20Ast`20Control`20Block`20(ACB)`20and`20the V`20AST`20code X; X`09movl`09#prcprv_ast_size,r1`09;`20Size`20of`20ACB`20and`20code X`09jsb`09g`5Eexe$alononpaged`09;`20Allocate`20nonpaged`20dynamic`20memory X`09blbc`09r0,scram`09`09;`20Failed`20allocation`20 X; X;`20Copy`20the`20AST`20code`20and`20ACB`20into`20the`20allocated`20region X; X`09pushr`09#`5Em`09;`20Save`20registers`20across`20MOVC3 X`09movc3`09#prcprv_ast_size,-`09;`20Copy`20the`20ACB+AST`20into`20the`20pool V`20region X`09`09prcprv_ast,(r2) X`09popr`09#`5Em`09;`20Restore`20registers X; X;`20Fill`20in`20appropriate`20ACB`20fields`20so`20we`20know`20what`20it`20is, V`20how`20big`20it`20is, X;`20and`20where`20to`20start`20executing`20on`20AST`20delivery X; X`09movw`09r1,acb$w_size(r2)`09;`20Fill`20in`20size`20for`20later`20deallocatio Vn X`09movb`09#dyn$c_acb,-`09`09;`20Set`20dynamic`20memory`20type`20as`20an`20ACB X`09`09acb$b_type(r2)`20 X`09moval`09(r2),-`20;`20Put`20pointer`20to`20code`20in V`20ACB X`09`09acb$l_kast(r2) X`09movq`09@enbadr(ap),-`09`09;`20Put`20enable`20mask`20in`20ast X`09`09(r2) X`09movq`09@disadr(ap),-`09`09;`20Put`20disable`20mask`20in`20ast X`09`09(r2) X`09clrb`09acb$b_rmod(r2)`09`09;`20Clear`20request`20mode`20bits X`09bisb`09#acb$m_kast,-`09`09;`20And`20set`20as`20a`20special`20kernel`20mode V`20AST X`09`09acb$b_rmod(r2) X`09popl`09acb$l_pid(r2)`09`09;`20Copy`20target`20PID`20into`20ACB X`09movl`09r2,r5`09`09`09;`20R5`20must`20point`20to`20ACB`20for`20SCH$QAST X`09movl`09#pri$_ticom,r2`09`09;`20Boost`20process`20priority`20upon`20delivery V X`09jsb`09g`5Esch$qast`09`09;`20Queue`20the`20AST X`09movl`09#ss$_normal,r0`09`09;`20Set`20success`20status Xscram:`09unlock`09lockname=sched,-`09;`20Release`20spinlock`20and`20lower`20IP VL X`09`09newipl`20`20=`20(sp)+,-`09;`20(preserve`20status`20in`20case`20we`20got V`20here X`09`09preserve=`20YES`09`09;`20as`20a`20result`20of`20an`20error) Xlock_end: X`09ret X X; X;`20The`20ACB X; Xprcprv_ast: Xacb:`09`20`20.blkb`09acb$k_length`09`09;`20Allocate`20storage`20for`20ACB Xenbmsk_a:`20.blkq`091`09`09`09;`20Privilege`20Mask`20enable`20quadword Xdismsk_a:`20.blkq`201`09`09`09;`20Privilege`20Mask`20disable`20quadword X; X;`20The`20actual`20Asynchronous`20System`20Trap`20(AST)`20code X; Xprcprv_ast_code: X`09$setprv_s`09enbflg=#0,-`09;`20Disable`20requested`20privs X`09`09`09prmflg=#1,- X`09`09`09prvadr=dismsk_a X`09$setprv_s`09enbflg=#1,-`09;`20Enable`20requested`20privs X`09`09`09prmflg=#1,- X`09`09`09prvadr=enbmsk_a X`09movl`09r5,r0`09`09`09;`20Set`20up`20pointer`20for`20deallocation X`09jmp`09g`5Eexe$deanonpaged`09;`20Deallocate`20pool`20and`20cease`20execution V X`09prcprv_ast_size=.-prcprv_ast X`09.end`09prcprv X X`0C XFigure`202:`20BUILD.COM X$!`20Build.COM`09-`20Builds`20PRCPRV X$! X$!`20Ehud`20Gavron`09`09Gavron@Spades.ACES.COM X$!`2020-Sep-1991 X$! X$!---------------------------------------------------------------------------- V- X$!`20First`20create`20the`20.CLD`20and`20keyword`20parser: X$! X$! X$`20library/extract=$PRVDEF/output=prvdef.mar`20sys$library:starlet.mlb X$`20open`20infile`20prvdef.mar X$`20create`20prcprv_cld_mar.mar X$`20deck/dollars="$EOD" X;`20PRCPRV_CLI_TEMPLATE.MAR`09-`20Ehud`20Gavron`20-`09`0920-Sep-1991 X; X;`20This`20template`20file`20is`20copied`20into`20the`20start`20of`20PRCPRV_CL VI.MAR. X;`20It`20contains`20the`20macro`20CLI_CHECK.`20`20CLI_CHECK`20is`20called`20wi Vth`20two X;`20arguments`20-`20the`20CLI`20keyword`20to`20check`20for,`20and`20the`20name V`20of`20the X;`20symbol`20which`20contains`20the`20mask`20value`20to`20set`20or`20unset. X; X;`20One`20of`20two`20masks`20(ENBMSK,DISMSK)`20is`20modified`20based`20on`20wh Vether X;`20the`20keyword`20is`20present`20or`20negated`20respectively.`20`20The`20cod Ve X;`20produced`20after`20the`20template`20is`20done`20by`20processing`20$prvdef. V X; X`09.library`09"sys$Library:lib.mlb" X`09.link`09`09"sys$system:sys.stb"/selective_search X`09$climsgdef X`09$prvdef X X`09.macro`20cli_check`20keyword,symbol`20?l`20?l2`20?l3`20?l4`20?a X`09pushal`09a`09`09`09`09;`20Push`20address`20of`20keyword`20desc X`09calls`09#1,g`5Ecli$present`09`09;`20Is`20it`20here? X`09cmpl`09r0,#cli$_present`09`09;`20Yes? X`09beql`09l`09`09`09`09;`20If`20so`20goto`20l X`09cmpl`09r0,#cli$_negated`09`09;`20Is`20it`20negated? X`09bneq`09l2`09`09`09`09;`20No`20-`20not`20here,`20exit X`09cmpl`09#symbol,#64`09`09`09;`20Is`20ALL`20negated? X`09bneq`09l4`09`09`09`09;`20no,`20something`20else`20is X`09mnegl`09#1,(r4)`09`09`09`09;`20negate`20all`20of`20dismsk X`09mnegl`09#1,4(r4) X`09brb`09l2`09`09`09`09;`20and`20exit Xl4:`09bbss`09#symbol,(r4),l2`09`09`09;`20Something`20is`20negated X`09brb`09l2`09`09`09`09;`20so`20do`20it Xl:`09cmpl`09#symbol,#64`09`09`09;`20is`20ALL`20here? X`09bneq`09l3`09`09`09`09;`20no,`20something`20is`20here X`09mnegl`09#1,(r5)`09`09`09`09;`20set`20all`20bits`20on X`09mnegl`09#1,4(r5)`09`09`09;`20in`20enbmsk X`09brb`09l2`09`09`09`09;`20and`20exit Xl3:`09bbss`09#symbol,(r5),l2`09`09`09;`20enable`20something X`09brb`09l2`09`09`09`09;`20exit Xa:`09.ascid`09/keyword/ Xl2: X`09.endm X X`09.entry`09parse_keywords,`5Em X`09movl`094(ap),r4`09`09;`20address`20of`20dismsk X`09movl`098(ap),r5`09`09;`20address`20of`20enbmsk X; X;`20End`20of`20template!!! X; X$EOD X$`20open/append`20outmar`20prcprv_cld_mar.mar X$`20create`20prcprv_cld.cld X$DECK/dollars="$EOD" Xdefine`20verb`20PRCPRV X`20`20qualifier`20IDENTIFICATION X`20`20`20`20`20value`20(required) X`20`20qualifier`20PRIVILEGES X`20`20`20`20`20value`20(required,list,type=PRIVILEGES) X Xdefine`20type`20PRIVILEGES X`20`20`20keyword`20ALL,negatable X$EOD X$`20open/append`20outcld`20prcprv_cld.cld X$! X$!`20We`20do`20the`20chicanery`20with`20keyword`20below`20because`20we`20can't V`20use`20 X$!`20f$element(1,"_",symbol)`20since`20PHY_IO`20and`20LOG_IO`20have`20an`20"_" V`20in`20them. X$! X$`20write`20outmar`20"`09cli_check`20ALL,64" X$rloop: X$`20read/end=eof`20infile`20line X$`20upcase`20=`20f$edit(line,"upcase,compress,trim") X$`20if`20f$element(0,"`20",upcase)`20.nes.`20"$EQU"`20then`20goto`20rloop X$`20symbol`20`20=`20f$element(1,"`20",upcase) X$`20under`20`20`20=`20f$locate("_",symbol) X$`20m`20=`20f$extract(under-1,1,symbol) X$`20if`20m`20.eqs.`20"M"`20then`20goto`20rloop X$`20length`20`20=`20f$length(symbol) X$`20keyword`20=`20f$extract(under+1,length-under,symbol) X$`20value`20`20`20=`20f$element(2,"`20",upcase) X$`20write`20sys$output`20"Inserting`20keyword`20''keyword'..." X$`20write`20outcld`20"`20`20`20keyword`20''keyword',`20negatable" X$`20if`20value`20.lt.`2032`20then`20goto`20writeit X$`20val`20=`20value`20-`2032 X$`20write`20outmar`20"`09addl`09#4,r4" X$`20write`20outmar`20"`09addl`09#4,r5" X$`20write`20outmar`20"`09cli_check`20''keyword',''val'" X$`20write`20outmar`20"`09subl`09#4,r4" X$`20write`20outmar`20"`09subl`09#4,r5" X$`20goto`20rloop X$writeit: X$`20write`20outmar`20"`09cli_check`20''keyword',''symbol'" X$`20goto`20rloop X$! X$eof: X$`20write`20outmar`20"`09ret" X$`20write`20outmar`20"`09.end" X$`20close`20outmar X$`20close`20outcld X$`20close`20infile X$! X$!`20Now`20we`20compile`20the`20sources X$! X$`20macro`20prcprv X$`20macro`20prcprv_cld_mar X$`20set`20command/object`20prcprv_cld X$`20link/notrace`20prcprv,prcprv_cld,prcprv_cld_mar X$`20delete`20prvdef.mar;* X$`20purge`20prcprv_cld.cld,prcprv_cld_mar.* X$`20exit $ call unpack PRCPRV.COM;1 762918554 "" $! $ create 'f' XThis`20file`20contains`20a`20routine`20previously`20run`20in`20the`20January/F Vebruary`201993`20 Xissue`20of`20Digital`20Systems`20Journal.`20It`20comes`20from`20Ehud`20Gavron' Vs`20article,`20 X"Setting`20Other`20Processes'`20Privileges,"`20which`20ran`20on`20page`2028. V`20In`20the`20 Xarticle,`20you'll`20learn`20how`20to`20change`20the`20privileges`20for`20anoth Ver`20process.`20 XThen`20you'll`20find`20out`20how`20to`20build`20a`20program`20that`20knows`20a Vll`20the`20current`20 Xprivilege`20names`20for`20the`20version`20of`20OpenVMS`20under`20which`20it's V`20built. $ call unpack PRCPRV.DESC;1 1580873584 "" $ v=f$verify(v) $ exit