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