Main Page | Modules | Data Structures | File List | Data Fields

Password


Functions

int u_pwd_init (const char *res_uri, u_pwd_open_cb_t cb_open, u_pwd_load_cb_t cb_load, u_pwd_close_cb_t cb_close, u_pwd_notify_cb_t cb_notify, u_pwd_hash_cb_t cb_hash, size_t hash_len, int in_memory, u_pwd_t **ppwd)
 Initialize a pwd instance.

int u_pwd_retr (u_pwd_t *pwd, const char *user, u_pwd_rec_t **prec)
 Retrieve a pwd record.

int u_pwd_auth_user (u_pwd_t *pwd, const char *user, const char *password)
 Check if user has presented the right credential.

void u_pwd_term (u_pwd_t *pwd)
 Dispose the supplied pwd instance.

int u_pwd_init_file (const char *res_uri, u_pwd_hash_cb_t cb_hash, size_t hash_len, int in_memory, u_pwd_t **ppwd)
 Init specialization for file-based password db.

void u_pwd_rec_free (u_pwd_t *pwd, u_pwd_rec_t *rec)
 Dispose a pwd_rec record (must be used on returned pwd_rec record from u_pwd_retr on in_memory pwd instances).

const char * u_pwd_rec_get_user (u_pwd_rec_t *rec)
 Return the user field of the supplied pwd record.

const char * u_pwd_rec_get_password (u_pwd_rec_t *rec)
 Return the password field of the supplied pwd record.

const char * u_pwd_rec_get_opaque (u_pwd_rec_t *rec)
 Return the opaque field of the supplied pwd record.

int u_pwd_in_memory (u_pwd_t *pwd)
 Return the in_memory flag of the supplied pwd instance.


Function Documentation

int u_pwd_auth_user u_pwd_t *  pwd,
const char *  user,
const char *  password
 

Parameters:
pwd an already initialized pwd instance
user user whose credential has to be checked
password the supplied credential
Returns:
0 if authentication is ok, ~0 if authentication fails

Definition at line 175 of file pwd.c.

References u_free(), u_pwd_rec_free(), u_pwd_retr(), and u_zalloc().

int u_pwd_in_memory u_pwd_t *  pwd  ) 
 

Parameters:
pwd the pwd instance to be examined
Returns:
return 0 in case it is not an in-memory pwd instance

Definition at line 328 of file pwd.c.

int u_pwd_init const char *  res_uri,
u_pwd_open_cb_t  cb_open,
u_pwd_load_cb_t  cb_load,
u_pwd_close_cb_t  cb_close,
u_pwd_notify_cb_t  cb_notify,
u_pwd_hash_cb_t  cb_hash,
size_t  hash_len,
int  in_memory,
u_pwd_t **  ppwd
 

Parameters:
res_uri name of the master db resource
cb_open method to open res_uri (get its handler)
cb_load method to load res_uri lines one by one
cb_close method to dispose res_uri handler (OPTIONAL)
cb_notify methor to notify changes in the master resource (OPTIONAL)
cb_hash method to hash passwords (OPTIONAL)
hash_len hashed password string lenght (needed if cb_hash has been set)
in_memory if true, keep an hash-map'd version of the master db into memory (useful for huge and static db's)
ppwd the pwd instance handler as a result value
Returns:
0 on success, ~0 on error

Definition at line 98 of file pwd.c.

References u_pwd_term(), and u_zalloc().

Referenced by u_pwd_init_file().

int u_pwd_init_file const char *  res_uri,
u_pwd_hash_cb_t  cb_hash,
size_t  hash_len,
int  in_memory,
u_pwd_t **  ppwd
 

Parameters:
res_uri name of the master db resource
cb_hash method to hash passwords (OPTIONAL)
hash_len hashed password string lenght (needed if cb_hash has been set)
in_memory if true, keep an hash-map'd version of the master db into memory (useful for huge and static db's)
ppwd the pwd instance handler as a result value
Returns:
0 on success, ~0 on error

Definition at line 249 of file pwd.c.

References u_pwd_init().

void u_pwd_rec_free u_pwd_t *  pwd,
u_pwd_rec_t *  rec
 

Parameters:
pwd the pwd instance which owns rec
rec the pwd_rec record to be disposed
Returns:
nothing

Definition at line 265 of file pwd.c.

References u_free().

Referenced by u_pwd_auth_user().

const char* u_pwd_rec_get_opaque u_pwd_rec_t *  rec  ) 
 

Parameters:
rec handler of a pwd record returned by u_pwd_retr
Returns:
the opaque string (can be NULL even if successful)

Definition at line 315 of file pwd.c.

const char* u_pwd_rec_get_password u_pwd_rec_t *  rec  ) 
 

Parameters:
rec handler of a pwd record returned by u_pwd_retr
Returns:
the password string or NULL on error

Definition at line 302 of file pwd.c.

const char* u_pwd_rec_get_user u_pwd_rec_t *  rec  ) 
 

Parameters:
rec handler of a pwd record returned by u_pwd_retr
Returns:
the user string or NULL on error

Definition at line 289 of file pwd.c.

int u_pwd_retr u_pwd_t *  pwd,
const char *  user,
u_pwd_rec_t **  prec
 

Parameters:
pwd an already initialized pwd instance
user user whose info shall be retrieved
prec retrieved user record as a result argument (the record must be free'd using u_pwd_rec_free API).
Returns:
0 on success, ~0 on error

Definition at line 152 of file pwd.c.

Referenced by u_pwd_auth_user().

void u_pwd_term u_pwd_t *  pwd  ) 
 

Parameters:
pwd the pwd instance that shall be disposed
Returns:
nothing

Definition at line 225 of file pwd.c.

Referenced by u_pwd_init().


←Products
© 2005-2008 - KoanLogic S.r.l. - All rights reserved