1 /* vi: set sw=4 ts=4: */
2 /* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4 
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9 
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, write to the Free
17    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18    02111-1307 USA.  */
19 
20 /* Declaration of types and functions for shadow password suite */
21 
22 #ifndef BB_SHADOW_H
23 #define BB_SHADOW_H 1
24 
25 PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
26 
27 /* Structure of the password file */
28 struct spwd {
29 	char *sp_namp;          /* Login name */
30 	char *sp_pwdp;          /* Encrypted password */
31 	long sp_lstchg;         /* Date of last change */
32 	long sp_min;            /* Minimum number of days between changes */
33 	long sp_max;            /* Maximum number of days between changes */
34 	long sp_warn;           /* Number of days to warn user to change the password */
35 	long sp_inact;          /* Number of days the account may be inactive */
36 	long sp_expire;         /* Number of days since 1970-01-01 until account expires */
37 	unsigned long sp_flag;  /* Reserved */
38 };
39 
40 #define setspent    bb_internal_setspent
41 #define endspent    bb_internal_endspent
42 #define getspent    bb_internal_getspent
43 #define getspnam    bb_internal_getspnam
44 #define sgetspent   bb_internal_sgetspent
45 #define fgetspent   bb_internal_fgetspent
46 #define putspent    bb_internal_putspent
47 #define getspent_r  bb_internal_getspent_r
48 #define getspnam_r  bb_internal_getspnam_r
49 #define sgetspent_r bb_internal_sgetspent_r
50 #define fgetspent_r bb_internal_fgetspent_r
51 #define lckpwdf     bb_internal_lckpwdf
52 #define ulckpwdf    bb_internal_ulckpwdf
53 
54 
55 /* All function names below should be remapped by #defines above
56  * in order to not collide with libc names. */
57 
58 #ifdef UNUSED_FOR_NOW
59 /* Open database for reading */
60 void FAST_FUNC setspent(void);
61 
62 /* Close database */
63 void FAST_FUNC endspent(void);
64 
65 /* Get next entry from database, perhaps after opening the file */
66 struct spwd* FAST_FUNC getspent(void);
67 
68 /* Get shadow entry matching NAME */
69 struct spwd* FAST_FUNC getspnam(const char *__name);
70 
71 /* Read shadow entry from STRING */
72 struct spwd* FAST_FUNC sgetspent(const char *__string);
73 
74 /* Read next shadow entry from STREAM */
75 struct spwd* FAST_FUNC fgetspent(FILE *__stream);
76 
77 /* Write line containing shadow password entry to stream */
78 int FAST_FUNC putspent(const struct spwd *__p, FILE *__stream);
79 
80 /* Reentrant versions of some of the functions above */
81 int FAST_FUNC getspent_r(struct spwd *__result_buf, char *__buffer,
82 		size_t __buflen, struct spwd **__result);
83 #endif
84 
85 int FAST_FUNC getspnam_r(const char *__name, struct spwd *__result_buf,
86 		char *__buffer, size_t __buflen,
87 		struct spwd **__result);
88 
89 #ifdef UNUSED_FOR_NOW
90 int FAST_FUNC sgetspent_r(const char *__string, struct spwd *__result_buf,
91 		char *__buffer, size_t __buflen,
92 		struct spwd **__result);
93 
94 int FAST_FUNC fgetspent_r(FILE *__stream, struct spwd *__result_buf,
95 		char *__buffer, size_t __buflen,
96 		struct spwd **__result);
97 /* Protect password file against multi writers */
98 int FAST_FUNC lckpwdf(void);
99 
100 /* Unlock password file */
101 int FAST_FUNC ulckpwdf(void);
102 #endif
103 
104 POP_SAVED_FUNCTION_VISIBILITY
105 
106 #endif /* shadow.h */
107