pwd.h revision 94688
11539Srgrimes/*- 21539Srgrimes * Copyright (c) 1989, 1993 31539Srgrimes * The Regents of the University of California. All rights reserved. 41539Srgrimes * (c) UNIX System Laboratories, Inc. 51539Srgrimes * All or some portions of this file are derived from material licensed 61539Srgrimes * to the University of California by American Telephone and Telegraph 71539Srgrimes * Co. or Unix System Laboratories, Inc. and are reproduced herein with 81539Srgrimes * the permission of UNIX System Laboratories, Inc. 91539Srgrimes * 101539Srgrimes * Redistribution and use in source and binary forms, with or without 111539Srgrimes * modification, are permitted provided that the following conditions 121539Srgrimes * are met: 131539Srgrimes * 1. Redistributions of source code must retain the above copyright 141539Srgrimes * notice, this list of conditions and the following disclaimer. 151539Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 161539Srgrimes * notice, this list of conditions and the following disclaimer in the 171539Srgrimes * documentation and/or other materials provided with the distribution. 181539Srgrimes * 3. All advertising materials mentioning features or use of this software 191539Srgrimes * must display the following acknowledgement: 201539Srgrimes * This product includes software developed by the University of 211539Srgrimes * California, Berkeley and its contributors. 221539Srgrimes * 4. Neither the name of the University nor the names of its contributors 231539Srgrimes * may be used to endorse or promote products derived from this software 241539Srgrimes * without specific prior written permission. 251539Srgrimes * 261539Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 271539Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 281539Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 291539Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 301539Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 311539Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 321539Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 331539Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 341539Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 351539Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 361539Srgrimes * SUCH DAMAGE. 371539Srgrimes * 381539Srgrimes * @(#)pwd.h 8.2 (Berkeley) 1/21/94 3990644Simp * $FreeBSD: head/include/pwd.h 94688 2002-04-14 22:24:55Z des $ 401539Srgrimes */ 411539Srgrimes 421539Srgrimes#ifndef _PWD_H_ 431539Srgrimes#define _PWD_H_ 441539Srgrimes 451539Srgrimes#include <sys/types.h> 461539Srgrimes 471539Srgrimes#ifndef _POSIX_SOURCE 482552Sgpalmer#define _PATH_PWD "/etc" 491539Srgrimes#define _PATH_PASSWD "/etc/passwd" 502552Sgpalmer#define _PASSWD "passwd" 511539Srgrimes#define _PATH_MASTERPASSWD "/etc/master.passwd" 522552Sgpalmer#define _MASTERPASSWD "master.passwd" 531539Srgrimes 541539Srgrimes#define _PATH_MP_DB "/etc/pwd.db" 552552Sgpalmer#define _MP_DB "pwd.db" 561539Srgrimes#define _PATH_SMP_DB "/etc/spwd.db" 572552Sgpalmer#define _SMP_DB "spwd.db" 581539Srgrimes 591539Srgrimes#define _PATH_PWD_MKDB "/usr/sbin/pwd_mkdb" 601539Srgrimes 611539Srgrimes#define _PW_KEYBYNAME '1' /* stored by name */ 621539Srgrimes#define _PW_KEYBYNUM '2' /* stored by entry in the "file" */ 631539Srgrimes#define _PW_KEYBYUID '3' /* stored by uid */ 642915Swollman#define _PW_KEYYPENABLED '4' /* YP is enabled */ 6515267Swpaul#define _PW_KEYYPBYNUM '5' /* special +@netgroup entries */ 661539Srgrimes 671539Srgrimes#define _PASSWORD_EFMT1 '_' /* extended encryption format */ 681539Srgrimes 691539Srgrimes#define _PASSWORD_LEN 128 /* max length, not counting NULL */ 701539Srgrimes#endif 711539Srgrimes 721539Srgrimesstruct passwd { 731539Srgrimes char *pw_name; /* user name */ 741539Srgrimes char *pw_passwd; /* encrypted password */ 7542780Sdes uid_t pw_uid; /* user uid */ 7642780Sdes gid_t pw_gid; /* user gid */ 771539Srgrimes time_t pw_change; /* password change time */ 781539Srgrimes char *pw_class; /* user access class */ 791539Srgrimes char *pw_gecos; /* Honeywell login info */ 801539Srgrimes char *pw_dir; /* home directory */ 811539Srgrimes char *pw_shell; /* default shell */ 821539Srgrimes time_t pw_expire; /* account expiration */ 832915Swollman int pw_fields; /* internal: fields filled in */ 841539Srgrimes}; 851539Srgrimes 862915Swollman/* Mapping from fields to bits for pw_fields. */ 872915Swollman#define _PWF(x) (1 << x) 882915Swollman#define _PWF_NAME _PWF(0) 892915Swollman#define _PWF_PASSWD _PWF(1) 902915Swollman#define _PWF_UID _PWF(2) 912915Swollman#define _PWF_GID _PWF(3) 922915Swollman#define _PWF_CHANGE _PWF(4) 932915Swollman#define _PWF_CLASS _PWF(5) 942915Swollman#define _PWF_GECOS _PWF(6) 952915Swollman#define _PWF_DIR _PWF(7) 962915Swollman#define _PWF_SHELL _PWF(8) 972915Swollman#define _PWF_EXPIRE _PWF(9) 982915Swollman 9994688Sdes#define _PWF_SOURCE 0x3000 10094688Sdes#define _PWF_FILES 0x1000 10194688Sdes#define _PWF_NIS 0x2000 10294688Sdes#define _PWF_HESIOD 0x3000 10394688Sdes 1041539Srgrimes#include <sys/cdefs.h> 1051539Srgrimes 1061539Srgrimes__BEGIN_DECLS 10793032Simpstruct passwd *getpwuid(uid_t); 10893032Simpstruct passwd *getpwnam(const char *); 1091539Srgrimes#ifndef _POSIX_SOURCE 11093032Simpstruct passwd *getpwent(void); 11193032Simpint setpassent(int); 11293032Simpvoid setpwent(void); 11393032Simpvoid endpwent(void); 11493032Simpconst char *user_from_uid(uid_t, int); 1151539Srgrimes#endif 1161539Srgrimes__END_DECLS 1171539Srgrimes 1181539Srgrimes#endif /* !_PWD_H_ */ 119