]>
Commit | Line | Data |
---|---|---|
267ca16a | 1 | /* Copyright (C) 1996 Free Software Foundation, Inc. |
2c6fe0bd | 2 | This file is part of the GNU C Library. |
267ca16a | 3 | |
2c6fe0bd UD |
4 | The GNU C Library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public License as | |
6 | published by the Free Software Foundation; either version 2 of the | |
7 | 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 | |
12 | Library General Public License for more details. | |
267ca16a | 13 | |
2c6fe0bd UD |
14 | You should have received a copy of the GNU Library General Public |
15 | License along with the GNU C Library; see the file COPYING.LIB. If not, | |
16 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
17 | Boston, MA 02111-1307, USA. */ | |
267ca16a UD |
18 | |
19 | /* Declaration of types and functions for shadow password suite. */ | |
20 | ||
21 | #ifndef _SHADOW_H | |
22 | ||
23 | #define _SHADOW_H 1 | |
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 | |
41 | { | |
42 | char *sp_namp; /* Login name. */ | |
43 | char *sp_pwdp; /* Encrypted password. */ | |
c4029823 UD |
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. */ |
c4029823 | 49 | long int sp_inact; /* Number of days the account may be |
267ca16a | 50 | inactive. */ |
c4029823 | 51 | long int sp_expire; /* Number of days since 1970-01-01 until |
dcf0671d | 52 | account expires. */ |
267ca16a UD |
53 | unsigned long int sp_flag; /* Reserved. */ |
54 | }; | |
55 | ||
56 | ||
57 | /* Open database for reading. */ | |
58 | extern void setspent __P ((void)); | |
59 | ||
60 | /* Close database. */ | |
61 | extern void endspent __P ((void)); | |
62 | ||
63 | /* Get next entry from database, perhaps after opening the file. */ | |
64 | extern struct spwd *getspent __P ((void)); | |
65 | ||
66 | /* Get shadow entry matching NAME. */ | |
67 | extern struct spwd *getspnam __P ((__const char *__name)); | |
68 | ||
69 | /* Read shadow entry from STRING. */ | |
70 | extern struct spwd *sgetspent __P ((__const char *__string)); | |
71 | ||
72 | /* Read next shadow entry from STREAM. */ | |
73 | extern struct spwd *fgetspent __P ((FILE *__stream)); | |
74 | ||
75 | /* Write line containing shadow password entry to stream. */ | |
76 | extern int putspent __P ((__const struct spwd *__p, FILE *__stream)); | |
77 | ||
78 | ||
79 | #ifdef __USE_REENTRANT | |
80 | /* Reentrant versions of some of the functions above. */ | |
ba1ffaa1 UD |
81 | extern int __getspent_r __P ((struct spwd *__result_buf, char *__buffer, |
82 | size_t __buflen, struct spwd **__result)); | |
83 | extern int getspent_r __P ((struct spwd *__result_buf, char *__buffer, | |
84 | size_t __buflen, struct spwd **__result)); | |
85 | ||
86 | extern int __getspnam_r __P ((__const char *__name, struct spwd *__result_buf, | |
87 | char *__buffer, size_t __buflen, | |
88 | struct spwd **__result)); | |
89 | extern int getspnam_r __P ((__const char *__name, struct spwd *__result_buf, | |
90 | char *__buffer, size_t __buflen, | |
91 | struct spwd **__result)); | |
92 | ||
93 | extern int __sgetspent_r __P ((__const char *__string, | |
94 | struct spwd *__result_buf, char *__buffer, | |
95 | size_t __buflen, struct spwd **__result)); | |
96 | extern int sgetspent_r __P ((__const char *__string, struct spwd *__result_buf, | |
97 | char *__buffer, size_t __buflen, | |
98 | struct spwd **__result)); | |
99 | ||
100 | extern int __fgetspent_r __P ((FILE *__stream, struct spwd *__result_buf, | |
101 | char *__buffer, size_t __buflen, | |
102 | struct spwd **__result)); | |
103 | extern int fgetspent_r __P ((FILE *__stream, struct spwd *__result_buf, | |
104 | char *__buffer, size_t __buflen, | |
105 | struct spwd **__result)); | |
267ca16a UD |
106 | #endif /* reentrant */ |
107 | ||
dcf0671d UD |
108 | |
109 | /* Protect password file against multi writers. */ | |
110 | extern int __lckpwdf __P ((void)); | |
111 | extern int lckpwdf __P ((void)); | |
112 | ||
113 | /* Unlock password file. */ | |
114 | extern int __ulckpwdf __P ((void)); | |
115 | extern int ulckpwdf __P ((void)); | |
116 | ||
267ca16a UD |
117 | __END_DECLS |
118 | ||
119 | #endif /* shadow.h */ |