From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CUNYVM.CUNY.EDU::MILILM%VTCC1.BITNET"  7-AUG-1989 21:04
To:	MRGATE::"ARISIA::EVERHART"
Subj:	No Subject

Message-Id:  <8908080101.AA18000@crdgw1.ge.com>
Received: from VTCC1.BITNET by VTVM1.CC.VT.EDU (IBM VM SMTP R1.2.1MX) with BSMTP id 2652; Mon, 07 Aug 89 20:59:32 EDT
Received: by VTCC1 (Jnet BSMTP V0.07) id 1765; Mon,  7 Aug 89 20:48 EDT
Date:     Mon,  7 Aug 89 20:48 EDT
From: Raj Viruru / L.M. Mili <MILILM%VTCC1.BITNET@VTVM1.CC.VT.EDU>
Subject: 
To: EVERHART@ARISIA.decnet
Original_To:   COM%"EVERHART%ARISIA.decnet@CRDGW1.GE.COM"

$ v='f$verify(f$trnlnm("SHARE_VERIFY"))'
$! ------------------ CUT HERE -----------------------
$!
$! This archive created by VMS_SHARE Version 7.1-002  17-JUl-1989
$!   On  6-AUG-1989 10:18:06.99   By user MILILM
$!
$! This VMS_SHARE Written by:
$!    Andy Harper, Kings College London UK
$!
$! Acknowledgements to:
$!    James Gray       - Original VMS_SHARE
$!    Michael Bednarek - Original Concept and implementation
$!
$!+ THIS PACKAGE DISTRIBUTED IN 3 PARTS, TO KEEP EACH PART
$!  BELOW 30 BLOCKS
$!
$! 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. AAAREADME.1ST;1
$!       2. BECOME.COM;1
$!       3. BECOME.PAS;1
$!       4. BECOMECLD.CLD;1
$!       5. BECOMEMSG.MSG;1
$!       6. BECOMESUB.MAR;1
$!       7. COMFILE.FOR;1
$!
$set="set"
$set symbol/scope=(nolocal,noglobal)
$f=f$parse("SHARE_TEMP","SYS$SCRATCH:.TMP_"+f$getjpi("","PID"))
$e="write sys$error  ""%UNPACK"", "
$w="write sys$output ""%UNPACK"", "
$ if f$trnlnm("SHARE_LOG") then $ w = "!"
$ if f$getsyi("version") .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
$ if f$search(P1) .eqs. "" then $ goto file_absent
$ e "-W-EXISTS, File ''P1' exists. Skipped."
$ delete/nolog 'f'*
$ exit
$file_absent:
$ 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/nolog 'f'*
$ exit
$dirok:
$ w "-I-PROCESS, Processing file ''P1'."
$ define/user sys$output nl:
$ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='P1'
PROCEDURE Unpacker ON_ERROR ENDON_ERROR;SET(FACILITY_NAME,"UNPACK");SET(
SUCCESS,OFF);SET(INFORMATIONAL,OFF);f:=GET_INFO(COMMAND_LINE,"file_name");
buff:=CREATE_BUFFER(f,f);p:=SPAN(" ")@r&LINE_END;POSITION(BEGINNING_OF(buff))
;LOOP EXITIF SEARCH(p,FORWARD)=0;POSITION(r);ERASE(r);ENDLOOP;POSITION(
BEGINNING_OF(buff));g:=0;LOOP EXITIF MARK(NONE)=END_OF(buff);x:=
ERASE_CHARACTER(1);IF g = 0 THEN IF x="X" THEN MOVE_VERTICAL(1);ENDIF;IF x=
"V" THEN APPEND_LINE;MOVE_HORIZONTAL(-CURRENT_OFFSET);MOVE_VERTICAL(1);ENDIF;
IF x="+" THEN g:=1;ERASE_LINE;ENDIF;ELSE IF x="-" THEN g:=0;ENDIF;ERASE_LINE;
ENDIF;ENDLOOP;p:="`";POSITION(BEGINNING_OF(buff));LOOP r:=SEARCH(p,FORWARD);
EXITIF r=0;POSITION(r);ERASE(r);COPY_TEXT(ASCII(INT(ERASE_CHARACTER(3))));
ENDLOOP;o:=GET_INFO(COMMAND_LINE,"output_file");WRITE_FILE(buff,o);
ENDPROCEDURE;Unpacker;EXIT;
$ delete/nolog 'f'*
$ CHECKSUM 'P1'
$ IF CHECKSUM$CHECKSUM .eqs. P2 THEN $ EXIT
$ e "-E-CHKSMFAIL, Checksum of ''P1' failed."
$ ENDSUBROUTINE
$START:
$ create/nolog 'f'
XThis program when used as a foreign command allows a suitably privileged use
Vr
Xto "BECOME" another user.  This program sets the following process parameter
Vs:`032
X
X`009UIC
X`009DEFAULT DEVICE & DIRECTORY
X`009PROCESS NAME
X`009USERNAME
X`009ACCOUNT NAME
X`009PROCESS PRIVS
X`009GROUP LOGICAL NAME TABLE LNM$GROUP
X`009RIGHTS from RIGHTSLIST.DAT
X
XNote that BECOME does not change the process's limits or quotas nor does it
Xexecute the target user's LOGIN.COM file.  BECOME does not touch the authori
Vzed
Xprivilege mask so that once you become another user, you can still become
Xyourself again.`032
X( this is the change I made, you can do LOGIN.COM,SYLOGIN.COM)
X
X
XThis submission is V1.6 of BECOME which has had several modifications and
Xbug fixes made in it.  Please read the header comments in the PASCAL & MACRO
Xsources to find out what's been changed.
X
XAny questions or comments should be directed to:
X
X`009Eric Wentz
X`009General Electric Co.
X`009Nela Park Noble Rd #1782.00
X`009Cleveland, Ohio 44112
X`009(216)266-2382
X
XTo install BECOME do the following.
X
Xedit comfile.for ; change the directory where BECOME.COM is located to suit
Xyour system, it should have world access.
X
X$ MESSAGE BECOMEMSG
X$ SET COMMAND/OBJECT BECOMECLD
X$ MACRO BECOMESUB
X$ PASCAL BECOME
X$ fortran comfile
X$ LINK BECOME,BECOMESUB,BECOMEMSG,BECOMECLD,comfile
X$ COPY BECOME.EXE SYS$COMMON:`091SYSEXE`093
X
XIn your LOGIN.COM file put:
X
X$ BECOME :== $BECOME
X
XNote that if you do not have a Pascal compiler,  the object module
XBECOME.OBJ has been included.  If you do intend to recompile the source,
Xyou must first compile the Pascal environment files in the directory
Xpointed to by the PASCAL$ENVIRONMENT logical name.  The sources for
Xthese environment files are included in another directory of this submission
V.
$ CALL UNPACK AAAREADME.1ST;1 1681713397
$ create/nolog 'f'
X$ delete/key/all/nolog
X$ delete/symbol/all/global/nolog
X$ type sys$manager:welcome.txt
X$ @sys$manager:sylogin
X$ @sys$login:login
$ CALL UNPACK BECOME.COM;1 1751393683
$ create/nolog 'f'
X`091IDENT('V1.8'),`009`009    `123 Update this with the version constant bel
Vow `125
XINHERIT ('SYS$LIBRARY:STARLET.PEN')`093
XPROGRAM BECOME(OUTPUT);
X
X`123 This program when used as a foreign command allows a suitably privilige
Vd
X  user to "BECOME" another user.  This program sets the following process
X  parameters:
X
X`009UIC
X`009DEFAULT DEVICE & DIRECTORY
X`009PROCESS NAME
X`009USERNAME
X`009ACCOUNT NAME
X`009PROCESS PRIVS
X`009GROUP LOGICAL NAME TABLE LNM$GROUP
X`009RIGHTS from RIGHTSLIST.DAT
X
XNote that BECOME does not change the process's limits or quotas.
X
XAuthor: Eric Wentz 1-May-1985 General Electric Co., Cleveland Ohio`032
X----------------------------------------------------------------------------
V----
XModification history:
XVersion 1.1 added these logical names:
X`009Eric Wentz 9-Sep-1985
X`009Changed logical name handling and add the three names
X`009SYS$LOGIN logical name
X`009SYS$LOGIN_DEVICE logical name
X`009SYS$SCRATCH logical name
XVersion 1.2
X`009Eric Wentz 26-Sep-1985
X`009Set the owner of the logical name table to be the same
X`009as the new user
XVersion 1.3
X`009Eric Wentz 20-Mar-1986
X`009Modified so that when you become a new user, you get all their
X`009`009rights as defined by the rightslist database.
X`009Changed process name to be more consistent with the way
X`009`009in which VMS handles duplicate process names.
X`009Added sanity check so you can't BECOME another user if you're
X`009`009in a sub-process or you own any subprocesses.
X`009Moved all messages to a message file.
X`009Added in the code to change the account name.
X`009Disable `094Y during the actual kernel changes.
X
XVersion 1.4
X`009Eric Wentz 17-May-1986
X`009Fixed the way process names were passed to VMS so that
X`009they wouldn't have trailing spaces.
X`009Changed UAF access to use the $GETUAI system service
X
XVersion 1.5 24-Nov-1986 Eric Wentz
X`009Fixed bug which caused the program not to exit if the user
X`009owened a sub-process.
X
XVersion 1.6 8-Feb-1987 Eric Wentz
X`009Added CLI parsing to the command string so we can support command
X`009qualifiers.
X`009Added the /VERSION qualifier to show the current version of BECOME
X
XVersion 1.7 10-Jun-1987 Eric Wentz
X`009Added accounting records so we can track who became who and when.
X
XVersion 1.8 04-Dec-1987 Eric Wentz
X`009Made necessary changes for VMS V5.x
X----------------------------------------------------------------------------
V---`125
XCONST
X    VER_STRING = 'V1.8';`009`009    `123 Update with version in the header`1
V25
X
XTYPE
X    UBYTE`009    = `091BYTE`093 0..255;
X    UWORD`009    = `091WORD`093 0..65535;
X    UQUAD`009    = `091QUAD,UNSAFE`093 RECORD L0,L1:UNSIGNED;END;
X    USERNAME_TYPE   = PACKED ARRAY `0911..12`093 OF CHAR;
X    ACCOUNT_TYPE    = PACKED ARRAY `0911..8`093 OF CHAR;
X
X    ITEM_LIST_TYPE = RECORD
X`009BUFFER_LENGTH`009: UWORD;
X`009ITEM_CODE`009: UWORD;
X`009BUFFER_ADDRESS`009: UNSIGNED;
X`009RETURN_LEN_ADDR`009: UNSIGNED;
X`009END;
X
X    UIC_TYPE = RECORD CASE INTEGER OF
X    1:(UIC  : INTEGER);
X    2:(MEMBER`009: UWORD;
X       GROUP`009: UWORD);
X       END;
X    VARY16 = RECORD
X`009LENGTH`009: UBYTE;
X`009BODY`009: PACKED ARRAY `0911..16`093 OF CHAR;
X`009END;
X    VARY64 = RECORD
X`009LENGTH`009: UBYTE;
X`009BODY`009: PACKED ARRAY `0911..64`093 OF CHAR;
X`009END;
X
X
X(********** Define the variables used by the program ************)
X
XVAR
X    ISTAT`009: `091VOLATILE`093 INTEGER;
X    NEW_USERNAME: USERNAME_TYPE;
X    SETUP_PRIVS`009: UQUAD:=0;
X    IDENTIFIER`009: UQUAD;
X    CONTEXT`009: UNSIGNED;
X    HOLDER`009: UQUAD;
X    ERRMSG`009: VARYING`091255`093 OF CHAR;
X    JPI_LIST`009: ARRAY `0911..2`093 OF ITEM_LIST_TYPE:=
X`009`009((4,JPI$_UIC,0,0),(0,0,0,0));
X`123
XLocal storage for $GETUAI items (from UAF file)
X`125
X    DEFDEV`009: `091VOLATILE`093 VARY16;
X    DEFDIR`009: `091VOLATILE`093 VARY64;
X    UIC`009`009: `091VOLATILE`093 UIC_TYPE;
X    ACCOUNT`009: ACCOUNT_TYPE;
X    PRIV`009: `091QUAD`093 PRV$TYPE;
X    GETUAI_LIST`009: ARRAY `0911..7`093 OF ITEM_LIST_TYPE:=ZERO;
X`123
XDefine the variables for the message numbers
X`125
X    BECOME_NOINSUB,
X    BECOME_NOSUB,
X    BECOME_UAFNOTFOU,
X    BECOME_VERSION,
X    BECOME_BECAME,
X    BECOME_NOUSER`009: `091EXTERNAL,VALUE`093 INTEGER;
X
X    COMMAND_STRING : VARYING `09180`093 OF CHAR;
X    BECOMECLD : `091EXTERNAL,VALUE`093 INTEGER;`009`123 Parsing tables for C
VLI    `125
X
X(******** Functions that reside in BECOMESUB.MAR ************)
X
XPROCEDURE COMFILES;`009EXTERNAL;
XPROCEDURE SET_UIC`009(VAR UIC`009: `091VOLATILE`093 UIC_TYPE);`009EXTERNAL;
XPROCEDURE SET_USERNAME`009(VAR USERNAME`009: USERNAME_TYPE);`009EXTERNAL;
XPROCEDURE SET_ACCOUNT`009(VAR ACCOUNT`009: ACCOUNT_TYPE);`009EXTERNAL;
XPROCEDURE SET_PRIVS`009(VAR PRIVS`009: `091QUAD`093 PRV$TYPE);`009EXTERNAL;
XFUNCTION SET_TABLE_PROT(VAR UIC`009: `091VOLATILE`093UIC_TYPE):INTEGER;`009E
VXTERNAL;
X
X
X(***************************************************************************
V***)
X(***************   Define RTL routines  ************************************
V***)
X(***************************************************************************
V***)
X
X`091ASYNCHRONOUS`093 PROCEDURE LIB$STOP
X  (%IMMED Cond_Value :INTEGER);EXTERNAL;
X
XFUNCTION LIB$GET_FOREIGN(
X`009var get_str : `091CLASS_S`093 PACKED ARRAY
X`009`091$L1..$U1:INTEGER`093 OF CHAR;
X`009var user_prompt : `091CLASS_S,READONLY`093 PACKED ARRAY
X`009`091$L2..$U2:INTEGER`093 OF CHAR := %IMMED 0;
X`009var out_len : UWORD := %IMMED 0;
X`009var force_prompt : `091CLASS_S,READONLY`093 PACKED ARRAY
X`009`091$L3..$U3:INTEGER`093 OF CHAR := %IMMED 0):integer; external;
X
XPROCEDURE LIB$PUT_OUTPUT(
X    VAR STR : `091READONLY,CLASS_S`093 PACKED ARRAY `091A..B:INTEGER`093 OF
V CHAR);EXTERNAL;
X
XPROCEDURE LIB$ENABLE_CTRL(
X`009VAR ENABLE_MSK : `091READONLY`093 UNSIGNED);EXTERNAL;
X
XPROCEDURE LIB$DISABLE_CTRL(
X`009VAR DISABLE_MSK : `091READONLY`093 UNSIGNED);EXTERNAL;
X
X`123 Somebody blew it, this should be defined in STARLET !! `125
X`091ASYNCHRONOUS,EXTERNAL(SYS$SETDDIR)`093
XFUNCTION $SETDDIR(
X    VAR NEW_DIR_ADDR : `091READONLY,CLASS_S`093 PACKED ARRAY `091A..B:INTEGE
VR`093 OF CHAR;
X    VAR LENGTH_ADDR : UWORD := %IMMED 0;
X    VAR CUR_DIR_ADDR : `091CLASS_S`093 PACKED ARRAY
X`009`091C..D:INTEGER`093 OF CHAR := %IMMED 0):INTEGER;EXTERNAL;
X
XVAR`009`009    `123 Define CLI utility conditions `125
X  CLI$_NOCOMD,
X  CLI$_INVROUT,
X  CLI$_COMMA,
X  CLI$_CONCAT,
X  CLI$_ABSENT,
X  CLI$_PRESENT,
X  CLI$_NEGATED,
X  CLI$_LOCPRES,
X  CLI$_DEFAULTED    : `091EXTERNAL,VALUE`093 INTEGER;
X
XFunction CLI$DCL_PARSE(
X`009var command_string  : `091CLASS_S,READONLY`093 PACKED ARRAY
X`009`009`091$L1..$U1:INTEGER`093 OF CHAR;
X`009%immed table`009    : `091READONLY`093 INTEGER;
X`009%immed `091UNBOUND`093 procedure param_routine := %immed 0;
X`009%immed `091UNBOUND`093 procedure prompt_routine := %immed 0;
X`009var prompt_string   : `091CLASS_S,READONLY`093 PACKED ARRAY
X`009`009`091$L2..$U2:INTEGER`093 OF CHAR:=%IMMED 0):INTEGER; EXTERNAL;
X
XFunction CLI$GET_VALUE(
X`009var entity_desc`009    : `091CLASS_S,READONLY`093 PACKED ARRAY
X`009`009`091$L1..$U1:INTEGER`093 OF CHAR;
X`009var retdesc`009    : `091CLASS_S`093 PACKED ARRAY
X`009`009`091$L2..$U2:INTEGER`093 OF CHAR;
X`009var retlength`009    : UWORD :=%IMMED 0):INTEGER;EXTERNAL;
X
XFunction CLI$PRESENT(
X`009var entity_desc`009    : `091CLASS_S,READONLY`093 PACKED ARRAY
X`009`009`091$L1..$U1:INTEGER`093 OF CHAR):INTEGER;EXTERNAL;
X
X
X(*********** Local functions to this program **************)
X
X`091ASYNCHRONOUS`093 PROCEDURE SET_LOGICAL(
X`009TABLE      : `091READONLY`093 PACKED ARRAY `091$L1..$U1:INTEGER`093 OF C
VHAR;
X`009LOG_NAME   : `091READONLY`093 PACKED ARRAY `091$L2..$U2:INTEGER`093 OF C
VHAR;
X`009VALUE      : `091READONLY`093 PACKED ARRAY `091$L3..$U3:INTEGER`093 OF C
VHAR;
X`009ACCESS_MODE: UBYTE);
XVAR
X    ITEM_LIST : ARRAY `0911..2`093 OF ITEM_LIST_TYPE;
X
XBEGIN
X    ITEM_LIST := ZERO;
X    WITH ITEM_LIST`0911`093 DO
X    BEGIN
X`009BUFFER_LENGTH`009:= $U3;
X`009ITEM_CODE`009:= LNM$_STRING;
X`009BUFFER_ADDRESS`009:= IADDRESS(VALUE);
X`009END;
X
X    ISTAT := $CRELNM(`009TABNAM := TABLE,
X`009`009`009LOGNAM := LOG_NAME,
X`009`009`009ACMODE := ACCESS_MODE,
X`009`009`009ITMLST := ITEM_LIST);
X    END;
X
X(******* Executive mode routine to set logical names ******)
X
X`091ASYNCHRONOUS`093 PROCEDURE SET_LOGICALS;
X
XVAR
X  GROUP_TABLE : `091VOLATILE`093 VARYING`09116`093 OF CHAR;
X
XBEGIN
X    $DELLNM(`009`009`009`009    `123 Delete any old SYS$DISK`009    `125
X`009TABNAM`009:= 'LNM$PROCESS',
X`009LOGNAM`009:= 'SYS$DISK',
X`009ACMODE`009:= PSL$C_SUPER);
X    SET_LOGICAL(`009`009`009    `123 Create new SYS$DISK`009    `125
X`009TABLE      := 'LNM$PROCESS',
X`009LOG_NAME   := 'SYS$DISK',
X`009VALUE      := SUBSTR(DEFDEV.BODY,1,DEFDEV.LENGTH),
X`009ACCESS_MODE:= PSL$C_EXEC);
X    SET_LOGICAL(
X`009TABLE      := 'LNM$JOB',
X`009LOG_NAME   := 'SYS$LOGIN_DEVICE',
X`009VALUE      := SUBSTR(DEFDEV.BODY,1,DEFDEV.LENGTH),
X`009ACCESS_MODE:= PSL$C_EXEC);
X    SET_LOGICAL(
X`009TABLE      := 'LNM$JOB',
X`009LOG_NAME   := 'SYS$LOGIN',
X`009VALUE      := SUBSTR(DEFDEV.BODY,1,DEFDEV.LENGTH)+
X`009`009      SUBSTR(DEFDIR.BODY,1,DEFDIR.LENGTH),
X`009ACCESS_MODE:= PSL$C_EXEC);
X    SET_LOGICAL(
X`009TABLE      := 'LNM$JOB',
X`009LOG_NAME   := 'SYS$SCRATCH',
X`009VALUE      := SUBSTR(DEFDEV.BODY,1,DEFDEV.LENGTH)+
X`009`009      SUBSTR(DEFDIR.BODY,1,DEFDIR.LENGTH),
X`009ACCESS_MODE:= PSL$C_EXEC);
X
+-+-+-+-+-+-+-+-  END  OF PART 1 +-+-+-+-+-+-+-+-
