From:	CSBVAX::CSBVAX::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX"  1-FEB-1989 09:43
To:	MRGATE::"ARISIA::EVERHART"
Subj:	UAF program


Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Tue, 31 JAN 89 23:34:01 PDT
Received: from uwavm.acs.washington.edu (oly.acs.washington.edu) by KL.SRI.COM with TCP; Tue, 31 Jan 89 23:29:25 PST
Received: from UWAVM.ACS.WASHINGTON.EDU by uwavm.acs.washington.edu ; Tue, 31 Jan 89 23:22:58 PST
Received: from FHCRCVAX.BITNET (JOE) by UWAVM.ACS.WASHINGTON.EDU (Mailer R2.02)
 with BSMTP id 8184; Tue, 31 Jan 89 23:22:46 PST
Date: Tue, 31 Jan 89 23:20 PST
From: Joe Meadows <JOE%FHCRCVAX.BITNET@uwavm.acs.washington.edu>
Subject: UAF program
To: info-vax@kl.sri.COM
X-VMS-To: IN%"info-vax@kl.sri.com"

Hello,

Well, I haven't heard too many negative things about UAF, so I'm
posting it for all to play with. As usual, all comments, questions,
enhancements, whatever, are all quite welcome.

Hope you have a C compiler.

Save the following as UAF.SH, execute it to create UAF.SHAR, then
execute that to create all the parts to UAF. Execute the COMPILE.COM
and you'll be in business.

By the way, I haven't added PASSWORD as a selection criteria, does
anybody want to argue with me why I should or shouldn't put it in?
Anybody want to send me HPWD.MAR (I typed it in for V3.n, has it changed
much since? I haven't had the time to look).

Cheers,
Joe Meadows     joe@fhcrcvax.bitnet
                joe%fhcrcvax.bitnet@oly.acs.washington.edu
                (206) 467-4970

$!.................... Cut between dotted lines and save ......................
$!.............................................................................
$! VAX/VMS archive file created by VMS_SHAR V-5.04-WJM-AGH 29-SEP-1988
$! which was written by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au)
$! and modified by W.J.Moeller <moeller@dgogwdg5.BITNET>
$! To unpack, simply save and execute (@) this file.
$!
$! This archive was created by JOE
$! on Tuesday 31-JAN-1989 23:18:39.07
$!
$! It contains the following 1 file:
$! UAF.SHAR
$!=============================================================================
$ Set Symbol/Scope=(NoLocal,NoGlobal)
$ Version=F$GetSYI("VERSION") ! See what VMS version we have here:
$ If Version.ges."V4.4" then goto Version_OK
$ Write SYS$Output "Sorry, you are running VMS ",Version, -
                ", but this procedure requires V4.4 or higher."
$ Exit 44
$Version_OK: CR[0,8]=13
$ Pass_or_Failed="failed!,passed."
$ Goto Start
$Convert_File:
$ Read/Time_Out=0/Error=No_Error1/Prompt="creating ''File_is'" SYS$Command ddd
$No_Error1: Define/User_Mode SYS$Output NL:
$ Edit/TPU/NoSection/NoDisplay/Command=SYS$Input/Output='File_is' -
        VMS_SHAR_DUMMY.DUMMY
