pwd.h revision 90644
1139738Simp/*-
2135699Smarcel * Copyright (c) 1989, 1993
3110211Smarcel *	The Regents of the University of California.  All rights reserved.
4110211Smarcel * (c) UNIX System Laboratories, Inc.
5110211Smarcel * All or some portions of this file are derived from material licensed
6110211Smarcel * to the University of California by American Telephone and Telegraph
7110211Smarcel * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8110211Smarcel * the permission of UNIX System Laboratories, Inc.
9110211Smarcel *
10110211Smarcel * Redistribution and use in source and binary forms, with or without
11110211Smarcel * modification, are permitted provided that the following conditions
12110211Smarcel * are met:
13110211Smarcel * 1. Redistributions of source code must retain the above copyright
14110211Smarcel *    notice, this list of conditions and the following disclaimer.
15110211Smarcel * 2. Redistributions in binary form must reproduce the above copyright
16110211Smarcel *    notice, this list of conditions and the following disclaimer in the
17110211Smarcel *    documentation and/or other materials provided with the distribution.
18110211Smarcel * 3. All advertising materials mentioning features or use of this software
19110211Smarcel *    must display the following acknowledgement:
20110211Smarcel *	This product includes software developed by the University of
21110211Smarcel *	California, Berkeley and its contributors.
22110211Smarcel * 4. Neither the name of the University nor the names of its contributors
23110211Smarcel *    may be used to endorse or promote products derived from this software
24110211Smarcel *    without specific prior written permission.
25110211Smarcel *
26110211Smarcel * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27119880Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28119880Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29119880Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30110211Smarcel * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31110211Smarcel * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32135699Smarcel * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33110211Smarcel * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34110211Smarcel * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35110211Smarcel * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36110211Smarcel * SUCH DAMAGE.
37110211Smarcel *
38110211Smarcel *	@(#)pwd.h	8.2 (Berkeley) 1/21/94
39110211Smarcel * $FreeBSD: head/include/pwd.h 90644 2002-02-14 01:59:47Z imp $
40110211Smarcel */
41110211Smarcel
42135699Smarcel#ifndef _PWD_H_
43135699Smarcel#define	_PWD_H_
44135699Smarcel
45110211Smarcel#include <sys/types.h>
46110211Smarcel
47135699Smarcel#ifndef _POSIX_SOURCE
48135699Smarcel#define _PATH_PWD		"/etc"
49135699Smarcel#define	_PATH_PASSWD		"/etc/passwd"
50135699Smarcel#define	_PASSWD			"passwd"
51110211Smarcel#define	_PATH_MASTERPASSWD	"/etc/master.passwd"
52135699Smarcel#define	_MASTERPASSWD		"master.passwd"
53135699Smarcel
54135699Smarcel#define	_PATH_MP_DB		"/etc/pwd.db"
55110211Smarcel#define	_MP_DB			"pwd.db"
56135699Smarcel#define	_PATH_SMP_DB		"/etc/spwd.db"
57135699Smarcel#define	_SMP_DB			"spwd.db"
58135699Smarcel
59135699Smarcel#define	_PATH_PWD_MKDB		"/usr/sbin/pwd_mkdb"
60135699Smarcel
61110211Smarcel#define	_PW_KEYBYNAME		'1'	/* stored by name */
62135699Smarcel#define	_PW_KEYBYNUM		'2'	/* stored by entry in the "file" */
63135699Smarcel#define	_PW_KEYBYUID		'3'	/* stored by uid */
64110211Smarcel#define _PW_KEYYPENABLED	'4'	/* YP is enabled */
65135699Smarcel#define	_PW_KEYYPBYNUM		'5'	/* special +@netgroup entries */
66110211Smarcel
67135699Smarcel#define	_PASSWORD_EFMT1		'_'	/* extended encryption format */
68135699Smarcel
69110211Smarcel#define	_PASSWORD_LEN		128	/* max length, not counting NULL */
70110211Smarcel#endif
71110211Smarcel
72110211Smarcelstruct passwd {
73110211Smarcel	char	*pw_name;		/* user name */
74110211Smarcel	char	*pw_passwd;		/* encrypted password */
75110211Smarcel	uid_t	pw_uid;			/* user uid */
76110211Smarcel	gid_t	pw_gid;			/* user gid */
77110211Smarcel	time_t	pw_change;		/* password change time */
78110211Smarcel	char	*pw_class;		/* user access class */
79110211Smarcel	char	*pw_gecos;		/* Honeywell login info */
80110211Smarcel	char	*pw_dir;		/* home directory */
81110211Smarcel	char	*pw_shell;		/* default shell */
82110211Smarcel	time_t	pw_expire;		/* account expiration */
83110211Smarcel	int	pw_fields;		/* internal: fields filled in */
84110211Smarcel};
85110211Smarcel
86110211Smarcel/* Mapping from fields to bits for pw_fields. */
87110211Smarcel#define _PWF(x)		(1 << x)
88110211Smarcel#define _PWF_NAME	_PWF(0)
89110211Smarcel#define _PWF_PASSWD	_PWF(1)
90110211Smarcel#define _PWF_UID	_PWF(2)
91110211Smarcel#define _PWF_GID	_PWF(3)
92110211Smarcel#define _PWF_CHANGE	_PWF(4)
93135699Smarcel#define _PWF_CLASS	_PWF(5)
94110211Smarcel#define _PWF_GECOS	_PWF(6)
95135699Smarcel#define _PWF_DIR	_PWF(7)
96135699Smarcel#define _PWF_SHELL	_PWF(8)
97135699Smarcel#define _PWF_EXPIRE	_PWF(9)
98135699Smarcel
99110211Smarcel#include <sys/cdefs.h>
100110211Smarcel
101110211Smarcel__BEGIN_DECLS
102135699Smarcelstruct passwd	*getpwuid __P((uid_t));
103110211Smarcelstruct passwd	*getpwnam __P((const char *));
104110211Smarcel#ifndef _POSIX_SOURCE
105110211Smarcelstruct passwd	*getpwent __P((void));
106110211Smarcelint		 setpassent __P((int));
107110211Smarcelvoid		 setpwent __P((void));
108110211Smarcelvoid		 endpwent __P((void));
109110211Smarcelchar		*user_from_uid __P((uid_t, int));
110135699Smarcel#endif
111110211Smarcel__END_DECLS
112110211Smarcel
113110211Smarcel#endif /* !_PWD_H_ */
114135699Smarcel