diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/libbb.h | 2 | ||||
-rw-r--r-- | include/shadow_.h | 87 |
2 files changed, 39 insertions, 50 deletions
diff --git a/include/libbb.h b/include/libbb.h index ece1c9d91..6948695e9 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -51,9 +51,7 @@ | |||
51 | 51 | ||
52 | #include "pwd_.h" | 52 | #include "pwd_.h" |
53 | #include "grp_.h" | 53 | #include "grp_.h" |
54 | #if ENABLE_FEATURE_SHADOWPASSWDS | ||
55 | #include "shadow_.h" | 54 | #include "shadow_.h" |
56 | #endif | ||
57 | 55 | ||
58 | /* Try to pull in PATH_MAX */ | 56 | /* Try to pull in PATH_MAX */ |
59 | #include <limits.h> | 57 | #include <limits.h> |
diff --git a/include/shadow_.h b/include/shadow_.h index 177ee5f93..634dfb466 100644 --- a/include/shadow_.h +++ b/include/shadow_.h | |||
@@ -17,83 +17,74 @@ | |||
17 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | 17 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
18 | 02111-1307 USA. */ | 18 | 02111-1307 USA. */ |
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 | #if !defined CONFIG_USE_BB_SHADOW | 22 | #if !ENABLE_USE_BB_SHADOW |
23 | #include <shadow.h> | 23 | #include <shadow.h> |
24 | #else | 24 | #else |
25 | 25 | ||
26 | #ifndef _SHADOW_H | 26 | #ifndef _SHADOW_H |
27 | #define _SHADOW_H 1 | 27 | #define _SHADOW_H 1 |
28 | 28 | ||
29 | #include <stdio.h> | 29 | /* Paths to the user database files */ |
30 | |||
31 | /* Paths to the user database files. */ | ||
32 | #ifndef _PATH_SHADOW | 30 | #ifndef _PATH_SHADOW |
33 | #define _PATH_SHADOW "/etc/shadow" | 31 | #define _PATH_SHADOW "/etc/shadow" |
34 | #endif | 32 | #endif |
35 | #define SHADOW _PATH_SHADOW | ||
36 | |||
37 | |||
38 | /* Structure of the password file. */ | ||
39 | struct spwd | ||
40 | { | ||
41 | char *sp_namp; /* Login name. */ | ||
42 | char *sp_pwdp; /* Encrypted password. */ | ||
43 | long int sp_lstchg; /* Date of last change. */ | ||
44 | long int sp_min; /* Minimum number of days between changes. */ | ||
45 | long int sp_max; /* Maximum number of days between changes. */ | ||
46 | long int sp_warn; /* Number of days to warn user to change | ||
47 | the password. */ | ||
48 | long int sp_inact; /* Number of days the account may be | ||
49 | inactive. */ | ||
50 | long int sp_expire; /* Number of days since 1970-01-01 until | ||
51 | account expires. */ | ||
52 | unsigned long int sp_flag; /* Reserved. */ | ||
53 | }; | ||
54 | 33 | ||
34 | /* Structure of the password file */ | ||
35 | struct spwd { | ||
36 | char *sp_namp; /* Login name */ | ||
37 | char *sp_pwdp; /* Encrypted password */ | ||
38 | long int sp_lstchg; /* Date of last change */ | ||
39 | long int sp_min; /* Minimum number of days between changes */ | ||
40 | long int sp_max; /* Maximum number of days between changes */ | ||
41 | long int sp_warn; /* Number of days to warn user to change the password */ | ||
42 | long int sp_inact; /* Number of days the account may be inactive */ | ||
43 | long int sp_expire; /* Number of days since 1970-01-01 until account expires */ | ||
44 | unsigned long int sp_flag; /* Reserved */ | ||
45 | }; | ||
55 | 46 | ||
56 | /* Open database for reading. */ | 47 | /* Open database for reading */ |
57 | extern void setspent (void); | 48 | extern void setspent(void); |
58 | 49 | ||
59 | /* Close database. */ | 50 | /* Close database */ |
60 | extern void endspent (void); | 51 | extern void endspent(void); |
61 | 52 | ||
62 | /* Get next entry from database, perhaps after opening the file. */ | 53 | /* Get next entry from database, perhaps after opening the file */ |
63 | extern struct spwd *getspent (void); | 54 | extern struct spwd *getspent(void); |
64 | 55 | ||
65 | /* Get shadow entry matching NAME. */ | 56 | /* Get shadow entry matching NAME */ |
66 | extern struct spwd *getspnam (__const char *__name); | 57 | extern struct spwd *getspnam(__const char *__name); |
67 | 58 | ||
68 | /* Read shadow entry from STRING. */ | 59 | /* Read shadow entry from STRING */ |
69 | extern struct spwd *sgetspent (__const char *__string); | 60 | extern struct spwd *sgetspent(__const char *__string); |
70 | 61 | ||
71 | /* Read next shadow entry from STREAM. */ | 62 | /* Read next shadow entry from STREAM */ |
72 | extern struct spwd *fgetspent (FILE *__stream); | 63 | extern struct spwd *fgetspent(FILE *__stream); |
73 | 64 | ||
74 | /* Write line containing shadow password entry to stream. */ | 65 | /* Write line containing shadow password entry to stream */ |
75 | extern int putspent (__const struct spwd *__p, FILE *__stream); | 66 | extern int putspent(__const struct spwd *__p, FILE *__stream); |
76 | 67 | ||
77 | /* Reentrant versions of some of the functions above. */ | 68 | /* Reentrant versions of some of the functions above */ |
78 | extern int getspent_r (struct spwd *__result_buf, char *__buffer, | 69 | extern int getspent_r(struct spwd *__result_buf, char *__buffer, |
79 | size_t __buflen, struct spwd **__result); | 70 | size_t __buflen, struct spwd **__result); |
80 | 71 | ||
81 | extern int getspnam_r (__const char *__name, struct spwd *__result_buf, | 72 | extern int getspnam_r(__const char *__name, struct spwd *__result_buf, |
82 | char *__buffer, size_t __buflen, | 73 | char *__buffer, size_t __buflen, |
83 | struct spwd **__result); | 74 | struct spwd **__result); |
84 | 75 | ||
85 | extern int sgetspent_r (__const char *__string, struct spwd *__result_buf, | 76 | extern int sgetspent_r(__const char *__string, struct spwd *__result_buf, |
86 | char *__buffer, size_t __buflen, | 77 | char *__buffer, size_t __buflen, |
87 | struct spwd **__result); | 78 | struct spwd **__result); |
88 | 79 | ||
89 | extern int fgetspent_r (FILE *__stream, struct spwd *__result_buf, | 80 | extern int fgetspent_r(FILE *__stream, struct spwd *__result_buf, |
90 | char *__buffer, size_t __buflen, | 81 | char *__buffer, size_t __buflen, |
91 | struct spwd **__result); | 82 | struct spwd **__result); |
92 | /* Protect password file against multi writers. */ | 83 | /* Protect password file against multi writers */ |
93 | extern int lckpwdf (void); | 84 | extern int lckpwdf(void); |
94 | 85 | ||
95 | /* Unlock password file. */ | 86 | /* Unlock password file */ |
96 | extern int ulckpwdf (void); | 87 | extern int ulckpwdf(void); |
97 | 88 | ||
98 | #endif /* shadow.h */ | 89 | #endif /* shadow.h */ |
99 | #endif | 90 | #endif |