You copied the Doc URL to your clipboard.

9.8.2. check_permit()

This function is used to authenticate users.


int check_permit(char *username, char *password, int appcode, void *permissions);



Is the name of the user to check.


Is the password that the user has entered.


Is the application asking for authentication (see Usage below).


is unused (see Usage below).

Return value

Returns one of the following:


If the user has been successfully authenticated.


If the user was not authenticated.


The check_permit() function is called by an application when it wishes to check if a particular user is authorized to use that application. The username and password values are as entered by the end user, and the appcode is selected from the list in userpass.h. Like add_user(), the permissions parameter is unused in the example applications and in this library implementation, but can be used for checking that the user has the required access permissions for a specific operation, such as writing a system file.

The example implementation of check_permit() simply performs a string comparison of the password and username, and if the two match, it is regarded as a positive authentication. Your implementation must implement a proper password authenticating mechanism in order to be secure.

Was this page helpful? Yes No