! ----- LOCATE_ALL_HELD_IDENTS.FUN ----- ! ! ----- SUBROUTINE TO LOCATE ALL HELD IDENTIFIERS BY A USER ----- ! ----- ON A SPECIFIC NODE ----- ! ! ---------- PASSED: ---------- ! ! ----- USER_NAME = Username to search for ----- ! ! ----- I_O_CHNL = Rightslist I/O channel to search ----- ! ! ---------- RETURNED: ---------- ! ! ----- HELD_IDENTS_CTR = Count of held identifiers ! ! ----- HELD_IDENTS(1->HELD_IDENTS_CTR) = List of Held ! ----- identifier values ! ! ----- HELD_IDENTS_STR(1->HELD_IDENTS_CTR) = List of Held ! ----- identifier names ! ! ----- Last Change 07/07/93 by Brian Lomasky ----- ! SUB LOCATE_ALL_HELD_IDENTS(WORD I_O_CHNL) %INCLUDE "NUSER.INC" DECLARE WORD ERR_FLAG ! TRUE=DONE SEARCHING RIGHTSLIST DECLARE LONG HELD_IDENT_INDEX ! HELD IDENTIFIER ARRAY INDEX DECLARE LONG TEMP_LONG ! TEMPORARY LONGWORD VARIABLE DECLARE STRING TEMP_STRING ! TEMPORARY STRING EXTERNAL WORD FUNCTION SEARCH_RIGHTSLIST(WORD, WORD, & WORD) ! READ MATCHING RIGHTSLIST REC MAP (LOCHELDMAP) STRING SEARCH_HOLDER_STRING = 8% HELD_IDENTS_CTR = 0% ! ASSUME NO HELD IDENTIFIERS TEMP_STRING = TRM$(USER_NAME) ! ----- SEARCH SPECIFIED RIGHTSLIST.DAT FILE BY ITS ----- ! ----- ALTERNATE KEY #2 TO CHECK FOR A VALID USERNAME ----- KGB_NAME = TEMP_STRING ! STORE USERNAME TO SEARCH FOR EXIT SUB IF NOT SEARCH_RIGHTSLIST(I_O_CHNL, 2%, FALSE) ! ----- ERROR IF NOT IN UIC FORMAT ----- IF KGB_IDENTIFIER < 0% OR KGB_HOLDER(0%) <> 0% THEN ! ----- PRINT ERROR IF IDENTIFIER IS NOT A ----- ! ----- USERNAME ----- PRINT PRINT "Error - " + TEMP_STRING + & " is not a username - it's an identifier" + BEL PRINT EXIT SUB END IF ! ----- SAVE THIS USER'S UIC AND USE AS THE SEARCH KEY ----- KGB_HOLDER(0%) = KGB_IDENTIFIER KGB_HOLDER(1%) = 0% ! ----- SAVE IN TEMP STRING ----- SEARCH_HOLDER_STRING = KGB_HOLDER_STRING ! ----- LOCATE FIRST HOLDER RECORD FOR THIS IDENTIFER ----- ! ----- RECORD ----- ERR_FLAG = FALSE ! INIT END-OF-FILE FLAG WHEN ERROR IN GET #I_O_CHNL, KEY #1% GE & SEARCH_HOLDER_STRING, REGARDLESS USE IF ERR = BUCKET_LOCKED THEN SLEEP 1% RETRY END IF EXIT HANDLER IF ERR <> END_OF_FILE AND & ERR <> REC_NOT_FOUND ERR_FLAG = TRUE ! SET END-OF-FILE FLAG CONTINUE ! AND CONTINUE AFTER HANDLER END WHEN ! ----- FIND ALL HELD IDENTIFIERS FOR THIS HOLDER UIC ----- WHILE NOT ERR_FLAG ! UNTIL END-OF-FILE REACHED: ! ----- DONE IF HOLDER UIC DOES NOT MATCH ----- IF SEARCH_HOLDER_STRING <> KGB_HOLDER_STRING THEN ERR_FLAG = TRUE ! SET END-OF-FILE FLAG ITERATE ! EXIT LOOP END IF ! ----- WE FOUND A HELD IDENTIFIER RECORD ----- ! ----- INCR COUNT OF HELD IDENTIFIERS ----- HELD_IDENTS_CTR = HELD_IDENTS_CTR + 1% ! ----- STORE HELD IDENTIFIER VALUE ----- HELD_IDENTS(HELD_IDENTS_CTR) = KGB_IDENTIFIER ! ----- READ NEXT HOLDER RECORD ----- WHEN ERROR IN GET #I_O_CHNL, REGARDLESS USE IF ERR = BUCKET_LOCKED THEN SLEEP 1% RETRY END IF EXIT HANDLER IF ERR <> END_OF_FILE AND & ERR <> REC_NOT_FOUND ERR_FLAG = TRUE ! SET END-OF-FILE FLAG CONTINUE ! AND CONTINUE AFTER HANDLER END WHEN NEXT ! ----- NOW GO LOOKUP EACH OF THE HELD IDENTIFIER ----- ! ----- DESCRIPTIONS ----- HELD_IDENT_INDEX = 0% WHILE HELD_IDENT_INDEX < HELD_IDENTS_CTR HELD_IDENT_INDEX = HELD_IDENT_INDEX + 1% KGB_IDENTIFIER = HELD_IDENTS(HELD_IDENT_INDEX) ! ----- LOOKUP IDENTIFIER NAME ON DESIRED NODE ----- IF NOT SEARCH_RIGHTSLIST(I_O_CHNL, 0%, FALSE) THEN ! ----- REMOVE THIS BAD IDENTIFIER FROM ----- ! ----- MEMORY LIST ----- TEMP_LONG = HELD_IDENT_INDEX WHILE TEMP_LONG < HELD_IDENTS_CTR HELD_IDENTS(TEMP_LONG) = & HELD_IDENTS(TEMP_LONG + 1%) HELD_IDENTS_STR(TEMP_LONG) = & HELD_IDENTS_STR(TEMP_LONG + 1%) TEMP_LONG = TEMP_LONG + 1% NEXT HELD_IDENTS_CTR = HELD_IDENTS_CTR - 1% HELD_IDENT_INDEX = HELD_IDENT_INDEX - 1% ITERATE END IF ! ----- STORE HELD IDENTIFIER STRING ----- HELD_IDENTS_STR(HELD_IDENT_INDEX) = KGB_NAME NEXT END SUB