home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / os / vms / 17941 < prev    next >
Encoding:
Internet Message Format  |  1992-11-14  |  14.6 KB

  1. Path: sparky!uunet!ogicse!uwm.edu!linac!att!ucbvax!DCD00.FNAL.GOV!LAURI
  2. From: LAURI@DCD00.FNAL.GOV (Laurelin of Middle Earth, x2214)
  3. Newsgroups: comp.os.vms
  4. Subject: SETPQL  2/9
  5. Message-ID: <921113111512.20800159@fndcd.fnal.gov>
  6. Date: 13 Nov 92 17:15:12 GMT
  7. Article-I.D.: fndcd.921113111512.20800159
  8. Sender: daemon@ucbvax.BERKELEY.EDU
  9. Distribution: world
  10. Organization: The Internet
  11. Lines: 346
  12.  
  13. -+-+-+-+-+-+-+-+ START OF PART 2 -+-+-+-+-+-+-+-+
  14. X/* them as-is).  If /MODIFY is in effect, call $SETUQI to set the new
  15. X/* `5Bhigher`5D PQL values for this account.
  16. X/*
  17. X/* Close the SYSUAF file and exit.
  18. X/*
  19. X/*
  20. X/* NOTE:
  21. X/*`20
  22. X/* The documentation clearly states that the USERNAME field of the SYSUAF
  23. X/* file is 12 bytes.  HOWEVER, it can easily be shown that:
  24. X/* `09- the SYSUAF file contains a 32 character field for this value,
  25. X/* `09- the $GETUAI/$SETUAI system services function properly for`20
  26. X/* `09  usernames which are 31 characters in length (when the username
  27. X/*`09  is in the argument list, *NOT* the itemlist)
  28. X/* `09- the AUTHORIZE utility functions properly with usernames which
  29. X/* `09  exceed 12 characters in length.
  30. X/* THEREFORE, I have done nothing within this program to limit the length
  31. X/* of usernames to 12 characters.  The MAX_UAI_LENGTH parameter is declared
  32. X/* and defined to be 12, but it is not used.
  33. X/* (I suspect that if a username longer than 12 characters was passed in the
  34. V`20
  35. X/* ItemList for the $SETUAI system service, *then* $SETUAI might complain.
  36. X/* However, I am not using this as an item within the itemlist; I only pass
  37. X/* it as a required argument on the argument list).
  38. X/*
  39. X/*
  40. X * History:
  41. X * 15-oct-1991`09l.loebel`09Initial.
  42. X * 09-dec-1991`09l.loebel`09Add exclusions.
  43. X */
  44. X`0C
  45. X/**************************************************
  46. X * Declarations, Inclusions, Headers, Functions,  *
  47. X * Et Cetera.                                     *
  48. X **************************************************/
  49. X
  50. X/*
  51. X * include files:
  52. X */
  53. X#include stdio `09`09`09/* standard I/O module */
  54. X#include descrip`09`09/* descriptor structures */
  55. X#include string`09`09`09/* string manipulation headers */
  56. X#include ctype`09`09`09/* character manipulation headers */
  57. X#include stdlib`09`09`09/* standard library routines */
  58. X#include ssdef`09`09`09/* status return symbols */
  59. X#include uaidef`09`09`09/* system service codes for $GETUAI, $SETUAI */
  60. X#include climsgdef`09`09/* CLI (command language interpreter) definitions */
  61. X#include rmsdef`09`09`09/* RMS status return definitions */
  62. X#include rms`09`09`09/* RMS initialization routines */
  63. X#include strdef`09`09`09/* STR initialization routines */
  64. X
  65. X
  66. X/*
  67. X * function/constant definitions:
  68. X */
  69. X
  70. X#define SIGNAL(c)`09`09if (!(c&1)) lib$signal(c)
  71. X#define RMS_SIGNAL(c,d) `09if (!(c&1)) lib$signal(c,d)
  72. X#define TRUE 1
  73. X#define FALSE !TRUE
  74. X
  75. X#define MAX_UAI_USERLEN 12`09/* Maximum number of non-zero characters in the
  76. V username string for $GETUAI/$SETUAI calls */
  77. X`09`09`09`09/* NOTE that I am *NOT* using this parameter!!!  For my purposes
  78. V, usernames longer than */
  79. X`09`09`09`09/*  12 characters have been found to exist and to function!!  */
  80. X
  81. X#define MAX_PARAMS 22`09`09/* number of $GETUAI/$SETUAI pql items we are goi
  82. Vng to look at */
  83. X
  84. X#define UAF_USERLEN 31`09`09/* maximum number of non-zero characters in the
  85. V record in the SYSUAF.DAT file */
  86. X`09`09`09`09/*  NOTE the field is 32 characters long, but that last characte
  87. Vr means something else.  */
  88. X`09`09`09`09/*  I'm not sure what, but it is *NOT* part of the username. */
  89. X
  90. X#define UAF_USERNAME_POS 4`09/* number of bytes preceeding the username in t
  91. Vhe sysuaf record */
  92. X#define UAF_RECORDLENGTH 1412`09/* number of bytes in each record of the sys
  93. Vuaf file */
  94. X#define UAF_KEYSIZE 32`09`09/* number of bytes in the keyname string */
  95. X
  96. X#define SYSUAF_FILE "SYSUAF"`09`09`09`09/* logical name for the SYSUAF file,
  97. V which we are reading to get usernames*/
  98. X#define DFLT_SYSUAF_FILE "SYS$SYSTEM:SYSUAF.DAT;" `09/* explicit name if no
  99. V logical is defined */
  100. X
  101. X#define DFLT_EXCLUDE_FILE1 "SYS$DISK:SETPQL_EXCLUDE.DAT;"/* explicit name if
  102. V no logical for SETPQL_EXCLUDE is defined. */
  103. X#define DFLT_EXCLUDE_FILE2 "SYS$LOGIN:SETPQL_EXCLUDE.DAT;"/* second chance f
  104. Vor SETPQL_EXCLUDE file defaults. */
  105. X
  106. X#define NOT_DEFINED -1`09`09`09`09`09/* flag that MasterValues were not assi
  107. Vgned yet */
  108. X#define BYTE sizeof(char)`09`09`09`09/* 1 byte  */
  109. X#define WORD sizeof(short)`09`09`09`09/* 2 bytes */
  110. X#define LONG sizeof(long)`09`09`09`09/* 4 bytes */
  111. X
  112. X/*
  113. X * RMS structure declarations --
  114. X * we will read the SYSUAF file record by record to get
  115. X * the usernames.  These Fabs and Rabs will be for opening the
  116. X * SYSUAF file.
  117. X * We also need to read records from the SETPQL_EXCLUDE file.
  118. X */
  119. X
  120. Xstruct FAB uaffab;`09`09`09/* File Access Block */
  121. Xstruct NAM uafnam;`09`09`09/* Name Block */
  122. Xstruct RAB uafrab;`09`09`09/* Record Access Block */
  123. Xstruct XABKEY uafxabkey;`09`09/* Key XAB */
  124. X
  125. Xstruct FAB excfab;`09`09`09/* File Access Block */
  126. Xstruct NAM excnam;`09`09`09/* Name Block */
  127. Xstruct RAB excrab;`09`09`09/* Record Access Block */
  128. X
  129. X/*
  130. X * structure definitions
  131. X */
  132. X
  133. X
  134. Xstruct UafRecordStruct `7B
  135. X`09char stuff`5BUAF_USERNAME_POS`5D;`09`09/* we don't care about what comes
  136. V before the username */
  137. X`09char username`5BUAF_USERLEN + 1`5D;`09`09/* we just want to read SYSUAF.D
  138. VAT to get the usernames (one for trailing null) */
  139. X`09char otherstuff`5BUAF_RECORDLENGTH - UAF_USERLEN - 1 - UAF_USERNAME_POS`5
  140. VD;
  141. X`09`7D UafRecord;
  142. X
  143. Xstruct ValueStruct `7B`09`09`09`09/* structure definition to contain the act
  144. Vual return values from $GETUAI/$SETUAI */
  145. X`09char  username`5BUAF_USERLEN + 1`5D;`09/*  NOTE: this is *NOT* the MAX_UA
  146. VI_USERLEN, because larger strings in fact WORK!*/
  147. X`09long  uic;`09`09`09`09/* Required for pattern matching on included/exclud
  148. Ved usernames. */
  149. X`09short astlm;`09`09`09`09/* These cannot be put into an array, because the
  150. Vy contain differing */
  151. X`09short biolm;`09`09`09`09/*  datatypes.  These are never examined directly
  152. V, they are only */
  153. X`09long  bytlm;`09`09`09`09/*  declared for storage purposes.  All manipulat
  154. Vion of these quantities */
  155. X`09long  cputim;`09`09`09`09/*  is done via the Address pointers declared be
  156. Vlow. */
  157. X`09long  dfwscnt;
  158. X`09short diolm;
  159. X`09short enqlm;
  160. X`09short fillm;
  161. X`09long  jtquota;
  162. X`09short maxacctjobs;
  163. X`09short maxdetach;
  164. X`09short maxjobs;
  165. X`09long  pbytlm;
  166. X`09long  pgflquota;
  167. X`09short prccnt;
  168. X`09char  pri;
  169. X`09char  quepri;
  170. X`09short shrfillm;
  171. X`09short tqcnt;
  172. X`09long  wsextent;
  173. X`09long  wsquota;
  174. X`09`7D;
  175. X
  176. Xstruct ValueStruct UserValue;`09`09`09/* contains the actual values for each
  177. V user in the SYSUAF file */
  178. Xstruct ValueStruct MasterValue;`09`09`09/* contains the actual master values
  179. V we're using as minimum pql values */
  180. X
  181. X$DESCRIPTOR( Master_d, MasterValue.username );
  182. X$DESCRIPTOR( User_d,   UserValue.username );
  183. X
  184. X
  185. Xunion Addr `7B`09`09`09`09`09/* pointers to the locations of the actual data
  186. V.  NOTE that we may not */
  187. X   struct `7B`09`09`09`09`09/*  initialize these addresses on the declaratio
  188. Vn line! */
  189. X`09char *pusername;`09`09`09/* We need this level of indirection because the
  190. V sizes of the various */
  191. X`09long *ptr`5BMAX_PARAMS`5D;`09`09`09/*  items we are storing are different
  192. V, and therefore need different */
  193. X`09`7D plong;`09`09`09`09/*  types of pointers. */
  194. X   struct `7B`09`09`09`09`09/* All of the manipulation, examination, etc., o
  195. Vf any PQL values is done via this */
  196. X`09char *pusername;`09`09`09/*  level of indirection so that we may do it vi
  197. Va DO-LOOPS rather than explicitly */
  198. X`09char *ptr`5BMAX_PARAMS`5D;`09`09`09/*  value by value. */
  199. X`09`7D pbyte;
  200. X   struct `7B
  201. X`09char *pusername;
  202. X`09short *ptr`5BMAX_PARAMS`5D;
  203. X`09`7D pword;
  204. X   `7D;
  205. X
  206. Xunion Addr UserAddress; `09`09`09/* contains pointers to values for each use
  207. Vr in the SYSUAF file */
  208. Xunion Addr MasterAddress; `09`09`09/* for the master values we're using as m
  209. Vinimum pql values */
  210. X
  211. X
  212. X
  213. Xstruct InfoStruct `7B`09`09`09`09/* auxillary info */
  214. X`09char text`5B12`5D;`09`09`09`09/* descriptive text string, e.g., 'astlm' *
  215. V/
  216. X`09short itmcod;`09`09`09`09/* UAI$_xxx item code for system service calls *
  217. V/
  218. X`09short buflen;`09`09`09`09/* length of return buffer for each item */
  219. X`09short on_cmdline;`09`09`09/* some $GETUAI/$SETUAI parameters are not qual
  220. Vifiers on the command line!! */
  221. X`09short shallwe;`09`09`09`09/* from command line: actually test/set/modify
  222. V this item? Some are ignorable. */
  223. X`09long  cmdval;`09`09`09`09/* value from the command line, if specified */
  224. X`09short cpu_special;`09`09`09/* special processing for CPUTIME qualifier, w
  225. Vhich is deltatime!! */
  226. X`09`7D;
  227. X
  228. X/*
  229. X * The Info structure is populated with:
  230. X *  text = description of which parameter is being considered,
  231. X *  itmcod = UAI$_xxx parameter for this parameter,
  232. X *  buflen = size of this parameter as declared in the Value structure,
  233. X *  shallwe = FALSE, assume that we will ignore this value until the command
  234. V line proves otherwise,
  235. X *  cmdval  = NOT_DEFINED, define this only if we determine that there was a
  236. Vn actual value entered on the command line,
  237. X *  cpu_special = FALSE except for the CPUTIME item, which needs special pro
  238. Vcessing on quadwords and the like.
  239. X */
  240. Xstruct InfoStruct Info`5BMAX_PARAMS`5D = `7B
  241. X
  242. X/***************************************************************************
  243. V**********************************************
  244. X/*
  245. V                                                                         `20
  246. V      on_cmdline                             *
  247. X/*
  248. V                                                                         `20
  249. V      `7C      shallwe                         *
  250. X/*                 text          itmcod            buflen
  251. V                         `7C      `7C      cmdval       cpu_special *
  252. X/***************************************************************************
  253. V**********************************************/
  254. X`09`09`7B "uic",`09 UAI$_UIC,`09   sizeof(UserValue.uic),`09  FALSE, FALSE,
  255. V NOT_DEFINED, FALSE `7D,
  256. X`09`09`7B "astlm", `09 UAI$_ASTLM, `09   sizeof(UserValue.astlm),       TRUE
  257. V,  FALSE, NOT_DEFINED, FALSE `7D,
  258. X`09`09`7B "biolm", `09 UAI$_BIOLM, `09   sizeof(UserValue.biolm),       TRUE
  259. V,  FALSE, NOT_DEFINED, FALSE `7D,
  260. X`09`09`7B "bytlm", `09 UAI$_BYTLM, `09   sizeof(UserValue.bytlm),       TRUE
  261. V,  FALSE, NOT_DEFINED, FALSE `7D,
  262. X`09`09`7B "cputim", `09 UAI$_CPUTIM, `09   sizeof(UserValue.cputim),      TR
  263. VUE,  FALSE, NOT_DEFINED, TRUE  `7D,
  264. X`09`09`7B "dfwscnt", `09 UAI$_DFWSCNT, `09   sizeof(UserValue.dfwscnt),
  265. V     TRUE,  FALSE, NOT_DEFINED, FALSE `7D,
  266. X`09`09`7B "diolm", `09 UAI$_DIOLM, `09   sizeof(UserValue.diolm),       TRUE
  267. V,  FALSE, NOT_DEFINED, FALSE `7D,
  268. X`09`09`7B "enqlm", `09 UAI$_ENQLM, `09   sizeof(UserValue.enqlm),       TRUE
  269. V,  FALSE, NOT_DEFINED, FALSE `7D,
  270. X`09`09`7B "fillm", `09 UAI$_FILLM, `09   sizeof(UserValue.fillm),       TRUE
  271. V,  FALSE, NOT_DEFINED, FALSE `7D,
  272. X`09`09`7B "jtquota", `09 UAI$_JTQUOTA, `09   sizeof(UserValue.jtquota),
  273. V     TRUE,  FALSE, NOT_DEFINED, FALSE `7D,
  274. X`09`09`7B "maxacctjobs", UAI$_MAXACCTJOBS, sizeof(UserValue.maxacctjobs), TR
  275. VUE,  FALSE, NOT_DEFINED, FALSE `7D,
  276. X`09`09`7B "maxdetach", `09 UAI$_MAXDETACH,   sizeof(UserValue.maxdetach),
  277. V   TRUE,  FALSE, NOT_DEFINED, FALSE `7D,
  278. X`09`09`7B "maxjobs", `09 UAI$_MAXJOBS, `09   sizeof(UserValue.maxjobs),
  279. V     TRUE,  FALSE, NOT_DEFINED, FALSE `7D,
  280. X`09`09`7B "pbytlm", `09 UAI$_PBYTLM, `09   sizeof(UserValue.pbytlm),      TR
  281. VUE,  FALSE, NOT_DEFINED, FALSE `7D,
  282. X`09`09`7B "pgflquota", `09 UAI$_PGFLQUOTA,   sizeof(UserValue.pgflquota),
  283. V   TRUE,  FALSE, NOT_DEFINED, FALSE `7D,
  284. X`09`09`7B "prccnt", `09 UAI$_PRCCNT, `09   sizeof(UserValue.prccnt),      TR
  285. VUE,  FALSE, NOT_DEFINED, FALSE `7D,
  286. X`09`09`7B "pri", `09 UAI$_PRI, `09   sizeof(UserValue.pri),         TRUE,  F
  287. VALSE, NOT_DEFINED, FALSE `7D,
  288. X`09`09`7B "quepri", `09 UAI$_QUEPRI, `09   sizeof(UserValue.quepri),      TR
  289. VUE,  FALSE, NOT_DEFINED, FALSE `7D,
  290. X`09`09`7B "shrfillm", `09 UAI$_SHRFILLM,    sizeof(UserValue.shrfillm),    T
  291. VRUE,  FALSE, NOT_DEFINED, FALSE `7D,
  292. X`09`09`7B "tqcnt", `09 UAI$_TQCNT, `09   sizeof(UserValue.tqcnt),       TRUE
  293. V,  FALSE, NOT_DEFINED, FALSE `7D,
  294. X`09`09`7B "wsextent", `09 UAI$_WSEXTENT,    sizeof(UserValue.wsextent),    T
  295. VRUE,  FALSE, NOT_DEFINED, FALSE `7D,
  296. X`09`09`7B "wsquota", `09 UAI$_WSQUOTA, `09   sizeof(UserValue.wsquota),
  297. V     TRUE,  FALSE, NOT_DEFINED, FALSE `7D
  298. X`09`7D;
  299. X
  300. Xstruct OneItemStruct `7B`09`09/* item list information for system service ca
  301. Vlls, type item_list_3 for $GETUAI/$SETUAI */
  302. X`09short buflen;`09`09/* length of buffer whence read/write during system se
  303. Vrvice */
  304. X`09short itmcod;`09`09/* UAI$ item code */
  305. X`09char *bufadr;`09`09/* address whence read/write during system service */
  306. X`09long *retlen;`09`09/* address of byte count read/written during system se
  307. Vrvice -- who cares?! */
  308. X`09`7D;
  309. X
  310. Xstruct ItemListStruct`7B
  311. X`09struct OneItemStruct item`5BMAX_PARAMS`5D;
  312. X`09long terminator;`09/* must be set to zero!! */
  313. X`09`7D;
  314. X
  315. Xstruct ItemListStruct ItemList;`09`09/* This is the one we will be using for
  316. V our $GETUAI/$SETUAI calls. */
  317. X`09`09`09`09`09/* We will use the same structure both for the call for the D
  318. VEFAULT account to */
  319. X`09`09`09`09`09/*  get the Master values, and for the loops through the user
  320. Vnames.  Therefore */
  321. X`09`09`09`09`09/*  we will not initialize this structure yet, do it dynamica
  322. Vlly during execution. */
  323. X
  324. X
  325. X
  326. Xstruct TimeStruct `7B`09`09`09/* Structure for converting quadwords/longword
  327. Vs to timestrings */
  328. X`09unsigned short year;`09`09/* User enters a $DELTATIME; we must convert to
  329. V a longword for $GETUAI/$SETUAI. */
  330. X`09unsigned short month;`09`09/*  The longword represents 10-microsecond uni
  331. Vts.  System service calls can */
  332. X`09unsigned short day;`09`09/*  convert to quadword values (a negative 64-bi
  333. Vt integer in units of 100 nanoseconds) */
  334. X`09unsigned short hour;`09`09/*  and then use LIB$EMUL/LIB$EDIV to convert t
  335. Vo a positive longword in our */
  336. X`09unsigned short minute;`09`09/*  $GETUAI/$SETUAI units.  However, for erro
  337. Vr messages and the like, we will need */
  338. X`09unsigned short second;`09`09/*  to be able to convert back and get the pi
  339. Veces contained within this structure. */
  340. X`09unsigned short hundredth;
  341. X`09`7D;
  342. X
  343. Xstruct TimeStruct timbuf;`09`09/* Store the time pieces for error messages,
  344. V etc. */
  345. X
  346. Xstruct LinkedListStruct `7B`09`09/* Structure for containing the lists of ex
  347. Vcluded and included usernames/uics */
  348. X`09struct LinkedListStruct *pfwd;`09/* Forwards pointer */
  349. X`09struct LinkedListStruct *pbwd;`09/* Backwards pointer */
  350. X`09short len;`09`09`09/* Length of text string */
  351. X`09char  *item;`09`09`09/* Actual string of `5Bwildcarded`5D username or uic
  352. V */
  353. X`09`7D;
  354. X
  355. X
  356. Xstruct LinkedListStruct *ExcludeUser_Root = NULL;`09/* Base address of Exclu
  357. Vded Username list */
  358. +-+-+-+-+-+-+-+-  END  OF PART 2 +-+-+-+-+-+-+-+-
  359.