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