]> sourceware.org Git - glibc.git/blame_incremental - shadow/shadow.h
handle password file locking.
[glibc.git] / shadow / shadow.h
... / ...
CommitLineData
1/* Copyright (C) 1996 Free Software Foundation, Inc.
2This file is part of the GNU C Library.
3
4The GNU C Library is free software; you can redistribute it and/or
5modify it under the terms of the GNU Library General Public License as
6published by the Free Software Foundation; either version 2 of the
7License, or (at your option) any later version.
8
9The GNU C Library is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12Library General Public License for more details.
13
14You should have received a copy of the GNU Library General Public
15License along with the GNU C Library; see the file COPYING.LIB. If
16not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17Boston, 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. */
38struct 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. */
56extern void setspent __P ((void));
57
58/* Close database. */
59extern void endspent __P ((void));
60
61/* Get next entry from database, perhaps after opening the file. */
62extern struct spwd *getspent __P ((void));
63
64/* Get shadow entry matching NAME. */
65extern struct spwd *getspnam __P ((__const char *__name));
66
67/* Read shadow entry from STRING. */
68extern struct spwd *sgetspent __P ((__const char *__string));
69
70/* Read next shadow entry from STREAM. */
71extern struct spwd *fgetspent __P ((FILE *__stream));
72
73/* Write line containing shadow password entry to stream. */
74extern int putspent __P ((__const struct spwd *__p, FILE *__stream));
75
76
77#ifdef __USE_REENTRANT
78/* Reentrant versions of some of the functions above. */
79extern struct spwd *__getspent_r __P ((struct spwd *__result_buf,
80 char *__buffer, int __buflen));
81extern struct spwd *getspent_r __P ((struct spwd *__result_buf,
82 char *__buffer, int __buflen));
83
84extern struct spwd *__getspnam_r __P ((__const char *__name,
85 struct spwd *__result_buf,
86 char *__buffer, int __buflen));
87extern struct spwd *getspnam_r __P ((__const char *__name,
88 struct spwd *__result_buf,
89 char *__buffer, int __buflen));
90
91extern struct spwd *__sgetspent_r __P ((__const char *__string,
92 struct spwd *__result_buf,
93 char *__buffer, int __buflen));
94extern struct spwd *sgetspent_r __P ((__const char *__string,
95 struct spwd *__result_buf,
96 char *__buffer, int __buflen));
97
98extern struct spwd *__fgetspent_r __P ((FILE *__stream,
99 struct spwd *__result_buf,
100 char *__buffer, int __buflen));
101extern 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. */
108extern int __lckpwdf __P ((void));
109extern int lckpwdf __P ((void));
110
111/* Unlock password file. */
112extern int __ulckpwdf __P ((void));
113extern int ulckpwdf __P ((void));
114
115__END_DECLS
116
117#endif /* shadow.h */
This page took 0.029051 seconds and 5 git commands to generate.