Previous Thread
Next Thread
Print Thread
Programmatically update ATE username/password #37388 13 Jun 24 02:48 PM
Joined: Aug 2016
Posts: 371
J
John Andreasen Offline OP
Member
OP Offline
Member
J
Joined: Aug 2016
Posts: 371
Hi,

Is there was a way to update the ATE username and password programmatically? I know this should be possible through changing the registry entries in HKCU\SOFTWARE\MicroSabio\JBCT\ATE\Hosts\, but was not sure if there was a simpler way. If not, is it possible to calculate the password value for the LoginPassword there?

Thanks,
John Andreasen
Diversified Data Software

Re: Programmatically update ATE username/password [Re: John Andreasen] #37389 13 Jun 24 06:04 PM
Joined: Jun 2001
Posts: 11,794
J
Jack McGregor Offline
Member
Offline
Member
J
Joined: Jun 2001
Posts: 11,794
Hi John -

I think the SOSLIB module ATEREG.SBX can do this for you. The only complication is that you'll want to encrypt the password before updating it.
The sample program ATEREGTST.BP illustrates it below...
Code
MAP1 PASSWORD$,S,24
MAP1 CRYPT$,S,70        ! [101] was 24
MAP1 STATUS,F
MAP1 LOGIN$,S,40        ! [101]
MAP1 OP,B,1             ! [101]
MAP1 ITEM$,S,20         ! [102] 

    ? tab(-1,0);"This program uses ATEREG.SBX to set a ATE password"

    input "Update 1) Cfg Password, 2) Login Password, 3) Ftp Password 0) end: ",OP  ! [102]
    if OP = 0 end
        
    ! for ftp / login password, name is the seed; for cfg password, seed is empty.
    if OP = 1 then                  ! [102] 
        ITEM$ = "CfgPassword"
    elseif OP = 2 then
        input "Login name to change password for: ",LOGIN$
        ITEM$ = "LoginPassword"
    elseif OP = 3 then         
        input "Ftp user name to change password for: ",LOGIN$
        ITEM$ = "FtpPassword"
    endif
    input "Enter new password: ",PASSWORD$
    
    xcall MIAMEX,MX_PWCRYPT,PASSWORD$,CRYPT$,3,LOGIN$   ! [101] add ,3,LOGIN$
    ? "Updating "; ITEM$; " ..."                        ! [102]
    xcall ATEREG,1,STATUS,ITEM$,CRYPT$                  ! [102] was "CfgPassword"
    ? "STATUS = ";STATUS

    if OP = 1 then
        ? "Now test it accessing Settings > Connection Properties"
        ? "(Use REGEDIT to remove from registry if you get stuck)"
    elseif OP = 2 then
        ? "Now test it by launching another session"
    endif

Last edited by Jack McGregor; 19 Jun 24 08:16 PM. Reason: Correction to example code; add FtpPassword option
Re: Programmatically update ATE username/password [Re: John Andreasen] #37390 13 Jun 24 08:24 PM
Joined: Aug 2016
Posts: 371
J
John Andreasen Offline OP
Member
OP Offline
Member
J
Joined: Aug 2016
Posts: 371
OK, thank you Jack. I will give ATEREG a try.

Re: Programmatically update ATE username/password [Re: John Andreasen] #37391 19 Jun 24 07:22 PM
Joined: Aug 2016
Posts: 371
J
John Andreasen Offline OP
Member
OP Offline
Member
J
Joined: Aug 2016
Posts: 371
Hi Jack, this seems to do exactly what I need. One question though, does the "FtpPassword" use the same encryption scheme?

Re: Programmatically update ATE username/password [Re: John Andreasen] #37392 19 Jun 24 08:22 PM
Joined: Jun 2001
Posts: 11,794
J
Jack McGregor Offline
Member
Offline
Member
J
Joined: Jun 2001
Posts: 11,794
Yes, same encryption scheme, except it uses the FtpName as the seed rather than the LoginName (although as a practical matter, they're probably the same).

A couple of notes:
  • I updated the ATEREGTST program and excerpt shown above. (The original version incorrectly updated the CfgPassword even when you selected the LoginPassword.)
  • The MX_PWCRYPT mode 3 encryption scheme will generate a different encryption each time, even for the same source. So the encrypted LoginPassword and FtpPassword values will not match even if using the same name and plain password.

Re: Programmatically update ATE username/password [Re: John Andreasen] #37393 20 Jun 24 12:37 AM
Joined: Aug 2016
Posts: 371
J
John Andreasen Offline OP
Member
OP Offline
Member
J
Joined: Aug 2016
Posts: 371
OK, great. Thank you!


Moderated by  Jack McGregor, Ty Griffin 

Powered by UBB.threads™ PHP Forum Software 7.7.3