Purpose
Changes the password of the specified user
on the iSeries™ system
from a specified old to a specified new value. This API does NOT use the user
ID and password that currently are set in the given system object, nor does
it change these values.
Syntax
UINT CWB_ENTRY cwbCO_ChangePassword(
cwbCO_SysHandle system,
LPCSTR userID,
LPCSTR oldPassword,
LPCSTR newPassword,
cwbSV_ErrHandle errorHandle);
Parameters
- cwbCO_SysHandle system - input
- Handle returned previously from cwbCO_CreateSystem or cwbCO_CreateSystemLike.
It identifies the iSeries system.
- LPCSTR userID - input
- A pointer to an ASCIIZ string that contains the user ID. The maximum length
is CWBCO_MAX_USER_ID + 1 characters, including the null terminator.
- LPCSTR oldPassword - input
- A pointer to a buffer which contains the old password. The maximum length
is CWBCO_MAX_PASSWORD + 1 bytes, including the null terminator.
- LPCSTR newPassword - input
- A pointer to a buffer which contains the new password. The maximum length
is CWBCO_MAX_PASSWORD + 1 bytes, including the null terminator.
- cwbSV_ErrHandle errorHandle - input/output
- Any returned messages will be written to this object. It is created with
the cwbSV_CreateErrHandle API. The messages may be retrieved
through the cwbSV_GetErrText API. If the parameter is set
to zero, or if the errorHandle is invalid, no messages will be retrieved.
Return Codes
The following list shows common return
values.
- CWB_OK
- Successful completion.
- CWB_INVALID_API_HANDLE
- Invalid system handle.
- CWB_INVALID_POINTER
- A pointer parameter is NULL.
- CWB_GENERAL_SECURITY_ERROR
- A general security error occurred. The user profile does not have a password
or the password validation program found an error in the password.
- CWB_INVALID_PASSWORD
- One or more characters in the new password is invalid or the password
is too long.
- CWB_INVALID_USERID
- One or more characters in the user ID is invalid or the user ID is too
long.
- CWB_UNKNOWN_USERID
- The supplied user ID is not known to this system.
- CWB_WRONG_PASSWORD
- Password is not correct.
- CWB_USER_PROFILE_DISABLED
- The user ID has been disabled.
- CWB_PW_TOO_LONG
- New password longer than maximum accepted length.
- CWB_PW_TOO_SHORT
- New password shorter than minimum accepted length.
- CWB_PW_REPEAT_CHARACTER
- New password contains a character used more than once.
- CWB_PW_ADJACENT_DIGITS
- New password has adjacent digits.
- CWB_PW_CONSECUTIVE_CHARS
- New password contains a character repeated consecutively.
- CWB_PW_PREVIOUSLY_USED
- New password was previously used.
- CWB_PW_DISALLOWED_CHAR
- New password uses an installation-disallowed character.
- CWB_PW_NEED_NUMERIC
- New password must contain at least one numeric.
- CWB_PW_MATCHES_OLD
- New password matches old password in one or more character positions.
- CWB_PW_NOT_ALLOWED
- New password exists in a dictionary of disallowed passwords.
- CWB_PW_CONTAINS_USERID
- New password contains user ID as part of the password.
- CWB_PW_LAST_INVALID_PWD
- The next invalid password will disable the user profile.
- CWB_NOT_ENOUGH_MEMORY
- Insufficient memory; may have failed to allocate temporary buffer.
- CWB_NON_REPRESENTABLE_UNICODE_CHAR
- One or more input Unicode characters have no representation in the codepage
being used.
- CWB_API_ERROR
- General API failure.
Usage
Valid password lengths depend on the current
setting of the iSeries system
password level. Password levels 0 and 1 allow passwords up to 10 characters
in length. Password levels 2 and 3 allow passwords up to 128 characters in
length.