From: DEREK@U.WASHINGTON.EDU
Newsgroups: vmsnet.internals
Subject: Re: What's the use of SETPRV privilege?
Date: 10 Apr 92 07:49:00 GMT
Organization: Macro32<==>Vmsnet.Internals Gateway
X-Gateway-Source-Info: Mailing List

On this topic, Carlo Mekenkamp further asked:

>Hm...
>So there are two privilege masks for a process, AUTHORIZED and SET.
>
>Consider the example I gave, having a subprocess with privs
>CMKRNL and TMPMBX and then set the SETPRV privilege.
>
>So CMKRNL and TMPMBX are both authorized and set.
>SETPRV is only set but not authorized.
>
>Now execute another SPAWN command.
>And then it's also possible to set any privilege with set proc/priv.
>So a subprocess inherits both its authorized and its set
>privileges from its parent's set privileges ??

Yes..... and no.

There are actually four privilege masks for a process.

        AUTHORIZED privileges -- "from the UAF"
                                When you log in, your UAF AUTHORIZED
                                privilege mask is copied into this mask.

        PROCESS privileges -- "from the UAF"
                                When you log in, your UAF DEFAULT
                                privilege mask is copied here.

        IMAGE privileges -- from "INSTALL"
                                This mask is set by the image activator
                                when you run an image which is installed
                                with privileges.

        CURRENT privileges -- privileges currently enabled.

        Normally when you are at the DCL prompt your CURPRIV and PROCPRIV
        masks are the same.  This is also normally true when you run a
        "user" image.  (For lack of a better word.)

        The SET PROCESS/PRIVILEGE command affects the PROCPRIV mask.
        It will remove any privilege, but will only add those which
        appear in your AUTHPRIV mask.

        The $SETPRV system service can affect either PROCPRIV or
        CURPRIV.  "Normally" it affects only the CURPRIV mask.  To
        modify PROCPRIV you must use the "permanent" flag.

        When you invoke an installed image (such as SHOW.EXE, which is
        normally installed with CMKRNL), the image activator places the
        installed privileges into IMAGPRIV, .OR.s those privileges with
        PROCPRIV, and places the result into CURPRIV.  Then, using
        $SETPRV, the image may add and/or remove "authorized/installed"
        privileges from the CURPRIV mask.  It should be able to remove any
        privilege from PROCPRIV, and it may "permanently" add any
        privileges found in AUTHPRIV.

        For security reasons, installed images frequently reset CURPRIV
        to PROCPRIV, and then attempt to enable privileges from IMAGPRIV
        when/if needed.  If this tactic is NOT used with a program which
        may SPAWN a subprocess, the result is what you have seen.

        Basically, a subprocess is given your CURPRIV mask as its
        AUTHPRIV and PROCPRIV masks.

        Is all of this clear as mud?  :)

        It's getting a bit late.  Perhaps it is time to go to sleep.

-Derek S. Haining
 University Computing Services
 University of Washington
 Seattle, Washington  98195
 (206) 543-5579

 DEREK@MAX.BITNET
 DEREK@MAX.U.WASHINGTON.EDU