f:=Get_Info(Command_Line,"File_Name");b:=Create_Buffer("",f);
o:=Get_Info(Command_Line,"Output_File");Set(Output_File,b,o);
Position(Beginning_of(b));a:=0;Loop ExitIf Mark(None)=End_of(b);
x:=Erase_Character(1);if x="V" then i:=LENGTH(CURRENT_LINE);
if i<>78 then MOVE_HORIZONTAL(i);if i>78 then ERASE_CHARACTER(78-i);endif;
if i<78 then COPY_TEXT(FAO("!#* ",78-i));endif;
Move_Horizontal(-Current_Offset);endif;endif;if a then Append_Line;
Move_Horizontal(-Current_Offset);endif;a:=(x="V");Move_Vertical(1);EndLoop;
POSITION(BEGINNING_OF(b));p:=" "&LINE_END;loop x:=SEARCH(p,Forward,Exact);
exitif x=0;POSITION(END_OF(x));s:=CURRENT_LINE;EDIT(s,Trim_trailing,Off);
ERASE_CHARACTER(LENGTH(s)-CURRENT_OFFSET);endloop;Position(Beginning_of(b));
Loop x:=Search("`",Forward,Exact);ExitIf x=0;Position(x);Erase_Character(1);
If Current_Character='`' then Move_Horizontal(1);else
Copy_Text(ASCII(INT(Erase_Character(3))));EndIf;EndLoop;Exit;
$ Delete VMS_SHAR_DUMMY.DUMMY;*
$ Checksum 'File_is
$ Success=F$Element(Check_Sum_is.eq.CHECKSUM$CHECKSUM,",",Pass_or_Failed)+CR
$ Read/Time_Out=0/Error=No_Error2/Prompt=" CHECKSUM ''Success'" SYS$Command ddd
$No_Error2: Return
$Start:
$ File_is="UAF.SHAR"
$ Check_Sum_is=1771197055
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X$ create/log UAF.HLP
X$DECK
X1 UAF
X
X  UAF is a program for searching through the SYSUAF.DAT file.
XIt has a fairly simplistic interface. You must provide a selection
Xcriteria, and a display criteria. Most fields are able to be selected
Xupon and displayed. Given no arguments, UAF will pretty much do nothing.
X
X  You may either define UAF as a command ($ SET COMMAND UAF_CLD),
Xor you may set it up as a foreign command via a symbol definition
X($ UAF == "$device:[directory]UAF). You choose.
X
X2 Qualifiers
X/OUTPUT
XOUTPUT=filename
X
X`009Redirects all output to a file.
X
X/MATCH
X  /MATCH=[AND `124 OR]
X`009Specifies, for multiple selection criteria, whether all criteria
Xmust match, or if any one is sufficient. /MATCH=OR is the default,
Xsignifying that any one match is sufficient. /MATCH=AND is allowed,
Xsignifying that all selection criteria must match.
X  Examples:
X
X  /Select=(priv=class=all,defpriv=class=all)
X  The above would select anybody whose default or authorized privileges
Xwere in the "ALL" class.
X
X  /select=(priv=class=all,flag=nodisuser)/match=and
X  The above would select anybody whose authorized privileges were
Xin the "all" class, and who were not disuserd.
X
X/UIC_ORDER
X`009Causes the SYSUAF to be searched (and displayed) in UIC order
Xrather than USERNAME order.
X
X/WRAP
X  /WRAP=n
X
X`009This is a kind of bogus qualifier (I admit it). If a field displays
Xpast the column specified by /WRAP, then the following field will start
Xin column 2 of the next line.
X
X/SELECT
X  /SELECT=(item=(min,max),item=min)
X
X  For all numeric and date fields, you may specify a minimum and a maximum
Xvalue, if you wish to enter only a maximum date, you should use 17-NOV-1858
Xas a minimum date. If you wish an exact value, you should enter the same
Xthing as both minimum and maximum value.
X
X  Privileges, login_flags, and weekday fields can be entered as a list
Xof items. If the item is negated, then that item must not be present
Xfor the record to be selected, if it is not negated, than any one match
Xwill suffice. For example, /SELECT=PRIV=(NOBYPASS,NOSYSPRV) means the
Xuser must not have either of BYPASS or SYSPRV. /SELECT=PRIV=(BYPASS,SYSPRV)
Xmeans the user must have either BYPASS or SYSPRV. /MATCH=AND does
Xnot change this behaviour.
X
X/DISPLAY
X  /DISPLAY=(item,item,...)
X
X  You'll probably want, at the very least, /DISPLAY=USERNAME
X
X2 Field_Types
X
X3 Access_Hours
X
X access hours look like:
X
X  thing=([NO][PRIMARY], [n-m], [n] [,...] [NO][SECONDARY], [n-m], [n] [,...])
X
X Used to specify hours of access for all modes of logins.  Specify hours
X as integers from 0 to 23, inclusive. Hours may be specified as single
X hours (n), or as ranges of hours (n-m).  The first set of hours after
X the keyword PRIMARY specifies hours on primary days; the second set of
X hours after the keyword SECONDARY specifies hours on secondary days.
X
X Note the differences between this and AUTHORIZE. A range of hours must go
X from a smaller value to a larger value. Hours must be given (i.e. doesn't
X default to 0-23 as does Authorize). If only one of PRIMARY or SECONDARY
X is specified, no assumptions are made about the other.
X
X3 Numeric
X  A numeric value. The range depends on the item.
X
X3 Text
X  A (wildcards allowed) text string.
X
X3 Privilege
X   ALL - All privileges.
X   ACNT, ALLSPOOL, ALTPRI, BUGCHK, BYPASS, CMEXEC, CMKRNL, DETACH,
X   DIAGNOSE, DOWNGRADE, EXQUOTA, GROUP, GRPNAM, GRPPRV, LOG_IO,
X   MOUNT, NETMBX, OPER, PFNMAP, PHY_IO, PRMCEB, PRMGBL, PRMMBX,
X   PSWAPM, READALL, SECURITY, SETPRV, SHARE, SHMEM, SYSLCK, SYSGBL,
X   SYSNAM, SYSPRV, TMPMBX, UPGRADE, VOLPRO, WORLD
X   CLASS=privilege-class
X
X4 Privilege_Class
X  ALL`009: bypass, cmexec, cmkrnl, detach, log_io,
X          pfnmap, phy_io, setprv, share, sysnam, sysprv, readall
X  FILES`009: diagnose, sysgbl, volpro, upgrade, downgrade, security
X  SYSTEM: altpri, oper, pswapm, world
X  DEVOUR: acnt, allspool, bugchk, exquota, grpnam,
X          prmceb, prmgbl, prmmbx, shmem, syslck
X  GROUP`009: group, grppr
X  NORMAL: mount, netmbx, tmpmbx
X  `032
X3 weekday
X  SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY
X
X3 login_flags
X  AUDIT, AUTOLOGIN, CAPTIVE, DEFCLI, DISCTLY, DISFORCE_PWD_CHANGE,
X  DISMAIL, DISNEWMAIL, DISRECONNECT, DISREPORT, DISUSER, DISWELCOME,
X  GENPWD, LOCKPWD, PWD_EXPIRED, PWD2_EXPIRED
X
X3 date
X  Standard VMS date/time.
X
X  To specify all records with a date prior to something, use
X  ITEM=(17-NOV-1858,max)
X3 deltatime
X  Standard VMS deltatime.
X
X2 Fields
X
X3 RTYPE
X  numeric
X
X  Record type. All user records have a record type of 1. The
Xsystem password is stored in the SYSUAF with a record type of 1.
X
X3 VERSION
X  numeric
X
X3 USRDATOFF
X  numeric
X
X3 LOGFAILS
X  numeric
X
X  Number of login failures.
X
X3 PWDCHANGE
X  date
X
X  Date of last (primary) password change.
X3 PWD2CHANGE
X  date
X
X  Date of last (secondary) password change.
X
X3 INTERACTIVE
X  date
X
X  Last interactive login date & time.
X
X3 NONINTERACTIVE
X  date
X
X  Last non-interactive login date & time.
X
X3 ACCESS
X  access_hours
X
X  Access sets up all the access hours to look the same.
XBatch, Dialup, Local, Network, and Remote. This gets parsed before
Xthe other access keywords, so if you follow ACCESS with (for example)
XDIALUP, the dialup access hours will be set accordingly.
X3 BATCH
X  access_hours
X3 DIALUP
X  access_hours
X3 LOCAL
X  access_hours
X3 NETWORK
X  access_hours
X3 REMOTE
X  access_hours
X3 ACCOUNT
X  text
X3 CLI
X  text
X3 CLITABLES
X  text
X3 DEVICE
X  text
X3 DIRECTORY
X  text
X3 LGICMD
X  text
X3 OWNER
X  text
X3 ASTLM
X  numeric
X3 BIOLM
X  numeric
X3 BYTLM
X  numeric
X3 DIOLM
X  numeric
X3 ENQLM
X  numeric
X3 FILLM
X  numeric
X3 JTQUOTA
X  numeric
X3 MAXACCTJOBS
X  numeric
X3 MAXDETACH
X  numeric
X3 MAXJOBS
X  numeric
X3 PGFLQUOTA
X  numeric
X3 PRCLM
X  numeric
X3 PRIORITY
X  numeric
X3 PWDMINIMUM
X  numeric
X3 SHRFILLM
X  numeric
X3 TQELM
X  numeric
X3 WSDEFAULT
X  numeric
X3 WSEXTENT
X  numeric
X3 WSQUOTA
X  numeric
X3 CPUTIME
X  deltatime
X
X  Hmm, not currently implemented I think..
X3 PWDLIFETIME
X  deltatime
X3 EXPIRATION
X  date
X3 USERNAME
X  text
X3 UIC
X  uic
X
X  Uic in numeric or ID format. Wildcarded group or member is allowed.
XThe same restrictions apply to wildcarding UICs as in the Authorize
Xand Diskquota programs.
X3 DEFPRIVILEGES
X  privilege
X3 PRIVILEGES
X  privilege
X3 FLAGS
X  login_flags
X3 PRIMEDAYS
X  weekday
X$EOD
X$ create/log C.OPT
X$DECK
Xsys$share:vaxcrtl.exe/share
X$EOD
X$ create/log COMPILE.COM
X$DECK
X$ cc uaf
X$ cc display
X$ cc init_cli
X$ cc parse
X$ cc select
X$ macro parse_uic
X$ set command/object uaf_cld
X$ link/notrace uaf,display,init_cli,parse,parse_uic,select,uaf_cld,c/opt
X$EOD
X$ create/log DISPLAY.C
X$DECK
X#include descrip
X#include "uaf.h"
X#include "uaf_cld.h"
X
Xdisplay(struct UAFDEF *record, int len)
X`123
X  static int init = 0, wrap = 0x7fffffff;
X  static struct UAF_FIELDS field;
X  char *s;
X  int c;
X
X  if (!init)
X  `123
X    init = 1;
X
X    init_parse("");
X    if (s = get_value("WRAP"))
X      wrap = atoi(s);
X
X    init_parse("DISPLAY.");
X    if (present("ACCESS"))
X    `123
X      field.network_access = 1;
X      field.local_access = 1;
X      field.dialup_access = 1;
X      field.remote_access = 1;
X      field.batch_access = 1;
X    `125
X    field.rtype = present("RTYPE");
X    field.version = present("VERSION");
X    field.usrdatoff = present("USRDATOFF");
X    field.account = present("ACCOUNT");
X    field.astlm = present("ASTLM");
X    field.batch_access `124= present("BATCH");
X    field.biolm = present("BIOLM");
X    field.bytlm = present("BYTLM");
X    field.defcli = present("CLI");
X    field.clitables = present("CLITABLES");
X    field.def_priv = present("DEFPRIVILEGES");
X    field.defdev = present("DEVICE");
X    field.dialup_access `124= present("DIALUP");
X    field.diolm = present("DIOLM");
X    field.defdir = present("DIRECTORY");
X    field.enqlm = present("ENQLM");
X    field.expiration = present("EXPIRATION");
X    field.fillm = present("FILLM");
X    field.flags = present("FLAGS");
X    field.jtquota = present("JTQUOTA");
X    field.logfails = present("LOGFAILS");
X    field.pwd_date = present("PWDCHANGE");
X    field.pwd2_date = present("PWD2CHANGE");
X    field.lastlogin_i = present("INTERACTIVE");
X    field.lastlogin_n = present("NONINTERACTIVE");
X    field.lgicmd = present("LGICMD");
X    field.local_access `124= present("LOCAL");
X    field.maxacctjobs = present("MAXACCTJOBS");
X    field.maxdetach = present("MAXDETACH");
X    field.maxjobs = present("MAXJOBS");
X    field.network_access `124= present("NETWORK");
X    field.owner = present("OWNER");
X    /* PASSWORD */
X    field.pgflquota = present("PGFLQUOTA");
X    field.prccnt = present("PRCLM");
X    field.primedays = present("PRIMEDAYS");
X    field.pri = present("PRIORITY");
X    field.priv = present("PRIVILEGES");
X    /* PWDEXPIRED */
X    field.pwd_lifetime = present("PWDLIFETIME");
X    field.pwd_length = present("PWDMINIMUM");
X    field.remote_access `124= present("REMOTE");
X    field.shrfillm = present("SHRFILLM");
X    field.tqcnt = present("TQELM");
X    field.uic = present("UIC");
X    field.username = present("USERNAME");
X    field.dfwscnt = present("WSDEFAULT");
X    field.wsextent = present("WSEXTENT");
X    field.wsquota = present("WSQUOTA");
X  `125
X
X  c = 0;
X  if (field.username) c += printf("user: %.*s ",12,record->uaf$t_username);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.rtype) c += printf("rtype: %d ",record->uaf$b_rtype);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.version) c += printf("version: %d ",record->uaf$b_version);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.usrdatoff) c += printf("usrdatoff: %d ",record->uaf$w_usrdatoff);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.uic) c += print_uic("UIC",record->uaf$l_uic);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  /* uaf$l_sub_id */
X  /* uaf$q_parent_id */
X  if (field.account) c += printf("account: %.*s ",8,record->uaf$t_account);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.owner) c += print_ascic("owner",record->uaf$t_owner);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.defdev && field.defdir)
X  `123
X    c += printf("default: ");
X    c += print_ascic("", record->uaf$t_defdev);
X    c += print_ascic("",record->uaf$t_defdir);
X    c += printf(" ");
X    if (c > wrap) `123printf("\n  "); c = 2;`125
X  `125
X  else
X  `123
X    if (field.defdev) c += print_ascic("device", record->uaf$t_defdev);
X    if (c > wrap) `123printf("\n  "); c = 2;`125
X    if (field.defdir) c += print_ascic("directory",record->uaf$t_defdir);
X    if (c > wrap) `123printf("\n  "); c = 2;`125
X  `125
X  if (field.lgicmd) c += print_ascic("login",record->uaf$t_lgicmd);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.defcli) c += print_ascic("cli",record->uaf$t_defcli);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.clitables) c += print_ascic("tables",record->uaf$t_clitables);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  /* uaf$q_pwd */
X  /* uaf$q_pwd2 */
V  if (field.logfails) c += printf("login failures: %d ",record->uaf$w_logfails
X);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  /* uaf$b_encrypt */
X  /* uaf$b_encrypt2 */
X  if (field.pwd_length) c += printf("pwd len: %d ",record->uaf$b_pwd_length);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
V  if (field.expiration) c += print_date("expiration",record->uaf$q_expiration)
X;
X  if (c > wrap) `123printf("\n  "); c = 2;`125
V  if (field.pwd_lifetime) c += print_date("pwd life",record->uaf$q_pwd_lifetim
Xe);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.pwd_date) c += print_date("pwd change",record->uaf$q_pwd_date);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.pwd2_date) c += print_date("pwd2 change",record->uaf$q_pwd2_date);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
V  if (field.lastlogin_i) c += print_date("last ilogin", record->uaf$q_lastlogi
Xn_i);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
V  if (field.lastlogin_n) c += print_date("last nlogin", record->uaf$q_lastlogi
Xn_n);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.priv) c += print_privs("privilege",record->uaf$q_priv);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.def_priv) c += print_privs("default priv",record->uaf$q_def_priv);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  /* uaf$r_min_class */
X  /* uaf$r_max_class */
X  if (field.flags) c += print_flags("flags",record->uaf$l_flags);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.network_access)
X    c += print_access("network",record->uaf$b_network_access_p,
X`009record->uaf$b_network_access_s);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.batch_access)
X    c += print_access("batch",record->uaf$b_batch_access_p,
X`009record->uaf$b_batch_access_s);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.local_access)
X    c += print_access("local",record->uaf$b_local_access_p,
X`009record->uaf$b_local_access_s);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.dialup_access)
X    c += print_access("dialup",record->uaf$b_dialup_access_p,
X`009record->uaf$b_dialup_access_s);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.remote_access)
X    c += print_access("remote",record->uaf$b_remote_access_p,
X`009record->uaf$b_remote_access_s);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.primedays) c += print_days("prime days",record->uaf$b_primedays);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.pri) c += printf("priority: %d ",record->uaf$b_pri);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  /* uaf$b_quepri */
X  if (field.maxjobs) c += printf("maxjobs: %d ",record->uaf$w_maxjobs);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
V  if (field.maxacctjobs) c += printf("maxacctjobs: %d ",record->uaf$w_maxacctj
Xobs);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.maxdetach) c += printf("maxdetach: %d ",record->uaf$w_maxdetach);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.prccnt) c += printf("prclim: %d ",record->uaf$w_prccnt);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.biolm) c += printf("biolm: %d ",record->uaf$w_biolm);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.diolm) c += printf("diolm: %d ",record->uaf$w_diolm);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.tqcnt) c += printf("tqcnt: %d ",record->uaf$w_tqcnt);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.astlm) c += printf("astlm: %d ",record->uaf$w_astlm);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.enqlm) c += printf("enqlm: %d ",record->uaf$w_enqlm);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.fillm) c += printf("fillm: %d ",record->uaf$w_fillm);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.shrfillm) c += printf("shrfillm: %d ",record->uaf$w_shrfillm);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.wsquota) c += printf("wsquota: %d ",record->uaf$l_wsquota);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.dfwscnt) c += printf("wsdefault: %d ",record->uaf$l_dfwscnt);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.wsextent) c += printf("wsextent: %d ",record->uaf$l_wsextent);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  if (field.pgflquota) c += printf("pgflquota: %d ",record->uaf$l_pgflquota);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  /* uaf$l_cputim */
X  if (field.bytlm) c += printf("bytlm: %d ",record->uaf$l_bytlm);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  /* uaf$l_pbytlm */
X  if (field.jtquota) c += printf("jtquota: %d ",record->uaf$l_jtquota);
X  if (c > wrap) `123printf("\n  "); c = 2;`125
X  /* uaf$w_proxy_lim */
X  /* uaf$w_proxies */
X  /* uaf$w_account_lim */
X  /* uaf$w_accounts */
X  if (c) printf("\n");
X`125
X
Xtrim(char *str, int max)
X`123
X  while (str[--max] == ' ')
X    str[max] = '\0';
X`125
X
Xprint_uic(char *txt, long uic)
X`123
X  union
X  `123
X    long val;
X    short word[2];
X  `125 cvt;
X
X  cvt.val = uic;
X
X  return(printf("%s: [%05o,%05o] ",txt,cvt.word[1],cvt.word[0]));
X`125
X
Xprint_ascic(char *txt, char *str)
X`123
X  int len;
X
X  len = *str++;
X  if (txt && strlen(txt))
X    return(printf("%s: %.*s ",txt,len,str));
X  else
X    return(printf("%.*s",txt,len));
X`125
X
Xprint_date(char *txt, long date[2])
X`123
X  char s[27];
X  struct dsc$descriptor d = `123sizeof(s) - 1,0,0,s`125;
X  short len;
X
X  if ((date[0] == 0) && (date[1] == 0))
X  `123
X    return(printf("%s: (none) ",txt));
X  `125
X  else
X  `123
X    sys$asctim(&len,&d,date,0);
X    return(printf("%s: %.*s ",txt,len,s));
X  `125
X`125
X
Xprint_privs(char *txt, struct prvdef *priv)
X`123
X  char comma = ' ';
X  int c = 0, i;
X
X  c += printf("%s:",txt);
X  if ((priv->prv$q_privilege[0] == 0) && (priv->prv$q_privilege[1] == 0))
X  `123
X    c += printf(" (none)");
X  `125
X  else
X  `123
X    for (i = 0; i < 32; ++i)
X    `123
X      if (priv->prv$q_privilege[0] & (1 << i))
X      `123
X        c += printf("%c%s",comma,priv_txt[i]);
X        comma = ',';
X       `125
X    `125
X    for (i = 0; i < 7; ++i)
X    `123
X      if ((i != 4) && (i != 5)) /* these two have been removed! */
X      `123
X        if (priv->prv$q_privilege[1] & (1 << i))
X        `123
X          c += printf("%c%s",comma,priv_txt[i+32]);
X          comma = ',';
X         `125
X      `125
X    `125
X  `125
X
X  c += printf(" ");
X  return(c);
X`125
X
Xprint_flags(char *txt, unsigned long flag)
X`123
X  char comma = ' ';
X  int c = 0, i;
X
X  c += printf("%s:",txt);
X  if (flag == 0)
X  `123
X    c += printf(" (none)");
X  `125
X  else
X  `123
X    for (i = 0; i < 16; ++i)
X    `123
X      if (flag & (1 << i))
X      `123
X        c += printf("%c%s",comma,flag_txt[i]);
X        comma = ',';
X       `125
X    `125
X  `125
X
X  c += printf(" ");
X  return(c);
X`125
X
Xprint_days(char *txt, unsigned char days)
X`123
X  char comma = ' ';
X  int c = 0, i;
X
X  c += printf("%s:",txt);
X  if (days == 0)
X  `123
X    c += printf(" (all)");
X  `125
X  else
X  `123
X    for (i = 0; i < 7; ++i)
X    `123
X      if (!(days & (1 << i)))
X      `123
X        c += printf("%c%s",comma,primeday_txt[i]);
X        comma = ',';
X       `125
X    `125
X  `125
X  c += printf(" ");
X
X  return(c);
X`125
X
Xprint_access(char *txt, char *primary, char *secondary)
X`123
X  int c = 0, t, i;
X
X  c += printf("%s:",txt);
X
X  c += printf(" Primary: ");
X  t = *(long *)primary & 0x00ffffff;
X  if (t == 0)
X  `123
X    c += printf("full access");
X  `125
X  else
X  `123
X    if (t == 0x00ffffff)
X    `123
X      c += printf("no access");
X    `125
X    else
X    `123
X      for (i = 0; i < 24; ++i)
X        c += printf("%s",(t & (1 << i))?"-":"#");
X    `125
X  `125
X
X  c += printf(" Secondary: ");
X  t = *(long *)secondary & 0x00ffffff;
X  if (t == 0)
X  `123
X    c += printf("full access");
X  `125
X  else
X  `123
X    if (t == 0x00ffffff)
X    `123
X      c += printf("no access");
X    `125
X    else
X    `123
X      for (i = 0; i < 24; ++i)
X        c += printf("%s",(t & (1 << i))?"-":"#");
X    `125
X  `125
X
X  c += printf(" ");
X  return(c);
X`125
X$EOD
X$ create/log INIT_CLI.C
X$DECK
X#include descrip
X`032
X/* "table" is a pointer to the internal CLD
X * "name" is a text string containing the name of the verb
X */
Xinit_cli(char *table, char *name)
X`123
X  static struct dsc$descriptor cmd = `1230,DSC$K_DTYPE_T,DSC$K_CLASS_D,0`125;
X  static $DESCRIPTOR(verb,"$VERB");
X  static $DESCRIPTOR(line,"$LINE");
X  int i,sts;
X`032
X  sts = CLI$GET_VALUE(&verb,&cmd);
X  if (!(sts & 1)) return(sts);
X
X  if (strncmp(cmd.dsc$a_pointer,name,cmd.dsc$w_length) == 0)
X  `123
X    return(1);    /* the command must have been properly defined! */
X  `125
X  else
X  `123
X    /* this code assumes that the verb is shorter than than the foreign
X       symbol (which includes device:[dir], so, should be reasonable) */
X    sts = CLI$GET_VALUE(&line,&cmd);
X    if (!(sts & 1)) return(sts);
X
X    for (i = 0; (i < cmd.dsc$w_length) &&
X                (cmd.dsc$a_pointer[i] != ' ') &&
X                (cmd.dsc$a_pointer[i] != '/'); ++i)
X      cmd.dsc$a_pointer[i] = (i < strlen(name))?name[i]:' ';
X
X    return(CLI$DCL_PARSE(&cmd,table)); /* initialize the parse tables */
X  `125
X`125
X$EOD
X$ create/log MAKEFILE.
X$DECK
XCC =
XLINK =
XUAF = uaf select display parse parse_uic init_cli uaf_cld
X
Xuaf : $(UAF).obj
X`009link/notrace$(LINK) $(UAF), c/opt
X
Xuaf_cld.obj : uaf_cld.cld
X`009set command/object $*
X
Xparse_uic.obj : parse_uic.mar
X`009macro $*
X
X.c.obj :
X`009cc$(CC) $*
X$EOD
X$ create/log PARSE.C
X$DECK
X#include ctype
X#include string
X
X#include climsgdef
X#include descrip
X
X#include "uaf.h"
X#include "uaf_cld.h"
X
X#define MIN(a,b) ((a)<(b))?(a):(b)
X#define SWAP(a,b) `123(a) `094= (b); (b) `094= (a); (a) `094= (b);`125
X
Xstatic struct dsc$descriptor prefix = `1230,DSC$K_DTYPE_T,DSC$K_CLASS_D,0`125;
Xstatic struct dsc$descriptor item = `1230,DSC$K_DTYPE_T,DSC$K_CLASS_D,0`125;
X
Xinit_parse(char *s1)
X`123
X  struct dsc$descriptor d1 = `123s1?strlen(s1):0,0,0,s1`125;
X
X  str$copy_dx(&prefix,&d1);
X`125
X
Xadd_parse(char *s1)
X`123
X  struct dsc$descriptor d1 = `123s1?strlen(s1):0,0,0,s1`125;
X
X  str$append(&prefix,&d1);
X`125
X
Xcli_present(char *s1)
X`123
X  struct dsc$descriptor d1 = `123s1?strlen(s1):0,0,0,s1`125;
X  str$copy_dx(&item,&prefix);
X  str$append(&item,&d1);
X  return(cli$present(&item));
X`125
X
Xpresent(char *s1)
X`123
X  struct dsc$descriptor d1 = `123s1?strlen(s1):0,0,0,s1`125;
X
X  str$copy_dx(&item,&prefix);
X  str$append(&item,&d1);
X
X  return(cli$present(&item) & 1);
X`125
X
Xget_value(char *s1)
X`123
X  struct dsc$descriptor d2 = `1230,DSC$K_DTYPE_T,DSC$K_CLASS_D,0`125;
X  struct dsc$descriptor null = `1231,DSC$K_DTYPE_T,DSC$K_CLASS_D,"\0"`125;
X  int sts;
X
X  if (present(s1))
X  `123
X    sts = cli$get_value(&item,&d2);
X    if (sts & 1)
X    `123
X      str$append(&d2,&null);
X      return(d2.dsc$a_pointer);
X    `125
X  `125
X  return(0);
X`125
X
Xparse_byte(char *s1, char *min, char *max)
X`123
X  char *s2;
X  if (s2 = get_value(s1))
X  `123
X    *min = atoi(s2);
X    if (s2 = get_value(s1))
X      *max = atoi(s2);
X    else
X      *max = 0x7f;
X    if (*max < *min) SWAP(*min,*max);
X    return(1);
X  `125
X  return(0);
X`125
X
Xparse_word(char *s1, short *min, short *max)
X`123
X  char *s2;
X  if (s2 = get_value(s1))
X  `123
X    *min = atoi(s2);
X    if (s2 = get_value(s1))
X      *max = atoi(s2);
X    else
X      *max = 0x7fff;
X    if (*max < *min) SWAP(*min,*max);
X    return(1);
X  `125
X  return(0);
X`125
X
Xparse_long(char *s1, long *min, long *max)
X`123
X  char *s2;
X  if (s2 = get_value(s1))
X  `123
X    *min = atoi(s2);
X    if (s2 = get_value(s1))
X      *max = atoi(s2);
X    else
X      *max = 0x7fffffff;
X    if (*max < *min) SWAP(*min,*max);
X    return(1);
X  `125
X  return(0);
X`125
X
Xparse_ctext(char *s1, char *s2, int len)
X`123
X  char *s3;
X  s2[0] = '\0';
X  if (s3 = get_value(s1))
X  `123
X    s2[0] = MIN(strlen(s3)+1,len);
X    strncpy(&s2[1],s3,s2[0]);
X    strnupcase(&s2[1],s2[0]);
X    return(1);
X  `125
X  return(0);
X`125
X
Xparse_text(char *s1, char *s2, int len)
X`123
X  char *s3;
X  int s3len;
X  s2[0] = '\0';
X  if (s3 = get_value(s1))
X  `123
X    s3len = MIN(strlen(s3)+1,len);
X    strncpy(s2,s3,s3len);
X    strnupcase(s2,s3len);
X    return(1);
X  `125
X  return(0);
X`125
X
Xstrnupcase(char *s, int len)
X`123
X  while (len)
X  `123
X    if (islower(*s)) *s = toupper(*s);
X    ++s; --len;
X  `125
X`125
X
Xparse_privileges(char *s1, struct prvdef *set, struct prvdef *clr)
X`123
X  long sts, i;
X
X  if (!present(s1)) return(0);
X  add_parse(s1); add_parse(".");
X
X  if (present("CLASS"))
X  `123 /* parse CLASS= */
X    add_parse("CLASS"); add_parse(".");
X
X    if ((sts = cli_present("ALL")) & 1)
X    `123
V      set->prv$q_privilege[0] `124= PRV$M_BYPASS `124 PRV$M_CMEXEC `124 PRV$M_
XCMKRNL
X`009`124 PRV$M_DETACH `124 PRV$M_LOG_IO `124 PRV$M_PFNMAP `124 PRV$M_PHY_IO
X`009`124 PRV$M_SETPRV `124 PRV$M_SHARE `124 PRV$M_SYSNAM `124 PRV$M_SYSPRV;
X      set->prv$q_privilege[1] `124= PRV$M_READALL;
X    `125
X    else if (sts == CLI$_NEGATED)
X    `123
V      clr->prv$q_privilege[0] `124= PRV$M_BYPASS `124 PRV$M_CMEXEC `124 PRV$M_
XCMKRNL
X`009`124 PRV$M_DETACH `124 PRV$M_LOG_IO `124 PRV$M_PFNMAP `124 PRV$M_PHY_IO
X`009`124 PRV$M_SETPRV `124 PRV$M_SHARE `124 PRV$M_SYSNAM `124 PRV$M_SYSPRV;
X      clr->prv$q_privilege[1] `124= PRV$M_READALL;
X    `125
X
X    if ((sts = cli_present("FILES")) & 1)
X    `123
X      set->prv$q_privilege[0] `124= PRV$M_DIAGNOSE `124 PRV$M_SYSGBL
X`009`124 PRV$M_VOLPRO;
X      set->prv$q_privilege[1] `124= PRV$M_UPGRADE
X`009`124 PRV$M_DOWNGRADE `124 PRV$M_SECURITY;
X    `125
X    else if (sts == CLI$_NEGATED)
X    `123
X      clr->prv$q_privilege[0] `124= PRV$M_DIAGNOSE `124 PRV$M_SYSGBL
X`009`124 PRV$M_VOLPRO;
X      clr->prv$q_privilege[1] `124= PRV$M_UPGRADE
X`009`124 PRV$M_DOWNGRADE `124 PRV$M_SECURITY;
X    `125
X
X    if ((sts = cli_present("SYSTEM")) & 1)
X      set->prv$q_privilege[0] `124= PRV$M_ALTPRI `124 PRV$M_OPER
X`009`124 PRV$M_PSWAPM `124 PRV$M_WORLD;
X    else if (sts == CLI$_NEGATED)
X      clr->prv$q_privilege[0] `124= PRV$M_ALTPRI `124 PRV$M_OPER
X`009`124 PRV$M_PSWAPM `124 PRV$M_WORLD;
X
X    if ((sts = cli_present("DEVOUR")) & 1)
V      set->prv$q_privilege[0] `124= PRV$M_ACNT `124 PRV$M_ALLSPOOL `124 PRV$M_
XBUGCHK
X`009`124 PRV$M_EXQUOTA `124 PRV$M_GRPNAM `124 PRV$M_PRMCEB `124 PRV$M_PRMGBL
X`009`124 PRV$M_PRMMBX `124 PRV$M_SHMEM `124 PRV$M_SYSLCK;
X    else if (sts == CLI$_NEGATED)
V      set->prv$q_privilege[0] `124= PRV$M_ACNT `124 PRV$M_ALLSPOOL `124 PRV$M_
XBUGCHK
X`009`124 PRV$M_EXQUOTA `124 PRV$M_GRPNAM `124 PRV$M_PRMCEB `124 PRV$M_PRMGBL
X`009`124 PRV$M_PRMMBX `124 PRV$M_SHMEM `124 PRV$M_SYSLCK;
X
X    if ((sts = cli_present("GROUP")) & 1)
X    `123
X      set->prv$q_privilege[0] `124= PRV$M_GROUP;
X      set->prv$q_privilege[1] `124= PRV$M_GRPPRV;
X    `125
X    else if (sts == CLI$_NEGATED)
X    `123
X      clr->prv$q_privilege[0] `124= PRV$M_GROUP;
X      clr->prv$q_privilege[1] `124= PRV$M_GRPPRV;
X    `125
X
X    if ((sts = cli_present("NORMAL")) & 1)
V      set->prv$q_privilege[0] `124= PRV$M_MOUNT `124 PRV$M_NETMBX `124 PRV$M_T
XMPMBX;
X    else if (sts == CLI$_NEGATED)
V      clr->prv$q_privilege[0] `124= PRV$M_MOUNT `124 PRV$M_NETMBX `124 PRV$M_T
XMPMBX;
X
X  `125 /* end of CLASS = parse */
X
X  init_parse("SELECT.");
X  add_parse(s1); add_parse(".");
X
X  for (i = 0; i < 32; ++i)
X  `123
X    if ((sts = cli_present(priv_txt[i])) & 1)
X      set->prv$q_privilege[0] `124= (1 << i);
X    else if (sts == CLI$_NEGATED)
X      clr->prv$q_privilege[0] `124= (1 << i);
X  `125
X  for (i = 0; i < 7; ++i)
X  `123
X    if ((i != 4) && (i != 5)) /* these two have been removed! */
X    `123
X      if ((sts = cli_present(priv_txt[i + 32])) & 1)
X        set->prv$q_privilege[1] `124= (1 << i);
X      else if (sts == CLI$_NEGATED)
X        clr->prv$q_privilege[1] `124= (1 << i);
X    `125
X  `125
X
X  init_parse("SELECT.");
X  return(1);
X`125
X
Xparse_date(char *s1, long min[2], long max[2])
X`123
X  struct dsc$descriptor d2;
X
X  if (d2.dsc$a_pointer = get_value(s1))
X  `123
X    d2.dsc$w_length = strlen(d2.dsc$a_pointer);
X    if (d2.dsc$w_length == 0)
X    `123
X      min[1] = 0x80000000; min[0] = 0x00000000;
X    `125
X    else
X    `123
X      sys$bintim(&d2,min);
X    `125
X    if (d2.dsc$a_pointer = get_value(s1))
X    `123
X      d2.dsc$w_length = strlen(d2.dsc$a_pointer);
X      sys$bintim(&d2,max);
X    `125
X    else
X    `123
X      max[1] = 0x7fffffff; max[0] = 0xffffffff;
X    `125
X    /* which is smaller? put smallest in min */
X    if (max[1] < min[1])
X    `123
X      SWAP(min[1],max[1]); SWAP(min[0],max[0]);
X    `125
X    else
X    `123
X      if ((max[1] == min[1]) && (max[0] < min[0]))
X      `123
X        SWAP(min[1],max[1]); SWAP(min[0],max[0]);
X      `125
X    `125
X    return(1);
X  `125
X  return(0);
X`125
X
Xparse_flags(char *s1, unsigned long *set, unsigned long *clr)
X`123
X  long sts, i;
X
X  if (!present(s1)) return(0);
X  add_parse(s1); add_parse(".");
X
X  for (i = 0; i < 16; ++i)
X  `123
X    if ((sts = cli_present(flag_txt[i])) & 1)
X      *set `124= (1 << i);
X    else if (sts == CLI$_NEGATED)
X      *clr `124= (1 << i);
X  `125
X
X  init_parse("SELECT.");
X  return(1);
X`125
X
Xparse_days(char *s1,
X        /* this is opposite what you may expect, a prime day bit is clear */
X`009char *clr,
X`009char *set)
X`123
X  int sts, i;
X
X  if (!present(s1)) return(0);
X  add_parse(s1); add_parse(".");
X
X  for (i = 0; i < 7; ++i)
X  `123
X    if ((sts = cli_present(primeday_txt[i])) & 1)
X      *set `124= (1 << i);           `032
X    else if (sts == CLI$_NEGATED)
X      *clr `124= (1 << i);
X  `125
X
X  init_parse("SELECT.");
X  return(1);
X`125
X
Xcli_parse_uic(char *s1, long *uic)
X`123
X  int sts;
X  char *s2;
X  struct dsc$descriptor d2 = `1230,0,0,0`125;
X
X  if (s2 = get_value(s1))
X  `123
X    d2.dsc$w_length = strlen(s2);
X    d2.dsc$a_pointer = s2;
X    sts = parse_uic(&d2,uic);
X
X    return(sts & 1);
X  `125
X  return(0);
X`125
X
Xparse_access(char *str1, char *pri1, char *pri2, char *sec1, char *sec2)
X`123
X  char *str2, *dash;
X  long p1 = 0, p2 = 0, s1 = 0, s2 = 0, *t = &p1, hr, hs, hf, parsed = 0;
X
X  if (!present(str1)) return(0);
X
X  while (str2 = get_value(str1))
X  `123
X    parsed = 0;
X
X    if ((hr = hour(str2)) > -1)`009/* is it an hour? */
X    `123 /* this is a number, set the right bit! */
X      *t `124= (1 << hr);
X      parsed = -1;
X    `125
X
X    if (!parsed && (dash = strchr(str2,'-')))
X    `123 /* set a range of hours */
X      *dash = '\0'; ++dash;
X      if ((hs = hour(str2)) == -1)
X      `123 /* oops, not a number, bitch and moan */
X        return(0);
X      `125
X      if ((hf = hour(dash))== -1)
X      `123 /* oops, not a number, bitch and moan */
X        return(0);
X      `125
X      for (hr = hs; hr <= hf; ++hr)
X      `123 /* set the bit for this hour */
X        *t `124= (1 << hr);
X      `125                        `032
X      parsed = -1;
X    `125
X
X    if (!parsed && string_eq(str2,"PRIMARY"))
X    `123
X      t = &p1;
X      parsed = -1;
X    `125
X
X    if (!parsed && string_eq(str2,"NOPRIMARY"))
X    `123
X      t = &p2;
X      parsed = -1;
X    `125
X
X    if (!parsed && string_eq(str2,"SECONDARY"))
X    `123
X      t = &s1;
X      parsed = -1;
X    `125
X
X    if (!parsed && string_eq(str2,"NOSECONDARY"))
X    `123
X      t = &s2;
X      parsed = -1;
X    `125
X
X    if (!parsed)
X    `123 /* hmm, we didn't find anything sensible in that */
X      return(0);
X    `125
X  `125
X
X  memcpy(pri1, &p1, 3);
X  memcpy(pri2, &p2, 3);
X  memcpy(sec1, &s1, 3);
X  memcpy(sec2, &s2, 3);
X
X  return(1);
X`125
X
Xhour(char *s1)
X`123
X  int hr = 0;
X
X  /* ignore spaces, see if this is a number! */
X  while (isspace(*s1)) ++s1;
X
X  while (isdigit(*s1))
X  `123
X    hr = hr * 10 + (*s1 - '0');
X    ++s1;
X  `125
X
X  while (isspace(*s1)) ++s1;
X
X  if (*s1)
X    return(-1);
X  else
X    return(hr);
X`125
X
Xstring_eq(char *s1, char *s2)
X`123
X  int i;
X
X  while (isspace(*s1)) ++s1;
X  for (i = 0; i < strlen(s1); ++i)
X  `123
X    if (islower(s1[i]))
X      s1[i] = toupper(s1[i]);
X  `125
X
X  if (strncmp(s1,s2,strlen(s1)) == 0)
X    return(1);
X  else
X    return(0);
X`125
X$EOD
X$ create/log PARSE_UIC.MAR
X$DECK
X$tpadef
X
Xtparse_init:
X`009.long`009tpa$k_count0
X`009.long`009tpa$m_blanks!tpa$m_abbre
Xtparse:`009.blkb`009tpa$k_length0
X
X`009$init_state`009uic_stb,uic_ktb
X`009$state
X`009$tran`009tpa$_ident,,,,uic
X`009$state
X`009$tran`009tpa$_eos,tpa$_exit
X`009$end_state
X
Xuic:`009.long
X
X`009.entry`009parse_uic,`094m<r2,r3,r4,r5>
X
X`009; initialize tparse block
X`009movc5`009#8,tparse_init,#0,#tpa$k_length0,tparse
X
X`009; set the tparse block string info
X`009movl`0094(ap),r0
X`009movzwl`009(r0),tparse+tpa$l_stringcnt
X`009movl`0094(r0),tparse+tpa$l_stringptr
X
X`009; call lib$tparse
X`009pushab`009uic_ktb
X`009pushab`009uic_stb
X`009pushab`009tparse
X`009calls`009#3,g`094lib$tparse
X
X`009movl`009uic,@8(ap)
X`009ret
X
X`009.end
X$EOD
X$ create/log PRVDEF.H
X$DECK
X/* Created by SDL V3.1-7     */
V/* Source:  8-AUG-1988 10:36:21 EMULEX$DISK:[MEADOWS.UNSDL.VMS5-0_H]STARDEFMP.
XS */
X#ifndef $PRVDEF_H
X#define $PRVDEF_H
X
X/*** MODULE $PRVDEF ***/
V/*+
X*/
V/* PRIVILEGE BIT DEFINITIONS
X*/
V/*
X*/
V/*      Note that any privileges added here must also be reflected in the
X*/
V/*      modules [VMSLIB.SRC]SETPRIV.MAR, [CLIUTL.SRC]SHOWPROC.B32,
X*/
V/*      [RTL.SRC]LIBLEXICA.B32, and
X*/
V/*      [CLD.SRC]DCLINT.CLD, MCRINT.CLD, MCRSET.CLD, RUN.CLD, and SET.CLD
X*/
V/*      to completely add the new privilege.
X*/
V/*
X*/
V/*-
X*/
X#define PRV$M_CMKRNL 0x00000001
X#define PRV$M_CMEXEC 0x00000002
X#define PRV$M_SYSNAM 0x00000004
X#define PRV$M_GRPNAM 0x00000008
X#define PRV$M_ALLSPOOL 0x00000010
X#define PRV$M_DETACH 0x00000020
X#define PRV$M_DIAGNOSE 0x00000040
X#define PRV$M_LOG_IO 0x00000080
X#define PRV$M_GROUP 0x00000100
X#define PRV$M_NOACNT 0x00000200
X#define PRV$M_PRMCEB 0x00000400
X#define PRV$M_PRMMBX 0x00000800
X#define PRV$M_PSWAPM 0x00001000
X#define PRV$M_SETPRI 0x00002000
X#define PRV$M_SETPRV 0x00004000
X#define PRV$M_TMPMBX 0x00008000
X#define PRV$M_WORLD 0x00010000
X#define PRV$M_MOUNT 0x00020000
X#define PRV$M_OPER 0x00040000
X#define PRV$M_EXQUOTA 0x00080000
X#define PRV$M_NETMBX 0x00100000
X#define PRV$M_VOLPRO 0x00200000
X#define PRV$M_PHY_IO 0x00400000
X#define PRV$M_BUGCHK 0x00800000
X#define PRV$M_PRMGBL 0x01000000
X#define PRV$M_SYSGBL 0x02000000
X#define PRV$M_PFNMAP 0x04000000
X#define PRV$M_SHMEM 0x08000000
X#define PRV$M_SYSPRV 0x10000000
X#define PRV$M_BYPASS 0x20000000
X#define PRV$M_SYSLCK 0x40000000
X#define PRV$M_SHARE 0x80000000
X#define PRV$M_ACNT 0x00000200
X#define PRV$M_ALTPRI 0x00002000
X
X/* added the following for consistency, and heck, to use them */
X#define PRV$M_UPGRADE 0x00000001
X#define PRV$M_DOWNGRADE 0x00000002
X#define PRV$M_GRPPRV 0x00000004
X#define PRV$M_READALL 0x00000008
X#define PRV$M_SECURITY 0x00000040
X
Xstruct prvdef `123
X  variant_union `123
X    long prv$q_privilege[2];
X    variant_struct `123
X        unsigned prv$v_cmkrnl : 1;
X        unsigned prv$v_cmexec : 1;
X        unsigned prv$v_sysnam : 1;
X        unsigned prv$v_grpnam : 1;
X        unsigned prv$v_allspool : 1;
X        unsigned prv$v_detach : 1;
X        unsigned prv$v_diagnose : 1;
X        unsigned prv$v_log_io : 1;
X        unsigned prv$v_group : 1;
X        unsigned prv$v_noacnt : 1;
X        unsigned prv$v_prmceb : 1;
X        unsigned prv$v_prmmbx : 1;
X        unsigned prv$v_pswapm : 1;
X        unsigned prv$v_setpri : 1;
X        unsigned prv$v_setprv : 1;
X        unsigned prv$v_tmpmbx : 1;
X        unsigned prv$v_world : 1;
X        unsigned prv$v_mount : 1;
X        unsigned prv$v_oper : 1;
X        unsigned prv$v_exquota : 1;
X        unsigned prv$v_netmbx : 1;
X        unsigned prv$v_volpro : 1;
X        unsigned prv$v_phy_io : 1;
X        unsigned prv$v_bugchk : 1;
X        unsigned prv$v_prmgbl : 1;
X        unsigned prv$v_sysgbl : 1;
X        unsigned prv$v_pfnmap : 1;
X        unsigned prv$v_shmem : 1;
X        unsigned prv$v_sysprv : 1;
X        unsigned prv$v_bypass : 1;
X        unsigned prv$v_syslck : 1;
X        unsigned prv$v_share : 1;
X        unsigned prv$v_upgrade : 1;
X        unsigned prv$v_downgrade : 1;
X        unsigned prv$v_grpprv : 1;
X        unsigned prv$v_readall : 1;
X        unsigned prvdef$$_fill_3 : 2;
X        unsigned prv$v_security : 1;
X        unsigned prv$v_fill_15 : 1;
X        `125 prv$r_prvdef_bits0;
X    variant_struct `123
X        unsigned prvdef$$_fill_1 : 9;
X        unsigned prv$v_acnt : 1;
X        unsigned prvdef$$_fill_2 : 3;
X        unsigned prv$v_altpri : 1;
X        unsigned prv$v_fill_16 : 2;
X        `125 prv$r_prvdef_bits1;
X  `125 prv$r_prvdef_overlay;
X`125;
X#endif
X$EOD
X$ create/log SELECT.C
X$DECK
X#include descrip
X#include "uaf.h"
X#include "uaf_cld.h"
X
X#define MIN(a,b) ((a) < (b))?(a):(b)
Xselect(struct UAFDEF *record, int len)
X`123
X  static int init = 0, and = 0;
X  static struct UAF_FIELDS field;
X  static struct UAFDEF minimum, maximum;
X  int test, i;
X
X  if (!init)
X  `123
X    init = 1;
X
X    init_parse("SELECT.");
X    if (parse_access("ACCESS",
X`009`009`009minimum.uaf$b_batch_access_p,
X`009`009`009maximum.uaf$b_batch_access_p,
X`009`009`009minimum.uaf$b_batch_access_s,
X`009`009`009maximum.uaf$b_batch_access_s))
X    `123
X      field.network_access = 1;
X      field.local_access = 1;
X      field.dialup_access = 1;
X      field.remote_access = 1;
X      memcpy(minimum.uaf$b_network_access_p,minimum.uaf$b_batch_access_p,6);
X      memcpy(maximum.uaf$b_network_access_p,maximum.uaf$b_batch_access_p,6);
X      memcpy(minimum.uaf$b_local_access_p,minimum.uaf$b_batch_access_p,6);
X      memcpy(maximum.uaf$b_local_access_p,maximum.uaf$b_batch_access_p,6);
X      memcpy(minimum.uaf$b_dialup_access_p,minimum.uaf$b_batch_access_p,6);
X      memcpy(maximum.uaf$b_dialup_access_p,maximum.uaf$b_batch_access_p,6);
X      memcpy(minimum.uaf$b_remote_access_p,minimum.uaf$b_batch_access_p,6);
X      memcpy(maximum.uaf$b_remote_access_p,maximum.uaf$b_batch_access_p,6);
X    `125
X    field.rtype = parse_byte("RTYPE",
X`009`009&minimum.uaf$b_rtype,&maximum.uaf$b_rtype);
X    field.version = parse_byte("VERSION",
X`009`009&minimum.uaf$b_version,&maximum.uaf$b_version);
X    field.usrdatoff = parse_word("USRDATOFF",
X`009`009&minimum.uaf$w_usrdatoff,&maximum.uaf$w_usrdatoff);
X    field.logfails = parse_word("LOGFAILS",
X`009`009&minimum.uaf$w_logfails,&maximum.uaf$w_logfails);
X    field.pwd_date = parse_date("PWDCHANGE",
X`009`009minimum.uaf$q_pwd_date,maximum.uaf$q_pwd_date);
X    field.pwd2_date = parse_date("PWD2CHANGE",
X`009`009minimum.uaf$q_pwd2_date,maximum.uaf$q_pwd2_date);
X    field.lastlogin_i = parse_date("INTERACTIVE",
X`009`009minimum.uaf$q_lastlogin_i,maximum.uaf$q_lastlogin_i);
X    field.lastlogin_n = parse_date("NONINTERACTIVE",
X`009`009minimum.uaf$q_lastlogin_n,maximum.uaf$q_lastlogin_n);
X
X    field.account = parse_text("ACCOUNT",
X`009`009minimum.uaf$t_account,UAF$S_ACCOUNT);
X    field.astlm = parse_word("ASTLM",
X`009`009&minimum.uaf$w_astlm,&maximum.uaf$w_astlm);
X    field.batch_access `124= parse_access("BATCH",
X`009`009minimum.uaf$b_batch_access_p,
X`009`009maximum.uaf$b_batch_access_p,
X`009`009minimum.uaf$b_batch_access_s,
X`009`009maximum.uaf$b_batch_access_s);
X    field.biolm = parse_word("BIOLM",
X`009`009&minimum.uaf$w_biolm,&maximum.uaf$w_biolm);
X    field.bytlm = parse_long("BYTLM",
X`009`009&minimum.uaf$l_bytlm,&maximum.uaf$l_bytlm);
X    field.defcli = parse_ctext("CLI",
X`009`009minimum.uaf$t_defcli,UAF$S_DEFCLI);
X    field.clitables = parse_ctext("CLITABLES",
X`009`009minimum.uaf$t_clitables,UAF$S_CLITABLES);
X    field.def_priv = parse_privileges("DEFPRIVILEGES",
X`009`009minimum.uaf$q_def_priv, maximum.uaf$q_def_priv);
X    field.defdev = parse_ctext("DEVICE",
X`009`009minimum.uaf$t_defdev,UAF$S_DEFDEV);
X    field.dialup_access `124= parse_access("DIALUP",
X`009`009minimum.uaf$b_dialup_access_p,
X`009`009maximum.uaf$b_dialup_access_p,
X`009`009minimum.uaf$b_dialup_access_s,
X`009`009maximum.uaf$b_dialup_access_s);
X    field.diolm = parse_word("DIOLM",
X`009`009&minimum.uaf$w_diolm,&maximum.uaf$w_diolm);
X    field.defdir = parse_ctext("DIRECTORY",
X`009`009minimum.uaf$t_defdir,UAF$S_DEFDIR);
X    field.enqlm = parse_word("ENQLM",
X`009`009&minimum.uaf$w_enqlm,&maximum.uaf$w_enqlm);
X    field.expiration = parse_date("EXPIRATION",
X`009`009minimum.uaf$q_expiration,maximum.uaf$q_expiration);
X    field.fillm = parse_word("FILLM",
X`009`009&minimum.uaf$w_fillm,&maximum.uaf$w_fillm);
X    field.flags = parse_flags("FLAGS",
X`009`009&minimum.uaf$l_flags,&maximum.uaf$l_flags);
X    field.jtquota = parse_long("JTQUOTA",
X`009`009&minimum.uaf$l_jtquota,&maximum.uaf$l_jtquota);
X    field.lgicmd = parse_ctext("LGICMD",
X`009`009minimum.uaf$t_lgicmd,UAF$S_LGICMD);
X    field.local_access `124= parse_access("LOCAL",
X`009`009minimum.uaf$b_local_access_p,
X`009`009maximum.uaf$b_local_access_p,
X`009`009minimum.uaf$b_local_access_s,
X`009`009maximum.uaf$b_local_access_s);
X    field.maxacctjobs = parse_word("MAXACCTJOBS",
X`009`009&minimum.uaf$w_maxacctjobs,&maximum.uaf$w_maxacctjobs);
X    field.maxdetach = parse_word("MAXDETACH",
X`009`009&minimum.uaf$w_maxdetach,&maximum.uaf$w_maxdetach);
X    field.maxjobs = parse_word("MAXJOBS",
X`009`009&minimum.uaf$w_maxjobs,&maximum.uaf$w_maxjobs);
X    field.network_access `124= parse_access("NETWORK",
X`009`009minimum.uaf$b_network_access_p,
X`009`009maximum.uaf$b_network_access_p,
X`009`009minimum.uaf$b_network_access_s,
X`009`009maximum.uaf$b_network_access_s);
X    field.owner = parse_ctext("OWNER",
X`009`009minimum.uaf$t_owner,UAF$S_OWNER);
X    /* PASSWORD */
X    field.pgflquota = parse_long("PGFLQUOTA",
X`009`009&minimum.uaf$l_pgflquota,&maximum.uaf$l_pgflquota);
X    field.prccnt = parse_word("PRCLM",
X`009`009&minimum.uaf$w_prccnt,&maximum.uaf$w_prccnt);
X    field.primedays = parse_days("PRIMEDAYS",
X`009`009&minimum.uaf$b_primedays,&maximum.uaf$b_primedays);
X    field.pri = parse_byte("PRIORITY",
X`009`009&minimum.uaf$b_pri,&maximum.uaf$b_pri);
X    field.priv = parse_privileges("PRIVILEGES",
X`009`009minimum.uaf$q_priv,maximum.uaf$q_priv);
X    /* PWDEXPIRED */
X    field.pwd_lifetime = parse_date("PWDLIFETIME",
X`009`009minimum.uaf$q_pwd_lifetime, maximum.uaf$q_pwd_lifetime);
X    field.pwd_length = parse_byte("PWDMINIMUM",
X`009`009&minimum.uaf$b_pwd_length,&maximum.uaf$b_pwd_length);
X    field.remote_access `124= parse_access("REMOTE",
X`009`009minimum.uaf$b_remote_access_p,
X`009`009maximum.uaf$b_remote_access_p,
X`009`009minimum.uaf$b_remote_access_s,
X`009`009maximum.uaf$b_remote_access_s);
X    field.shrfillm = parse_word("SHRFILLM",
X`009`009&minimum.uaf$w_shrfillm,&maximum.uaf$w_shrfillm);
X    field.tqcnt = parse_word("TQELM",
X`009`009&minimum.uaf$w_tqcnt,&maximum.uaf$w_tqcnt);
X    field.uic = cli_parse_uic("UIC",
X`009`009&minimum.uaf$l_uic);
X    field.username = parse_text("USERNAME",
X`009`009minimum.uaf$t_username,UAF$S_USERNAME);
X    field.dfwscnt = parse_long("WSDEFAULT",
X`009`009&minimum.uaf$l_dfwscnt,&maximum.uaf$l_dfwscnt);
X    field.wsextent = parse_long("WSEXTENT",
X`009`009&minimum.uaf$l_wsextent,&maximum.uaf$l_wsextent);
X    field.wsquota = parse_long("WSQUOTA",
X`009`009&minimum.uaf$l_wsquota,&maximum.uaf$l_wsquota);
X    init_parse("MATCH.");
X    and = present("AND");
X  `125
X
X
X  if (field.rtype)
X  `123
X    test = !((record->uaf$b_rtype < minimum.uaf$b_rtype) `124`124
X`009     (record->uaf$b_rtype > maximum.uaf$b_rtype));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.version)
X  `123
X    test = !((record->uaf$b_version < minimum.uaf$b_version) `124`124
X`009     (record->uaf$b_version > maximum.uaf$b_version));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.usrdatoff)
X  `123
X    test = !((record->uaf$w_usrdatoff < minimum.uaf$w_usrdatoff) `124`124
X`009     (record->uaf$w_usrdatoff > maximum.uaf$w_usrdatoff));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.logfails)
X  `123
X    test = !((record->uaf$w_logfails < minimum.uaf$w_logfails) `124`124
X`009     (record->uaf$w_logfails > maximum.uaf$w_logfails));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.pwd_date)
X  `123
X    test =
V      !((datecmp(record->uaf$q_pwd_date,minimum.uaf$q_pwd_date) == -1) `124`12
X4
X        (datecmp(record->uaf$q_pwd_date,maximum.uaf$q_pwd_date) == 1));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.pwd2_date)
X  `123
X    test =
V      !((datecmp(record->uaf$q_pwd2_date,minimum.uaf$q_pwd2_date) == -1) `124`
X124
X        (datecmp(record->uaf$q_pwd2_date,maximum.uaf$q_pwd2_date) == 1));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.lastlogin_i)
X  `123
X    test =
V      !((datecmp(record->uaf$q_lastlogin_i,minimum.uaf$q_lastlogin_i) == -1) `
X124`124
X        (datecmp(record->uaf$q_lastlogin_i,maximum.uaf$q_lastlogin_i) == 1));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.lastlogin_n)
X  `123
X    test =
V      !((datecmp(record->uaf$q_lastlogin_n,minimum.uaf$q_lastlogin_n) == -1) `
X124`124
X        (datecmp(record->uaf$q_lastlogin_n,maximum.uaf$q_lastlogin_n) == 1));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.account)
X  `123
X    trim(record->uaf$t_account,UAF$S_ACCOUNT);
X
X    test = string_compare(record->uaf$t_account,
X`009`009minimum.uaf$t_account,UAF$S_ACCOUNT + 1);
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.astlm)
X  `123
X    test = !((record->uaf$w_astlm < minimum.uaf$w_astlm) `124`124
X`009     (record->uaf$w_astlm > maximum.uaf$w_astlm));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.batch_access)
X  `123
X    int t1, t2;
X    t1 = check_access(
X`009`009record->uaf$b_batch_access_p,
X`009`009minimum.uaf$b_batch_access_p,
X`009`009maximum.uaf$b_batch_access_p);
X    t2 = check_access(
X`009`009record->uaf$b_batch_access_s,
X`009`009minimum.uaf$b_batch_access_s,
X`009`009maximum.uaf$b_batch_access_s);
X    t1 = t1 && t2;
X    if (t1 && !and) return(1);
X    if (!t1 && and) return(0);
X  `125
X
X  if (field.biolm)
X  `123
X    test = !((record->uaf$w_biolm < minimum.uaf$w_biolm) `124`124
X`009     (record->uaf$w_biolm > maximum.uaf$w_biolm));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.bytlm)
X  `123
X    test = !((record->uaf$l_bytlm < minimum.uaf$l_bytlm) `124`124
X`009     (record->uaf$l_bytlm > maximum.uaf$l_bytlm));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.defcli)
X  `123
X    trim(record->uaf$t_defcli,UAF$S_DEFCLI);
X    test = string_compare(&record->uaf$t_defcli[1] ,
X`009`009&minimum.uaf$t_defcli[1],UAF$S_DEFCLI);
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.clitables)
X  `123
X    trim(record->uaf$t_clitables,UAF$S_CLITABLES);
X    test = string_compare(&record->uaf$t_clitables[1],
X`009`009&minimum.uaf$t_clitables[1],UAF$S_CLITABLES);
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.def_priv)
X  `123 /* minimum.uaf$q_def_priv,maximum.uaf$q_def_priv */
X    test =`032
X      ((minimum.uaf$q_def_priv[0] `124`124 minimum.uaf$q_def_priv[1])?
X`009((record->uaf$q_def_priv[0] & minimum.uaf$q_def_priv[0]) `124`124
X`009 (record->uaf$q_def_priv[1] & minimum.uaf$q_def_priv[1])):1) &&
X      ((maximum.uaf$q_def_priv[0] `124`124 maximum.uaf$q_def_priv[1])?
X`009!((record->uaf$q_def_priv[0] & maximum.uaf$q_def_priv[0]) `124`124
X`009  (record->uaf$q_def_priv[1] & maximum.uaf$q_def_priv[1])):1);
X
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.defdev)
X  `123
X    trim(record->uaf$t_defdev,UAF$S_DEFDEV);
X    test = string_compare(&record->uaf$t_defdev[1],
X`009`009&minimum.uaf$t_defdev[1],UAF$S_DEFDEV);
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.dialup_access)
X  `123 /* minimum.uaf$b_dialup_access_p,minimum.uaf$b_dialup_access_s); */
X    int t1, t2;
X
X    t1 = check_access(
X`009`009record->uaf$b_dialup_access_p,
X`009`009minimum.uaf$b_dialup_access_p,
X`009`009maximum.uaf$b_dialup_access_p);
X    t2 = check_access(
X`009`009record->uaf$b_dialup_access_s,
X`009`009minimum.uaf$b_dialup_access_s,
X`009`009maximum.uaf$b_dialup_access_s);
X    t1 = t1 && t2;
X    if (t1 && !and) return(1);
X    if (!t1 && and) return(0);
X  `125
X
X  if (field.diolm)
X  `123
X    test = !((record->uaf$w_diolm < minimum.uaf$w_diolm) `124`124
X`009     (record->uaf$w_diolm > maximum.uaf$w_diolm));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.defdir)
X  `123
X    trim(record->uaf$t_defdir,UAF$S_DEFDIR);
X    test = string_compare(&record->uaf$t_defdir[1],
X`009`009&minimum.uaf$t_defdir[1],UAF$S_DEFDIR);
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X     `032
X  if (field.enqlm)
X  `123
X    test = !((record->uaf$w_enqlm < minimum.uaf$w_enqlm) `124`124
X`009     (record->uaf$w_enqlm > maximum.uaf$w_enqlm));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.expiration)
X  `123
X    test =
V      !((datecmp(record->uaf$q_expiration,minimum.uaf$q_expiration) == -1) `12
X4`124
X        (datecmp(record->uaf$q_expiration,maximum.uaf$q_expiration) == 1));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.fillm)
X  `123
X    test = !((record->uaf$w_fillm < minimum.uaf$w_fillm) `124`124
X`009     (record->uaf$w_fillm > maximum.uaf$w_fillm));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.flags)
X  `123
X    test = (minimum.uaf$l_flags?(record->uaf$l_flags & minimum.uaf$l_flags):1)
V      &&  (maximum.uaf$l_flags?!(record->uaf$l_flags & maximum.uaf$l_flags):1)
X;
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.jtquota)
X  `123
X    test = !((record->uaf$l_jtquota < minimum.uaf$l_jtquota) `124`124
X`009     (record->uaf$l_jtquota > maximum.uaf$l_jtquota));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.lgicmd)
X  `123
X    trim(record->uaf$t_lgicmd,UAF$S_LGICMD);
X    test = string_compare(&record->uaf$t_lgicmd[1],
X`009`009&minimum.uaf$t_lgicmd[1],UAF$S_LGICMD);
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.local_access)
X  `123 /* minimum.uaf$b_local_access_p,minimum.uaf$b_local_access_s); */
X    int t1, t2;
X
X    t1 = check_access(
X`009`009record->uaf$b_local_access_p,
X`009`009minimum.uaf$b_local_access_p,
X`009`009maximum.uaf$b_local_access_p);
X    t2 = check_access(
X`009`009record->uaf$b_local_access_s,
X`009`009minimum.uaf$b_local_access_s,
X`009`009maximum.uaf$b_local_access_s);
X    t1 = t1 && t2;
X    if (t1 && !and) return(1);
X    if (!t2 && and) return(0);
X  `125
X
X  if (field.maxacctjobs)
X  `123
X    test = !((record->uaf$w_maxacctjobs < minimum.uaf$w_maxacctjobs) `124`124
X`009     (record->uaf$w_maxacctjobs > maximum.uaf$w_maxacctjobs));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.maxdetach)
X  `123
X    test = !((record->uaf$w_maxdetach < minimum.uaf$w_maxdetach) `124`124
X`009     (record->uaf$w_maxdetach > maximum.uaf$w_maxdetach));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.maxjobs)
X  `123
X    test = !((record->uaf$w_maxjobs < minimum.uaf$w_maxjobs) `124`124
X`009     (record->uaf$w_maxjobs > maximum.uaf$w_maxjobs));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.network_access)
X  `123 /* minimum.uaf$b_network_access_p,minimum.uaf$b_network_access_s); */
X    int t1, t2;
X
X    t1 = check_access(
X`009`009record->uaf$b_network_access_p,
X`009`009minimum.uaf$b_network_access_p,
X`009`009maximum.uaf$b_network_access_p);
X    t2 = check_access(
X`009`009record->uaf$b_network_access_s,
X`009`009minimum.uaf$b_network_access_s,
X`009`009maximum.uaf$b_network_access_s);
X    t1 = t1 && t2;
X    if (t1 && !and) return(1);
X    if (!t1 && and) return(0);
X  `125
X
X  if (field.owner)
X  `123
X    trim(record->uaf$t_owner,UAF$S_OWNER);
X    test = string_compare(&record->uaf$t_owner[1],
X`009`009&minimum.uaf$t_owner[1],UAF$S_OWNER);
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  /* PASSWORD */
X
X  if (field.pgflquota)
X  `123
X    test = !((record->uaf$l_pgflquota < minimum.uaf$l_pgflquota) `124`124
X`009     (record->uaf$l_pgflquota > maximum.uaf$l_pgflquota));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.prccnt)
X  `123
X    test = !((record->uaf$w_prccnt < minimum.uaf$w_prccnt) `124`124
X`009     (record->uaf$w_prccnt > maximum.uaf$w_prccnt));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.primedays)
X  `123 /* &minimum.uaf$b_primedays,&maximum.uaf$b_primedays); */
X    test = (minimum.uaf$b_primedays?
X`009`009(record->uaf$b_primedays & minimum.uaf$b_primedays):1)
X        && (maximum.uaf$b_primedays?
X`009`009!(record->uaf$b_primedays & maximum.uaf$b_primedays):1);
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.pri)
X  `123
X    test = !((record->uaf$b_pri < minimum.uaf$b_pri) `124`124
X`009   (  record->uaf$b_pri > maximum.uaf$b_pri));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.priv)
X  `123 /* minimum.uaf$q_priv,maximum.uaf$q_priv); */
X    test =`032
X      ((minimum.uaf$q_priv[0] `124`124 minimum.uaf$q_priv[1])?
X`009((record->uaf$q_priv[0] & minimum.uaf$q_priv[0]) `124`124
X`009 (record->uaf$q_priv[1] & minimum.uaf$q_priv[1])):1) &&
X      ((maximum.uaf$q_priv[0] `124`124 maximum.uaf$q_priv[1])?
X`009!((record->uaf$q_priv[0] & maximum.uaf$q_priv[0]) `124`124
X`009  (record->uaf$q_priv[1] & maximum.uaf$q_priv[1])):1);
X/*
X      (minimum.uaf$q_priv[0]?
X`009(record->uaf$q_priv[0] & minimum.uaf$q_priv[0]):1) &&
X      (minimum.uaf$q_priv[1]?
X`009(record->uaf$q_priv[1] & minimum.uaf$q_priv[1]):1) &&
X      (maximum.uaf$q_priv[0]?
X`009!(record->uaf$q_priv[0] & maximum.uaf$q_priv[0]):1) &&
X      (maximum.uaf$q_priv[1]?
X`009!(record->uaf$q_priv[1] & maximum.uaf$q_priv[1]):1);
X*/
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  /* PWDEXPIRED */
X
X  if (field.pwd_lifetime)
X  `123 /* minimum.uaf$q_pwd_lifetime, maximum.uaf$q_pwd_lifetime); */
X    test =
X      !((datecmp(record->uaf$q_pwd_lifetime,minimum.uaf$q_pwd_lifetime) == -1)
X       `124`124
V        (datecmp(record->uaf$q_pwd_lifetime,maximum.uaf$q_pwd_lifetime) == 1))
X;
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.pwd_length)
X  `123
X    test = !((record->uaf$b_pwd_length < minimum.uaf$b_pwd_length) `124`124
X`009     (record->uaf$b_pwd_length > maximum.uaf$b_pwd_length));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.remote_access)
X  `123 /* minimum.uaf$b_remote_access_p,maximum.uaf$b_remote_access_s); */
X    int t1, t2;
X
X    t1 = check_access(
X`009`009record->uaf$b_remote_access_p,
X`009`009minimum.uaf$b_remote_access_p,
X`009`009maximum.uaf$b_remote_access_p);
X    t2 = check_access(
X`009`009record->uaf$b_remote_access_s,
X`009`009minimum.uaf$b_remote_access_s,
X`009`009maximum.uaf$b_remote_access_s);
X    t1 = t1 && t2;
X    if (t1 && !and) return(1);
X    if (!t1 && and) return(0);
X  `125
X
X  if (field.shrfillm)
X  `123
X    test = !((record->uaf$w_shrfillm < minimum.uaf$w_shrfillm) `124`124
X`009     (record->uaf$w_shrfillm > maximum.uaf$w_shrfillm));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.tqcnt)
X  `123
X    test = !((record->uaf$w_tqcnt < minimum.uaf$w_tqcnt) `124`124
X`009     (record->uaf$w_tqcnt > maximum.uaf$w_tqcnt));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.uic)
X  `123
X    test = uic_match(record->uaf$l_uic,minimum.uaf$l_uic);
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.username)
X  `123
X    trim(record->uaf$t_username,UAF$S_USERNAME);
X    test = string_compare(record->uaf$t_username,
X`009`009minimum.uaf$t_username,UAF$S_USERNAME + 1);
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.dfwscnt)
X  `123
X    test = !((record->uaf$l_dfwscnt < minimum.uaf$l_dfwscnt) `124`124
X`009     (record->uaf$l_dfwscnt > maximum.uaf$l_dfwscnt));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.wsextent)
X  `123
X    test = !((record->uaf$l_wsextent < minimum.uaf$l_wsextent) `124`124
X`009     (record->uaf$l_wsextent > maximum.uaf$l_wsextent));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  if (field.wsquota)
X  `123
X    test = !((record->uaf$l_wsquota < minimum.uaf$l_wsquota) `124`124
X`009     (record->uaf$l_wsquota > maximum.uaf$l_wsquota));
X    if (test && !and) return(1);
X    if (!test && and) return(0);
X  `125
X
X  /* if it was an AND match then it was successfull,`009*/
X  /* if it was an OR search, it must have failed.`009*/
X  return(and);
X`125
X
Xdatecmp(long a[2], long b[2])
X`123 /* if a < b, return -1, if a > b, return 1, if a == b, return 0 */
X  long quad[2];
X
X  lib$subx(a,b,quad);
X  if (quad[1] < 0) return(-1);
X  if ((quad[1] == 0) && (quad[0] == 0)) return(0);
X  return(1);
X`125
X
Xstring_compare(char *s1,char *s2,int max)
X`123
X  struct dsc$descriptor d1 = `123MIN(strlen(s1),max-1),0,0,s1`125;
X  struct dsc$descriptor d2 = `123MIN(strlen(s2),max-1),0,0,s2`125;
X  static struct dsc$descriptor d3 = `1230,DSC$K_DTYPE_T,DSC$K_CLASS_D,0`125;
X
X  str$upcase(&d3,&d1);
X  return(str$match_wild(&d3, &d2) & 1);
X`125
X
Xstruct uic
X`123
X  variant_union
X  `123
X    long value;
X    variant_struct
X    `123
X      short group;
X      short member;
X    `125 uic_fields;
X  `125 uic_overlay;
X`125;
X
Xuic_match(struct uic uic1, struct uic uic2)
X`123
X  if (uic1.value == uic2.value) return(1);
X  if (((uic1.group == -1) `124`124 (uic2.group == -1))
X     && (uic1.member == uic2.member)) return(1);
X  if (((uic1.member == -1) `124`124 (uic2.member == -1))
X     && (uic1.group == uic2.group)) return(1);
X  return(0);
X`125
X
X
Xcheck_access(char *r, char *min, char*max)
X`123
X  int t1, t2 = 1, i;
X
X  for (i = 0; i < 3; ++i)
X  `123
X    t1 = (min[i]?(`126r[i] & min[i]):1) &&  (max[i]?!(`126r[i] & max[i]):1);
X    t2 = t1 && t2;
X  `125
X  return(t2);
X`125
X$EOD
X$ create/log UAF.C
X$DECK
X/* UAF, written by Joe Meadows, released to the world Jan 31, 1989.
X   This is a public domain utility. No parts of this utility are
X   copyrighted in any way. It may be used in any way, by anyone.
X   There are no restrictions on this code. You may include it
X   in a commercial package if you wish. Feel free to send money,
X   or better yet, make a donation to the FHCRC.
X
X  Joe Meadows Jr.
X  VAX/VMS System Manager / guru in training
X  Fred Hutchinson Cancer Research Center
X  1124 Columbia St.
X  Seattle Wa. 98104
X     bitnet - JOE@FHCRCVAX
X     arpa   - JOE%FHCRCVAX.BITNET@WISCVM.WISC.EDU
X     voice  - (206) 467-4970
X*/
X
X/* Modification History
X   --------------------
X   Jan 31, 1989 JEM - Conversion from BETA to Release
X*/
X#include stdio
X#include rms
X
X#include "uaf.h"
X#include "uaf_cld.h"
X
Xglobalvalue UAF_CLD;
X
Xmain(int argc, char *argv[])
X`123
X  struct FAB fab;
X  struct RAB rab;
X  struct UAFDEF record;
X  char *s;
X  int records = 0, sts;
X
X  init_cli(UAF_CLD,"UAF");
X
X  init_parse("");
X  fab = cc$rms_fab;
X  rab = cc$rms_rab;
X  fab.fab$b_fns = sizeof("sysuaf");
X  fab.fab$l_fna = "sysuaf";
X  fab.fab$b_dns = sizeof("sys$system:.dat");
X  fab.fab$l_dna = "sys$system:.dat";
X  fab.fab$b_fac = FAB$M_GET;
V  fab.fab$b_shr = FAB$M_SHRGET `124 FAB$M_SHRPUT `124 FAB$M_SHRDEL `124 FAB$M_
XSHRUPD;
X  rab.rab$l_rop = RAB$M_NLK;
X  rab.rab$w_usz = sizeof(record);
X  rab.rab$l_ubf = & record;
X  rab.rab$l_fab = &fab;
X
X  if (cli_present("UIC_ORDER") & 1)
X  `123
X    rab.rab$b_krf = 1;
X  `125
X  sts = SYS$OPEN(&fab);
X  if (!(sts & 1)) return(sts);
X
X  sts = SYS$CONNECT(&rab);
X  if (!(sts & 1)) return(sts);
X
X  s = get_value("OUTPUT");
X  if (s) freopen(s,"w",stdout,"rfm=var","rat=cr");
X
X  while(SYS$GET(&rab) & 1)
X  `123
X    if (select(&record,rab.rab$w_rsz))
X    `123
X      display(&record,rab.rab$w_rsz);
X      ++records;
X    `125
X  `125
X  printf("%d record%s matched\n",records,(records==1)?"":"s");
X`125
X$EOD
X$ create/log UAF.H
X$DECK
X#include "prvdef.h"
X
X/* *** MODULE $UAFDEF *** */
X/* ++ */
X/* User authorization file format */
X/* Note: With the exception of the username and account name, */
X/* all strings are blank padded counted strings. Username and */
X/* account name are uncounted, blank padded. */
X/* -- */
X#define UAF$C_USER_ID 1 /* main user ID record */
X#define UAF$C_VERSION1 1 /* this version */
X#define UAF$C_KEYED_PART 52 /* ISAM keys come this far */
X#define UAF$C_AD_II 0 /* AUTODIN-II 32 bit crc code */
X#define UAF$C_PURDY 1 /* Purdy polynomial over salted input */
X#define UAF$C_PURDY_V 2 /* Purdy polynomial + variable length username */
X#define UAF$K_FIXED 644 /* length of fixed portion */
X#define UAF$C_FIXED 644 /* length of fixed portion */
X#define UAF$K_LENGTH 1412
X#define UAF$C_LENGTH 1412
X#define UAF$S_UAFDEF 1412
X
X#define UAF$S_USERNAME 32
X#define UAF$S_PARENT_ID 8
X#define UAF$S_ACCOUNT 32
X#define UAF$S_OWNER 32
X#define UAF$S_DEFDEV 32
X#define UAF$S_DEFDIR 64
X#define UAF$S_LGICMD 64
X#define UAF$S_DEFCLI 32
X#define UAF$S_CLITABLES 32
X#define UAF$S_PWD 8
X#define UAF$S_PWD2 8
X#define UAF$S_EXPIRATION 8
X#define UAF$S_PWD_LIFETIME 8
X#define UAF$S_PWD_DATE 8
X#define UAF$S_PWD2_DATE 8
X#define UAF$S_LASTLOGIN_I 8
X#define UAF$S_LASTLOGIN_N 8
X#define UAF$S_PRIV 8
X#define UAF$S_DEF_PRIV 8
X#define UAF$S_MIN_CLASS 20
X#define UAF$S_MAX_CLASS 20
X#define UAF$S_NETWORK_ACCESS_P 3
X#define UAF$S_NETWORK_ACCESS_S 3
X#define UAF$S_BATCH_ACCESS_P 3
X#define UAF$S_BATCH_ACCESS_S 3
X#define UAF$S_LOCAL_ACCESS_P 3
X#define UAF$S_LOCAL_ACCESS_S 3
X#define UAF$S_DIALUP_ACCESS_P 3
X#define UAF$S_DIALUP_ACCESS_S 3
X#define UAF$S_REMOTE_ACCESS_P 3
X#define UAF$S_REMOTE_ACCESS_S 3
X
Xstruct uaf$r_flags_bits `123
X  unsigned uaf$v_disctly:1; /* no user control-y */
X  unsigned uaf$v_defcli:1; /* only allow user default CLI */
X  unsigned uaf$v_lockpwd:1; /* disable SET PASSWORD command */
X  unsigned uaf$v_captive:1; /* captive account (no overrides) */
X  unsigned uaf$v_disacnt:1; /* no interactive login */
X  unsigned uaf$v_diswelcom:1; /* skip welcome message */
X  unsigned uaf$v_dismail:1; /* skip new mail message */
X  unsigned uaf$v_nomail:1; /* disable mail delivery */
X  unsigned uaf$v_genpwd:1; /* passwords must be generated */
X  unsigned uaf$v_pwd_expired:1; /* password has expired */
X  unsigned uaf$v_pwd2_expired:1; /* 2nd password has expired */
X  unsigned uaf$v_audit:1; /* audit all actions */
X  unsigned uaf$v_disreport:1; /* skip last login messages */
X  unsigned uaf$v_disreconnect:1; /* inhibit reconnections */
X  unsigned uaf$v_autologin:1; /* auto-login only */
X  unsigned uaf$v_disforce_pwd_change:1; /* disable forced password change */
X`125;
X
Xstruct uaf$r_primedays_bits `123
X  unsigned uaf$v_monday:1; /* bit clear means this is a primary day */
X  unsigned uaf$v_tuesday:1; /* bit set means this is an off day */
X  unsigned uaf$v_wednesday:1;`032
X  unsigned uaf$v_thursday:1;`032
X  unsigned uaf$v_friday:1;`032
X  unsigned uaf$v_saturday:1;`032
X  unsigned uaf$v_sunday:1;`032
X`125;
X
Xstruct UAFDEF
X`123
X  char uaf$b_rtype; /* UAF record type */
X  char uaf$b_version; /* UAF format version */
X  short int uaf$w_usrdatoff; /* offset of counted string of user data */
X  char uaf$t_username[UAF$S_USERNAME]; /* username */
X  variant_union `123
X    long int uaf$l_uic; /* user ID code */
X    variant_struct `123
X      short int uaf$w_mem; /* member subfield */
X      short int uaf$w_grp; /* group subfield */
X    `125 uaf$r_uic_fields;
X  `125 uaf$r_uic_overlay;
X  long int uaf$l_sub_id; /* user sub-identifier */
X  long int uaf$q_parent_id[2]; /* identifier of owner of this account */
X  char uaf$t_account[UAF$S_ACCOUNT]; /* account name */
X  char uaf$t_owner[UAF$S_OWNER]; /* owner's name */
X  char uaf$t_defdev[UAF$S_DEFDEV]; /* default device */
X  char uaf$t_defdir[UAF$S_DEFDIR]; /* default directory */
X  char uaf$t_lgicmd[UAF$S_LGICMD]; /* login command file */
X  char uaf$t_defcli[UAF$S_DEFCLI]; /* default command interpreter */
X  char uaf$t_clitables[UAF$S_CLITABLES]; /* user CLI tables */
X  variant_union `123
X    long int uaf$q_pwd[2];  /* hashed password */
X    long int uaf$l_pwd; /* 32 bit subfield */
X  `125 uaf$r_pwd_overlay;
X  long int uaf$q_pwd2[2]; /* second password */
X  short int uaf$w_logfails; /* count of login failures */
X  short int uaf$w_salt; /* random password salt */
X  char uaf$b_encrypt; /* encryption algorithm */
X/* encryption codes */
X  char uaf$b_encrypt2; /* encryption algorithm for 2nd pwd */
X  char uaf$b_pwd_length; /* minimum password length */
X  char uaf$fill_1;
X  long int uaf$q_expiration[2]; /* expiration date for account */
X  long int uaf$q_pwd_lifetime[2]; /* password lifetime */
X  long int uaf$q_pwd_date[2]; /* date of password change */
X  long int uaf$q_pwd2_date[2]; /* date of 2nd password change */
X  long int uaf$q_lastlogin_i[2]; /* date of last interactive login */
X  long int uaf$q_lastlogin_n[2]; /* date of last non-interactive login */
X  variant_union `123
X    long int uaf$q_priv[2]; /* process privilege vector */
X    struct prvdef uaf$r_priv;
X  `125 uaf$r_priv_overlay;
X  variant_union `123
X    long int uaf$q_def_priv[2]; /* default process privileges */
X    struct prvdef uaf$r_def_priv;
X  `125 uaf$r_def_priv_overlay;
X  char uaf$r_min_class[UAF$S_MIN_CLASS]; /* minimum security class */
X  char uaf$r_max_class[UAF$S_MAX_CLASS]; /* maximum security class */
X  variant_union `123
X    long int uaf$l_flags; /* user flags longword */
X    struct uaf$r_flags_bits uaf$r_flags_bits;
X  `125 uaf$r_flags_overlay;
V  char uaf$b_network_access_p[UAF$S_NETWORK_ACCESS_P]; /* hourly network acces
Xs, primary */
V  char uaf$b_network_access_s[UAF$S_NETWORK_ACCESS_S]; /* hourly network acces
Xs, secondary */
V  char uaf$b_batch_access_p[UAF$S_BATCH_ACCESS_P]; /* hourly batch access, pri
Xmary */
V  char uaf$b_batch_access_s[UAF$S_BATCH_ACCESS_S]; /* hourly batch access, sec
Xondary */
V  char uaf$b_local_access_p[UAF$S_LOCAL_ACCESS_P]; /* hourly local access, pri
Xmary */
V  char uaf$b_local_access_s[UAF$S_LOCAL_ACCESS_S]; /* hourly local access, sec
Xondary */
V  char uaf$b_dialup_access_p[UAF$S_DIALUP_ACCESS_P]; /* hourly dialup access,
Xprimary */
V  char uaf$b_dialup_access_s[UAF$S_DIALUP_ACCESS_S]; /* hourly dialup access,
Xsecondary */
V  char uaf$b_remote_access_p[UAF$S_REMOTE_ACCESS_P]; /* hourly remote access,
Xprimary */
V  char uaf$b_remote_access_s[UAF$S_REMOTE_ACCESS_S]; /* hourly remote access,
Xsecondary */
X  char uaf$fill_2[514 - 502];
X  variant_union `123
X    char uaf$b_primedays; /* bits representing primary days */
X    struct uaf$r_primedays_bits uaf$r_primedays_bits;
X  `125 uaf$r_primedays_overlay;
X  char uaf$fill_3[516 - 515];
X  char uaf$b_pri; /* base process priority */
X  char uaf$b_quepri; /* maximum job queuing priority */
X  short int uaf$w_maxjobs; /* maximum jobs for UIC allowed */
X/* 0 means no limit */
X  short int uaf$w_maxacctjobs; /* maximum jobs for account allowed */
X/* 0 means no limit */
X  short int uaf$w_maxdetach; /* maximum detached processes for UIC */
X/* 0 means no limit */
X  short int uaf$w_prccnt; /* subprocess creation limit */
X  short int uaf$w_biolm; /* buffered I/O limit */
X  short int uaf$w_diolm; /* direct I/O limit */
X  short int uaf$w_tqcnt; /* timer queue entry limit */
X  short int uaf$w_astlm; /* AST queue limit */
X  short int uaf$w_enqlm; /* enqueue limit */
X  short int uaf$w_fillm; /* open file limit */
X  short int uaf$w_shrfillm; /* shared file limit */
X  long int uaf$l_wsquota; /* working set size quota */
X  long int uaf$l_dfwscnt; /* default working set size */
X  long int uaf$l_wsextent; /* working set size limit */
X  long int uaf$l_pgflquota; /* page file quota */
X  long int uaf$l_cputim; /* CPU time quota */
X  long int uaf$l_bytlm; /* buffered I/O byte count limit */
X  long int uaf$l_pbytlm; /* paged buffer I/O byte count limit */
X  long int uaf$l_jtquota; /* job-wide logical name table creation quota */
X  short int uaf$w_proxy_lim; /* number of proxies user can grant */
X  short int uaf$w_proxies; /* number of proxies granted */
X  short int uaf$w_account_lim; /* number of sub-accounts allowed */
X  short int uaf$w_accounts; /* number of sub-accounts in use */
X  char uaf$fill_4[UAF$K_LENGTH - 580];
X`125;
X$EOD
X$ create/log UAF_CLD.CLD
X$DECK
Xdefine type priv_class
X  keyword ALL, negatable
X  ! bypass, cmexec, cmkrnl, detach, log_io,
X  ! pfnmap, phy_io, setprv, share, sysnam, sysprv, readall
X  keyword FILES, negatable
X  ! diagnose, sysgbl, volpro, upgrade, downgrade, security
X  keyword SYSTEM, negatable
X  ! altpri, oper, pswapm, world
X  keyword DEVOUR, negatable
X  ! acnt, allspool, bugchk, exquota, grpnam,
X  ! prmceb, prmgbl, prmmbx, shmem, syslck
X  keyword GROUP, negatable
X  ! group, grppr
X  keyword NORMAL, negatable
X  ! mount, netmbx, tmpmbx
X
Xdefine type PRIVILEGES
X   keyword CLASS, value(type=priv_class)
X   keyword ACNT, negatable
X   keyword ALL, negatable
X   keyword ALLSPOOL, negatable
X   keyword ALTPRI, negatable
X   keyword BUGCHK, negatable
X   keyword BYPASS, negatable
X   keyword CMEXEC, negatable
X   keyword CMKRNL, negatable
X   keyword DETACH, negatable
X   keyword DIAGNOSE, negatable
X   keyword DOWNGRADE, negatable
X   keyword EXQUOTA, negatable
X   keyword GROUP, negatable
X   keyword GRPNAM, negatable
X   keyword GRPPRV, negatable
X   keyword LOG_IO, negatable
X   keyword MOUNT, negatable
X   keyword NETMBX, negatable
X   keyword OPER, negatable
X   keyword PFNMAP, negatable
X   keyword PHY_IO, negatable
X   keyword PRMCEB, negatable
X   keyword PRMGBL, negatable
X   keyword PRMMBX, negatable
X   keyword PSWAPM, negatable
X   keyword READALL, negatable
X   keyword SECURITY, negatable
X   keyword SETPRV, negatable
X   keyword SHARE, negatable
X   keyword SHMEM, negatable
X   keyword SYSLCK, negatable
X   keyword SYSGBL, negatable
X   keyword SYSNAM, negatable
X   keyword SYSPRV, negatable
X   keyword TMPMBX, negatable
X   keyword UPGRADE, negatable
X   keyword VOLPRO, negatable
X   keyword WORLD, negatable
X
Xdefine type weekdays
X  keyword SUNDAY, negatable
X  keyword MONDAY, negatable
X  keyword TUESDAY, negatable
X  keyword WEDNESDAY, negatable
X  keyword THURSDAY, negatable
X  keyword FRIDAY, negatable
X  keyword SATURDAY, negatable
X
Xdefine type login_flags
X  keyword AUDIT, negatable
X  keyword AUTOLOGIN, negatable
X  keyword CAPTIVE, negatable
X  keyword DEFCLI, negatable
X  keyword DISCTLY, negatable
X  keyword DISFORCE_PWD_CHANGE, negatable
X  keyword DISMAIL, negatable
X  keyword DISNEWMAIL, negatable
X  keyword DISRECONNECT, negatable
X  keyword DISREPORT, negatable
X  keyword DISUSER, negatable
X  keyword DISWELCOME, negatable
X  keyword GENPWD, negatable
X  keyword LOCKPWD, negatable
X  keyword PWD_EXPIRED, negatable
X  keyword PWD2_EXPIRED, negatable
X
X
Xdefine type selection_types
X  keyword RTYPE, value(required,type=$number,list)
X  keyword VERSION, value(required, type=$number,list)
X  keyword USRDATOFF, value(required, type=$number,list)
X  keyword LOGFAILS, value(required, type=$number, list)
X  keyword PWDCHANGE, value(type=$datetime,required,list)
X  keyword PWD2CHANGE, value(type=$datetime,required,list)
X  keyword INTERACTIVE, value(type=$datetime,required,list)
X  keyword NONINTERACTIVE, value(type=$datetime,required,list)
X
X  !access values look like:
X  ! [NO]thing=([PRIMARY], [n-m], [n] [,...] [SECONDARY], [n-m], [n] [,...])
X  ! [NO]thing="[PRIMARY][:] [n-m][,] [n][,...][;] [SECONDARY][:] [n-m][,...]"
X  keyword ACCESS, value(list), negatable
X  keyword BATCH, value(list), negatable
X  keyword DIALUP, value(list), negatable
X  !keyword INTERACTIVE, value(list), negatable
X  keyword LOCAL, value(list), negatable
X  keyword NETWORK, value(list), negatable
X  keyword REMOTE, value(list), negatable
X  !
X  !string values
X  keyword ACCOUNT, value(required)
X  keyword CLI, value(required)
X  keyword CLITABLES, value(required)
X  keyword DEVICE, value(required)
X  keyword DIRECTORY, value(required)
X  keyword LGICMD, value(required)
X  keyword OWNER, value(required)
X  keyword PASSWORD, value(required, list), negatable
X  !
X  ! numeric values
X  keyword ASTLM, value(type=$number,required,list)
X  keyword BIOLM, value(type=$number,required,list)
X  keyword BYTLM, value(type=$number,required,list)
X  keyword DIOLM, value(type=$number,required,list)
X  keyword ENQLM, value(type=$number,required,list)
X  keyword FILLM, value(type=$number,required,list)
X  keyword JTQUOTA, value(type=$number,required,list)
X  keyword MAXACCTJOBS, value(type=$number,required,list)
X  keyword MAXDETACH, value(type=$number,required,list)
X  keyword MAXJOBS, value(type=$number,required,list)
X  !  keyword PBYTLM, value(type=$number,required,list)
X  keyword PGFLQUOTA, value(type=$number,required,list)
X  keyword PRCLM, value(type=$number,required,list)
X  keyword PRIORITY, value(type=$number,required,list)
X  keyword PWDMINIMUM, value(type=$number,required,list)
X  keyword SHRFILLM, value(type=$number,required,list)
X  keyword TQELM, value(type=$number,required,list)
X  keyword WSDEFAULT, value(type=$number,required,list)
X  keyword WSEXTENT, value(type=$number,required,list)
X  keyword WSQUOTA, value(type=$number,required,list)
X  !
X  !various values
X  keyword CPUTIME, value(type=$deltatime,required,list)
X  keyword PWDLIFETIME, value(type=$deltatime,required,list)
X  keyword EXPIRATION, value(type=$datetime,required,list)
X  keyword USERNAME, value(required)
X  keyword UIC, value(type=$uic,required)
X  keyword DEFPRIVILEGES, value(type=privileges,list,required)
X  keyword PRIVILEGES, value(type=privileges,list,required)
X  keyword FLAGS, value(type=login_flags,list,required)
X  keyword PRIMEDAYS, value(type=weekdays,list), negatable
X  keyword PWDEXPIRED, negatable
X
Xdefine type display_types
X  keyword RTYPE
X  keyword VERSION
X  keyword USRDATOFF
X  keyword LOGFAILS
X  keyword PWDCHANGE
X  keyword PWD2CHANGE
X  keyword INTERACTIVE
X  keyword NONINTERACTIVE
X  keyword ACCESS
X  keyword BATCH
X  keyword DIALUP
X  keyword LOCAL
X  keyword NETWORK
X  keyword REMOTE
X  keyword ACCOUNT
X  keyword CLI
X  keyword CLITABLES
X  keyword DEVICE
X  keyword DIRECTORY
X  keyword LGICMD
X  keyword OWNER
X  keyword PASSWORD
X  keyword ASTLM
X  keyword BIOLM
X  keyword BYTLM
X  keyword DIOLM
X  keyword ENQLM
X  keyword FILLM
X  keyword JTQUOTA
X  keyword MAXACCTJOBS
X  keyword MAXDETACH
X  keyword MAXJOBS
X  !  keyword PBYTLM
X  keyword PGFLQUOTA
X  keyword PRCLM
X  keyword PRIORITY
X  keyword PWDMINIMUM
X  keyword SHRFILLM
X  keyword TQELM
X  keyword USERNAME
X  keyword WSDEFAULT
X  keyword WSEXTENT
X  keyword WSQUOTA
X  keyword CPUTIME
X  keyword PWDLIFETIME
X  keyword EXPIRATION
X  keyword UIC
X  keyword DEFPRIVILEGES
X  keyword PRIVILEGES
X  keyword FLAGS
X  keyword PRIMEDAYS
X  keyword PWDEXPIRED
X
Xdefine type match_types
X  keyword AND
X  keyword OR
X
Xdefine verb uaf
X
X  qualifier select, value(list,type=selection_types)
X  qualifier display, value(list,type=display_types)
X  qualifier match, value(type=match_types)
X  qualifier wrap, value(type=$number)
X  qualifier output, value
X  qualifier uic_order
X$EOD
X$ create/log UAF_CLD.H
X$DECK
Xstruct UAF_FIELDS
X`123
X  unsigned rtype:1;
X  unsigned version:1;
X  unsigned usrdatoff:1;
X  unsigned username:1;
X  unsigned uic:1;
X  unsigned account:1;
X  unsigned owner:1;
X  unsigned defdev:1;
X  unsigned defdir:1;
X  unsigned lgicmd:1;
X  unsigned defcli:1;
X  unsigned clitables:1;
X  unsigned pwd:1;`032
X  unsigned pwd2:1;
X  unsigned logfails:1;
X  unsigned salt:1;
X  unsigned encrypt:1;
X  unsigned encrypt2:1;
X  unsigned pwd_length:1;
X  unsigned expiration:1;
X  unsigned pwd_lifetime:1;
X  unsigned pwd_date:1;
X  unsigned pwd2_date:1;
X  unsigned lastlogin_i:1;
X  unsigned lastlogin_n:1;
X  unsigned priv:1;
X  unsigned def_priv:1;
X  unsigned min_class:1;
X  unsigned max_class:1;
X  unsigned flags:1;
X  unsigned network_access:1;
X  unsigned batch_access:1;
X  unsigned local_access:1;
X  unsigned dialup_access:1;
X  unsigned remote_access:1;
X  unsigned primedays:1;
X  unsigned pri:1;
X  unsigned quepri:1;
X  unsigned maxjobs:1;
X  unsigned maxacctjobs:1;
X  unsigned maxdetach:1;
X  unsigned prccnt:1;
X  unsigned biolm:1;
X  unsigned diolm:1;
X  unsigned tqcnt:1;
X  unsigned astlm:1;
X  unsigned enqlm:1;
X  unsigned fillm:1;
X  unsigned shrfillm:1;
X  unsigned wsquota:1;
X  unsigned dfwscnt:1;
X  unsigned wsextent:1;
X  unsigned pgflquota:1;
X  unsigned cputim:1;
X  unsigned bytlm:1;
X  unsigned pbytlm:1;
X  unsigned jtquota:1;
X  unsigned proxy_lim:1;
X  unsigned proxies:1;
X  unsigned account_lim:1;
X  unsigned accounts:1;
X`125;
Xstatic char *priv_txt[] = `123
X  "CMKRNL","CMEXEC","SYSNAM","GRPNAM","ALLSPOOL","DETACH","DIAGNOSE",
X  "LOG_IO","GROUP","ACNT","PRMCEB","PRMMBX","PSWAPM","ALTPRI","SETPRV",
X  "TMPMBX","WORLD","MOUNT","OPER","EXQUOTA","NETMBX","VOLPRO","PHY_IO",
X  "BUGCHK","PRMGBL","SYSGBL","PFNMAP","SHMEM","SYSPRV","BYPASS","SYSLCK",
X  "SHARE","UPGRADE","DOWNGRADE","GRPPRV","READALL","TMPJNL","PRMJNL",
X  "SECURITY"`125;
Xstatic char *flag_txt[] = `123
X  "DISCTLY","DEFCLI","LOCKPWD","CAPTIVE","DISUSER","DISWELCOME","DISNEWMAIL",
X  "DISMAIL","GENPWD","PWD_EXPIRED","PWD2_EXPIRED","AUDIT","DISREPORT",
X  "DISRECONNECT","AUTOLOGIN","DISFORCE_PWD_CHANGE"`125;
Xstatic char *primeday_txt[] = `123
X  "MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"`125;
X$EOD
$ GoSub Convert_File
$ Exit

