Users

Interface to change the password of a system user.

File information

Filecommon/interface/users.h

Classes IUsers

Data types users_password_change_error_t

Examples IUsers::ChangePassword

Classes

IUsers

class IUsers {
public:
    static users_password_change_error_t ChangePassword(const char * user, const char * oldPassword, const char * newPassword);;
};

Public functions

ChangePassword (static function)
This function changes the password of a given user. The old and the new password must be both provided.

Parameters

const char * user The system user which must exist
const char * oldPassword The old password of the system user
const char * newPassword The desired new password

Return value

If the password is successfully changed USERS_PASSWORD_CHANGE_SUCCESS is returned.

Code Example

users_password_change_error_t error = IUsers::ChangePassword("root", "topSecret", "superTopSecret");
                

Data types

users_password_change_error_t

typedef enum {
    USERS_PASSWORD_CHANGE_SUCCESS = 0,
    USERS_PASSWORD_CHANGE_PAM,
    USERS_PASSWORD_CHANGE_AUTHENTICATION,
    USERS_PASSWORD_CHANGE_ACCOUNT,
    USERS_PASSWORD_CHANGE_FAILURE
} users_password_change_error_t;

Overview

The enum users_password_change_error_t is an error enum which can be used to check if changing the passowrd was a success or a failure.

Values

USERS_PASSWORD_CHANGE_SUCCESS The password was changed successfully
USERS_PASSWORD_CHANGE_PAMError: A PAM (Pluggable Authentication Modules Library) transcation could not be created
USERS_PASSWORD_CHANGE_AUTHENTICATIONError: The system user could not be authenticated
USERS_PASSWORD_CHANGE_ACCOUNTError: The user account might not be valid
USERS_PASSWORD_CHANGE_FAILUREError: The password could not be changed