02d3bf9a561f40e0e1b2c3396ba70982c1eeaeea
[oweals/busybox.git] / include / shadow_.h
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 /* This file is #included after #include <shadow.h>
28  * We will use libc-defined structures, but will #define function names
29  * so that function calls are directed to bb_internal_XXX replacements
30  */
31
32 /* Paths to the user database files */
33 #ifndef _PATH_SHADOW
34 #define _PATH_SHADOW "/etc/shadow"
35 #endif
36
37 #define setspent    bb_internal_setspent
38 #define endspent    bb_internal_endspent
39 #define getspent    bb_internal_getspent
40 #define getspnam    bb_internal_getspnam
41 #define sgetspent   bb_internal_sgetspent
42 #define fgetspent   bb_internal_fgetspent
43 #define putspent    bb_internal_putspent
44 #define getspent_r  bb_internal_getspent_r
45 #define getspnam_r  bb_internal_getspnam_r
46 #define sgetspent_r bb_internal_sgetspent_r
47 #define fgetspent_r bb_internal_fgetspent_r
48 #define lckpwdf     bb_internal_lckpwdf
49 #define ulckpwdf    bb_internal_ulckpwdf
50
51
52 /* All function names below should be remapped by #defines above
53  * in order to not collide with libc names. */
54
55
56 /* Open database for reading */
57 extern void setspent(void);
58
59 /* Close database */
60 extern void endspent(void);
61
62 /* Get next entry from database, perhaps after opening the file */
63 extern struct spwd *getspent(void);
64
65 /* Get shadow entry matching NAME */
66 extern struct spwd *getspnam(const char *__name);
67
68 /* Read shadow entry from STRING */
69 extern struct spwd *sgetspent(const char *__string);
70
71 /* Read next shadow entry from STREAM */
72 extern struct spwd *fgetspent(FILE *__stream);
73
74 /* Write line containing shadow password entry to stream */
75 extern int putspent(const struct spwd *__p, FILE *__stream);
76
77 /* Reentrant versions of some of the functions above */
78 extern int getspent_r(struct spwd *__result_buf, char *__buffer,
79                        size_t __buflen, struct spwd **__result);
80
81 extern int getspnam_r(const char *__name, struct spwd *__result_buf,
82                        char *__buffer, size_t __buflen,
83                        struct spwd **__result);
84
85 extern int sgetspent_r(const char *__string, struct spwd *__result_buf,
86                         char *__buffer, size_t __buflen,
87                         struct spwd **__result);
88
89 extern int fgetspent_r(FILE *__stream, struct spwd *__result_buf,
90                         char *__buffer, size_t __buflen,
91                         struct spwd **__result);
92 /* Protect password file against multi writers */
93 extern int lckpwdf(void);
94
95 /* Unlock password file */
96 extern int ulckpwdf(void);
97
98 POP_SAVED_FUNCTION_VISIBILITY
99
100 #endif /* shadow.h */