]>
Commit | Line | Data |
---|---|---|
2c008571 | 1 | /* Copyright (C) 1996, 1997, 1998, 1999, 2003 Free Software Foundation, Inc. |
2c6fe0bd | 2 | This file is part of the GNU C Library. |
267ca16a | 3 | |
2c6fe0bd | 4 | The GNU C Library is free software; you can redistribute it and/or |
41bdb6e2 AJ |
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. | |
267ca16a | 8 | |
2c6fe0bd UD |
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 | |
41bdb6e2 | 12 | Lesser General Public License for more details. |
267ca16a | 13 | |
41bdb6e2 AJ |
14 | You should have received a copy of the GNU Lesser General Public |
15 | License along with the GNU C Library; if not, write to the Free | |
16 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
17 | 02111-1307 USA. */ | |
267ca16a UD |
18 | |
19 | /* Declaration of types and functions for shadow password suite. */ | |
20 | ||
21 | #ifndef _SHADOW_H | |
267ca16a | 22 | #define _SHADOW_H 1 |
5107cf1d | 23 | |
267ca16a UD |
24 | #include <features.h> |
25 | ||
2c6fe0bd UD |
26 | #include <paths.h> |
27 | ||
267ca16a UD |
28 | #define __need_FILE |
29 | #include <stdio.h> | |
0f110f41 TBB |
30 | #define __need_size_t |
31 | #include <stddef.h> | |
32 | ||
2c6fe0bd UD |
33 | /* Paths to the user database files. */ |
34 | #define SHADOW _PATH_SHADOW | |
267ca16a UD |
35 | |
36 | ||
37 | __BEGIN_DECLS | |
38 | ||
39 | /* Structure of the password file. */ | |
40 | struct spwd | |
19361cb7 UD |
41 | { |
42 | char *sp_namp; /* Login name. */ | |
43 | char *sp_pwdp; /* Encrypted password. */ | |
44 | long int sp_lstchg; /* Date of last change. */ | |
45 | long int sp_min; /* Minimum number of days between changes. */ | |
46 | long int sp_max; /* Maximum number of days between changes. */ | |
47 | long int sp_warn; /* Number of days to warn user to change | |
267ca16a | 48 | the password. */ |
19361cb7 | 49 | long int sp_inact; /* Number of days the account may be |
267ca16a | 50 | inactive. */ |
19361cb7 | 51 | long int sp_expire; /* Number of days since 1970-01-01 until |
dcf0671d | 52 | account expires. */ |
19361cb7 UD |
53 | unsigned long int sp_flag; /* Reserved. */ |
54 | }; | |
267ca16a UD |
55 | |
56 | ||
2c008571 | 57 | /* Open database for reading. |
267ca16a | 58 | |
2c008571 UD |
59 | This function is not part of POSIX and therefore no official |
60 | cancellation point. But due to similarity with an POSIX interface | |
61 | or due to the implementation it is a cancellation point and | |
62 | therefore not marked with __THROW. */ | |
63 | extern void setspent (void); | |
267ca16a | 64 | |
2c008571 | 65 | /* Close database. |
267ca16a | 66 | |
2c008571 UD |
67 | This function is not part of POSIX and therefore no official |
68 | cancellation point. But due to similarity with an POSIX interface | |
69 | or due to the implementation it is a cancellation point and | |
70 | therefore not marked with __THROW. */ | |
71 | extern void endspent (void); | |
267ca16a | 72 | |
2c008571 | 73 | /* Get next entry from database, perhaps after opening the file. |
267ca16a | 74 | |
2c008571 UD |
75 | This function is not part of POSIX and therefore no official |
76 | cancellation point. But due to similarity with an POSIX interface | |
77 | or due to the implementation it is a cancellation point and | |
78 | therefore not marked with __THROW. */ | |
79 | extern struct spwd *getspent (void); | |
267ca16a | 80 | |
2c008571 UD |
81 | /* Get shadow entry matching NAME. |
82 | ||
83 | This function is not part of POSIX and therefore no official | |
84 | cancellation point. But due to similarity with an POSIX interface | |
85 | or due to the implementation it is a cancellation point and | |
86 | therefore not marked with __THROW. */ | |
87 | extern struct spwd *getspnam (__const char *__name); | |
88 | ||
89 | /* Read shadow entry from STRING. | |
90 | ||
91 | This function is not part of POSIX and therefore no official | |
92 | cancellation point. But due to similarity with an POSIX interface | |
93 | or due to the implementation it is a cancellation point and | |
94 | therefore not marked with __THROW. */ | |
95 | extern struct spwd *sgetspent (__const char *__string); | |
96 | ||
97 | /* Read next shadow entry from STREAM. | |
98 | ||
99 | This function is not part of POSIX and therefore no official | |
100 | cancellation point. But due to similarity with an POSIX interface | |
101 | or due to the implementation it is a cancellation point and | |
102 | therefore not marked with __THROW. */ | |
103 | extern struct spwd *fgetspent (FILE *__stream); | |
104 | ||
105 | /* Write line containing shadow password entry to stream. | |
106 | ||
107 | This function is not part of POSIX and therefore no official | |
108 | cancellation point. But due to similarity with an POSIX interface | |
109 | or due to the implementation it is a cancellation point and | |
110 | therefore not marked with __THROW. */ | |
111 | extern int putspent (__const struct spwd *__p, FILE *__stream); | |
267ca16a UD |
112 | |
113 | ||
19361cb7 | 114 | #ifdef __USE_MISC |
2c008571 UD |
115 | /* Reentrant versions of some of the functions above. |
116 | ||
117 | These functions are not part of POSIX and therefore no official | |
118 | cancellation point. But due to similarity with an POSIX interface | |
119 | or due to the implementation they are cancellation points and | |
120 | therefore not marked with __THROW. */ | |
c1422e5b | 121 | extern int getspent_r (struct spwd *__result_buf, char *__buffer, |
2c008571 | 122 | size_t __buflen, struct spwd **__result); |
ba1ffaa1 | 123 | |
c1422e5b UD |
124 | extern int getspnam_r (__const char *__name, struct spwd *__result_buf, |
125 | char *__buffer, size_t __buflen, | |
2c008571 | 126 | struct spwd **__result); |
ba1ffaa1 | 127 | |
c1422e5b UD |
128 | extern int sgetspent_r (__const char *__string, struct spwd *__result_buf, |
129 | char *__buffer, size_t __buflen, | |
2c008571 | 130 | struct spwd **__result); |
ba1ffaa1 | 131 | |
c1422e5b UD |
132 | extern int fgetspent_r (FILE *__stream, struct spwd *__result_buf, |
133 | char *__buffer, size_t __buflen, | |
2c008571 | 134 | struct spwd **__result); |
19361cb7 | 135 | #endif /* misc */ |
dcf0671d | 136 | |
2c008571 UD |
137 | |
138 | /* The simple locking functionality provided here is not suitable for | |
139 | multi-threaded applications. */ | |
140 | ||
dcf0671d | 141 | /* Protect password file against multi writers. */ |
c1422e5b | 142 | extern int lckpwdf (void) __THROW; |
dcf0671d UD |
143 | |
144 | /* Unlock password file. */ | |
c1422e5b | 145 | extern int ulckpwdf (void) __THROW; |
dcf0671d | 146 | |
267ca16a UD |
147 | __END_DECLS |
148 | ||
149 | #endif /* shadow.h */ |