Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1298598
  • 博文数量: 287
  • 博客积分: 11000
  • 博客等级: 上将
  • 技术积分: 3833
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-16 08:43
文章分类
文章存档

2013年(15)

2012年(17)

2011年(17)

2010年(135)

2009年(85)

2008年(18)

分类: 系统运维

2010-06-04 17:30:59

Validation List Object APIs ** ** Service program summary ** ----------------------- ** ** Security APIs: ** ** QsyAddValidationLstEntry Adds an entry to a validation list ** object. The entry is defined by an ** Entry Id (user name), Encrypt Data ** (user password) and Entry Data ** (user description). ** ** QsyFindValidationLstEntry Finds an entry in a validation list ** object. To be able to retrieve the ** password the system value QRETSVRSEC ** must be set to 1 and the QsyEncrypt- ** Data attribute of the entry should ** have been set to 1 when the entry ** was stored. ** ** QsyChangeValidationLstEntry Changes an entry in a validation ** list object. Eligible to change are ** the password and description values ** as well as attribute information. ** ** QsyRemoveValidationLstEntry Removes an entry from a validation ** list object. ** ** QsyVerifyValidationLstEntry Verifies the existence of the speci- ** fied validation list entry and the ** and the validity of the specified ** password. ** ** ** Exported functions: ** Return values: ** VfyUsrPwd Verifies the username and password -1: Failure ** against the specified validation -2: Password error ** list. ** ** AddUsrPwd Adds a username, a password and a -1: Failure ** description to the specified -2: Password error ** validation list. ** ** ChgUsrPwd Changes the password of the speci- -1: Failure ** fied username in the specified -1: Password error ** validation list. ** ** GetUsrPwd Returns the password of the speci- Blanks: Failure ** fied username if found in the ** specified validation list. ** ** RmvUsrPwd Removes the validation list entry -1: Failure ** of the specified username in the ** specified validation list. ** ** ** Compile options: ** ** CRTRPGMOD CBX003 ** ** CRTSRVPGM CBX003 ** ** **-- Header specifications: --------------------------------------------** H NoMain Option( *SrcStmt ) **-- Entry Id: ---------------------------------------------------------** D EntId Ds D EiDtaLen 10i 0 D EiCcsId 10i 0 Inz( 65535 ) D EiDta 10a **-- Encryption data: --------------------------------------------------** D EncDta Ds D EcDtaLen 10i 0 D EcCcsId 10i 0 Inz( 65535 ) D EcDta 10a **-- Entry data: -------------------------------------------------------** D EntDta Ds D EdDtaLen 10i 0 D EdCcsID 10i 0 Inz( 65535 ) D EdDta 50a **-- Attribute data: ---------------------------------------------------** D AtrInf Ds D AiNbrAtr 10i 0 Inz( 1 ) D AiAlign 12a ** Qsy_Attr_Descr_T 1 4D AdAtrLoc 10i 0 Inz( 0 ) 5 8D AdAtrTyp 10i 0 Inz( 0 ) 9 16D AdRes_1 8a Inz( *Allx'00' ) 17 32D AdAtrId_p * 33 64D AdOthDsc 32a Inz( *Allx'00' ) ** Attr_Data_Info ** Qsy_In_VLDL_T D VldLstAtr 96a 65 68D AvAtrCcsid 10i 0 Overlay( VldLstAtr: 1 ) 65 68D Inz( -1 ) 69 72D AvAtrLen 10i 0 Overlay( VldLstAtr: 5 ) 69 72D Inz( 1 ) 73 80D AvRes_1 8a Overlay( VldLstAtr: 9 ) 73 80D Inz( *Allx'00' ) 81 96D AvAtrVal_p * Overlay( VldLstAtr: 17 ) 81 96D Inz( %Addr( AvAtrVal )) 97192D VaInOther 96a Overlay( VldLstAtr: 1 ) D 64a Overlay( VaInOther: 33 ) D Inz( *Allx'00' ) 93224D AdOtherData 32a Inz( *Allx'00' ) ** D AvAtrVal s 1a Inz( '1' ) **-- Return data: ------------------------------------------------------** D RtnDta Ds ** Qsy_Entry_ID_Info_T D RiDtaLen 10i 0 D RiCcsId 10i 0 D RiDta 100a ** Qsy_Entry_Encr_Data_Info_T D RcDtaLen 10i 0 D RcCcsId 10i 0 D RcDta 600a ** Qsy_Entry_Data_Info_T D RdDtaLen 10i 0 D RdCcsID 10i 0 D RdDta 1000a D 4a D RaAtrPtr * **-- Verify user password: ---------------------------------------------** D VfyUsrPwd Pr 10i 0 D PxVldLst 10a Const D PxVldLstLib 10a Const D PxUsrId 10a Const D PxUsrPwd 10a Const **-- Add user password: ------------------------------------------------** D AddUsrPwd Pr 10i 0 D PxVldLst 10a Const D PxVldLstLib 10a Const D PxUsrId 10a Const D PxUsrPwd 10a Const D PxUsrDsc 50a Const **-- Get user password: ------------------------------------------------** D GetUsrPwd Pr 10a D PxVldLst 10a Const D PxVldLstLib 10a Const D PxUsrId 10a Const **-- Change user password: ---------------------------------------------** D ChgUsrPwd Pr 10i 0 D PxVldLst 10a Const D PxVldLstLib 10a Const D PxUsrId 10a Const D PxUsrPwd 10a Const **-- Remove user password: ---------------------------------------------** D RmvUsrPwd Pr 10i 0 D PxVldLst 10a Const D PxVldLstLib 10a Const D PxUsrId 10a Const **-- Verify user password: ---------------------------------------------** P VfyUsrPwd B Export D Pi 10i 0 D PxVldL 10a Const D PxVldLlib 10a Const D PxUsrId 10a Const D PxUsrPwd 10a Const **-- Verify validation list entry: D VfyVldLst Pr 10i 0 ExtProc( 'QsyVerifyValidation+ D LstEntry' ) D VvLstNam 20a Const D VvEntId * Value D VvEncDta * Value ** **-- Mainline: ---------------------------------------------------------** ** C Eval EiDta = PxUsrId C Eval EiDtaLen = %Len( %TrimR( EiDta )) ** C Eval EcDta = PxUsrPwd C Eval EcDtaLen = %Len( %TrimR( EcDta )) ** C Return VfyVldLst( PxVldL + PxVldLlib C : %Addr( EntId ) C : %Addr( EncDta ) C ) ** P VfyUsrPwd E **-- Add user password: ------------------------------------------------** P AddUsrPwd B Export D Pi 10i 0 D PxVldL 10a Const D PxVldLlib 10a Const D PxUsrId 10a Const D PxUsrPwd 10a Const D PxUsrDsc 50a Const **-- Add validation list entry: D AddVldLst Pr 10i 0 ExtProc( 'QsyAddValidation+ D LstEntry' ) D AvLstNam 20a Const D AvEntId * Value D AvEncDta * Value D AvEntDta * Value D AvAtrDta * Value ** **-- Mainline: ---------------------------------------------------------** ** C Eval EiDta = PxUsrId C Eval EiDtaLen = %Len( %TrimR( EiDta )) ** C Eval EcDta = PxUsrPwd C Eval EcDtaLen = %Len( %TrimR( EcDta )) ** C Eval EdDta = PxUsrDsc C Eval EdDtaLen = %Len( %TrimR( EdDta )) ** C Alloc 15 AdAtrId_p C Eval %Str( AdAtrId_p: 15 ) = 'QsyEncryptData' ** C Return AddVldLst( PxVldL + PxVldLlib C : %Addr( EntId ) C : %Addr( EncDta ) C : %Addr( EntDta ) C : %Addr( AtrInf ) C ) ** P AddUsrPwd E **-- Get user password: ------------------------------------------------** P GetUsrPwd B Export D Pi 10a D PxVldL 10a Const D PxVldLlib 10a Const D PxUsrId 10a Const **-- Find validation list entry: D FndVldLst Pr 10i 0 ExtProc( 'QsyFindValidation+ D LstEntry' ) D FvLstNam 20a Const D FvEntId * Value D FvRtnDta * Value ** **-- Mainline: ---------------------------------------------------------** ** C Eval EiDta = PxUsrId C Eval EiDtaLen = %Len( %TrimR( EiDta )) ** C If FndVldLst( PxVldL + PxVldLlib C : %Addr( EntId ) C : %Addr( RtnDta ) C ) = -1 C Return *Blanks ** C Else C Return %SubSt( RcDta: 1: RcDtaLen ) C EndIf ** P GetUsrPwd E **-- Change user password: ---------------------------------------------** P ChgUsrPwd B Export D Pi 10i 0 D PxVldL 10a Const D PxVldLlib 10a Const D PxUsrId 10a Const D PxUsrPwd 10a Const **-- Change validation list entry: D ChgVldLst Pr 10i 0 ExtProc( 'QsyChangeValidation+ D LstEntry' ) D CvLstNam 20a Const D CvEntId * Value D CvEncDta * Value D CvEntDta * Value D CvAtrDta * Value ** **-- Mainline: ---------------------------------------------------------** ** C Eval EiDta = PxUsrId C Eval EiDtaLen = %Len( %TrimR( EiDta )) ** C Eval EcDta = PxUsrPwd C Eval EcDtaLen = %Len( %TrimR( EcDta )) ** C Return ChgVldLst( PxVldL + PxVldLlib C : %Addr( EntId ) C : %Addr( EncDta ) C : *Null C : *Null C ) ** P ChgUsrPwd E **-- Remove user password: ---------------------------------------------** P RmvUsrPwd B Export D Pi 10i 0 D PxVldL 10a Const D PxVldLlib 10a Const D PxUsrId 10a Const **-- Remove validation list entry: D RmvVldLst Pr 10i 0 ExtProc( 'QsyRemoveValidation+ D LstEntry' ) D RvLstNam 20a Const D RvEntId * Value ** **-- Mainline: ---------------------------------------------------------** ** C Eval EiDta = PxUsrId C Eval EiDtaLen = %Len( %TrimR( EiDta )) ** C Return RmvVldLst( PxVldL + PxVldLlib C : %Addr( EntId ) C ) ** P RmvUsrPwd E
Test validation list functions in service program CBX003 ** ** Program description: ** ** Test validation list functions in service program CBX003. ** ** ** Program prerequisite: ** ** Create validation list in QGPL: CRTVLDL WEB001V ** ** ** Compile options: ** ** CRTRPGMOD ... DBGVIEW(*LIST) ** ** CRTPGM ... BNDSRVPGM(CBX003) ** ** **-- Header specifications: --------------------------------------------** H Option( *SrcStmt ) **-- Global variables & constants: -------------------------------------** D RtnCod s 10i 0 D UsrPwd s 10a D VldLst c 'WEB001V' D VldLib c '*LIBL' **-- Verify user password: ---------------------------------------------** D VfyUsrPwd Pr 10i 0 D PxVldLst 10a Const D PxVldLstLib 10a Const D PxUsrId 10a Const D PxUsrPwd 10a Const **-- Add user password: ------------------------------------------------** D AddUsrPwd Pr 10i 0 D PxVldLst 10a Const D PxVldLstLib 10a Const D PxUsrId 10a Const D PxUsrPwd 10a Const D PxUsrDsc 50a Const **-- Get user password: ------------------------------------------------** D GetUsrPwd Pr 10a D PxVldLst 10a Const D PxVldLstLib 10a Const D PxUsrId 10a Const **-- Change user password: ---------------------------------------------** D ChgUsrPwd Pr 10i 0 D PxVldLst 10a Const D PxVldLstLib 10a Const D PxUsrId 10a Const D PxUsrPwd 10a Const **-- Remove user password: ---------------------------------------------** D RmvUsrPwd Pr 10i 0 D PxVldLst 10a Const D PxVldLstLib 10a Const D PxUsrId 10a Const **-- Test user password functions: --------------------------------------** ** C If AddUsrPwd( VldLst C : VldLib C : 'Dexter' C : 'DeeDee' C : 'Big scientist' C ) = *Zero ** C Eval RtnCod = VfyUsrPwd( VldLst C : VldLib C : 'Dexter' C : 'DeeDee' C ) ** C Eval RtnCod = VfyUsrPwd( VldLst C : VldLib C : 'Dexter' C : 'deedee' C ) ** C Eval UsrPwd = GetUsrPwd( VldLst C : VldLib C : 'Dexter' C ) ** C Eval RtnCod = ChgUsrPwd( VldLst C : VldLib C : 'Dexter' C : 'DEEDEE' C ) ** C Eval UsrPwd = GetUsrPwd( VldLst C : VldLib C : 'Dexter' C ) ** C EndIf ** C Eval RtnCod = RmvUsrPwd( VldLst C : VldLib C : 'Dexter' C ) ** C Eval *InLr = *On ** Thanks to Carsten Flensburg
阅读(1192) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~