diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-09-26 10:35:55 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-09-26 10:35:55 +0000 |
commit | ee5dce336597c76d674b570ed2c85041d50b6339 (patch) | |
tree | cd7ea0e60aff3fa129899319446dd3cce7b3ae39 /include/shadow_.h | |
parent | f1980f67d3b005090a31b7465d219e8ca19c5736 (diff) | |
download | busybox-w32-ee5dce336597c76d674b570ed2c85041d50b6339.tar.gz busybox-w32-ee5dce336597c76d674b570ed2c85041d50b6339.tar.bz2 busybox-w32-ee5dce336597c76d674b570ed2c85041d50b6339.zip |
libpwdgrp: make it coexist with <pwd.h>, <grp.h> and <shadow.h>.
allows to get rid of hacks in libbb.h (extra declaration of setgroups -
now it comes from grp.h as intended).
Diffstat (limited to 'include/shadow_.h')
-rw-r--r-- | include/shadow_.h | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/include/shadow_.h b/include/shadow_.h index 5a8b71a47..73bed8400 100644 --- a/include/shadow_.h +++ b/include/shadow_.h | |||
@@ -19,32 +19,23 @@ | |||
19 | 19 | ||
20 | /* Declaration of types and functions for shadow password suite */ | 20 | /* Declaration of types and functions for shadow password suite */ |
21 | 21 | ||
22 | #ifndef _SHADOW_H | 22 | #ifndef BB_SHADOW_H |
23 | #define _SHADOW_H 1 | 23 | #define BB_SHADOW_H 1 |
24 | 24 | ||
25 | #if __GNUC_PREREQ(4,1) | 25 | #if __GNUC_PREREQ(4,1) |
26 | # pragma GCC visibility push(hidden) | 26 | # pragma GCC visibility push(hidden) |
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | /* This file is #included after #include <shadow.h> | ||
30 | * We will use libc-defined structures, but will #define finction names | ||
31 | * so that function calls are directed to bb_internal_XXX replacements | ||
32 | */ | ||
33 | |||
29 | /* Paths to the user database files */ | 34 | /* Paths to the user database files */ |
30 | #ifndef _PATH_SHADOW | 35 | #ifndef _PATH_SHADOW |
31 | #define _PATH_SHADOW "/etc/shadow" | 36 | #define _PATH_SHADOW "/etc/shadow" |
32 | #endif | 37 | #endif |
33 | 38 | ||
34 | /* Structure of the password file */ | ||
35 | struct spwd { | ||
36 | char *sp_namp; /* Login name */ | ||
37 | char *sp_pwdp; /* Encrypted password */ | ||
38 | long sp_lstchg; /* Date of last change */ | ||
39 | long sp_min; /* Minimum number of days between changes */ | ||
40 | long sp_max; /* Maximum number of days between changes */ | ||
41 | long sp_warn; /* Number of days to warn user to change the password */ | ||
42 | long sp_inact; /* Number of days the account may be inactive */ | ||
43 | long sp_expire; /* Number of days since 1970-01-01 until account expires */ | ||
44 | unsigned long sp_flag; /* Reserved */ | ||
45 | }; | ||
46 | |||
47 | |||
48 | #define setspent bb_internal_setspent | 39 | #define setspent bb_internal_setspent |
49 | #define endspent bb_internal_endspent | 40 | #define endspent bb_internal_endspent |
50 | #define getspent bb_internal_getspent | 41 | #define getspent bb_internal_getspent |
@@ -61,9 +52,7 @@ struct spwd { | |||
61 | 52 | ||
62 | 53 | ||
63 | /* All function names below should be remapped by #defines above | 54 | /* All function names below should be remapped by #defines above |
64 | * in order to not collide with libc names. | 55 | * in order to not collide with libc names. */ |
65 | * In theory it isn't necessary, but I saw weird interactions at link time. | ||
66 | * Let's play safe */ | ||
67 | 56 | ||
68 | 57 | ||
69 | /* Open database for reading */ | 58 | /* Open database for reading */ |
@@ -76,26 +65,26 @@ extern void endspent(void); | |||
76 | extern struct spwd *getspent(void); | 65 | extern struct spwd *getspent(void); |
77 | 66 | ||
78 | /* Get shadow entry matching NAME */ | 67 | /* Get shadow entry matching NAME */ |
79 | extern struct spwd *getspnam(__const char *__name); | 68 | extern struct spwd *getspnam(const char *__name); |
80 | 69 | ||
81 | /* Read shadow entry from STRING */ | 70 | /* Read shadow entry from STRING */ |
82 | extern struct spwd *sgetspent(__const char *__string); | 71 | extern struct spwd *sgetspent(const char *__string); |
83 | 72 | ||
84 | /* Read next shadow entry from STREAM */ | 73 | /* Read next shadow entry from STREAM */ |
85 | extern struct spwd *fgetspent(FILE *__stream); | 74 | extern struct spwd *fgetspent(FILE *__stream); |
86 | 75 | ||
87 | /* Write line containing shadow password entry to stream */ | 76 | /* Write line containing shadow password entry to stream */ |
88 | extern int putspent(__const struct spwd *__p, FILE *__stream); | 77 | extern int putspent(const struct spwd *__p, FILE *__stream); |
89 | 78 | ||
90 | /* Reentrant versions of some of the functions above */ | 79 | /* Reentrant versions of some of the functions above */ |
91 | extern int getspent_r(struct spwd *__result_buf, char *__buffer, | 80 | extern int getspent_r(struct spwd *__result_buf, char *__buffer, |
92 | size_t __buflen, struct spwd **__result); | 81 | size_t __buflen, struct spwd **__result); |
93 | 82 | ||
94 | extern int getspnam_r(__const char *__name, struct spwd *__result_buf, | 83 | extern int getspnam_r(const char *__name, struct spwd *__result_buf, |
95 | char *__buffer, size_t __buflen, | 84 | char *__buffer, size_t __buflen, |
96 | struct spwd **__result); | 85 | struct spwd **__result); |
97 | 86 | ||
98 | extern int sgetspent_r(__const char *__string, struct spwd *__result_buf, | 87 | extern int sgetspent_r(const char *__string, struct spwd *__result_buf, |
99 | char *__buffer, size_t __buflen, | 88 | char *__buffer, size_t __buflen, |
100 | struct spwd **__result); | 89 | struct spwd **__result); |
101 | 90 | ||