21 |
* POSIX Standard: 9.2.2 User Database Access <pwd.h> |
* POSIX Standard: 9.2.2 User Database Access <pwd.h> |
22 |
*/ |
*/ |
23 |
|
|
24 |
#if !ENABLE_USE_BB_PWD_GRP |
#ifndef BB_PWD_H |
25 |
|
#define BB_PWD_H 1 |
26 |
|
|
27 |
#include <pwd.h> |
#if __GNUC_PREREQ(4,1) |
28 |
|
# pragma GCC visibility push(hidden) |
29 |
#else |
#endif |
|
|
|
|
#ifndef _PWD_H |
|
|
#define _PWD_H 1 |
|
|
|
|
|
/* The passwd structure. */ |
|
|
struct passwd { |
|
|
char *pw_name; /* Username. */ |
|
|
char *pw_passwd; /* Password. */ |
|
|
uid_t pw_uid; /* User ID. */ |
|
|
gid_t pw_gid; /* Group ID. */ |
|
|
char *pw_gecos; /* Real name. */ |
|
|
char *pw_dir; /* Home directory. */ |
|
|
char *pw_shell; /* Shell program. */ |
|
|
}; |
|
30 |
|
|
31 |
|
/* This file is #included after #include <pwd.h> |
32 |
|
* We will use libc-defined structures, but will #define function names |
33 |
|
* so that function calls are directed to bb_internal_XXX replacements |
34 |
|
*/ |
35 |
|
|
36 |
#define setpwent bb_internal_setpwent |
#define setpwent bb_internal_setpwent |
37 |
#define endpwent bb_internal_endpwent |
#define endpwent bb_internal_endpwent |
44 |
#define getpwuid_r bb_internal_getpwuid_r |
#define getpwuid_r bb_internal_getpwuid_r |
45 |
#define getpwnam_r bb_internal_getpwnam_r |
#define getpwnam_r bb_internal_getpwnam_r |
46 |
#define fgetpwent_r bb_internal_fgetpwent_r |
#define fgetpwent_r bb_internal_fgetpwent_r |
47 |
#define getpw bb_internal_getpw |
//#define getpw bb_internal_getpw |
48 |
|
|
49 |
|
|
50 |
/* All function names below should be remapped by #defines above |
/* All function names below should be remapped by #defines above |
51 |
* in order to not collide with libc names. |
* in order to not collide with libc names. */ |
|
* In theory it isn't necessary, but I saw weird interactions at link time. |
|
|
* Let's play safe */ |
|
52 |
|
|
53 |
|
|
54 |
/* Rewind the password-file stream. */ |
/* Rewind the password-file stream. */ |
64 |
extern struct passwd *fgetpwent(FILE *__stream); |
extern struct passwd *fgetpwent(FILE *__stream); |
65 |
|
|
66 |
/* Write the given entry onto the given stream. */ |
/* Write the given entry onto the given stream. */ |
67 |
extern int putpwent(__const struct passwd *__restrict __p, |
extern int putpwent(const struct passwd *__restrict __p, |
68 |
FILE *__restrict __f); |
FILE *__restrict __f); |
69 |
|
|
70 |
/* Search for an entry with a matching user ID. */ |
/* Search for an entry with a matching user ID. */ |
71 |
extern struct passwd *getpwuid(uid_t __uid); |
extern struct passwd *getpwuid(uid_t __uid); |
72 |
|
|
73 |
/* Search for an entry with a matching username. */ |
/* Search for an entry with a matching username. */ |
74 |
extern struct passwd *getpwnam(__const char *__name); |
extern struct passwd *getpwnam(const char *__name); |
75 |
|
|
76 |
/* Reentrant versions of some of the functions above. |
/* Reentrant versions of some of the functions above. |
77 |
|
|
90 |
char *__restrict __buffer, size_t __buflen, |
char *__restrict __buffer, size_t __buflen, |
91 |
struct passwd **__restrict __result); |
struct passwd **__restrict __result); |
92 |
|
|
93 |
extern int getpwnam_r(__const char *__restrict __name, |
extern int getpwnam_r(const char *__restrict __name, |
94 |
struct passwd *__restrict __resultbuf, |
struct passwd *__restrict __resultbuf, |
95 |
char *__restrict __buffer, size_t __buflen, |
char *__restrict __buffer, size_t __buflen, |
96 |
struct passwd **__restrict __result); |
struct passwd **__restrict __result); |
105 |
/* Re-construct the password-file line for the given uid |
/* Re-construct the password-file line for the given uid |
106 |
in the given buffer. This knows the format that the caller |
in the given buffer. This knows the format that the caller |
107 |
will expect, but this need not be the format of the password file. */ |
will expect, but this need not be the format of the password file. */ |
108 |
extern int getpw(uid_t __uid, char *__buffer); |
/* UNUSED extern int getpw(uid_t __uid, char *__buffer); */ |
109 |
|
|
110 |
#endif /* pwd.h */ |
#if __GNUC_PREREQ(4,1) |
111 |
|
# pragma GCC visibility pop |
112 |
#endif |
#endif |
113 |
|
|
114 |
|
#endif /* pwd.h */ |