From:	MERC::"uunet!CRVAX.SRI.COM!RELAY-INFO-VAX" 18-JUN-1992 13:04:25.95
To:	"info-vax" <info-vax@sri.com>
CC:	
Subj:	re: get owner field from sysuaf

Subj:	need to extract OWNER field from SYSUAF

>I need a way of extracting the OWNER field from SYSUAF.DAT. Since  $GETJPI does not have (yet) a way of reading this field, what is the easiest way of reading it? 
>Any sample code, FORTRAN, C or DCL will be appreciated.

It depends on what you're trying to do.  If you're getting it for one or two 
known user names, using the getuai system service would probably be easiest
and best.  (See example #1 appended to this message).  However, it doesn't
allow any wildcards for global username lookups.  Supposedly in the second
parameter, it can take a context variable like the getjpi system service call
and do a global search (undocumented), but I tried playing with that location
passing a -1 as a variable, pointer, descriptor and any other ways I could 
think of, but always got an insufficient arguments error.  The easiest way to
do a global username lookup is to read the sysuaf.dat file using RMS (RAB's and
FAB's)  -see example 2 (not included in the info-vax message, since it's
fairly long).
                                    bob

+---------------------------------------------------------------------+
|      Bob George       Internet:  BOB@AENEAS.IMS.DISA.MIL            |
|      Disclaimer:      Opinions expressed are mine and mine only.    |
+---------------------------------------------------------------------+
-------------------example 1--------------------------
#include uaidef
#include ssdef
#include descrip
#include stdio
#include string

/*  This program will terminate idle interactive processes. */

main()
{
struct
   {
   struct 
      {
      short buffer_len;
      short item_code;
      int buffer_addr;
      int ret_len_addr;
      } uafitem[1];
   int terminator;
   }  uaflst;

int length,context,uic,priv[1],pwd_date[1];
int pwd_lifetime[1],last_login_inter[1],last_login_non[1];
short logfails,username_l,owner_l,account_l;
char name[33], username[14],owner[32],account[9];

$DESCRIPTOR (place,"rich");
struct dsc$descriptor_d message =
    {0,DSC$K_DTYPE_T,DSC$K_CLASS_D,0};
register status;

/* set up uaflst */
/* find user name */
uaflst.uafitem[0].buffer_len = 32;
uaflst.uafitem[0].item_code = UAI$_OWNER;
uaflst.uafitem[0].buffer_addr = &owner;
uaflst.uafitem[0].ret_len_addr = &owner_l;
uaflst.terminator = 0;

/* initial set up */
{
if (((status=sys$getuai(0,0,&place,&uaflst,0,0,0)) &1) !=1)
  LIB$STOP(status);
owner[owner_l]='\0';
printf ("/%s/%x/%d/\n",&owner,status,owner_l);
}
}
-------------------------------------------


