OSDN Git Service

test: NPTL: sync WRITE_BUFFER_SIZE with glibc test
[uclinux-h8/uClibc.git] / include / shadow.h
1 /* Copyright (C) 1996, 1997, 1998, 1999, 2003 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License as published by the Free Software Foundation; either
7    version 2.1 of the License, or (at your option) any later version.
8
9    The GNU C Library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Lesser General Public License for more details.
13
14    You should have received a copy of the GNU Lesser General Public
15    License along with the GNU C Library; if not, see
16    <http://www.gnu.org/licenses/>.  */
17
18 /* Declaration of types and functions for shadow password suite.  */
19
20 #ifndef _SHADOW_H
21 #define _SHADOW_H       1
22
23 #include <features.h>
24
25 #include <paths.h>
26
27 #define __need_FILE
28 #include <stdio.h>
29 #define __need_size_t
30 #include <stddef.h>
31
32 /* Paths to the user database files.  */
33 #define SHADOW _PATH_SHADOW
34
35
36 __BEGIN_DECLS
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
55
56 /* Open database for reading.
57
58    This function is not part of POSIX and therefore no official
59    cancellation point.  But due to similarity with an POSIX interface
60    or due to the implementation it is a cancellation point and
61    therefore not marked with __THROW.  */
62 extern void setspent (void);
63
64 /* Close database.
65
66    This function is not part of POSIX and therefore no official
67    cancellation point.  But due to similarity with an POSIX interface
68    or due to the implementation it is a cancellation point and
69    therefore not marked with __THROW.  */
70 extern void endspent (void);
71
72 /* Get next entry from database, perhaps after opening the file.
73
74    This function is not part of POSIX and therefore no official
75    cancellation point.  But due to similarity with an POSIX interface
76    or due to the implementation it is a cancellation point and
77    therefore not marked with __THROW.  */
78 extern struct spwd *getspent (void);
79
80 /* Get shadow entry matching NAME.
81
82    This function is not part of POSIX and therefore no official
83    cancellation point.  But due to similarity with an POSIX interface
84    or due to the implementation it is a cancellation point and
85    therefore not marked with __THROW.  */
86 extern struct spwd *getspnam (const char *__name);
87
88 /* Read shadow entry from STRING.
89
90    This function is not part of POSIX and therefore no official
91    cancellation point.  But due to similarity with an POSIX interface
92    or due to the implementation it is a cancellation point and
93    therefore not marked with __THROW.  */
94 extern struct spwd *sgetspent (const char *__string);
95
96 /* Read next shadow entry from STREAM.
97
98    This function is not part of POSIX and therefore no official
99    cancellation point.  But due to similarity with an POSIX interface
100    or due to the implementation it is a cancellation point and
101    therefore not marked with __THROW.  */
102 extern struct spwd *fgetspent (FILE *__stream);
103
104 /* Write line containing shadow password entry to stream.
105
106    This function is not part of POSIX and therefore no official
107    cancellation point.  But due to similarity with an POSIX interface
108    or due to the implementation it is a cancellation point and
109    therefore not marked with __THROW.  */
110 extern int putspent (const struct spwd *__p, FILE *__stream);
111
112
113 #ifdef __USE_MISC
114 /* Reentrant versions of some of the functions above.
115
116    These functions are not part of POSIX and therefore no official
117    cancellation point.  But due to similarity with an POSIX interface
118    or due to the implementation they are cancellation points and
119    therefore not marked with __THROW.  */
120 extern int getspent_r (struct spwd *__result_buf, char *__buffer,
121                        size_t __buflen, struct spwd **__result);
122 libc_hidden_proto(getspent_r)
123
124 extern int getspnam_r (const char *__name, struct spwd *__result_buf,
125                        char *__buffer, size_t __buflen,
126                        struct spwd **__result);
127 libc_hidden_proto(getspnam_r)
128
129 extern int sgetspent_r (const char *__string, struct spwd *__result_buf,
130                         char *__buffer, size_t __buflen,
131                         struct spwd **__result);
132 libc_hidden_proto(sgetspent_r)
133
134 extern int fgetspent_r (FILE *__stream, struct spwd *__result_buf,
135                         char *__buffer, size_t __buflen,
136                         struct spwd **__result);
137 libc_hidden_proto(fgetspent_r)
138 #endif  /* misc */
139
140
141 /* The simple locking functionality provided here is not suitable for
142    multi-threaded applications.  */
143
144 /* Protect password file against multi writers.  */
145 extern int lckpwdf (void) __THROW;
146
147 /* Unlock password file.  */
148 extern int ulckpwdf (void) __THROW;
149
150 __END_DECLS
151
152 #endif /* shadow.h */