]>
Commit | Line | Data |
---|---|---|
b168057a | 1 | /* Copyright (C) 1996-2015 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 | 14 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
15 | License along with the GNU C Library; if not, see |
16 | <http://www.gnu.org/licenses/>. */ | |
267ca16a UD |
17 | |
18 | /* Declaration of types and functions for shadow password suite. */ | |
19 | ||
20 | #ifndef _SHADOW_H | |
267ca16a | 21 | #define _SHADOW_H 1 |
5107cf1d | 22 | |
267ca16a UD |
23 | #include <features.h> |
24 | ||
2c6fe0bd UD |
25 | #include <paths.h> |
26 | ||
267ca16a UD |
27 | #define __need_FILE |
28 | #include <stdio.h> | |
0f110f41 TBB |
29 | #define __need_size_t |
30 | #include <stddef.h> | |
31 | ||
2c6fe0bd UD |
32 | /* Paths to the user database files. */ |
33 | #define SHADOW _PATH_SHADOW | |
267ca16a UD |
34 | |
35 | ||
36 | __BEGIN_DECLS | |
37 | ||
38 | /* Structure of the password file. */ | |
39 | struct spwd | |
19361cb7 UD |
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 | |
267ca16a | 47 | the password. */ |
19361cb7 | 48 | long int sp_inact; /* Number of days the account may be |
267ca16a | 49 | inactive. */ |
19361cb7 | 50 | long int sp_expire; /* Number of days since 1970-01-01 until |
dcf0671d | 51 | account expires. */ |
19361cb7 UD |
52 | unsigned long int sp_flag; /* Reserved. */ |
53 | }; | |
267ca16a UD |
54 | |
55 | ||
2c008571 | 56 | /* Open database for reading. |
267ca16a | 57 | |
2c008571 UD |
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); | |
267ca16a | 63 | |
2c008571 | 64 | /* Close database. |
267ca16a | 65 | |
2c008571 UD |
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); | |
267ca16a | 71 | |
2c008571 | 72 | /* Get next entry from database, perhaps after opening the file. |
267ca16a | 73 | |
2c008571 UD |
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); | |
267ca16a | 79 | |
2c008571 UD |
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. */ | |
a784e502 | 86 | extern struct spwd *getspnam (const char *__name); |
2c008571 UD |
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. */ | |
a784e502 | 94 | extern struct spwd *sgetspent (const char *__string); |
2c008571 UD |
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. */ | |
a784e502 | 110 | extern int putspent (const struct spwd *__p, FILE *__stream); |
267ca16a UD |
111 | |
112 | ||
19361cb7 | 113 | #ifdef __USE_MISC |
2c008571 UD |
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. */ | |
c1422e5b | 120 | extern int getspent_r (struct spwd *__result_buf, char *__buffer, |
2c008571 | 121 | size_t __buflen, struct spwd **__result); |
ba1ffaa1 | 122 | |
a784e502 | 123 | extern int getspnam_r (const char *__name, struct spwd *__result_buf, |
c1422e5b | 124 | char *__buffer, size_t __buflen, |
2c008571 | 125 | struct spwd **__result); |
ba1ffaa1 | 126 | |
a784e502 | 127 | extern int sgetspent_r (const char *__string, struct spwd *__result_buf, |
c1422e5b | 128 | char *__buffer, size_t __buflen, |
2c008571 | 129 | struct spwd **__result); |
ba1ffaa1 | 130 | |
c1422e5b UD |
131 | extern int fgetspent_r (FILE *__stream, struct spwd *__result_buf, |
132 | char *__buffer, size_t __buflen, | |
2c008571 | 133 | struct spwd **__result); |
19361cb7 | 134 | #endif /* misc */ |
dcf0671d | 135 | |
2c008571 UD |
136 | |
137 | /* The simple locking functionality provided here is not suitable for | |
138 | multi-threaded applications. */ | |
139 | ||
dcf0671d | 140 | /* Protect password file against multi writers. */ |
c1422e5b | 141 | extern int lckpwdf (void) __THROW; |
dcf0671d UD |
142 | |
143 | /* Unlock password file. */ | |
c1422e5b | 144 | extern int ulckpwdf (void) __THROW; |
dcf0671d | 145 | |
267ca16a UD |
146 | __END_DECLS |
147 | ||
148 | #endif /* shadow.h */ |