********************************************************************** * GETDDIR - Get Default Directory * * * * Syntax: GETDDIR userid * * * * This program extracts and displays, among other things, a user's * * initial working directory as defined by the CP POSIXINFO IWDIR * * directory statement. POSIXOPT QUERYDB ALLOW is required in order * * to query users other than yourself. When an external security * * manager such as RACF/VM is being used, these permissions, as * * well as the values they return are under control of the ESM. * * * * The interface to the directory is the posix BPX1GPN CSL routine, * * documented in the VM/ESA Open Edition CSL Reference. * * * * You may wish to modify this program for use in your environment. * * To build: 1. VMFHLASM GETDDIR DMSVM * * 2. GLOBAL TXTLIB VMLIB VMMTLIB * * 3. LOAD GETDDIR (RLD * * 4. GENMOD * * * * Author: Alan Altmark, VM and VM TCP/IP Development, IBM * * * * This program is provided on an as-is basis. No warranty is * * expressed or implied. The evaluation and verification of * * operation in specific environments is the responsiblity of the * * user. * * * * (C) Copyright IBM Corporation, 1997 * ********************************************************************** GETDDIR CSECT USING *,R12 USING GIDN,R5 MVC USERNAME,8(R1) Get userid from command line LR R10,R14 CALL BPX1GPN, Access the user database X (USERNLEN, X USERNAME, X RETVAL, X RETCODE, X RSNCODE), X VL ICM R15,B'1111',RETCODE If call failed exit with RETCODE BNZR R10 ICM R5,B'1111',RETVAL If nothing returned, issue msg BZ NoValue LR R6,R5 L R7,GIDN_U_LEN APPLMSG TEXT='User name: &&1', + SUB=(CHARA,(GIDN_U_NAME,(R7))) LA R6,8(R6,R7) Skip uid, uname and uname length APPLMSG TEXT='User id: &&1', + SUB=(DECA,(R6)) LA R6,8(,R6) Skip uid and gid length field APPLMSG TEXT='Group id: &&1', + SUB=(DECA,(R6)) L R7,4(R6) Get dir name length LA R6,8(,R6) Skip gid and dir name length APPLMSG TEXT='Initial directory: &&1', + SUB=(CHARA,((R6),(R7))) AR R6,R7 Skip directory name L R7,0(R6) Get program name length LA R6,4(,R6) Skip program name length APPLMSG TEXT='Initial program: &&1', + SUB=(CHARA,((R6),(R7))) BR R10 NoValue equ * APPLMSG TEXT='Defaults not available' BR R10 * RETVAL DS F RETCODE DS F RSNCODE DS F USERNAME DS CL8 USERNLEN DC AL4(L'USERNAME) BPXYGIDN REGEQU END GETDDIR