NAME

Login Services - login_services

SYNOPSIS

#include <login.h>

int init_login_table( char * loginfile)
int add_user( char *user, char * pswd )
int delete_user( char *user)
int check_password( char *user, char * pswd )
int update_password( char *user, char * oldpswd, char * pswd )
void set_loginfile(char * loginfile)

DESCRIPTION

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.

RETURN VALUES

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.

ERRORS

All errors are handled by the return values.

EXAMPLE

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;
}



NOTES

Coding password do with cryptographic hash algorithm SHA-1.




< Copyright Rowebots Research Inc. and Multiprocessor Toolsmiths Inc. 1987-2011 >