1 /* Copyright (C) 1996-1999, 2003, 2012 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. */
32 /* Paths to the user database files. */
33 #define SHADOW _PATH_SHADOW
38 /* Structure of the password file. */
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
48 long int sp_inact
; /* Number of days the account may be
50 long int sp_expire
; /* Number of days since 1970-01-01 until
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);
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
);
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
);
123 extern int getspnam_r (const char *__name
, struct spwd
*__result_buf
,
124 char *__buffer
, size_t __buflen
,
125 struct spwd
**__result
);
127 extern int sgetspent_r (const char *__string
, struct spwd
*__result_buf
,
128 char *__buffer
, size_t __buflen
,
129 struct spwd
**__result
);
131 extern int fgetspent_r (FILE *__stream
, struct spwd
*__result_buf
,
132 char *__buffer
, size_t __buflen
,
133 struct spwd
**__result
);
137 /* The simple locking functionality provided here is not suitable for
138 multi-threaded applications. */
140 /* Protect password file against multi writers. */
141 extern int lckpwdf (void) __THROW
;
143 /* Unlock password file. */
144 extern int ulckpwdf (void) __THROW
;
148 #endif /* shadow.h */