home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ogicse!uwm.edu!linac!att!ucbvax!DCD00.FNAL.GOV!LAURI
- From: LAURI@DCD00.FNAL.GOV (Laurelin of Middle Earth, x2214)
- Newsgroups: comp.os.vms
- Subject: SETPQL 2/9
- Message-ID: <921113111512.20800159@fndcd.fnal.gov>
- Date: 13 Nov 92 17:15:12 GMT
- Article-I.D.: fndcd.921113111512.20800159
- Sender: daemon@ucbvax.BERKELEY.EDU
- Distribution: world
- Organization: The Internet
- Lines: 346
-
- -+-+-+-+-+-+-+-+ START OF PART 2 -+-+-+-+-+-+-+-+
- X/* them as-is). If /MODIFY is in effect, call $SETUQI to set the new
- X/* `5Bhigher`5D PQL values for this account.
- X/*
- X/* Close the SYSUAF file and exit.
- X/*
- X/*
- X/* NOTE:
- X/*`20
- X/* The documentation clearly states that the USERNAME field of the SYSUAF
- X/* file is 12 bytes. HOWEVER, it can easily be shown that:
- X/* `09- the SYSUAF file contains a 32 character field for this value,
- X/* `09- the $GETUAI/$SETUAI system services function properly for`20
- X/* `09 usernames which are 31 characters in length (when the username
- X/*`09 is in the argument list, *NOT* the itemlist)
- X/* `09- the AUTHORIZE utility functions properly with usernames which
- X/* `09 exceed 12 characters in length.
- X/* THEREFORE, I have done nothing within this program to limit the length
- X/* of usernames to 12 characters. The MAX_UAI_LENGTH parameter is declared
- X/* and defined to be 12, but it is not used.
- X/* (I suspect that if a username longer than 12 characters was passed in the
- V`20
- X/* ItemList for the $SETUAI system service, *then* $SETUAI might complain.
- X/* However, I am not using this as an item within the itemlist; I only pass
- X/* it as a required argument on the argument list).
- X/*
- X/*
- X * History:
- X * 15-oct-1991`09l.loebel`09Initial.
- X * 09-dec-1991`09l.loebel`09Add exclusions.
- X */
- X`0C
- X/**************************************************
- X * Declarations, Inclusions, Headers, Functions, *
- X * Et Cetera. *
- X **************************************************/
- X
- X/*
- X * include files:
- X */
- X#include stdio `09`09`09/* standard I/O module */
- X#include descrip`09`09/* descriptor structures */
- X#include string`09`09`09/* string manipulation headers */
- X#include ctype`09`09`09/* character manipulation headers */
- X#include stdlib`09`09`09/* standard library routines */
- X#include ssdef`09`09`09/* status return symbols */
- X#include uaidef`09`09`09/* system service codes for $GETUAI, $SETUAI */
- X#include climsgdef`09`09/* CLI (command language interpreter) definitions */
- X#include rmsdef`09`09`09/* RMS status return definitions */
- X#include rms`09`09`09/* RMS initialization routines */
- X#include strdef`09`09`09/* STR initialization routines */
- X
- X
- X/*
- X * function/constant definitions:
- X */
- X
- X#define SIGNAL(c)`09`09if (!(c&1)) lib$signal(c)
- X#define RMS_SIGNAL(c,d) `09if (!(c&1)) lib$signal(c,d)
- X#define TRUE 1
- X#define FALSE !TRUE
- X
- X#define MAX_UAI_USERLEN 12`09/* Maximum number of non-zero characters in the
- V username string for $GETUAI/$SETUAI calls */
- X`09`09`09`09/* NOTE that I am *NOT* using this parameter!!! For my purposes
- V, usernames longer than */
- X`09`09`09`09/* 12 characters have been found to exist and to function!! */
- X
- X#define MAX_PARAMS 22`09`09/* number of $GETUAI/$SETUAI pql items we are goi
- Vng to look at */
- X
- X#define UAF_USERLEN 31`09`09/* maximum number of non-zero characters in the
- V record in the SYSUAF.DAT file */
- X`09`09`09`09/* NOTE the field is 32 characters long, but that last characte
- Vr means something else. */
- X`09`09`09`09/* I'm not sure what, but it is *NOT* part of the username. */
- X
- X#define UAF_USERNAME_POS 4`09/* number of bytes preceeding the username in t
- Vhe sysuaf record */
- X#define UAF_RECORDLENGTH 1412`09/* number of bytes in each record of the sys
- Vuaf file */
- X#define UAF_KEYSIZE 32`09`09/* number of bytes in the keyname string */
- X
- X#define SYSUAF_FILE "SYSUAF"`09`09`09`09/* logical name for the SYSUAF file,
- V which we are reading to get usernames*/
- X#define DFLT_SYSUAF_FILE "SYS$SYSTEM:SYSUAF.DAT;" `09/* explicit name if no
- V logical is defined */
- X
- X#define DFLT_EXCLUDE_FILE1 "SYS$DISK:SETPQL_EXCLUDE.DAT;"/* explicit name if
- V no logical for SETPQL_EXCLUDE is defined. */
- X#define DFLT_EXCLUDE_FILE2 "SYS$LOGIN:SETPQL_EXCLUDE.DAT;"/* second chance f
- Vor SETPQL_EXCLUDE file defaults. */
- X
- X#define NOT_DEFINED -1`09`09`09`09`09/* flag that MasterValues were not assi
- Vgned yet */
- X#define BYTE sizeof(char)`09`09`09`09/* 1 byte */
- X#define WORD sizeof(short)`09`09`09`09/* 2 bytes */
- X#define LONG sizeof(long)`09`09`09`09/* 4 bytes */
- X
- X/*
- X * RMS structure declarations --
- X * we will read the SYSUAF file record by record to get
- X * the usernames. These Fabs and Rabs will be for opening the
- X * SYSUAF file.
- X * We also need to read records from the SETPQL_EXCLUDE file.
- X */
- X
- Xstruct FAB uaffab;`09`09`09/* File Access Block */
- Xstruct NAM uafnam;`09`09`09/* Name Block */
- Xstruct RAB uafrab;`09`09`09/* Record Access Block */
- Xstruct XABKEY uafxabkey;`09`09/* Key XAB */
- X
- Xstruct FAB excfab;`09`09`09/* File Access Block */
- Xstruct NAM excnam;`09`09`09/* Name Block */
- Xstruct RAB excrab;`09`09`09/* Record Access Block */
- X
- X/*
- X * structure definitions
- X */
- X
- X
- Xstruct UafRecordStruct `7B
- X`09char stuff`5BUAF_USERNAME_POS`5D;`09`09/* we don't care about what comes
- V before the username */
- X`09char username`5BUAF_USERLEN + 1`5D;`09`09/* we just want to read SYSUAF.D
- VAT to get the usernames (one for trailing null) */
- X`09char otherstuff`5BUAF_RECORDLENGTH - UAF_USERLEN - 1 - UAF_USERNAME_POS`5
- VD;
- X`09`7D UafRecord;
- X
- Xstruct ValueStruct `7B`09`09`09`09/* structure definition to contain the act
- Vual return values from $GETUAI/$SETUAI */
- X`09char username`5BUAF_USERLEN + 1`5D;`09/* NOTE: this is *NOT* the MAX_UA
- VI_USERLEN, because larger strings in fact WORK!*/
- X`09long uic;`09`09`09`09/* Required for pattern matching on included/exclud
- Ved usernames. */
- X`09short astlm;`09`09`09`09/* These cannot be put into an array, because the
- Vy contain differing */
- X`09short biolm;`09`09`09`09/* datatypes. These are never examined directly
- V, they are only */
- X`09long bytlm;`09`09`09`09/* declared for storage purposes. All manipulat
- Vion of these quantities */
- X`09long cputim;`09`09`09`09/* is done via the Address pointers declared be
- Vlow. */
- X`09long dfwscnt;
- X`09short diolm;
- X`09short enqlm;
- X`09short fillm;
- X`09long jtquota;
- X`09short maxacctjobs;
- X`09short maxdetach;
- X`09short maxjobs;
- X`09long pbytlm;
- X`09long pgflquota;
- X`09short prccnt;
- X`09char pri;
- X`09char quepri;
- X`09short shrfillm;
- X`09short tqcnt;
- X`09long wsextent;
- X`09long wsquota;
- X`09`7D;
- X
- Xstruct ValueStruct UserValue;`09`09`09/* contains the actual values for each
- V user in the SYSUAF file */
- Xstruct ValueStruct MasterValue;`09`09`09/* contains the actual master values
- V we're using as minimum pql values */
- X
- X$DESCRIPTOR( Master_d, MasterValue.username );
- X$DESCRIPTOR( User_d, UserValue.username );
- X
- X
- Xunion Addr `7B`09`09`09`09`09/* pointers to the locations of the actual data
- V. NOTE that we may not */
- X struct `7B`09`09`09`09`09/* initialize these addresses on the declaratio
- Vn line! */
- X`09char *pusername;`09`09`09/* We need this level of indirection because the
- V sizes of the various */
- X`09long *ptr`5BMAX_PARAMS`5D;`09`09`09/* items we are storing are different
- V, and therefore need different */
- X`09`7D plong;`09`09`09`09/* types of pointers. */
- X struct `7B`09`09`09`09`09/* All of the manipulation, examination, etc., o
- Vf any PQL values is done via this */
- X`09char *pusername;`09`09`09/* level of indirection so that we may do it vi
- Va DO-LOOPS rather than explicitly */
- X`09char *ptr`5BMAX_PARAMS`5D;`09`09`09/* value by value. */
- X`09`7D pbyte;
- X struct `7B
- X`09char *pusername;
- X`09short *ptr`5BMAX_PARAMS`5D;
- X`09`7D pword;
- X `7D;
- X
- Xunion Addr UserAddress; `09`09`09/* contains pointers to values for each use
- Vr in the SYSUAF file */
- Xunion Addr MasterAddress; `09`09`09/* for the master values we're using as m
- Vinimum pql values */
- X
- X
- X
- Xstruct InfoStruct `7B`09`09`09`09/* auxillary info */
- X`09char text`5B12`5D;`09`09`09`09/* descriptive text string, e.g., 'astlm' *
- V/
- X`09short itmcod;`09`09`09`09/* UAI$_xxx item code for system service calls *
- V/
- X`09short buflen;`09`09`09`09/* length of return buffer for each item */
- X`09short on_cmdline;`09`09`09/* some $GETUAI/$SETUAI parameters are not qual
- Vifiers on the command line!! */
- X`09short shallwe;`09`09`09`09/* from command line: actually test/set/modify
- V this item? Some are ignorable. */
- X`09long cmdval;`09`09`09`09/* value from the command line, if specified */
- X`09short cpu_special;`09`09`09/* special processing for CPUTIME qualifier, w
- Vhich is deltatime!! */
- X`09`7D;
- X
- X/*
- X * The Info structure is populated with:
- X * text = description of which parameter is being considered,
- X * itmcod = UAI$_xxx parameter for this parameter,
- X * buflen = size of this parameter as declared in the Value structure,
- X * shallwe = FALSE, assume that we will ignore this value until the command
- V line proves otherwise,
- X * cmdval = NOT_DEFINED, define this only if we determine that there was a
- Vn actual value entered on the command line,
- X * cpu_special = FALSE except for the CPUTIME item, which needs special pro
- Vcessing on quadwords and the like.
- X */
- Xstruct InfoStruct Info`5BMAX_PARAMS`5D = `7B
- X
- X/***************************************************************************
- V**********************************************
- X/*
- V `20
- V on_cmdline *
- X/*
- V `20
- V `7C shallwe *
- X/* text itmcod buflen
- V `7C `7C cmdval cpu_special *
- X/***************************************************************************
- V**********************************************/
- X`09`09`7B "uic",`09 UAI$_UIC,`09 sizeof(UserValue.uic),`09 FALSE, FALSE,
- V NOT_DEFINED, FALSE `7D,
- X`09`09`7B "astlm", `09 UAI$_ASTLM, `09 sizeof(UserValue.astlm), TRUE
- V, FALSE, NOT_DEFINED, FALSE `7D,
- X`09`09`7B "biolm", `09 UAI$_BIOLM, `09 sizeof(UserValue.biolm), TRUE
- V, FALSE, NOT_DEFINED, FALSE `7D,
- X`09`09`7B "bytlm", `09 UAI$_BYTLM, `09 sizeof(UserValue.bytlm), TRUE
- V, FALSE, NOT_DEFINED, FALSE `7D,
- X`09`09`7B "cputim", `09 UAI$_CPUTIM, `09 sizeof(UserValue.cputim), TR
- VUE, FALSE, NOT_DEFINED, TRUE `7D,
- X`09`09`7B "dfwscnt", `09 UAI$_DFWSCNT, `09 sizeof(UserValue.dfwscnt),
- V TRUE, FALSE, NOT_DEFINED, FALSE `7D,
- X`09`09`7B "diolm", `09 UAI$_DIOLM, `09 sizeof(UserValue.diolm), TRUE
- V, FALSE, NOT_DEFINED, FALSE `7D,
- X`09`09`7B "enqlm", `09 UAI$_ENQLM, `09 sizeof(UserValue.enqlm), TRUE
- V, FALSE, NOT_DEFINED, FALSE `7D,
- X`09`09`7B "fillm", `09 UAI$_FILLM, `09 sizeof(UserValue.fillm), TRUE
- V, FALSE, NOT_DEFINED, FALSE `7D,
- X`09`09`7B "jtquota", `09 UAI$_JTQUOTA, `09 sizeof(UserValue.jtquota),
- V TRUE, FALSE, NOT_DEFINED, FALSE `7D,
- X`09`09`7B "maxacctjobs", UAI$_MAXACCTJOBS, sizeof(UserValue.maxacctjobs), TR
- VUE, FALSE, NOT_DEFINED, FALSE `7D,
- X`09`09`7B "maxdetach", `09 UAI$_MAXDETACH, sizeof(UserValue.maxdetach),
- V TRUE, FALSE, NOT_DEFINED, FALSE `7D,
- X`09`09`7B "maxjobs", `09 UAI$_MAXJOBS, `09 sizeof(UserValue.maxjobs),
- V TRUE, FALSE, NOT_DEFINED, FALSE `7D,
- X`09`09`7B "pbytlm", `09 UAI$_PBYTLM, `09 sizeof(UserValue.pbytlm), TR
- VUE, FALSE, NOT_DEFINED, FALSE `7D,
- X`09`09`7B "pgflquota", `09 UAI$_PGFLQUOTA, sizeof(UserValue.pgflquota),
- V TRUE, FALSE, NOT_DEFINED, FALSE `7D,
- X`09`09`7B "prccnt", `09 UAI$_PRCCNT, `09 sizeof(UserValue.prccnt), TR
- VUE, FALSE, NOT_DEFINED, FALSE `7D,
- X`09`09`7B "pri", `09 UAI$_PRI, `09 sizeof(UserValue.pri), TRUE, F
- VALSE, NOT_DEFINED, FALSE `7D,
- X`09`09`7B "quepri", `09 UAI$_QUEPRI, `09 sizeof(UserValue.quepri), TR
- VUE, FALSE, NOT_DEFINED, FALSE `7D,
- X`09`09`7B "shrfillm", `09 UAI$_SHRFILLM, sizeof(UserValue.shrfillm), T
- VRUE, FALSE, NOT_DEFINED, FALSE `7D,
- X`09`09`7B "tqcnt", `09 UAI$_TQCNT, `09 sizeof(UserValue.tqcnt), TRUE
- V, FALSE, NOT_DEFINED, FALSE `7D,
- X`09`09`7B "wsextent", `09 UAI$_WSEXTENT, sizeof(UserValue.wsextent), T
- VRUE, FALSE, NOT_DEFINED, FALSE `7D,
- X`09`09`7B "wsquota", `09 UAI$_WSQUOTA, `09 sizeof(UserValue.wsquota),
- V TRUE, FALSE, NOT_DEFINED, FALSE `7D
- X`09`7D;
- X
- Xstruct OneItemStruct `7B`09`09/* item list information for system service ca
- Vlls, type item_list_3 for $GETUAI/$SETUAI */
- X`09short buflen;`09`09/* length of buffer whence read/write during system se
- Vrvice */
- X`09short itmcod;`09`09/* UAI$ item code */
- X`09char *bufadr;`09`09/* address whence read/write during system service */
- X`09long *retlen;`09`09/* address of byte count read/written during system se
- Vrvice -- who cares?! */
- X`09`7D;
- X
- Xstruct ItemListStruct`7B
- X`09struct OneItemStruct item`5BMAX_PARAMS`5D;
- X`09long terminator;`09/* must be set to zero!! */
- X`09`7D;
- X
- Xstruct ItemListStruct ItemList;`09`09/* This is the one we will be using for
- V our $GETUAI/$SETUAI calls. */
- X`09`09`09`09`09/* We will use the same structure both for the call for the D
- VEFAULT account to */
- X`09`09`09`09`09/* get the Master values, and for the loops through the user
- Vnames. Therefore */
- X`09`09`09`09`09/* we will not initialize this structure yet, do it dynamica
- Vlly during execution. */
- X
- X
- X
- Xstruct TimeStruct `7B`09`09`09/* Structure for converting quadwords/longword
- Vs to timestrings */
- X`09unsigned short year;`09`09/* User enters a $DELTATIME; we must convert to
- V a longword for $GETUAI/$SETUAI. */
- X`09unsigned short month;`09`09/* The longword represents 10-microsecond uni
- Vts. System service calls can */
- X`09unsigned short day;`09`09/* convert to quadword values (a negative 64-bi
- Vt integer in units of 100 nanoseconds) */
- X`09unsigned short hour;`09`09/* and then use LIB$EMUL/LIB$EDIV to convert t
- Vo a positive longword in our */
- X`09unsigned short minute;`09`09/* $GETUAI/$SETUAI units. However, for erro
- Vr messages and the like, we will need */
- X`09unsigned short second;`09`09/* to be able to convert back and get the pi
- Veces contained within this structure. */
- X`09unsigned short hundredth;
- X`09`7D;
- X
- Xstruct TimeStruct timbuf;`09`09/* Store the time pieces for error messages,
- V etc. */
- X
- Xstruct LinkedListStruct `7B`09`09/* Structure for containing the lists of ex
- Vcluded and included usernames/uics */
- X`09struct LinkedListStruct *pfwd;`09/* Forwards pointer */
- X`09struct LinkedListStruct *pbwd;`09/* Backwards pointer */
- X`09short len;`09`09`09/* Length of text string */
- X`09char *item;`09`09`09/* Actual string of `5Bwildcarded`5D username or uic
- V */
- X`09`7D;
- X
- X
- Xstruct LinkedListStruct *ExcludeUser_Root = NULL;`09/* Base address of Exclu
- Vded Username list */
- +-+-+-+-+-+-+-+- END OF PART 2 +-+-+-+-+-+-+-+-
-