cwbCO_SetPassword
Use the cwbCO_SetPassword command.
Purpose
This function sets the password to associate with the specified system object. This password is used for an IBM i connection with either the cwbCO_Signon or cwbCO_Connect call, and when a user ID is set with the cwbCO_SetUserIDEx call.
Syntax
UINT CWB_ENTRY cwbCO_SetPassword(
cwbCO_SysHandle system,
LPCSTR password );
Parameters
- cwbCO_SysHandle system - input
- Handle that previously was returned from cwbCO_CreateSystem or cwbCO_CreateSystemLike. It is the IBM i identification.
- LPCSTR password - input
- A pointer to a buffer that contains the NULL-terminated password. The maximum length is CWBCO_MAX_PASSWORD + 1 bytes in length, including the NULL terminator.
Return Codes
The following list shows common return values.
- CWB_OK
- Successful completion.
- CWB_INVALID_API_HANDLE
- Invalid system handle.
- CWB_INVALID_POINTER
- The password pointer is NULL.
- CWB_NON_REPRESENTABLE_UNICODE_CHAR
- One or more input Unicode characters have no representation in the codepage that is being used.
- CWB_INV_AFTER_SIGNON
- Signon successfully has occurred by using the specified system object, so this setting no longer may be changed.
Usage
This API cannot be used after a successful signon has occurred for the specified system object. A signon has occurred if either cwbCO_Signon or cwbCO_Connect has been called successfully for this system object. A password set with this API will not be used unless a corresponding user ID has been set with cwbCO_SetUserIDEx.
Valid password lengths depend on the current setting of the IBM i 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.