Login Services - login_services
#include <login.h>
The login services are provided by the login library. These login services allow add users and password, identify users , check passwords, update user password in login file.
All login functions return 0 on success, -2 on a missing user if the password is being updated and -1 on all other conditions like missing login file or failed user - password.
All errors are handled by the return values.
const char htpasswd_name[] = "/dev/rd/thttp/top_secret/.htpasswd";
THREAD Main(void *arg)
{
…....
set_loginfile((char *)htpasswd_name); //set login and pass to access to files in this dir
init_login_table((char *)htpasswd_name);
add_user( "root", "root" );
…....
// check user name and password in login file
if (check_password(request->hr_authuser, request->hr_authpass ))
return -1;
else
return 0;
}Coding password do with cryptographic hash algorithm SHA-1.