MentOS  0.8.0
The Mentoring Operating System
Classes | Typedefs | Functions
pwd.h File Reference

Contains the structure and functions for managing passwords. More...

Go to the source code of this file.

Classes

struct  passwd_t
 Stores user account information. More...
 

Typedefs

typedef struct passwd_t passwd_t
 Stores user account information.
 

Functions

passwd_tgetpwnam (const char *name)
 Provides access to the password database entry for name. More...
 
passwd_tgetpwuid (uid_t uid)
 Provides access to the password database entry for uid. More...
 
int getpwnam_r (const char *name, passwd_t *pwd, char *buf, size_t buflen, passwd_t **result)
 Provides the same information as getpwnam but it stores the results inside pwd, and the string information are store store inside buf. More...
 
int getpwuid_r (uid_t uid, passwd_t *pwd, char *buf, size_t buflen, passwd_t **result)
 Provides the same information as getpwuid but it stores the results inside pwd, and the string information are store store inside buf. More...
 

Detailed Description

Contains the structure and functions for managing passwords.

Function Documentation

◆ getpwnam()

passwd_t* getpwnam ( const char *  name)

Provides access to the password database entry for name.

Parameters
nameThe name to search inside the database.
Returns
A pointer to the structure containing the database entry.

◆ getpwnam_r()

int getpwnam_r ( const char *  name,
passwd_t pwd,
char *  buf,
size_t  buflen,
passwd_t **  result 
)

Provides the same information as getpwnam but it stores the results inside pwd, and the string information are store store inside buf.

Parameters
nameThe name to search inside the database.
pwdThe structure containing pointers to the entry fields.
bufThe buffer where the strings should be stored.
buflenThe lenght of the buffer.
resultA pointer to the result or NULL is stored here.
Returns
If the entry was found returns zero and set *result to pwd, if the entry was not found returns zero and set *result to NULL, on failure returns a number and sets and set *result to NULL.

◆ getpwuid()

passwd_t* getpwuid ( uid_t  uid)

Provides access to the password database entry for uid.

Parameters
uidThe uid to search inside the database.
Returns
A pointer to the structure containing the database entry.

◆ getpwuid_r()

int getpwuid_r ( uid_t  uid,
passwd_t pwd,
char *  buf,
size_t  buflen,
passwd_t **  result 
)

Provides the same information as getpwuid but it stores the results inside pwd, and the string information are store store inside buf.

Parameters
uidThe uid to search inside the database.
pwdThe structure containing pointers to the entry fields.
bufThe buffer where the strings should be stored.
buflenThe lenght of the buffer.
resultA pointer to the result or NULL is stored here.
Returns
If the entry was found returns zero and set *result to pwd, if the entry was not found returns zero and set *result to NULL, on failure returns a number and sets and set *result to NULL.