diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/grp_.h | 74 | ||||
-rw-r--r-- | include/pwd_.h | 71 | ||||
-rw-r--r-- | include/shadow_.h | 26 |
3 files changed, 114 insertions, 57 deletions
diff --git a/include/grp_.h b/include/grp_.h index b34addfa2..061b86ef7 100644 --- a/include/grp_.h +++ b/include/grp_.h | |||
@@ -21,50 +21,71 @@ | |||
21 | * POSIX Standard: 9.2.1 Group Database Access <grp.h> | 21 | * POSIX Standard: 9.2.1 Group Database Access <grp.h> |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #if !ENABLE_USE_BB_PWD_GRP | ||
24 | 25 | ||
25 | #if !defined CONFIG_USE_BB_PWD_GRP | ||
26 | #include <grp.h> | 26 | #include <grp.h> |
27 | 27 | ||
28 | #else | 28 | #else |
29 | 29 | ||
30 | #ifndef _GRP_H | 30 | #ifndef _GRP_H |
31 | #define _GRP_H 1 | 31 | #define _GRP_H 1 |
32 | |||
33 | #include <sys/types.h> | ||
34 | #include <features.h> | ||
35 | #include <stdio.h> | ||
36 | 32 | ||
37 | /* The group structure. */ | 33 | /* The group structure. */ |
38 | struct group | 34 | struct group { |
39 | { | 35 | char *gr_name; /* Group name. */ |
40 | char *gr_name; /* Group name. */ | 36 | char *gr_passwd; /* Password. */ |
41 | char *gr_passwd; /* Password. */ | 37 | gid_t gr_gid; /* Group ID. */ |
42 | gid_t gr_gid; /* Group ID. */ | 38 | char **gr_mem; /* Member list. */ |
43 | char **gr_mem; /* Member list. */ | ||
44 | }; | 39 | }; |
45 | 40 | ||
41 | /* We don't reimplement this, just supplying prototype */ | ||
42 | /* The function itself is in libc */ | ||
43 | /* Set the group set for the current user to GROUPS (N of them). */ | ||
44 | extern int setgroups(size_t __n, __const gid_t *__groups); | ||
45 | |||
46 | |||
47 | #define setgrent bb_internal_setgrent | ||
48 | #define endgrent bb_internal_endgrent | ||
49 | #define getgrent bb_internal_getgrent | ||
50 | #define fgetgrent bb_internal_fgetgrent | ||
51 | #define putgrent bb_internal_putgrent | ||
52 | #define getgrgid bb_internal_getgrgid | ||
53 | #define getgrnam bb_internal_getgrnam | ||
54 | #define getgrent_r bb_internal_getgrent_r | ||
55 | #define getgrgid_r bb_internal_getgrgid_r | ||
56 | #define getgrnam_r bb_internal_getgrnam_r | ||
57 | #define fgetgrent_r bb_internal_fgetgrent_r | ||
58 | #define getgrouplist bb_internal_getgrouplist | ||
59 | #define initgroups bb_internal_initgroups | ||
60 | |||
61 | |||
62 | /* All function names below should be remapped by #defines above | ||
63 | * in order to not collide with libc names. | ||
64 | * In theory it isn't necessary, but I saw weird interactions at link time. | ||
65 | * Let's play safe */ | ||
66 | |||
46 | 67 | ||
47 | /* Rewind the group-file stream. */ | 68 | /* Rewind the group-file stream. */ |
48 | extern void setgrent (void); | 69 | extern void setgrent(void); |
49 | 70 | ||
50 | /* Close the group-file stream. */ | 71 | /* Close the group-file stream. */ |
51 | extern void endgrent (void); | 72 | extern void endgrent(void); |
52 | 73 | ||
53 | /* Read an entry from the group-file stream, opening it if necessary. */ | 74 | /* Read an entry from the group-file stream, opening it if necessary. */ |
54 | extern struct group *getgrent (void); | 75 | extern struct group *getgrent(void); |
55 | 76 | ||
56 | /* Read a group entry from STREAM. */ | 77 | /* Read a group entry from STREAM. */ |
57 | extern struct group *fgetgrent (FILE *__stream); | 78 | extern struct group *fgetgrent(FILE *__stream); |
58 | 79 | ||
59 | /* Write the given entry onto the given stream. */ | 80 | /* Write the given entry onto the given stream. */ |
60 | extern int putgrent (__const struct group *__restrict __p, | 81 | extern int putgrent(__const struct group *__restrict __p, |
61 | FILE *__restrict __f); | 82 | FILE *__restrict __f); |
62 | 83 | ||
63 | /* Search for an entry with a matching group ID. */ | 84 | /* Search for an entry with a matching group ID. */ |
64 | extern struct group *getgrgid (gid_t __gid); | 85 | extern struct group *getgrgid(gid_t __gid); |
65 | 86 | ||
66 | /* Search for an entry with a matching group name. */ | 87 | /* Search for an entry with a matching group name. */ |
67 | extern struct group *getgrnam (__const char *__name); | 88 | extern struct group *getgrnam(__const char *__name); |
68 | 89 | ||
69 | /* Reentrant versions of some of the functions above. | 90 | /* Reentrant versions of some of the functions above. |
70 | 91 | ||
@@ -74,41 +95,38 @@ extern struct group *getgrnam (__const char *__name); | |||
74 | other reentrant functions so the chances are good this is what the | 95 | other reentrant functions so the chances are good this is what the |
75 | POSIX people would choose. */ | 96 | POSIX people would choose. */ |
76 | 97 | ||
77 | extern int getgrent_r (struct group *__restrict __resultbuf, | 98 | extern int getgrent_r(struct group *__restrict __resultbuf, |
78 | char *__restrict __buffer, size_t __buflen, | 99 | char *__restrict __buffer, size_t __buflen, |
79 | struct group **__restrict __result); | 100 | struct group **__restrict __result); |
80 | 101 | ||
81 | /* Search for an entry with a matching group ID. */ | 102 | /* Search for an entry with a matching group ID. */ |
82 | extern int getgrgid_r (gid_t __gid, struct group *__restrict __resultbuf, | 103 | extern int getgrgid_r(gid_t __gid, struct group *__restrict __resultbuf, |
83 | char *__restrict __buffer, size_t __buflen, | 104 | char *__restrict __buffer, size_t __buflen, |
84 | struct group **__restrict __result); | 105 | struct group **__restrict __result); |
85 | 106 | ||
86 | /* Search for an entry with a matching group name. */ | 107 | /* Search for an entry with a matching group name. */ |
87 | extern int getgrnam_r (__const char *__restrict __name, | 108 | extern int getgrnam_r(__const char *__restrict __name, |
88 | struct group *__restrict __resultbuf, | 109 | struct group *__restrict __resultbuf, |
89 | char *__restrict __buffer, size_t __buflen, | 110 | char *__restrict __buffer, size_t __buflen, |
90 | struct group **__restrict __result); | 111 | struct group **__restrict __result); |
91 | 112 | ||
92 | /* Read a group entry from STREAM. This function is not standardized | 113 | /* Read a group entry from STREAM. This function is not standardized |
93 | an probably never will. */ | 114 | an probably never will. */ |
94 | extern int fgetgrent_r (FILE *__restrict __stream, | 115 | extern int fgetgrent_r(FILE *__restrict __stream, |
95 | struct group *__restrict __resultbuf, | 116 | struct group *__restrict __resultbuf, |
96 | char *__restrict __buffer, size_t __buflen, | 117 | char *__restrict __buffer, size_t __buflen, |
97 | struct group **__restrict __result); | 118 | struct group **__restrict __result); |
98 | 119 | ||
99 | /* Set the group set for the current user to GROUPS (N of them). */ | ||
100 | extern int setgroups (size_t __n, __const gid_t *__groups); | ||
101 | |||
102 | /* Store at most *NGROUPS members of the group set for USER into | 120 | /* Store at most *NGROUPS members of the group set for USER into |
103 | *GROUPS. Also include GROUP. The actual number of groups found is | 121 | *GROUPS. Also include GROUP. The actual number of groups found is |
104 | returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. */ | 122 | returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. */ |
105 | extern int getgrouplist (__const char *__user, gid_t __group, | 123 | extern int getgrouplist(__const char *__user, gid_t __group, |
106 | gid_t *__groups, int *__ngroups); | 124 | gid_t *__groups, int *__ngroups); |
107 | 125 | ||
108 | /* Initialize the group set for the current user | 126 | /* Initialize the group set for the current user |
109 | by reading the group database and using all groups | 127 | by reading the group database and using all groups |
110 | of which USER is a member. Also include GROUP. */ | 128 | of which USER is a member. Also include GROUP. */ |
111 | extern int initgroups (__const char *__user, gid_t __group); | 129 | extern int initgroups(__const char *__user, gid_t __group); |
112 | 130 | ||
113 | 131 | ||
114 | #endif /* grp.h */ | 132 | #endif /* grp.h */ |
diff --git a/include/pwd_.h b/include/pwd_.h index d161c0e8f..f47e4eb2c 100644 --- a/include/pwd_.h +++ b/include/pwd_.h | |||
@@ -21,52 +21,68 @@ | |||
21 | * POSIX Standard: 9.2.2 User Database Access <pwd.h> | 21 | * POSIX Standard: 9.2.2 User Database Access <pwd.h> |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #if !defined CONFIG_USE_BB_PWD_GRP | 24 | #if !ENABLE_USE_BB_PWD_GRP |
25 | |||
25 | #include <pwd.h> | 26 | #include <pwd.h> |
26 | 27 | ||
27 | #else | 28 | #else |
28 | 29 | ||
29 | #ifndef _PWD_H | 30 | #ifndef _PWD_H |
30 | #define _PWD_H 1 | 31 | #define _PWD_H 1 |
31 | |||
32 | #include <sys/types.h> | ||
33 | #include <features.h> | ||
34 | #include <stdio.h> | ||
35 | 32 | ||
36 | /* The passwd structure. */ | 33 | /* The passwd structure. */ |
37 | struct passwd | 34 | struct passwd { |
38 | { | 35 | char *pw_name; /* Username. */ |
39 | char *pw_name; /* Username. */ | 36 | char *pw_passwd; /* Password. */ |
40 | char *pw_passwd; /* Password. */ | 37 | uid_t pw_uid; /* User ID. */ |
41 | uid_t pw_uid; /* User ID. */ | 38 | gid_t pw_gid; /* Group ID. */ |
42 | gid_t pw_gid; /* Group ID. */ | 39 | char *pw_gecos; /* Real name. */ |
43 | char *pw_gecos; /* Real name. */ | 40 | char *pw_dir; /* Home directory. */ |
44 | char *pw_dir; /* Home directory. */ | 41 | char *pw_shell; /* Shell program. */ |
45 | char *pw_shell; /* Shell program. */ | ||
46 | }; | 42 | }; |
47 | 43 | ||
48 | 44 | ||
45 | #define setpwent bb_internal_setpwent | ||
46 | #define endpwent bb_internal_endpwent | ||
47 | #define getpwent bb_internal_getpwent | ||
48 | #define fgetpwent bb_internal_fgetpwent | ||
49 | #define putpwent bb_internal_putpwent | ||
50 | #define getpwuid bb_internal_getpwuid | ||
51 | #define getpwnam bb_internal_getpwnam | ||
52 | #define getpwent_r bb_internal_getpwent_r | ||
53 | #define getpwuid_r bb_internal_getpwuid_r | ||
54 | #define getpwnam_r bb_internal_getpwnam_r | ||
55 | #define fgetpwent_r bb_internal_fgetpwent_r | ||
56 | #define getpw bb_internal_getpw | ||
57 | |||
58 | |||
59 | /* All function names below should be remapped by #defines above | ||
60 | * in order to not collide with libc names. | ||
61 | * In theory it isn't necessary, but I saw weird interactions at link time. | ||
62 | * Let's play safe */ | ||
63 | |||
64 | |||
49 | /* Rewind the password-file stream. */ | 65 | /* Rewind the password-file stream. */ |
50 | extern void setpwent (void); | 66 | extern void setpwent(void); |
51 | 67 | ||
52 | /* Close the password-file stream. */ | 68 | /* Close the password-file stream. */ |
53 | extern void endpwent (void); | 69 | extern void endpwent(void); |
54 | 70 | ||
55 | /* Read an entry from the password-file stream, opening it if necessary. */ | 71 | /* Read an entry from the password-file stream, opening it if necessary. */ |
56 | extern struct passwd *getpwent (void); | 72 | extern struct passwd *getpwent(void); |
57 | 73 | ||
58 | /* Read an entry from STREAM. */ | 74 | /* Read an entry from STREAM. */ |
59 | extern struct passwd *fgetpwent (FILE *__stream); | 75 | extern struct passwd *fgetpwent(FILE *__stream); |
60 | 76 | ||
61 | /* Write the given entry onto the given stream. */ | 77 | /* Write the given entry onto the given stream. */ |
62 | extern int putpwent (__const struct passwd *__restrict __p, | 78 | extern int putpwent(__const struct passwd *__restrict __p, |
63 | FILE *__restrict __f); | 79 | FILE *__restrict __f); |
64 | 80 | ||
65 | /* Search for an entry with a matching user ID. */ | 81 | /* Search for an entry with a matching user ID. */ |
66 | extern struct passwd *getpwuid (uid_t __uid); | 82 | extern struct passwd *getpwuid(uid_t __uid); |
67 | 83 | ||
68 | /* Search for an entry with a matching username. */ | 84 | /* Search for an entry with a matching username. */ |
69 | extern struct passwd *getpwnam (__const char *__name); | 85 | extern struct passwd *getpwnam(__const char *__name); |
70 | 86 | ||
71 | /* Reentrant versions of some of the functions above. | 87 | /* Reentrant versions of some of the functions above. |
72 | 88 | ||
@@ -76,24 +92,23 @@ extern struct passwd *getpwnam (__const char *__name); | |||
76 | other reentrant functions so the chances are good this is what the | 92 | other reentrant functions so the chances are good this is what the |
77 | POSIX people would choose. */ | 93 | POSIX people would choose. */ |
78 | 94 | ||
79 | extern int getpwent_r (struct passwd *__restrict __resultbuf, | 95 | extern int getpwent_r(struct passwd *__restrict __resultbuf, |
80 | char *__restrict __buffer, size_t __buflen, | 96 | char *__restrict __buffer, size_t __buflen, |
81 | struct passwd **__restrict __result); | 97 | struct passwd **__restrict __result); |
82 | 98 | ||
83 | extern int getpwuid_r (uid_t __uid, | 99 | extern int getpwuid_r(uid_t __uid, |
84 | struct passwd *__restrict __resultbuf, | 100 | struct passwd *__restrict __resultbuf, |
85 | char *__restrict __buffer, size_t __buflen, | 101 | char *__restrict __buffer, size_t __buflen, |
86 | struct passwd **__restrict __result); | 102 | struct passwd **__restrict __result); |
87 | 103 | ||
88 | extern int getpwnam_r (__const char *__restrict __name, | 104 | extern int getpwnam_r(__const char *__restrict __name, |
89 | struct passwd *__restrict __resultbuf, | 105 | struct passwd *__restrict __resultbuf, |
90 | char *__restrict __buffer, size_t __buflen, | 106 | char *__restrict __buffer, size_t __buflen, |
91 | struct passwd **__restrict __result); | 107 | struct passwd **__restrict __result); |
92 | 108 | ||
93 | |||
94 | /* Read an entry from STREAM. This function is not standardized and | 109 | /* Read an entry from STREAM. This function is not standardized and |
95 | probably never will. */ | 110 | probably never will. */ |
96 | extern int fgetpwent_r (FILE *__restrict __stream, | 111 | extern int fgetpwent_r(FILE *__restrict __stream, |
97 | struct passwd *__restrict __resultbuf, | 112 | struct passwd *__restrict __resultbuf, |
98 | char *__restrict __buffer, size_t __buflen, | 113 | char *__restrict __buffer, size_t __buflen, |
99 | struct passwd **__restrict __result); | 114 | struct passwd **__restrict __result); |
@@ -101,7 +116,7 @@ extern int fgetpwent_r (FILE *__restrict __stream, | |||
101 | /* Re-construct the password-file line for the given uid | 116 | /* Re-construct the password-file line for the given uid |
102 | in the given buffer. This knows the format that the caller | 117 | in the given buffer. This knows the format that the caller |
103 | will expect, but this need not be the format of the password file. */ | 118 | will expect, but this need not be the format of the password file. */ |
104 | extern int getpw (uid_t __uid, char *__buffer); | 119 | extern int getpw(uid_t __uid, char *__buffer); |
105 | 120 | ||
106 | #endif /* pwd.h */ | 121 | #endif /* pwd.h */ |
107 | #endif | 122 | #endif |
diff --git a/include/shadow_.h b/include/shadow_.h index 634dfb466..fb2153c52 100644 --- a/include/shadow_.h +++ b/include/shadow_.h | |||
@@ -20,11 +20,13 @@ | |||
20 | /* Declaration of types and functions for shadow password suite */ | 20 | /* Declaration of types and functions for shadow password suite */ |
21 | 21 | ||
22 | #if !ENABLE_USE_BB_SHADOW | 22 | #if !ENABLE_USE_BB_SHADOW |
23 | |||
23 | #include <shadow.h> | 24 | #include <shadow.h> |
25 | |||
24 | #else | 26 | #else |
25 | 27 | ||
26 | #ifndef _SHADOW_H | 28 | #ifndef _SHADOW_H |
27 | #define _SHADOW_H 1 | 29 | #define _SHADOW_H 1 |
28 | 30 | ||
29 | /* Paths to the user database files */ | 31 | /* Paths to the user database files */ |
30 | #ifndef _PATH_SHADOW | 32 | #ifndef _PATH_SHADOW |
@@ -44,6 +46,28 @@ struct spwd { | |||
44 | unsigned long int sp_flag; /* Reserved */ | 46 | unsigned long int sp_flag; /* Reserved */ |
45 | }; | 47 | }; |
46 | 48 | ||
49 | |||
50 | #define setspent bb_internal_setspent | ||
51 | #define endspent bb_internal_endspent | ||
52 | #define getspent bb_internal_getspent | ||
53 | #define getspnam bb_internal_getspnam | ||
54 | #define sgetspent bb_internal_sgetspent | ||
55 | #define fgetspent bb_internal_fgetspent | ||
56 | #define putspent bb_internal_putspent | ||
57 | #define getspent_r bb_internal_getspent_r | ||
58 | #define getspnam_r bb_internal_getspnam_r | ||
59 | #define sgetspent_r bb_internal_sgetspent_r | ||
60 | #define fgetspent_r bb_internal_fgetspent_r | ||
61 | #define lckpwdf bb_internal_lckpwdf | ||
62 | #define ulckpwdf bb_internal_ulckpwdf | ||
63 | |||
64 | |||
65 | /* All function names below should be remapped by #defines above | ||
66 | * in order to not collide with libc names. | ||
67 | * In theory it isn't necessary, but I saw weird interactions at link time. | ||
68 | * Let's play safe */ | ||
69 | |||
70 | |||
47 | /* Open database for reading */ | 71 | /* Open database for reading */ |
48 | extern void setspent(void); | 72 | extern void setspent(void); |
49 | 73 | ||