Z-MODPWD

This document covers the following topics:


Description

Modify the password.

This subprogram can be used by a user or an administrator. The administrator must be either a supervisor or a cabinet administrator with the permission to modify cabinets.

A user can modify the password of the own private cabinet. An administrator can modify the password of any cabinet, except cabinet SYSCNT. The parameter Cabinet-name specifies the cabinet for which the password is to be changed.

If it is not allowed to define the cabinet ID or a specific string as the password, return code 99 is issued.

If the parameter Generate-password is filled, Z-MODPWD automatically generates a new password. In this case, the parameter New-password is ignored.

If the parameter Generate-password is not filled, you must specify the parameter New-password.

Note:
If Z-MODPWD generates a new password, this new password is not returned to the calling program.

The following applies when an administrator modifies the password of another than his own cabinet: when the parameter Generate-password is not filled or contains the value S, a notification indicating that the password was changed is automatically sent to the cabinet specified in the parameter Cabinet-name. However, when sending and receiving of mail was disallowed for a cabinet, the notification is sent to the cabinet SYSCNT.

A notification is sent only when the administrator modifies the password of a cabinet other than his own. These are the parameters that are used for the different functions of this subprogram:

  • New-password is filled (Generate-password is not filled): a notification is sent.

  • Generate-password is filled with S: a notification is sent.

  • Generate-password is filled with any character except S: a notification is not sent.

If a notification is to be sent, Z-MODPWD uses the value of the parameter Notification-text both as subject and text of the notification. If the parameter Notification-text is not filled, Z-MODPWD tries to retrieve the appropriate Con-nect message according to the current value of *LANGUAGE.

Successful termination of Z-MODPWD always results in an END TRANSACTION. You are not able to control transaction handling. When a value other than 0 is returned, BACKOUT TRANSACTION is automatically issued.

Parameters

Parameter Format In Out Remarks
Return-code N2   X  
Cabinet A8 R   The cabinet of the administrator or user.
Password A8 R   The password of the above cabinet.
Cabinet-name A8 R   The cabinet that is to be modified.
New-password A8 R*   The new password for the cabinet that is to be modified. This is ignored when Generate-password is marked.
Generate-password A1 R*   If marked with any character except S, a new password is created. If marked with S, a new password is created and a notification is sent.
Notification-text A65 O   The text for the notification that is to be sent.

Return Codes

00 Success
02 Invalid cabinet name or - in batch mode only - locked cabinet
03 Password incorrect
15 Invalid administrator status
18 API context buffer not available
97 Message text not available
98 Cabinet to modify cannot be found
99 Invalid new password

Subprograms

Z-SENDX
Z-110
Z-120
Z-122
Z-123
Z-135
Z-145
Z-155
Z-164
Z-165
Z-175
Z-185
Z-190
Z-1200&0

Example

