1/*
2 * Copyright 2008-2012 Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _SHADOW_H_
6#define _SHADOW_H_
7
8
9#include <stddef.h>
10#include <stdio.h>
11
12struct spwd {
13	char*	sp_namp;	/* login name */
14	char*	sp_pwdp;	/* encrypted password */
15	int		sp_lstchg;	/* date of last change (days since 1970) */
16	int		sp_min;		/* min days between password changes */
17	int		sp_max;		/* max days between password changes */
18	int		sp_warn;	/* days to warn before password expired */
19	int		sp_inact;	/* days of inactivity until account expiration */
20	int		sp_expire;	/* date when the account expires (days since 1970) */
21	int		sp_flag;	/* unused */
22};
23
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29
30extern struct spwd*	getspent(void);
31extern int getspent_r(struct spwd* spwd, char* buffer, size_t bufferSize,
32				struct spwd** _result);
33extern void	setspent(void);
34extern void	endspent(void);
35
36extern struct spwd*	getspnam(const char* name);
37extern int getspnam_r(const char* name, struct spwd* spwd, char* buffer,
38				size_t bufferSize, struct spwd** _result);
39
40extern struct spwd* sgetspent(const char* line);
41extern int sgetspent_r(const char* line, struct spwd *spwd, char *buffer,
42				size_t bufferSize, struct spwd** _result);
43
44extern struct spwd* fgetspent(FILE* file);
45extern int fgetspent_r(FILE* file, struct spwd* spwd, char* buffer,
46				size_t bufferSize, struct spwd** _result);
47
48
49#ifdef __cplusplus
50}
51#endif
52
53
54#endif	/* _SHADOW_H_ */
55