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