Home > AS/400 Tips > iSeries administrator tips > Using system APIs to retrieve and set encrypted user password
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES ADMINISTRATOR TIPS

Using system APIs to retrieve and set encrypted user password


Sudhakar Kunji
01.30.2001
Rating: -3.33- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


If you are maintaining multiple AS/400 boxes and have the same user ID in all the boxes, and if you want to have the user set his password in just one box and get reflected in all other boxes, this tip will be useful.

There are system APIs for retrieving and setting the encrypted user password.

You can use the API QSYRUPWD to retrieve the user password from the AS/400 box where the password is changed and use the API QSYSUPWD to set the password in the other AS/400s with the value retrieved from the previous API in the previous box.

Note:
These APIs are not thread safe. The User should have *ALLOBJ and *SECADM authority to use this API. The value for the encrypted password length must match that of the system value QPWDMAXLEN The FORMAT Parameter for the APIs is case sensitive and should always be UPPER CASE.

Note:
The QSYSUPWD API updates the following fields in the user profile:
The password expiration field is set to *NO.
The password change date field is updated.
The user profile change date is updated.

A wrapper program should be written to call the following program in lopp for all user IDs.



Code

========
RTVPWD
========
FPWDDEF00UF  E           K        DISK                      A     
I              'QSYRUPWD'            C         QSYDHB             
 *                                                                
I*****************************************************************
I*Record structure for UPWD0100 format                            
I*****************************************************************
IQSYDJ       DS                                                   
I*                                             Qsy RUPWD UPWD0100 
I                                    B   1   40QSYDJB             
I*                                             Bytes Returned     
I                                    B   5   80QSYDJC             
I*                                             Bytes Available    
I                                        9  18 QSYDJD             
I*                                             Profile Name       
I                                       19 269 QSYDJF             
I*                                                                
I*                                    Varying length              
I            DS                                                   
I                                    B   1   40#LEN               
I                                        5  12 #FRMT              
I                                       13  22 #USER   
I                                       23  72 #ERRFL  
 ******************************************************
C           *ENTRY    PLIST                            
C                     PARM           USER              
 *                                                     
C                     MOVELUSER      #USER             
C                     Z-ADD250       #LEN              
C                     MOVEL'UPWD0100'#FRMT             
C                     MOVEL*BLANKS   #ERRFL            
 *                                                     
C                     CALL 'QSYRUPWD'                  
C                     PARM           QSYDJ             
C                     PARM           #LEN              
C                     PARM           #FRMT             
C                     PARM           #USER             
C                     PARM           #ERRFL            
 *                                                     
 *                                                     
C                     MOVEL#USER     USER              
 *                                                      
C           USER      CHAINPASS                 50      
C                     MOVELQSYDJF    PWD                
 *                                                      
C           *IN50     IFEQ '1'                          
C                     WRITEPASS                         
C                     ELSE                              
C                     UPDATPASS                         
C                     ENDIF                             
 *                                                      
 *                                                      
C                     SETON                     LR      

______________________________________________________________
______________________


THE FILE PWDDEF00 HAS 2 FIELDS. ONE IS 
USER ID AND THE OTHER ONE IS PASSWORD.

THIS FILE SHOULD BE TRANSFERRED TO THE OTHER AS/400 SYSTEM WHERE 
YOU WANT TO SET THE PASSWORD.

AND THE FOLLOWING PROGRAM SHOULD BE EXECUTED.

========
SETPWD
========

FPWDDEF00IF  E           K        DISK                            
 *****************************************************************
I              'QSYSUPWD'            C         QSYDKB             
I*****************************************************************
I*Record structure for UPWD0100 format                            
I*****************************************************************
IQSYDL       DS                                                   
I*                                             Qsy SYPWD UPWD0100 
I                                    B   1   40QSYDLB             
I*                                             Bytes Returned     
I                                    B   5   80QSYDLC             
I*                                             Bytes Available    
I                                        9  18 QSYDLD             
I*                                             Profile Name       
I                                       19 269 QSYDLF             
I*                                                                
I            DS                                                   
I                                        1  50 ERRCD              
I                                       51  58 #FRMT              
I*                                                                
I*                                    Varying length    
 *******************************************************
C           *ENTRY    PLIST                             
C                     PARM           USER   10          
 *                                                      
C           USER      CHAINPASS                 50      
 *                                                      
C           *IN50     IFEQ '0'                          
C                     MOVEL'UPWD0100'#FRMT              
C                     MOVELUSER      QSYDLD             
C                     MOVELPWD       QSYDLF             
C                     CALL 'QSYSUPWD'                   
C                     PARM           QSYDL              
C                     PARM           #FRMT              
C                     PARM           ERRCD              
C                     ENDIF                             
 *                                                      
C                     SETON                     LR 


Rate this Tip
To rate tips, you must be a member of Search400.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
iSeries administrator tips
Analyze the health of your IBM i server with iScore
Researching high availability for your System i shop
Translating Linux for IBM i admins: Using GUI to make it easy
Translating Linux for IBM i admins: Working with jobs and networking
OpenOffice: What to know before making the transition from Microsoft Office
OpenOffice: An enterprise open source solution
Database performance comparisons on IBM i
Translating Linux for IBM i admins: User profile commands
Modern System i reports using Client Access
Tips for installing Lotus Domino server on a System i partition

Performance
Will overloaded discs impact iSeries performance?
Extend storage capacity on an IBM i without negatively effecting system performance
Database drivers on the i: MySQL vs. IBM Toolbox
Performance tuning for IBM i: The basics and beyond
IBM releases new Power products for the midrange
Top System i admin tips for 2006
Catholic Charities keeps track of homeless with iSeries
i5 error messages: What you need to know
IBM races for clock speed
System shutting down after cleanup

iSeries system performance and monitoring
Analyze the health of your IBM i server with iScore
Translating Linux for IBM i admins: Working with jobs and networking
Database performance comparisons on IBM i
How to: Monitoring job activity on the AS/400
Performance tuning for IBM i: The basics and beyond
How to: Reduce the percentage of ASP used on the AS/400
Detecting system changes made by outside IP address
AS/400 system values quiz
Checking on System i disk space requires creating a new command: XRTVSYSSTS
Drive space management commands

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
CIW  (Search400.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



iSeries Security - Security Tools, Physical Security and System Security
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts