1 1.2 christos /* $NetBSD: pwd.h,v 1.2 2009/01/11 02:46:25 christos Exp $ */ 2 1.2 christos 3 1.2 christos #ifndef _COMPAT_PWD_H_ 4 1.2 christos #define _COMPAT_PWD_H_ 5 1.2 christos 6 1.2 christos #include <sys/cdefs.h> 7 1.2 christos #include <sys/featuretest.h> 8 1.2 christos #include <sys/types.h> 9 1.2 christos 10 1.2 christos struct passwd; 11 1.2 christos struct passwd50 { 12 1.2 christos __aconst char *pw_name; /* user name */ 13 1.2 christos __aconst char *pw_passwd; /* encrypted password */ 14 1.2 christos uid_t pw_uid; /* user uid */ 15 1.2 christos gid_t pw_gid; /* user gid */ 16 1.2 christos int32_t pw_change; /* password change time */ 17 1.2 christos __aconst char *pw_class; /* user login class */ 18 1.2 christos __aconst char *pw_gecos; /* general information */ 19 1.2 christos __aconst char *pw_dir; /* home directory */ 20 1.2 christos __aconst char *pw_shell; /* default shell */ 21 1.2 christos int32_t pw_expire; /* account expiration */ 22 1.2 christos }; 23 1.2 christos 24 1.2 christos __BEGIN_DECLS 25 1.2 christos static __inline void 26 1.2 christos passwd_to_passwd50(const struct passwd *p, struct passwd50 *q) 27 1.2 christos { 28 1.2 christos q->pw_name = p->pw_name; 29 1.2 christos q->pw_passwd = p->pw_passwd; 30 1.2 christos q->pw_uid = p->pw_uid; 31 1.2 christos q->pw_gid = p->pw_gid; 32 1.2 christos q->pw_change = (int32_t)p->pw_change; 33 1.2 christos q->pw_class = p->pw_class; 34 1.2 christos q->pw_gecos = p->pw_gecos; 35 1.2 christos q->pw_dir = p->pw_dir; 36 1.2 christos q->pw_shell = p->pw_shell; 37 1.2 christos q->pw_expire = (int32_t)p->pw_expire; 38 1.2 christos } 39 1.2 christos 40 1.2 christos static __inline void 41 1.2 christos passwd50_to_passwd(const struct passwd50 *p, struct passwd *q) 42 1.2 christos { 43 1.2 christos q->pw_name = p->pw_name; 44 1.2 christos q->pw_passwd = p->pw_passwd; 45 1.2 christos q->pw_uid = p->pw_uid; 46 1.2 christos q->pw_gid = p->pw_gid; 47 1.2 christos q->pw_change = p->pw_change; 48 1.2 christos q->pw_class = p->pw_class; 49 1.2 christos q->pw_gecos = p->pw_gecos; 50 1.2 christos q->pw_dir = p->pw_dir; 51 1.2 christos q->pw_shell = p->pw_shell; 52 1.2 christos q->pw_expire = p->pw_expire; 53 1.2 christos } 54 1.2 christos 55 1.2 christos struct passwd50 *getpwuid(uid_t); 56 1.2 christos struct passwd50 *getpwnam(const char *); 57 1.2 christos #if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \ 58 1.2 christos defined(_REENTRANT) || defined(_NETBSD_SOURCE) 59 1.2 christos int getpwnam_r(const char *, struct passwd50 *, char *, size_t, 60 1.2 christos struct passwd50 **); 61 1.2 christos int getpwuid_r(uid_t, struct passwd50 *, char *, size_t, 62 1.2 christos struct passwd50 **); 63 1.2 christos #endif 64 1.2 christos #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) 65 1.2 christos struct passwd50 *getpwent(void); 66 1.2 christos #endif 67 1.2 christos #if defined(_NETBSD_SOURCE) 68 1.2 christos int pw_scan(char *, struct passwd50 *, int *); 69 1.2 christos int getpwent_r(struct passwd50 *, char *, size_t, struct passwd50 **); 70 1.2 christos #endif 71 1.2 christos #if defined(_NETBSD_SOURCE) 72 1.2 christos int pwcache_userdb(int (*)(int), void (*)(void), 73 1.2 christos struct passwd50 * (*)(const char *), struct passwd50 * (*)(uid_t)); 74 1.2 christos #endif 75 1.2 christos 76 1.2 christos struct passwd *__getpwuid50(uid_t); 77 1.2 christos struct passwd *__getpwnam50(const char *); 78 1.2 christos #if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \ 79 1.2 christos defined(_REENTRANT) || defined(_NETBSD_SOURCE) 80 1.2 christos int __getpwnam_r50(const char *, struct passwd *, char *, size_t, 81 1.2 christos struct passwd **); 82 1.2 christos int __getpwuid_r50(uid_t, struct passwd *, char *, size_t, 83 1.2 christos struct passwd **); 84 1.2 christos #endif 85 1.2 christos #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) 86 1.2 christos struct passwd *__getpwent50(void); 87 1.2 christos #endif 88 1.2 christos #if defined(_NETBSD_SOURCE) 89 1.2 christos int __pw_scan50(char *, struct passwd *, int *); 90 1.2 christos int __getpwent_r50(struct passwd *, char *, size_t, struct passwd **); 91 1.2 christos #endif 92 1.2 christos int setpassent(int); 93 1.2 christos #if defined(_NETBSD_SOURCE) 94 1.2 christos int __pwcache_userdb50(int (*)(int), void (*)(void), 95 1.2 christos struct passwd * (*)(const char *), struct passwd * (*)(uid_t)); 96 1.2 christos #endif 97 1.2 christos __END_DECLS 98 1.2 christos 99 1.2 christos #endif /* !_COMPAT_PWD_H_ */ 100