summaryrefslogtreecommitdiffstats
path: root/include/pwd.h
diff options
context:
space:
mode:
authornectar <nectar@FreeBSD.org>2003-04-17 14:15:26 +0000
committernectar <nectar@FreeBSD.org>2003-04-17 14:15:26 +0000
commitcd021cdb21c56ef20cd0d905c99c29cf24bd9773 (patch)
tree194a658195371c8a28e5f3ecbd1d1b1e2dfe5588 /include/pwd.h
parent1b1f6bb4f50d42bbbb1291be0c60741c12f8201a (diff)
downloadFreeBSD-src-cd021cdb21c56ef20cd0d905c99c29cf24bd9773.zip
FreeBSD-src-cd021cdb21c56ef20cd0d905c99c29cf24bd9773.tar.gz
= Implement thread-safe versions of the getpwent(3) and getgrent(3)
family of functions using the new nsdispatch(3) core. Remove arbitrary size limits when using the thread-safe versions. = Re-implement the traditional getpwent(3)/getgrent(3) functions on top of the thread-safe versions. = Update the on-disk format of the hashed version of the passwd(5) databases to allow for versioned entries. The legacy version is `3'. (Don't ask.) = Add support for version `4' entries in the passwd(5) database. Entries in this format are identical to version 3 entries except that all integers are stored as 32-bit integers in network byte order (big endian). = pwd_mkdb is updated to generate both version 3 and version 4 entries. Sponsored by: DARPA, Network Associates Laboratories
Diffstat (limited to 'include/pwd.h')
-rw-r--r--include/pwd.h32
1 files changed, 24 insertions, 8 deletions
diff --git a/include/pwd.h b/include/pwd.h
index 40082c3..cda449a 100644
--- a/include/pwd.h
+++ b/include/pwd.h
@@ -60,6 +60,11 @@ typedef __uid_t uid_t;
#define _UID_T_DECLARED
#endif
+#ifndef _SIZE_T_DECLARED
+typedef __size_t size_t;
+#define _SIZE_T_DECLARED
+#endif
+
#define _PATH_PWD "/etc"
#define _PATH_PASSWD "/etc/passwd"
#define _PASSWD "passwd"
@@ -73,11 +78,17 @@ typedef __uid_t uid_t;
#define _PATH_PWD_MKDB "/usr/sbin/pwd_mkdb"
-#define _PW_KEYBYNAME '1' /* stored by name */
-#define _PW_KEYBYNUM '2' /* stored by entry in the "file" */
-#define _PW_KEYBYUID '3' /* stored by uid */
-#define _PW_KEYYPENABLED '4' /* YP is enabled */
-#define _PW_KEYYPBYNUM '5' /* special +@netgroup entries */
+#define _PWD_VERSION_KEY "\xFF" "VERSION"
+#define _PWD_CURRENT_VERSION '\x04'
+
+#define _PW_VERSION_MASK '0xF0'
+#define _PW_VERSION(x) ((unsigned char)((x)<<4))
+
+#define _PW_KEYBYNAME '\x01' /* stored by name */
+#define _PW_KEYBYNUM '\x02' /* stored by entry in the "file" */
+#define _PW_KEYBYUID '\x03' /* stored by uid */
+#define _PW_KEYYPENABLED '\x04' /* YP is enabled */
+#define _PW_KEYYPBYNUM '\x05' /* special +@netgroup entries */
#define _PASSWORD_EFMT1 '_' /* extended encryption format */
@@ -110,6 +121,9 @@ struct passwd {
#define _PWF_SHELL _PWF(8)
#define _PWF_EXPIRE _PWF(9)
+/* XXX These flags are bogus. With nsswitch, there are many
+ * possible sources and they cannot be represented in a small integer.
+ */
#define _PWF_SOURCE 0x3000
#define _PWF_FILES 0x1000
#define _PWF_NIS 0x2000
@@ -123,12 +137,14 @@ struct passwd *getpwuid(uid_t);
void endpwent(void);
struct passwd *getpwent(void);
void setpwent(void);
-/*
- * XXX missing getpwnam_r() and getpwuid_r().
- */
+int getpwnam_r(const char *, struct passwd *, char *, size_t,
+ struct passwd **);
+int getpwuid_r(uid_t, struct passwd *, char *, size_t,
+ struct passwd **);
#endif
#if __BSD_VISIBLE
+int getpwent_r(struct passwd *, char *, size_t, struct passwd **);
int setpassent(int);
const char *user_from_uid(uid_t, int);
#endif
OpenPOWER on IntegriCloud