]> git.ipfire.org Git - thirdparty/glibc.git/blob - shadow/shadow.h
update from main archive
[thirdparty/glibc.git] / shadow / shadow.h
1 /* Copyright (C) 1996 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
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.
8
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.
13
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
16 not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
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
26 #define __need_FILE
27 #include <stdio.h>
28
29 /* Paths to the userd files. */
30 #define SHADOW "/etc/shadow"
31
32
33 __BEGIN_DECLS
34
35 /* Structure of the password file. */
36 struct spwd
37 {
38 char *sp_namp; /* Login name. */
39 char *sp_pwdp; /* Encrypted password. */
40 long int sp_lstchg; /* Date of last change. */
41 long int sp_min; /* Minimum number of days between changes. */
42 long int sp_max; /* Maximum number of days between changes. */
43 long int sp_warn; /* Number of days to warn user to change
44 the password. */
45 long int sp_inact; /* Number of days the account may be
46 inactive. */
47 long int sp_expire; /* Number of days since 1970-01-01 until
48 account expires. */
49 unsigned long int sp_flag; /* Reserved. */
50 };
51
52
53 /* Open database for reading. */
54 extern void setspent __P ((void));
55
56 /* Close database. */
57 extern void endspent __P ((void));
58
59 /* Get next entry from database, perhaps after opening the file. */
60 extern struct spwd *getspent __P ((void));
61
62 /* Get shadow entry matching NAME. */
63 extern struct spwd *getspnam __P ((__const char *__name));
64
65 /* Read shadow entry from STRING. */
66 extern struct spwd *sgetspent __P ((__const char *__string));
67
68 /* Read next shadow entry from STREAM. */
69 extern struct spwd *fgetspent __P ((FILE *__stream));
70
71 /* Write line containing shadow password entry to stream. */
72 extern int putspent __P ((__const struct spwd *__p, FILE *__stream));
73
74
75 #ifdef __USE_REENTRANT
76 /* Reentrant versions of some of the functions above. */
77 extern struct spwd *__getspent_r __P ((struct spwd *__result_buf,
78 char *__buffer, int __buflen));
79 extern struct spwd *getspent_r __P ((struct spwd *__result_buf,
80 char *__buffer, int __buflen));
81
82 extern struct spwd *__getspnam_r __P ((__const char *__name,
83 struct spwd *__result_buf,
84 char *__buffer, int __buflen));
85 extern struct spwd *getspnam_r __P ((__const char *__name,
86 struct spwd *__result_buf,
87 char *__buffer, int __buflen));
88
89 extern struct spwd *__sgetspent_r __P ((__const char *__string,
90 struct spwd *__result_buf,
91 char *__buffer, int __buflen));
92 extern struct spwd *sgetspent_r __P ((__const char *__string,
93 struct spwd *__result_buf,
94 char *__buffer, int __buflen));
95
96 extern struct spwd *__fgetspent_r __P ((FILE *__stream,
97 struct spwd *__result_buf,
98 char *__buffer, int __buflen));
99 extern struct spwd *fgetspent_r __P ((FILE *__stream,
100 struct spwd *__result_buf,
101 char *__buffer, int __buflen));
102 #endif /* reentrant */
103
104
105 /* Protect password file against multi writers. */
106 extern int __lckpwdf __P ((void));
107 extern int lckpwdf __P ((void));
108
109 /* Unlock password file. */
110 extern int __ulckpwdf __P ((void));
111 extern int ulckpwdf __P ((void));
112
113 __END_DECLS
114
115 #endif /* shadow.h */