fix regression from a745c4bfc8a9b5db4e48387170da0dc1d39e3abe
[uclibc-ng.git] / include / shadow.h
blob97725102f51c9103286aef6c4ba2754374afd776
1 /* Copyright (C) 1996, 1997, 1998, 1999, 2003 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
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.
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.
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/>. */
18 /* Declaration of types and functions for shadow password suite. */
20 #ifndef _SHADOW_H
21 #define _SHADOW_H 1
23 #include <features.h>
25 #include <paths.h>
27 #define __need_FILE
28 #include <stdio.h>
29 #define __need_size_t
30 #include <stddef.h>
32 /* Paths to the user database files. */
33 #define SHADOW _PATH_SHADOW
36 __BEGIN_DECLS
38 /* Structure of the password file. */
39 struct spwd
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. */
56 /* Open database for reading.
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);
64 /* Close database.
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);
72 /* Get next entry from database, perhaps after opening the file.
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);
80 /* Get shadow entry matching NAME.
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);
88 /* Read shadow entry from STRING.
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);
96 /* Read next shadow entry from STREAM.
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);
104 /* Write line containing shadow password entry to stream.
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);
113 #ifdef __USE_MISC
114 /* Reentrant versions of some of the functions above.
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)
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)
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)
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 */
141 /* The simple locking functionality provided here is not suitable for
142 multi-threaded applications. */
144 /* Protect password file against multi writers. */
145 extern int lckpwdf (void) __THROW;
147 /* Unlock password file. */
148 extern int ulckpwdf (void) __THROW;
150 __END_DECLS
152 #endif /* shadow.h */