! ----- CHANGE_USER_PASSWORD.FUN ----- ! ! ----- SUBROUTINE TO CHANGE THE PASSWORD FOR ENTERED_USERNAME ----- ! ----- ON ALL DUPLICATE NODES (IF ONLY_ON_LOCAL_NODE IS FALSE), ----- ! ----- OTHERWISE CHANGE THE PASSWORD ONLY ON THE LOCAL NODE ----- ! ! ---------- PASSED: ---------- ! ! ----- ENTERED_USERNAME = Username to change password for ! ----- (Password will BE the username) ! ! ----- ONLY_ON_LOCAL_NODE = TRUE to change the password only on ! ----- the local node (rather than all ! ----- duplicate nodes) ! ! ----- DEFAULT_MINIMUM_PASSWORD_LEN = Original Minimum Password ! ----- Length for this username ! ! ----- Last Change 03/02/94 by Brian Lomasky ----- ! SUB CHANGE_USER_PASSWORD(WORD ONLY_ON_LOCAL_NODE) %INCLUDE "NUSER.INC" EXTERNAL LONG CONSTANT SS$_PWDNOTDIF ! PASSWORD NOT DIFFERENT %INCLUDE "$RMSDEF" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET.TLB" %INCLUDE "$UAIDEF" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET.TLB" RECORD UAIBUF ! $SETUAI RECORD VARIANT CASE WORD BUFFER_LENGTH WORD ITEM_CODE LONG BUFFER_ADDRESS LONG RETURN_LENGTH_ADDRESS CASE LONG LIST_TERMINATOR END VARIANT END RECORD UAIBUF DECLARE STRING A_NODE ! NODE TO CHANGE PASSWORD ON DECLARE WORD ACTUAL_I_O_CHNL ! ACTUAL SYSUAF I/O CHANNEL USED DECLARE STRING DEFAULT_NODE ! NULL FOR DEFAULT NODE DECLARE WORD FOUND_LOCAL_NODE ! TRUE IF LOCAL NODE NAME FOUND DECLARE WORD I_O_CHNL_SYSUAF ! SYSUAF ARRAY INDEX TO ACCESS DECLARE LONG LOCAL_STATUS ! SYSTEM SERVICE EXIT STATUS DECLARE LONG MINPWDLEN_LEN ! LENGTH OF MINIMUM_PASSWORD_LEN DECLARE WORD NODE_INDEX ! INDEX OF DUPLICATE NODES DECLARE LONG PASSWORD_LEN ! LENGTH OF UAI_PASSWORD DECLARE WORD RECORD_FOUND ! TRUE IF MATCHING RECORD FOUND DIM LONG SAVED_DATE_OF_PASSWORD_CHANGE(1%) ! SAVED PWD CHG DATE DECLARE STRING TEMP_STRING ! TEMPORARY STRING DIM UAIBUF UAIITEM(2%) ! EQUATE $SETUAI RECORD ! ----- MAPPED VARIABLES FOR $SETUAI SYSTEM SERVICE ----- MAP (CHUPWM) STRING UAI_PASSWORD = 32% EXTERNAL WORD FUNCTION CALC_DUPL_NODES( & STRING) ! RETURN LIST OF DUPL NODES EXTERNAL LONG FUNCTION & SYS$SETUAI ! SET UAF INFORMATION ! ----- STORE MINIMUM PASSWORD LENGTH ----- MINIMUM_PASSWORD_LENGTH = 1% ! STORE VALUE OF 1 SO NO ERROR UAIITEM(0%)::BUFFER_LENGTH = 1% UAIITEM(0%)::ITEM_CODE = UAI$_PWD_LENGTH UAIITEM(0%)::BUFFER_ADDRESS = LOC(MINIMUM_PASSWORD_LENGTH) UAIITEM(0%)::RETURN_LENGTH_ADDRESS = LOC(MINPWDLEN_LEN) ! ----- STORE NEW PASSWORD ----- UAI_PASSWORD = ENTERED_USERNAME ! STORE USERNAME AS PASSWORD UAIITEM(1%)::BUFFER_LENGTH = LEN(TRM$(ENTERED_USERNAME)) UAIITEM(1%)::ITEM_CODE = UAI$_PASSWORD UAIITEM(1%)::BUFFER_ADDRESS = LOC(UAI_PASSWORD) UAIITEM(1%)::RETURN_LENGTH_ADDRESS = LOC(PASSWORD_LEN) UAIITEM(2%)::LIST_TERMINATOR=0% ! STORE ITEM LIST TERMINATOR IF DEBUG_MODE THEN IF ONLY_ON_LOCAL_NODE THEN PRINT "DEBUG>CHANGE_USER_PASSWORD:" + & " Only on Local Node" ELSE PRINT "DEBUG>CHANGE_USER_PASSWORD:" + & " On all Duplicate Node(s)" END IF END IF ! ----- CALCULATE LIST OF DUPLICATE NODES TO CHANGE THE ----- ! ----- PASSWORD ON ----- DEFAULT_NODE = "" ! STORE NULL FOR DEFAULT NODE EXIT SUB IF CALC_DUPL_NODES(DEFAULT_NODE) ! ----- FOR EACH DUPLICATE NODE TO BE ACCESSED: ----- PRINT FOUND_LOCAL_NODE = FALSE ! ASSUME LOCAL NODE NOT FOUND NODE_INDEX = 0% WHILE NODE_INDEX < NODES_IN_MEMORY NODE_INDEX = NODE_INDEX + 1% A_NODE = NODE_LISTS(NODE_INDEX) ! ----- SEE IF ONLY LOCAL NODE TO BE CHANGED ----- ITERATE IF ONLY_ON_LOCAL_NODE AND NODE_INDEX <> 1% ! ----- FOR EACH POSSIBLE NODE: ----- I_O_CHNL_SYSUAF = 0% ! ----- FOR EACH OPEN FILE: ----- WHILE I_O_CHNL_SYSUAF < SYSUAF_COUNTER I_O_CHNL_SYSUAF = I_O_CHNL_SYSUAF + 1% ! ----- SKIP IF SYSUAF IS UNAVAILABLE ----- ITERATE IF TRM$(SYSUAF_SPECS( & I_O_CHNL_SYSUAF)) = "" ! ----- SKIP IF UNDESIRED NODE ----- ITERATE IF A_NODE <> & TRM$(SYSUAF_NODES(I_O_CHNL_SYSUAF)) IF DEBUG_MODE THEN PRINT "DEBUG>Check node " + & TRM$(SYSUAF_NODES( & I_O_CHNL_SYSUAF)) END IF ACTUAL_I_O_CHNL = I_O_CHNL_SYSUAF + 49% ! ----- SEE IF CHANGING LOCAL NODE'S ----- ! ----- SYSUAF ----- IF NODE_INDEX = 1% THEN ! ----- UPDATE THIS USER'S LOCAL ----- ! ----- SYSUAF INFO ----- TEMP_STRING = TRM$(ENTERED_USERNAME) LOCAL_STATUS = SYS$SETUAI( & , ! NULL & , ! NULL & TEMP_STRING, & ! USERNAME TO MODIFY & UAIITEM() BY & REF, ! ITEM LIST & , ! NULL & , ! NULL & ) ! NULL SELECT LOCAL_STATUS CASE RMS$_RNF PRINT PRINT "Someone just" + & " deleted the" +& " record for " +& TRM$(ENTERED_USERNAME) & + " on " + & TRM$(SYSUAF_NODES( & I_O_CHNL_SYSUAF)) + BEL PRINT " The password" +& " has not" + & " been changed!" + BEL ITERATE CASE SS$_PWDNOTDIF ! ----- PASSWORD ALREADY ----- ! ----- WAS SET TO THE ----- ! ----- USERNAME ----- CASE <> SS$_NORMAL PRINT "CHANGE_USER_PASSWORD:" & + " Unexpected" + & " SYS$SETUAI error" + & " on " + & TRM$(SYSUAF_NODES( & I_O_CHNL_SYSUAF)) + BEL CALL LIB$STOP(LOCAL_STATUS & BY VALUE) END SELECT ! ----- GO BACK INTO THIS SYSUAF ----- ! ----- ENTRY AND CHANGE THE ----- ! ----- PASSWORD TO PRE-EXPIRED ----- ! ----- AND THE MINIMUM PASSWORD ----- ! ----- LENGTH BACK TO ITS ----- ! ----- ORIGINAL VALUE ----- RECORD_FOUND = TRUE WHEN ERROR IN GET #ACTUAL_I_O_CHNL, & KEY #0% EQ USER_NAME USE IF ERR = BUCKET_LOCKED THEN SLEEP 1% RETRY END IF IF ERR = REC_NOT_FOUND THEN RECORD_FOUND = FALSE CONTINUE END IF EXIT HANDLER END WHEN IF NOT RECORD_FOUND THEN PRINT PRINT "Someone just " + & "deleted the" + & " record for " & + TRM$( & ENTERED_USERNAME& ) + " on " + & TRM$( & SYSUAF_NODES( & I_O_CHNL_SYSUAF)) + BEL ITERATE END IF ! ----- (PRE-EXPIRED PASSWORD ONLY ----- ! ----- TAKES EFFECT IF PASSWORD ----- ! ----- LIFETIME IS NON-ZERO) ----- IF PASSWORD_LIFETIME(0%) = 0% & AND PASSWORD_LIFETIME(1%) = 0% THEN PRINT PRINT "Since this user" & + " has no" + & " password" + & " lifetime," + & " the password" & + " has not" + & " been pre-expired." PRINT ELSE ! ----- SET PRE-EXPIRED ----- ! ----- FLAG ----- DATE_OF_PASSWORD_CHANGE(0%) & = -1% DATE_OF_PASSWORD_CHANGE(1%) & = -1% END IF ! ----- RESTORE THE ORIGINAL ----- ! ----- MINIMUM PASSWORD LENGTH ----- MINIMUM_PASSWORD_LENGTH = & DEFAULT_MINIMUM_PASSWORD_LEN UPDATE #ACTUAL_I_O_CHNL UNLOCK #ACTUAL_I_O_CHNL ! ----- SAVE PASSWORD-RELATED DATA ----- ! ----- TO BE TRANSFERRED TO ----- ! ----- DUPLICATE NODES ----- FOUND_LOCAL_NODE = TRUE SAVED_PASSWORD = PASSWORD SAVED_RANDOM_PASSWORD_SEED = & RANDOM_PASSWORD_SEED SAVED_ENCRYPTION_ALGORITHM = & ENCRYPTION_ALGORITHM SAVED_DATE_OF_PASSWORD_CHANGE(0%) = & DATE_OF_PASSWORD_CHANGE(0%) SAVED_DATE_OF_PASSWORD_CHANGE(1%) = & DATE_OF_PASSWORD_CHANGE(1%) ELSE ! ----- UPDATE TRANSFERRED ITEMS ----- ! ----- ON THIS DUPLICATE NODE ----- IF NOT FOUND_LOCAL_NODE THEN PRINT PRINT "Error - Skipping node " & + TRM$(SYSUAF_NODES( & I_O_CHNL_SYSUAF)) + & " since the local" + & " node was not" + & " found" + BEL ITERATE END IF RECORD_FOUND = TRUE WHEN ERROR IN GET #ACTUAL_I_O_CHNL, & KEY #0% EQ USER_NAME USE IF ERR = BUCKET_LOCKED THEN SLEEP 1% RETRY END IF IF ERR = REC_NOT_FOUND THEN RECORD_FOUND = FALSE CONTINUE END IF EXIT HANDLER END WHEN IF NOT RECORD_FOUND THEN PRINT PRINT "Someone just " + & "deleted the" + & " record for " & + TRM$( & ENTERED_USERNAME& ) + " on " + & TRM$( & SYSUAF_NODES( & I_O_CHNL_SYSUAF)) + BEL ITERATE END IF ! ----- STORE THE COPIED ----- ! ----- PASSWORD-RELATED DATA ----- ! ----- FROM THE LOCAL NODE ----- PASSWORD = SAVED_PASSWORD RANDOM_PASSWORD_SEED = & SAVED_RANDOM_PASSWORD_SEED ENCRYPTION_ALGORITHM = & SAVED_ENCRYPTION_ALGORITHM DATE_OF_PASSWORD_CHANGE(0%) = & SAVED_DATE_OF_PASSWORD_CHANGE( & 0%) DATE_OF_PASSWORD_CHANGE(1%) = & SAVED_DATE_OF_PASSWORD_CHANGE( & 1%) ! ----- CLEAR THE PWD_EXPIRED BIT ----- FLAGS(1%) = FLAGS(1%) AND NOT 2% UPDATE #ACTUAL_I_O_CHNL UNLOCK #ACTUAL_I_O_CHNL END IF PRINT "The password for " + & TRM$(ENTERED_USERNAME) + & " has been changed to " + & TRM$(ENTERED_USERNAME) + & " on " + TRM$(SYSUAF_NODES( & I_O_CHNL_SYSUAF)) + "..." NEXT NEXT END SUB