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.
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.
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.
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
20 /* Declaration of types and functions for shadow password suite */
25 #if __GNUC_PREREQ(4,1)
26 # pragma GCC visibility push(hidden)
29 /* Paths to the user database files */
31 #define _PATH_SHADOW "/etc/shadow"
34 /* Structure of the password file */
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 */
48 #define setspent bb_internal_setspent
49 #define endspent bb_internal_endspent
50 #define getspent bb_internal_getspent
51 #define getspnam bb_internal_getspnam
52 #define sgetspent bb_internal_sgetspent
53 #define fgetspent bb_internal_fgetspent
54 #define putspent bb_internal_putspent
55 #define getspent_r bb_internal_getspent_r
56 #define getspnam_r bb_internal_getspnam_r
57 #define sgetspent_r bb_internal_sgetspent_r
58 #define fgetspent_r bb_internal_fgetspent_r
59 #define lckpwdf bb_internal_lckpwdf
60 #define ulckpwdf bb_internal_ulckpwdf
63 /* All function names below should be remapped by #defines above
64 * in order to not collide with libc names.
65 * In theory it isn't necessary, but I saw weird interactions at link time.
69 /* Open database for reading */
70 extern void setspent(void);
73 extern void endspent(void);
75 /* Get next entry from database, perhaps after opening the file */
76 extern struct spwd *getspent(void);
78 /* Get shadow entry matching NAME */
79 extern struct spwd *getspnam(__const char *__name);
81 /* Read shadow entry from STRING */
82 extern struct spwd *sgetspent(__const char *__string);
84 /* Read next shadow entry from STREAM */
85 extern struct spwd *fgetspent(FILE *__stream);
87 /* Write line containing shadow password entry to stream */
88 extern int putspent(__const struct spwd *__p, FILE *__stream);
90 /* Reentrant versions of some of the functions above */
91 extern int getspent_r(struct spwd *__result_buf, char *__buffer,
92 size_t __buflen, struct spwd **__result);
94 extern int getspnam_r(__const char *__name, struct spwd *__result_buf,
95 char *__buffer, size_t __buflen,
96 struct spwd **__result);
98 extern int sgetspent_r(__const char *__string, struct spwd *__result_buf,
99 char *__buffer, size_t __buflen,
100 struct spwd **__result);
102 extern int fgetspent_r(FILE *__stream, struct spwd *__result_buf,
103 char *__buffer, size_t __buflen,
104 struct spwd **__result);
105 /* Protect password file against multi writers */
106 extern int lckpwdf(void);
108 /* Unlock password file */
109 extern int ulckpwdf(void);
111 #if __GNUC_PREREQ(4,1)
112 # pragma GCC visibility pop
115 #endif /* shadow.h */