Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
The simplest way is:
$ SET PASSWORD
oldpassword
newpassword
newpasswordBut You certainly don't want to put passwords in a file.
What is the purpose of Your question ?
If it is just to call SET PASSWORD out of some (menu-)command-file, then first do a noecho read from the terminal of the old andf new password, then put that into a temporary file with the above SET PASSWORD command:$set terminal/noecho
$read/error=done/end=done/prompt="Old PW" sys$command oldpw
$read/error=done/end=done/prompt="New PW" sys$command newpw
$open/write t sys$scratch:xxxyyy.tmp
$ write t "$SET PASSWORD"
$ write t oldpw
$ write t newpw
$ write t newpw
$ write t "$ EXIT"
$ close t
$ set noon
$@sys$scratch:xxxyyy.tmp
$ delete sys$scratch:xxxyyy.tmp;
$DONE:
$ set terminal/echo(The above probably doesn't catch all error-cases).
Now if the purpose is to unconditionally (re)set the password of another user (in a help-desk script ?), then it is simply a one liner:
$ MCR AUTHORIZE modify 'user' /password='password'where the two symbols user and password have been defined before.

Joseph,
With all due respect, the command file leaves the data from its execution on the disk. If this must be done, I strongly suggest the use of DELETE/ERASE to erase the blocks BEFORE the space is returned to the free space.
- Bob Gezelter, http://www.rlgsc.com

You mean replace in my quick hack example:
delete sys$scratch:xxxyyy.tmp;
by
delete/erase sys$scratch:xxxyyy.tmp;There are other (error-)situations to catch, and with recent (>=6.2) VMS, PIPE can be used to avoid temporary files at all (the posters OS is apparently windows, so I don't know the VMS version :-).
Anyway I never used and do not recommand to set passwords out of a command file, and the few lines just demonstrate the principle how to solve the question asked.
Joseph Huber, http://www.huber-joseph.de

Could someone help me? I'm not a real programmer, but I can understand the code above. Could I add a few lines of code after this line...
$read/error=done/end=done/prompt="New PW" sys$command newpw
...to force alpha-numeric passwords and refuse alpha-only and numeric-only passwords? Something like:
$ pw_num=f$extract(something)
$ if pw_num .nes. "" then goto pw_cont_a
$ WRITE SYS$OUTPUT "password must contain at least one number"
$ goto set_pass
$pw_cont_a:
$ pw_alp=f$extract(something)
$ if pw_alp .nes. "" then goto pw_cont
$ WRITE SYS$OUTPUT "password must contain at least one letter"
$ goto set_pass
$pw_cont:Am I on the right track or out in left field? Thanks for any info...

You can't test for something with a single f$extract, but in a loop, best written as a subroutine.
Example for testing if a string contains a number:$TESTNUM: SUBROUTINE
$ x=p1
$ L=f$length(x) - 1
$ num="0123456789"
$ n=0
$loop:
$ t=f$extract(L,1,x)
$ isnum=F$locate(t,num)
$ if isnum.lt.f$length(num) then n=n + 1
$ L = L - 1
$ if L.ge.0 then goto loop
$ if n.eq.0
$ then write sys$output x," contains no numbers."
$ else write sys$output x," contains ",n," numbers."
$ 'p2'==n
$ EXIT
$ ENDSUBROUTINE !End of subroutine testnum
$!
$ CALL TESTNUM "abc123def" N
$ write sys$output "testnum returned N=",NA similar subroutine for testing if it contains alpha or special characters like "_$" is left as an exercise to You.
Joseph Huber, http://www.huber-joseph.de
ITRC

And BTW, why do this in a procedure using DCL input, why not just do a SET PASSWORD ?
Together with a "password policy" module, which does all this checks ?
See the discussion in
http://forums11.itrc.hp.com/service...which has pointers to a password policy module doing exactly that.
A password policy module works also for users doing a "SET PASSWORD" directly from the command-line, not only from Your command-file.
Joseph Huber, http://www.huber-joseph.de
ITRC

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |