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