cwbCO_SetPassword

Purpose

This function sets the password to associate with the specified system object. This password will be used when connecting to the iSeries™ server with either the cwbCO_Signon or cwbCO_Connect call, and when a user ID has been 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 identifies the iSeries system.
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 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.