              <<< VAXAXP::NOTES$:[NOTES$LIBRARY]VMSNOTES.NOTE;1 >>>
               -< VAX and Alpha VMS - Digital Internal Use Only >-
================================================================================
Note 1062.3            SYS$PERSONA and system () DEC C RTL                3 of 3
ROM01::CALDONI                                       31 lines  20-JUN-1996 08:24
                       -< sample code  for SYS$PERSONA >-
--------------------------------------------------------------------------------
    Here is a sample code: user "TRASFE" has only TMPMBX and NETMBX privs;
    the first lib$spawn works, the second, after using sys$persona, does
    not.
    The account from wich I run this code has the following provileges set:
    TMPMBX,NETMBX,DETACH (required for sys$persona), SYSPRV (required too
    for sys$persona, although documentation states only DETACH needed)
    To me it looks like a privileges issue! Thanks,
     
    Gaetano
    
    $ ty stub2.c
    #include  <stdlib.h>
    #include  <processes.h>
    #include <descrip.h>
    #include  <ssdef.h>
    #include  <impdef.h>
    #include  <starlet.h>
    
    main()
    {
    
    int pers, status;
    $DESCRIPTOR(user_dscr,"TRASFE");
    $DESCRIPTOR(cmnd_dscr,"DIR");
    status = lib$spawn(&cmnd_dscr); !this works 
    status = sys$persona_create(&pers,&user_dscr,IMP$M_ASSUME_DEFPRIV);
    status = sys$persona_assume(&pers,IMP$M_ASSUME_SECURITY|IMP$M_ASSUME_JOB_WIDE);
    status = lib$spawn(&cmnd_dscr); !this does not work
    status = sys$persona_delete(&pers);
    exit(status);
    }
