pwd.h revision 98070
11573Srgrimes/*- 21573Srgrimes * Copyright (c) 1989, 1993 31573Srgrimes * The Regents of the University of California. All rights reserved. 41573Srgrimes * (c) UNIX System Laboratories, Inc. 51573Srgrimes * All or some portions of this file are derived from material licensed 61573Srgrimes * to the University of California by American Telephone and Telegraph 71573Srgrimes * Co. or Unix System Laboratories, Inc. and are reproduced herein with 81573Srgrimes * the permission of UNIX System Laboratories, Inc. 91573Srgrimes * 101573Srgrimes * Redistribution and use in source and binary forms, with or without 111573Srgrimes * modification, are permitted provided that the following conditions 121573Srgrimes * are met: 131573Srgrimes * 1. Redistributions of source code must retain the above copyright 141573Srgrimes * notice, this list of conditions and the following disclaimer. 151573Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 161573Srgrimes * notice, this list of conditions and the following disclaimer in the 171573Srgrimes * documentation and/or other materials provided with the distribution. 181573Srgrimes * 3. All advertising materials mentioning features or use of this software 191573Srgrimes * must display the following acknowledgement: 201573Srgrimes * This product includes software developed by the University of 211573Srgrimes * California, Berkeley and its contributors. 221573Srgrimes * 4. Neither the name of the University nor the names of its contributors 231573Srgrimes * may be used to endorse or promote products derived from this software 241573Srgrimes * without specific prior written permission. 251573Srgrimes * 261573Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 271573Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 281573Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2950476Speter * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 301573Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31201512Skib * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 321573Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3379531Sru * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 341573Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 351573Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 361573Srgrimes * SUCH DAMAGE. 371573Srgrimes * 3859460Sphantom * @(#)pwd.h 8.2 (Berkeley) 1/21/94 3959460Sphantom * $FreeBSD: head/include/pwd.h 98070 2002-06-09 19:39:18Z mike $ 401573Srgrimes */ 4184306Sru 421573Srgrimes#ifndef _PWD_H_ 43208734Suqs#define _PWD_H_ 441573Srgrimes 45201512Skib#include <sys/cdefs.h> 461573Srgrimes#include <sys/_types.h> 471573Srgrimes 481573Srgrimes#ifdef _BSD_GID_T_ 491573Srgrimestypedef _BSD_GID_T_ gid_t; 501573Srgrimes#undef _BSD_GID_T_ 511573Srgrimes#endif 521573Srgrimes 531573Srgrimes#ifdef _BSD_TIME_T_ 541573Srgrimestypedef _BSD_TIME_T_ time_t; 551573Srgrimes#undef _BSD_TIME_T_ 561573Srgrimes#endif 571573Srgrimes 581573Srgrimes#ifdef _BSD_UID_T_ 591573Srgrimestypedef _BSD_UID_T_ uid_t; 601573Srgrimes#undef _BSD_UID_T_ 611573Srgrimes#endif 62108087Sru 631573Srgrimes#define _PATH_PWD "/etc" 641573Srgrimes#define _PATH_PASSWD "/etc/passwd" 651573Srgrimes#define _PASSWD "passwd" 661573Srgrimes#define _PATH_MASTERPASSWD "/etc/master.passwd" 671573Srgrimes#define _MASTERPASSWD "master.passwd" 681573Srgrimes 691573Srgrimes#define _PATH_MP_DB "/etc/pwd.db" 701573Srgrimes#define _MP_DB "pwd.db" 711573Srgrimes#define _PATH_SMP_DB "/etc/spwd.db" 721573Srgrimes#define _SMP_DB "spwd.db" 731573Srgrimes 74108087Sru#define _PATH_PWD_MKDB "/usr/sbin/pwd_mkdb" 751573Srgrimes 761573Srgrimes#define _PW_KEYBYNAME '1' /* stored by name */ 771573Srgrimes#define _PW_KEYBYNUM '2' /* stored by entry in the "file" */ 781573Srgrimes#define _PW_KEYBYUID '3' /* stored by uid */ 791573Srgrimes#define _PW_KEYYPENABLED '4' /* YP is enabled */ 801573Srgrimes#define _PW_KEYYPBYNUM '5' /* special +@netgroup entries */ 811573Srgrimes 821573Srgrimes#define _PASSWORD_EFMT1 '_' /* extended encryption format */ 831573Srgrimes 84202691Sache#define _PASSWORD_LEN 128 /* max length, not counting NULL */ 85202691Sache 861573Srgrimesstruct passwd { 871573Srgrimes char *pw_name; /* user name */ 881573Srgrimes char *pw_passwd; /* encrypted password */ 891573Srgrimes uid_t pw_uid; /* user uid */ 901573Srgrimes gid_t pw_gid; /* user gid */ 911573Srgrimes time_t pw_change; /* password change time */ 921573Srgrimes char *pw_class; /* user access class */ 931573Srgrimes char *pw_gecos; /* Honeywell login info */ 941573Srgrimes char *pw_dir; /* home directory */ 951573Srgrimes char *pw_shell; /* default shell */ 961573Srgrimes time_t pw_expire; /* account expiration */ 971573Srgrimes int pw_fields; /* internal: fields filled in */ 98202691Sache}; 99202691Sache 1001573Srgrimes/* Mapping from fields to bits for pw_fields. */ 1011573Srgrimes#define _PWF(x) (1 << x) 1021573Srgrimes#define _PWF_NAME _PWF(0) 1031573Srgrimes#define _PWF_PASSWD _PWF(1) 1041573Srgrimes#define _PWF_UID _PWF(2) 10567967Sasmodai#define _PWF_GID _PWF(3) 1061573Srgrimes#define _PWF_CHANGE _PWF(4) 107#define _PWF_CLASS _PWF(5) 108#define _PWF_GECOS _PWF(6) 109#define _PWF_DIR _PWF(7) 110#define _PWF_SHELL _PWF(8) 111#define _PWF_EXPIRE _PWF(9) 112 113#define _PWF_SOURCE 0x3000 114#define _PWF_FILES 0x1000 115#define _PWF_NIS 0x2000 116#define _PWF_HESIOD 0x3000 117 118__BEGIN_DECLS 119struct passwd *getpwnam(const char *); 120struct passwd *getpwuid(uid_t); 121 122#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500 123void endpwent(void); 124struct passwd *getpwent(void); 125void setpwent(void); 126/* 127 * XXX missing getpwnam_r() and getpwuid_r(). 128 */ 129#endif 130 131#if __BSD_VISIBLE 132int setpassent(int); 133const char *user_from_uid(uid_t, int); 134#endif 135__END_DECLS 136 137#endif /* !_PWD_H_ */ 138