prelude-auth

Name

prelude-auth -- 

Synopsis



int         prelude_auth_create_account     (const char *filename,
                                             char **user,
                                             char **pass,
                                             int crypted,
                                             uid_t uid);
int         prelude_auth_create_account_noprompt
                                            (const char *filename,
                                             const char *user,
                                             const char *pass,
                                             int crypted,
                                             uid_t uid);
int         prelude_auth_check              (const char *authfile,
                                             const char *user,
                                             const char *pass);
#define     user_does_not_exist
#define     password_does_not_match
int         prelude_auth_read_entry         (const char *authfile,
                                             const char *wanted_user,
                                             const char *wanted_pass,
                                             char **user,
                                             char **pass);

Description

Details

prelude_auth_create_account ()

int         prelude_auth_create_account     (const char *filename,
                                             char **user,
                                             char **pass,
                                             int crypted,
                                             uid_t uid);

Ask for a new account creation which will be stored into 'filename' which is the authentication file. Uppon success, user and pass will be updated to point on the configured username and password.

filename :

The filename to store account in.

user :

Address of a pointer where the created username will be stored.

pass :

Address of a pointer where the created password will be stored.

crypted :

Specify wether the password should be crypted using crypt().

uid :

UID of authentication file owner.

Returns :

0 on sucess, -1 otherwise


prelude_auth_create_account_noprompt ()

int         prelude_auth_create_account_noprompt
                                            (const char *filename,
                                             const char *user,
                                             const char *pass,
                                             int crypted,
                                             uid_t uid);

Create specified account.

filename :

The filename to store account in.

user :

Username to create.

pass :

Password associated with username.

crypted :

Specify wether the password should be crypted using crypt().

uid :

UID of authentication file owner.

Returns :

0 on sucess, -1 otherwise


prelude_auth_check ()

int         prelude_auth_check              (const char *authfile,
                                             const char *user,
                                             const char *pass);

Check the used / pass pair match an entry in the authfile file.

authfile :

Filename containing username/password pair.

user :

Pointer on an username.

pass :

Pointer on a password.

Returns :

0 on success, -1 if an error occured or authentication failed.


user_does_not_exist

#define user_does_not_exist      -2


password_does_not_match

#define password_does_not_match  -3


prelude_auth_read_entry ()

int         prelude_auth_read_entry         (const char *authfile,
                                             const char *wanted_user,
                                             const char *wanted_pass,
                                             char **user,
                                             char **pass);

prelude_auth_read_entry() try to find wanted_user in authfile.

If wanted_user is NULL, the first entry in authfile is returned.

If wanted_password is not NULL and that wanted_user is found, the password will be compared and an error will be returned if they don't match.

authfile :

Filename containing username/password pair.

wanted_user :

Pointer to an username.

wanted_pass :

Pointer to a password.

user :

Address of a pointer where username should be stored.

pass :

Address of a pointer where password should be stored.

Returns :

0 on success, -1 for generic error, password_does_not match, user_does_not_exist.