xref: /haiku/headers/posix/shadow.h (revision b93201281504cee31f4186f7c6548815940c576e)
1a94ce1c9SIngo Weinhold /*
2a94ce1c9SIngo Weinhold  * Copyright 2008, 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 
8a94ce1c9SIngo Weinhold #include <stddef.h>
9a94ce1c9SIngo Weinhold #include <stdio.h>
10a94ce1c9SIngo Weinhold 
11a94ce1c9SIngo Weinhold struct spwd {
12a94ce1c9SIngo Weinhold 	char*	sp_namp;	/* login name */
13a94ce1c9SIngo Weinhold 	char*	sp_pwdp;	/* encrypted password */
14a94ce1c9SIngo Weinhold 	int		sp_min;		/* min days between password changes */
15a94ce1c9SIngo Weinhold 	int		sp_max;		/* max days between password changes */
16a94ce1c9SIngo Weinhold 	int		sp_warn;	/* days to warn before password expired */
17a94ce1c9SIngo Weinhold 	int		sp_inact;	/* days of inactivity until account expiration */
18a94ce1c9SIngo Weinhold 	int		sp_expire;	/* date when the account expires (days since 1970) */
19a94ce1c9SIngo Weinhold 	int		sp_flag;	/* unused */
20a94ce1c9SIngo Weinhold };
21a94ce1c9SIngo Weinhold 
22a94ce1c9SIngo Weinhold 
23a94ce1c9SIngo Weinhold #ifdef __cplusplus
24a94ce1c9SIngo Weinhold extern "C" {
25a94ce1c9SIngo Weinhold #endif
26a94ce1c9SIngo Weinhold 
27a94ce1c9SIngo Weinhold 
28a94ce1c9SIngo Weinhold extern struct spwd*	getspent(void);
29a94ce1c9SIngo Weinhold extern int getspent_r(struct spwd* spwd, char* buffer, size_t bufferSize,
30a94ce1c9SIngo Weinhold 				struct spwd** _result);
31a94ce1c9SIngo Weinhold extern void	setspent(void);
32a94ce1c9SIngo Weinhold extern void	endspent(void);
33a94ce1c9SIngo Weinhold 
34a94ce1c9SIngo Weinhold extern struct spwd*	getspnam(const char* name);
35a94ce1c9SIngo Weinhold extern int getspnam_r(const char* name, struct spwd* spwd, char* buffer,
36a94ce1c9SIngo Weinhold 				size_t bufferSize, struct spwd** _result);
37a94ce1c9SIngo Weinhold 
38a94ce1c9SIngo Weinhold extern struct spwd* sgetspent(const char* line);
39a94ce1c9SIngo Weinhold extern int sgetspent_r(const char* line, struct spwd *spwd, char *buffer,
40a94ce1c9SIngo Weinhold 				size_t bufferSize, struct spwd** _result);
41a94ce1c9SIngo Weinhold 
42a94ce1c9SIngo Weinhold extern struct spwd* fgetspent(FILE* file);
43a94ce1c9SIngo Weinhold extern int fgetspent_r(FILE* file, struct spwd* spwd, char* buffer,
44a94ce1c9SIngo Weinhold 				size_t bufferSize, struct spwd** _result);
45a94ce1c9SIngo Weinhold 
46a94ce1c9SIngo Weinhold 
47a94ce1c9SIngo Weinhold #ifdef __cplusplus
48a94ce1c9SIngo Weinhold }
49a94ce1c9SIngo Weinhold #endif
50a94ce1c9SIngo Weinhold 
51a94ce1c9SIngo Weinhold 
52*b9320128SIngo Weinhold #endif	/* _SHADOW_H_ */
53