0010 * This routine changes the passwords for all private cabinets where
0020 * the old password matches the cabinet name. A main process uses
0030 * Z-DIS05 to loop around the cabinets. For each found cabinet
0040 * a dummy-call for Z-ADD13 is executed. If this dummy-call results
0050 * in a return code other than 3, the old password matches the
0060 * cabinet name and Z-MODPWD is invoked.
0070 *
0080 DEFINE DATA
0090 *
0100 LOCAL
0110 *
0120 * Parameters for Z-MODPWD
0130 *
0140 1 RETURN-CODE               (N2)
0150 1 CABINET                   (A8)
0160 1 PASSWORD                  (A8)
0170 1 CABINET-NAME              (A8)
0180 1 NEW-PASSWORD              (A8)
0190 1 GENERATE-PASSWORD         (A1)
0200 1 NOTIFICATION-TEXT         (A65)
0210 *
0220 * Parameters for Z-DIS05
0230 *
0240 1 #05-RETURN-CODE           (N2)
0250 1 #05-CABINET               (A8)
0260 1 #05-PASSWORD              (A8)
0270 1 #05-START-CABINET         (A8)
0280 1 #05-START-CABINET-TYPE    (N1)
0290 1 #05-NUMBER                (N2)
0300 1 #05-CABINET-TABLE         (1:20)
0310   2 #05-CABINET-NAME        (A8)
0320   2 #05-CABINET-TYPE        (A1)
0330   2 #05-USER-LAST-NAME      (A32)
0340   2 #05-USER-FIRST-NAME     (A32)
0350   2 #05-USER-INITIAL        (A1)
0360   2 #05-DISALLOW-MAIL       (A1)
0370   2 #05-OWNER               (A1)
0380   2 #05-ADMINISTRATOR       (A1)
0390   2 #05-CABINET-ISN         (P8)
0400 1 #05-WORK-PARAMETER        (A42)
0410 *
0420 * Parameters for Z-ADD13
0430 *
0440 1 #13-RETURN-CODE           (N2)
0450 1 #13-CABINET               (A8)
0460 1 #13-PASSWORD              (A8)
0470 1 #13-FOLDER-NAME           (A15)
0480 1 #13-FILE-NAME             (A15)
0490 1 #13-FOLDER-SEQUENCE       (N1)
0500 1 #13-FOLDER-NUMBER         (N5)
0510 1 #13-FILE-NUMBER           (N5)
0520 *
0530 * Other local parameters
0540 *
0550 1 #MESSAGE                  (A40)
0560 1 #LOOP                     (P3)
0570 1 #CANCEL                   (L)
0580 *
0590 END-DEFINE
0600 *
0610 MOVE FALSE                             TO #CANCEL
0620 MOVE 'SYSADMIN'                        TO CABINET  #05-CABINET
0630                                           PASSWORD #05-PASSWORD
0640 MOVE 'DUMMY'                           TO NEW-PASSWORD
0650 MOVE 'Password was changed - please contact your administrator'
0660                                        TO NOTIFICATION-TEXT
0670 MOVE 'Check of passwords completed'    TO #MESSAGE
0680 *
0690 REPEAT
0700      CALLNAT 'Z-DIS05'
0710           #05-RETURN-CODE
0720           #05-CABINET
0730           #05-PASSWORD
0740           #05-START-CABINET
0750           #05-START-CABINET-TYPE
0760           #05-NUMBER
0770           #05-CABINET-TABLE (*)
0780           #05-WORK-PARAMETER
0790      IF   #05-RETURN-CODE EQ 0 OR EQ 77
0800           FOR  #LOOP EQ 1 TO 20
0810                IF   #05-CABINET-NAME (#LOOP) NE ' '
0820                 AND NOT #CANCEL
0830                     PERFORM PROCESS-CABINET
0840                END-IF
0850           END-FOR
0860      ELSE
0870           COMPRESS 'Error Z-DIS05:' #05-RETURN-CODE
0880                                      INTO #MESSAGE
0890      END-IF
0900 UNTIL #05-RETURN-CODE GT 0
0910   OR #CANCEL
0920 END-REPEAT
0930 *
0940 WRITE NOTITLE #MESSAGE
0950 *
0960 DEFINE SUBROUTINE PROCESS-CABINET
0970 *
0980 RESET                                     #13-RETURN-CODE
0990 MOVE #05-CABINET-NAME (#LOOP)          TO #13-CABINET #13-PASSWORD
1000 CALLNAT 'Z-ADD13'
1010      #13-RETURN-CODE
1020      #13-CABINET
1030      #13-PASSWORD
1040      #13-FOLDER-NAME
1050      #13-FILE-NAME
1060      #13-FOLDER-SEQUENCE
1070      #13-FOLDER-NUMBER
1080      #13-FILE-NUMBER
1090 *
1100 IF   #13-RETURN-CODE LT 3              /* should not happen
1110      COMPRESS 'Error Z-ADD13:' #13-RETURN-CODE #13-CABINET
1120                                      INTO #MESSAGE
1130      MOVE TRUE                         TO #CANCEL
1140 ELSE
1150      IF   #13-RETURN-CODE GT 3       /* password matches the cabinet name
1160           MOVE #13-CABINET             TO CABINET-NAME
1170           CALLNAT 'Z-MODPWD'
1180                RETURN-CODE
1190                CABINET
1200                PASSWORD
1210                CABINET-NAME
1220                NEW-PASSWORD
1230                GENERATE-PASSWORD
1240                NOTIFICATION-TEXT
1250           IF   RETURN-CODE GT 0
1260                COMPRESS 'Error Z-MODPWD:' RETURN-CODE
1270                                      INTO #MESSAGE
1280                MOVE TRUE               TO #CANCEL
1290           END-IF
1300      END-IF
1310 END-IF
1320 *
1330 END-SUBROUTINE
1340 *
1350 END