Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!uwmcsd1!ig!agate!ucbvax!ISUMVS.BITNET!GG.SPY From: GG.SPY@ISUMVS.BITNET ("John Hascall") Newsgroups: comp.os.vms Subject: Re: How to find the next available UIC Message-ID: <8807040702.AA15775@ucbvax.Berkeley.EDU> Date: 30 Jun 88 16:50:12 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 93 > Date: Fri, 29 Apr 88 14:17:00 N > Sender: INFO-VAX Discussion > From: ARJAN%HROEUR51.BITNET@CUNYVM.CUNY.EDU > Subject: How to find the next available UIC > To: John Hascall > > Whenever we want to add new users to sysuaf.dat, we try to find > the next uic available for this new user. (For accounting reasons > we do NOT use any uic that has been used before). The only way I > could think of was to scan sysuaf.dat completely, using $IDTOASC > in a wildcard operation, translate the usernames back to individual > UIC's with $ASCTOID, then examining the group and member value, thus > finding the highest member value of the specified group. > But this takes about THIRTY times as much cpu time as does AUTHORIZE > with a SHOW [XXXX,*]/BRIEF > > Does anybody know which calls authorize might be using ? > > ARJAN@HROEUR51.BITNET > ------- I do a very similar thing (except that I will re-use UICs). What I do is scan RIGHTSLIST by opening it for keyed access and repeatedly call SYS$GET with successively larger key-values (I can stop as soon as I get RMS$_RNF--you will need to look at all 64K possible members I guess). Here are some fragments, hope they are some help: .psect CODE,RD,NOWRT,EXE ; ; stat = open_right(context) ; : : $FAB_STORE FAB=FFU_$S_FAB(R11) - DNA=@RIGHTSFDEF+4,- DNS=RIGHTSFDEF,- FAC=,- FNA=@RIGHTSFNAM+4,- FNS=RIGHTSFNAM,- ORG=,- SHR=,- XAB=FFU_$S_KEY0(R11) : $RAB_STORE RAB=FFU_$S_RAB(R11),- FAB=FFU_$S_FAB(R11),- RAC=,- UBF=FFU_$S_RECORD(R11),- USZ=#64 : ; ; member = find_free_uic(context,min_group,max_group,flags) ; .entry FIND_FREE_UIC,M SUBL2 #4,SP MOVL SP,R10 MOVL 4(AP),R11 $RAB_STORE RAB=FFU_$S_RAB(R11),- KBF=(R10),- KSZ=#4,- KRF=#0,- ROP= MOVZWL 8(AP),R2 ; R2 is (current) group CLRLR 3 ; R3 is (attempted) member MOVL 12(AP),R4 ; R4 is max member MOVL 16(AP),R5 ; R5 is flags BBC #3,R5,5$ ; do not start at member 0? INCL R3 ; then start at member 1 5$: MOVL R3,(R10) INSV R2,#16,#14,(R10) PUSHAL FFU_$S_RAB(R11) CALLS #1,gSYS$GET BLBC R0,10$ BBS #0,R5,7$ ; always start a new group? INCL R3 CMPL R3,#65535 BLEQ 5$ 7$: INCL R2 CMPL R2,R4 BLEQ 5$ MNEGL #2,R0 ; ran out of allowable uic's RET 10$: CMPL R0,#RMS$_RNF BNEQ 99$ MOVL (R10),R0 ; first member not found RET 99$: MNEGL #1,R0 ; error RET ------ John Hascall ISU Comp Center