Changes the database password.
Format
#include <gskcms.h>
gsk_status gsk_change_database_password (
const char * filename,
const char * old_password,
const char * new_password,
gsk_time pwd_expiration)
Parameters
- filename
- Specifies the database file name in the local code page. The
length of the fully-qualified file name cannot exceed 251.
- old_password
- Specifies the current database password in the local code page.
The user will be prompted to enter the password if NULL is specified
for this parameter.
- new_password
- Specifies the new database password in the local code page. The
user will be prompted to enter the password if NULL is specified for
this parameter.
- pwd_expiration
- Specifies the new password expiration time as the number of seconds
since the POSIX epoch. A value of 0 indicates the password does not
expire.
Results
The function return value will be
0 if no error is detected. Otherwise, it will be one of the return
codes listed in the
gskcms.h include file. These are some
possible errors:
- [CMSERR_ACCESS_DENIED]
- The file permissions do not allow access.
- [CMSERR_BACKUP_EXISTS]
- The backup file already exists.
- [CMSERR_BAD_FILENAME]
- The database file name is not valid.
- [CMSERR_DB_CORRUPTED]
- The database file is not valid.
- [CMSERR_DB_FIPS_MODE_ONLY]
- Key database can only be opened for update if running in FIPS
mode.
- [CMSERR_DB_LOCKED]
- The database is open for update by another process.
- [CMSERR_DB_NOT_FIPS]
- Key database is not a FIPS mode database.
- [CMSERR_FILE_NOT_FOUND]
- The database file is not found.
- [CMSERR_IO_CANCELED]
- The user canceled the password prompt.
- [CMSERR_IO_ERROR]
- An input/output request failed.
- [CMSERR_NO_MEMORY]
- Insufficient storage is available.
- [CMSERR_OPEN_FAILED]
- Unable to open the database.
- [CMSERR_PW_INCORRECT]
- The password is not correct.
Usage
The gsk_change_database_password() routine
will change the password for the database and set a new password expiration
time. gsk_mktime() can be used to convert a year/month/day
time value to the number of seconds since the POSIX epoch.
A
FIPS database password may only be changed while executing in FIPS
mode. A non-FIPS database password can only be changed if not executing
in FIPS mode.