From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 22-JAN-1991 10:29:34.23
To:	MRGATE::"ARISIA::EVERHART"
CC:	
Subj:	Re: Wildcard usernames from UAF...

Received:  by crdgw1.ge.com (5.57/GE 1.80)
	 id AA11146; Tue, 22 Jan 91 10:14:36 EST
Received: From DANPOST.UNI-C.DK by CRVAX.SRI.COM with TCP; Tue, 22 JAN 91 06:46:00 PST
Received: from vms2.uni-c.dk by danpost.uni-c.dk (5.65/4.7)
	id AA24396; Tue, 22 Jan 91 13:45:00 GMT
Date: Tue, 22 Jan 91 14:46 +0100
From: ISIS08@ecostat.aau.dk
Subject: Re: Wildcard usernames from UAF...
To: CWIKLA%UIUCMRL.BITNET@CUNYVM.CUNY.EDU, INFO-VAX@SRI.COM
Message-Id: <CE7F978BC3FF00B4DE@vms2.uni-c.dk>
X-Envelope-To: CWIKLA%UIUCMRL.BITNET@CUNYVM.CUNY.EDU, INFO-VAX@SRI.COM
X-Vms-To: UNIL63::IN%"CWIKLA%UIUCMRL.BITNET@CUNYVM.CUNY.EDU"
X-Vms-Cc: IN::"INFO-VAX@SRI.COM"

>         Is there any way to get a list of users from the UAF file?
> Example:  Get a list of all users that first letter is A (Like what
> you can do in AUTHORIZE).  I want to do this from a program, and
> actually want to be able to get a list users by username, uic, or account,
> so any thoughts, suggestions, or program pieces (preferably C, Pascal or
> FORTRAN) would be appreciated.

We had this discussion just three weeks ago on INFO-VAX !

The two different approaches is:

1)  Read SYSUAF.DAT directly. It is undocumented, but several people
    have done it with success.

2)  Call SYS$IDTOASC to get all identifiers. It is documented, but it
    will not work, if you have two usernames with the same UIC.

Below is a program using the second approach. It is almost identical
to a program I posted three weeks ago, but it now automatically eliminates
identifiers, which is not usernames (thanks to Bruce Hudson for explaining
that detail for me).

#include <stdio.h>
#include <descrip.h>
#include <ssdef.h>

int sys$idtoasc();

main(int argc,char *argv[])
{
   int stat,resid,contxt;
   short unlen;
   char un[33];
   $DESCRIPTOR(undesc,un);
   contxt = 0;
   do {
      stat = sys$idtoasc(-1,&unlen,&undesc,&resid,0,&contxt);
      if ((stat == SS$_NORMAL)&&(resid > 0)) {
         un[unlen] = '\0';
         printf("%s\n",un);
      };
   } while (stat == SS$_NORMAL);
   return SS$_NORMAL;
};

                                                            Arne

Arne Vajhxj                             Internet: ISIS08@ECOSTAT.AAU.DK
Institute of Economics and Statistics   PSI:      DATAPAX.23830211371400::ISIS08
Aarhus University
Denmark


