1.1 --- a/epoc32/include/stdapis/pwd.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/stdapis/pwd.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,164 @@
1.4 -pwd.h
1.5 +/*-
1.6 + * Copyright (c) 1989, 1993
1.7 + * The Regents of the University of California. All rights reserved.
1.8 + * (c) UNIX System Laboratories, Inc.
1.9 + * All or some portions of this file are derived from material licensed
1.10 + * to the University of California by American Telephone and Telegraph
1.11 + * Co. or Unix System Laboratories, Inc. and are reproduced herein with
1.12 + * the permission of UNIX System Laboratories, Inc.
1.13 + *
1.14 + * Redistribution and use in source and binary forms, with or without
1.15 + * modification, are permitted provided that the following conditions
1.16 + * are met:
1.17 + * 1. Redistributions of source code must retain the above copyright
1.18 + * notice, this list of conditions and the following disclaimer.
1.19 + * 2. Redistributions in binary form must reproduce the above copyright
1.20 + * notice, this list of conditions and the following disclaimer in the
1.21 + * documentation and/or other materials provided with the distribution.
1.22 + * 4. Neither the name of the University nor the names of its contributors
1.23 + * may be used to endorse or promote products derived from this software
1.24 + * without specific prior written permission.
1.25 + *
1.26 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1.27 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1.28 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1.29 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1.30 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1.31 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1.32 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1.33 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1.34 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1.35 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1.36 + * SUCH DAMAGE.
1.37 + *
1.38 + * @(#)pwd.h 8.2 (Berkeley) 1/21/94
1.39 + * $FreeBSD: src/include/pwd.h,v 1.16 2005/01/26 17:26:54 nectar Exp $
1.40 + * © Portions copyright (c) 2005-2006 Nokia Corporation. All rights reserved.
1.41 + */
1.42 +
1.43 +#ifndef _PWD_H_
1.44 +#define _PWD_H_
1.45 +
1.46 +#include <sys/cdefs.h>
1.47 +#include <sys/_types.h>
1.48 +
1.49 +#ifndef _GID_T_DECLARED
1.50 +typedef __gid_t gid_t;
1.51 +#define _GID_T_DECLARED
1.52 +#endif
1.53 +
1.54 +#ifndef _TIME_T_DECLARED
1.55 +typedef __time_t time_t;
1.56 +#define _TIME_T_DECLARED
1.57 +#endif
1.58 +
1.59 +#ifndef _UID_T_DECLARED
1.60 +typedef __uid_t uid_t;
1.61 +#define _UID_T_DECLARED
1.62 +#endif
1.63 +
1.64 +#ifndef _SIZE_T_DECLARED
1.65 +typedef __size_t size_t;
1.66 +#define _SIZE_T_DECLARED
1.67 +#endif
1.68 +
1.69 +#define _PATH_PWD "/etc"
1.70 +#define _PATH_PASSWD "/etc/passwd"
1.71 +#define _PASSWD "passwd"
1.72 +#define _PATH_MASTERPASSWD "/etc/master.passwd"
1.73 +#define _MASTERPASSWD "master.passwd"
1.74 +
1.75 +#define _PATH_MP_DB "/etc/pwd.db"
1.76 +#define _MP_DB "pwd.db"
1.77 +#define _PATH_SMP_DB "/etc/spwd.db"
1.78 +#define _SMP_DB "spwd.db"
1.79 +
1.80 +#define _PATH_PWD_MKDB "/usr/sbin/pwd_mkdb"
1.81 +
1.82 +/* Historically, the keys in _PATH_MP_DB/_PATH_SMP_DB had the format
1.83 + * `1 octet tag | key', where the tag is one of the _PW_KEY* values
1.84 + * listed below. These values happen to be ASCII digits. Starting
1.85 + * with FreeBSD 5.1, the tag is now still a single octet, but the
1.86 + * upper 4 bits are interpreted as a version. Pre-FreeBSD 5.1 format
1.87 + * entries are version `3' -- this conveniently results in the same
1.88 + * key values as before. The new, architecture-independent entries
1.89 + * are version `4'.
1.90 + * As it happens, some applications read the database directly.
1.91 + * (Bad app, no cookie!) Thus, we leave the _PW_KEY* symbols at their
1.92 + * old pre-FreeBSD 5.1 values so these apps still work. Consequently
1.93 + * we have to muck around a bit more to get the correct, versioned
1.94 + * tag, and that is what the _PW_VERSIONED macro is about.
1.95 + */
1.96 +
1.97 +#define _PW_VERSION_MASK '\xF0'
1.98 +#define _PW_VERSIONED(x, v) ((unsigned char)(((x) & 0xCF) | ((v)<<4)))
1.99 +
1.100 +#define _PW_KEYBYNAME '\x31' /* stored by name */
1.101 +#define _PW_KEYBYNUM '\x32' /* stored by entry in the "file" */
1.102 +#define _PW_KEYBYUID '\x33' /* stored by uid */
1.103 +#define _PW_KEYYPENABLED '\x34' /* YP is enabled */
1.104 +#define _PW_KEYYPBYNUM '\x35' /* special + @ netgroup entries */
1.105 +
1.106 +/* The database also contains a key to indicate the format version of
1.107 + * the entries therein. There may be other, older versioned entries
1.108 + * as well.
1.109 + */
1.110 +#define _PWD_VERSION_KEY "\xFF" "VERSION"
1.111 +#define _PWD_CURRENT_VERSION '\x04'
1.112 +
1.113 +#define _PASSWORD_EFMT1 '_' /* extended encryption format */
1.114 +
1.115 +#define _PASSWORD_LEN 128 /* max length, not counting NULL */
1.116 +
1.117 +struct passwd {
1.118 + char *pw_name; /* user name */
1.119 + char *pw_passwd; /* encrypted password */
1.120 + uid_t pw_uid; /* user uid */
1.121 + gid_t pw_gid; /* user gid */
1.122 + time_t pw_change; /* password change time */
1.123 + char *pw_class; /* user access class */
1.124 + char *pw_gecos; /* Honeywell login info */
1.125 + char *pw_dir; /* home directory */
1.126 + char *pw_shell; /* default shell */
1.127 + time_t pw_expire; /* account expiration */
1.128 + int pw_fields; /* internal: fields filled in */
1.129 +};
1.130 +
1.131 +/* Mapping from fields to bits for pw_fields. */
1.132 +#define _PWF(x) (1 << x)
1.133 +#define _PWF_NAME _PWF(0)
1.134 +#define _PWF_PASSWD _PWF(1)
1.135 +#define _PWF_UID _PWF(2)
1.136 +#define _PWF_GID _PWF(3)
1.137 +#define _PWF_CHANGE _PWF(4)
1.138 +#define _PWF_CLASS _PWF(5)
1.139 +#define _PWF_GECOS _PWF(6)
1.140 +#define _PWF_DIR _PWF(7)
1.141 +#define _PWF_SHELL _PWF(8)
1.142 +#define _PWF_EXPIRE _PWF(9)
1.143 +
1.144 +/* XXX These flags are bogus. With nsswitch, there are many
1.145 + * possible sources and they cannot be represented in a small integer.
1.146 + */
1.147 +#define _PWF_SOURCE 0x3000
1.148 +#define _PWF_FILES 0x1000
1.149 +#define _PWF_NIS 0x2000
1.150 +#define _PWF_HESIOD 0x3000
1.151 +
1.152 +__BEGIN_DECLS
1.153 +IMPORT_C struct passwd *getpwnam(const char *);
1.154 +IMPORT_C struct passwd *getpwuid(uid_t);
1.155 +
1.156 +#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500
1.157 +IMPORT_C void endpwent(void);
1.158 +IMPORT_C struct passwd *getpwent(void);
1.159 +IMPORT_C void setpwent(void);
1.160 +IMPORT_C int getpwnam_r(const char *, struct passwd *, char *, size_t,
1.161 + struct passwd **);
1.162 +IMPORT_C int getpwuid_r(uid_t, struct passwd *, char *, size_t,
1.163 + struct passwd **);
1.164 +#endif
1.165 +
1.166 +__END_DECLS
1.167 +
1.168 +#endif /* !_PWD_H_ */