ABSTINE@CLVMS.CLARKSON.EDU (Art Stine - Network Engineer) (05/27/88)
i have code which will do this. if you do get an rsh done, i'd really
like a copy. it was on my list of things to add to the cmu tcp package
as soon as i finish with the lpr code.
here it is, along with another routine to set the uic:
--------------------------------------------------------------------------------
.TITLE SYS_SET_USERNAME
;
.IDENT /X01-001/
;
; FACILITY: SYS - General procedure library
;
; ABSTRACT: Rewrite current process's USERNAME
;
; ENVIRONMENT: User mode, calls kernel mode routine, requires
; user privelege CMKRNL
;
;
; AUTHOR: Geoff Fitch
; CREATION DATE: 04-AUG-82
;
;--
;++
;
; FUNCTIONAL DESCRIPTION:
;
;
; This routine is passed the address of a string descriptor
; pointing to the new username, it copies the string buffer
; to a local buffer and calls a kernel mode routine to write
; the new username in control space and the JIB.
;
; Calling routines must be linked with SYS$SYSTEM:SYS.STB
;
; CALLING SEQUENCE: (from DCL)
;
; ret_status.wlc.v = SYS_SET_USERNAME ( new_name.rt.dx )
;
; FORMAL PARAMETERS:
;
; NEW_NAME String containing the new username
;
; IMPLICIT INPUTS:
;
; NONE
;
; IMPLICIT OUTPUTS:
;
; Process control space (CTL$T_USERNAME)
; Jb Info Block (JIB$T_USERNAME)
;
; COMPLETION STATUS:
;
; SS$_NORMAL Success
; SS$_NOPRIV You don't have CMKRNL
; <other> something returned from LIB$SCOPY_DXDX
;
; SIDE EFFECTS:
;
; Process Username is changed
;--
;
.LIBRARY /SYS$LIBRARY:LIB.MLB/
$JIBDEF ; JIB symbols
$PCBDEF
.PSECT _SYS_CODE, PIC, USR, CON, REL, LCL, SHR, EXE, RD, NOWRT
.ENTRY SYS_SET_USERNAME, ^M<R3, R4, R5, R8>
SUBL2 #12, SP ; allocate local string
MOVAL (SP), -(SP) ; and create string descr
PUSHL #12
PUSHAQ (SP)
PUSHAQ @4(AP) ; copy username to local area
CALLS #2, G^LIB$SCOPY_DXDX
BLBC R0, 10$ ; return if copy failed
ADDL #8, SP ; deallocate descriptor
MOVAB (SP), R8 ; save buffer address
$CMKRNL_S ROUTIN=WRITEUSER ; call kernel routine
10$: RET
.ENTRY WRITEUSER, 0
MOVC3 #12, (R8), CTL$T_USERNAME ; write username in P1 space
MOVL CTL$GL_PCB, R0 ; load address of pcb
MOVL PCB$L_JIB(R0), R1 ; load address of jib
MOVC3 #12, (R8), JIB$T_USERNAME(R1) ; write username into jib
MOVL #1, R0 ; return with success
RET
.END
--------------------------------------------------------------------------------
.TITLE SYS_SET_UIC
;
.IDENT /X01-01/
;
; FACILITY: SYS - General procedure Library
;
; ABSTRACT: Rewrite current process's UIC
;
; ENVIRONMENT: User mode, calls kernel mode routine, requires
; user privelege CMKRNL
;
;
; AUTHOR: DSA , ABS STINE
; CREATION DATE: 09-SEP-83
;
;--
;++
;
; FUNCTIONAL DESCRIPTION:
;
; Sets process UIC to longword UIC passed from caller
;
; Note: Calling procedure must be linked with SYS$SYSTEM:SYS.STB
;
; CALLING SEQUENCE: (from high - level language)
;
; ret_status.wlc.v = SYS_SET_UIC ( new_uic.rl )
;
; FORMAL PARAMETERS:
;
; NEW_UIC The longword containing the new UIC
;
; IMPLICIT INPUTS:
;
; NONE
;
; IMPLICIT OUTPUTS:
;
; Process Control Block (PCB$L_UIC)
;
; COMPLETION STATUS:
;
; SS$_NORMAL Success
; SS$_NOPRIV You don't have CMKRNL priv
; <other> something returned from $CMKRNL
;
; SIDE EFFECTS:
;
; Process UIC is changed
;
;******************************************************************************
;
; WARNING ******: DO NOT CHANGE THE FORMAT OF THE ADDRESSING IN THIS ROUTINE.
; WARNING ALMOST NO ERROR CHECKING IS, OR CAN BE DONE. THERE IS NO
; WARNING REAL WAY OF HANDLING AN EXCEPTION WHILE IN KERNEL MODE,
; AND HAVE IT COME BACK TO USER MODE.
;
; **** IN OTHER WORDS, YOU GOOF IT, YOU LOOSE IT. *****
;
;******************************************************************************
;
; integer*4 newuic, SYS_SET_UIC, ERROR
; DATA NEWUIC/ 65540 / ! SAME UIC AS [ 1,4 ]
;
; ERROR = SYS_SET_UIC( NEWUIC )
;
;
;--
;
.LIBRARY /SYS$LIBRARY:LIB.MLB/
;
$SSDEF ; system return definitions
$PCBDEF
;
.PSECT CODE, PIC, USR, CON, REL, LCL, SHR, EXE, RD, NOWRT
;
.ENTRY SYS_SET_UIC,^M<R2,R3,R4,R5,R6,R7,R8,R9,R10,R11> ; save all reg
;
MOVL @4(AP),R2 ; GRAB THE UIC AND STUFF INTO R2
;
$CMKRNL_S ROUTIN=SETUIC ; call kernel routine
10$: RET
;
.ENTRY SETUIC,0
MOVL @#SCH$GL_CURPCB,R0 ; get current process PCB address
MOVL R2 , PCB$L_UIC(R0) ; set user identification code
MOVZWL #SS$_NORMAL,R0 ; SET A ONE IN R0 FOR NORMAL RETURN
RET
;
;
.END