pwd.h revision 94688
181390Sjake/*- 281390Sjake * Copyright (c) 1989, 1993 381390Sjake * The Regents of the University of California. All rights reserved. 481390Sjake * (c) UNIX System Laboratories, Inc. 581390Sjake * All or some portions of this file are derived from material licensed 681390Sjake * to the University of California by American Telephone and Telegraph 781390Sjake * Co. or Unix System Laboratories, Inc. and are reproduced herein with 881390Sjake * the permission of UNIX System Laboratories, Inc. 981390Sjake * 1081390Sjake * Redistribution and use in source and binary forms, with or without 1181390Sjake * modification, are permitted provided that the following conditions 1281390Sjake * are met: 1381390Sjake * 1. Redistributions of source code must retain the above copyright 1481390Sjake * notice, this list of conditions and the following disclaimer. 1581390Sjake * 2. Redistributions in binary form must reproduce the above copyright 1681390Sjake * notice, this list of conditions and the following disclaimer in the 1781390Sjake * documentation and/or other materials provided with the distribution. 1881390Sjake * 3. All advertising materials mentioning features or use of this software 1981390Sjake * must display the following acknowledgement: 2081390Sjake * This product includes software developed by the University of 2181390Sjake * California, Berkeley and its contributors. 2281390Sjake * 4. Neither the name of the University nor the names of its contributors 2381390Sjake * may be used to endorse or promote products derived from this software 2481390Sjake * without specific prior written permission. 2581390Sjake * 2681390Sjake * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2781390Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2881390Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2981390Sjake * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 3081390Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3181390Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3297265Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3381390Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3497265Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3597265Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36117658Sjmg * SUCH DAMAGE. 3781390Sjake * 3897265Sjake * @(#)pwd.h 8.2 (Berkeley) 1/21/94 3997265Sjake * $FreeBSD: head/include/pwd.h 94688 2002-04-14 22:24:55Z des $ 4088623Sjake */ 4181390Sjake 4281390Sjake#ifndef _PWD_H_ 4381390Sjake#define _PWD_H_ 4484849Stmm 4584849Stmm#include <sys/types.h> 4689051Sjake 4789051Sjake#ifndef _POSIX_SOURCE 4889051Sjake#define _PATH_PWD "/etc" 4984849Stmm#define _PATH_PASSWD "/etc/passwd" 5081390Sjake#define _PASSWD "passwd" 5181390Sjake#define _PATH_MASTERPASSWD "/etc/master.passwd" 52166105Smarius#define _MASTERPASSWD "master.passwd" 53166105Smarius 5497508Sjake#define _PATH_MP_DB "/etc/pwd.db" 5597508Sjake#define _MP_DB "pwd.db" 5681390Sjake#define _PATH_SMP_DB "/etc/spwd.db" 5781390Sjake#define _SMP_DB "spwd.db" 5881390Sjake 5997265Sjake#define _PATH_PWD_MKDB "/usr/sbin/pwd_mkdb" 6081390Sjake 6197265Sjake#define _PW_KEYBYNAME '1' /* stored by name */ 6297265Sjake#define _PW_KEYBYNUM '2' /* stored by entry in the "file" */ 6397265Sjake#define _PW_KEYBYUID '3' /* stored by uid */ 6497265Sjake#define _PW_KEYYPENABLED '4' /* YP is enabled */ 6597265Sjake#define _PW_KEYYPBYNUM '5' /* special +@netgroup entries */ 6697265Sjake 6781390Sjake#define _PASSWORD_EFMT1 '_' /* extended encryption format */ 6881390Sjake 6983053Sobrien#define _PASSWORD_LEN 128 /* max length, not counting NULL */ 7085235Sjake#endif 7181390Sjake 72151658Sjhbstruct passwd { 7381390Sjake char *pw_name; /* user name */ 7485235Sjake char *pw_passwd; /* encrypted password */ 7581390Sjake uid_t pw_uid; /* user uid */ 7681390Sjake gid_t pw_gid; /* user gid */ 7788623Sjake time_t pw_change; /* password change time */ 7881390Sjake char *pw_class; /* user access class */ 7981390Sjake char *pw_gecos; /* Honeywell login info */ 8081390Sjake char *pw_dir; /* home directory */ 81166105Smarius char *pw_shell; /* default shell */ 8290624Stmm time_t pw_expire; /* account expiration */ 8390624Stmm int pw_fields; /* internal: fields filled in */ 8484849Stmm}; 85166105Smarius 8684849Stmm/* Mapping from fields to bits for pw_fields. */ 8781390Sjake#define _PWF(x) (1 << x) 88104075Sjake#define _PWF_NAME _PWF(0) 8981390Sjake#define _PWF_PASSWD _PWF(1) 90166105Smarius#define _PWF_UID _PWF(2) 91166105Smarius#define _PWF_GID _PWF(3) 92166105Smarius#define _PWF_CHANGE _PWF(4) 93#define _PWF_CLASS _PWF(5) 94#define _PWF_GECOS _PWF(6) 95#define _PWF_DIR _PWF(7) 96#define _PWF_SHELL _PWF(8) 97#define _PWF_EXPIRE _PWF(9) 98 99#define _PWF_SOURCE 0x3000 100#define _PWF_FILES 0x1000 101#define _PWF_NIS 0x2000 102#define _PWF_HESIOD 0x3000 103 104#include <sys/cdefs.h> 105 106__BEGIN_DECLS 107struct passwd *getpwuid(uid_t); 108struct passwd *getpwnam(const char *); 109#ifndef _POSIX_SOURCE 110struct passwd *getpwent(void); 111int setpassent(int); 112void setpwent(void); 113void endpwent(void); 114const char *user_from_uid(uid_t, int); 115#endif 116__END_DECLS 117 118#endif /* !_PWD_H_ */ 119