USS Sample - find UIDs and GIDs

Sample
USS - Sample

 

Beispiel:                                 

/* REXX YUSSBSP3  Copyright YCOS Yves Colliard Software 1990-2013 */
/*----------------------------------------------------------------*/
/* USS Sample - find UIDs and GIDs                                */
/*----------------------------------------------------------------*/
/* Sample                                                         */
/* USS - Sample                                                   */
/*================================================================*/
/* TRACE ?R  */
  /* einschalten des interaktiven Trace Modus */
  /* */
/* alloc output datasets */
call bpxwdyn "alloc space(5,5) tracks new delete lrecl(4096)",
   "recfm(v,b) dsorg(ps) msg(ymsg1.) rtddn(ydd1) rtdsn(ydsn1)"
if result<>0 then do
  say "Alloc temp dataset error:" result
  do i=1 to ymsg1.0
    say ymsg1.i
  end
  exit 0
end
x =syscalls('ON')
address syscall
"getuid"
myuid=retval
if myuid<>0 then do
  "seteuid 0"
  "geteuid"
  myeuid=retval
  if retval<>0 then do
    say "Seteuid not successful - review RACF BPX.SUPERUSER"
    exit
  end
end
else do
  myeuid=""
end
o.1=userid() "Current uid :" myuid "Current euid:" myeuid
address mvs "execio 1 diskw "ydd1" (stem o."
o.1=copies("=",60)
address mvs "execio 1 diskw "ydd1" (stem o."
o.1="List UIDs, GIDs, Home directory, Program:"
address mvs "execio 1 diskw "ydd1" (stem o."
o.1=copies("-",60)
address mvs "execio 1 diskw "ydd1" (stem o."
do until retval < 1
  "getpwent pw."
  if retval > 0 then do
    o.1=left(pw.pw_name,8) format(pw.pw_uid,9) format(pw.pw_gid,9),
    pw.pw_dir pw.pw_shell
    address mvs "execio 1 diskw "ydd1" (stem o."
    name=pw.pw_name
    userid.name=pw.pw_uid
  end
end
o.1=copies("=",60)
address mvs "execio 1 diskw "ydd1" (stem o."
o.1="List GIDs and connections:"
address mvs "execio 1 diskw "ydd1" (stem o."
o.1=copies("-",60)
address mvs "execio 1 diskw "ydd1" (stem o."
do until retval < 1
  "getgrent gr."
  if retval > 0 then do
    "getgrnam" gr.gr_name "gm."
    o.1=gr.gr_members "Users Connected to" gr.gr_name gr.gr_gid
    address mvs "execio 1 diskw "ydd1" (stem o."
    do i=4 to gm.0
      name=gm.i
      if userid.name="USERID."name then do
        tx="No UID"
      end
      else do
        tx="UID:" format(userid.name,9)
      end
      o.1=left(gm.i,8) "-" tx
      address mvs "execio 1 diskw "ydd1" (stem o."
    end
    o.1=copies("-",30)
    address mvs "execio 1 diskw "ydd1" (stem o."
  end
end
"seteuid" myuid
/* close the data */
address mvs "execio 0 diskw "ydd1" (finis"
/* show the result */
address ispexec "lminit dataid(myou) ddname("ydd1")"
address ispexec "view dataid("myou")"
address ispexec "lmfree dataid("myou")"
msgset=msg('OFF')
address tso "free fi("ydd1")"
msgset=msg(msgset)