diff options
author | nectar <nectar@FreeBSD.org> | 2003-04-18 14:11:17 +0000 |
---|---|---|
committer | nectar <nectar@FreeBSD.org> | 2003-04-18 14:11:17 +0000 |
commit | 8e1cb92b6b284beb94e09cfdf1027e4e8e63340b (patch) | |
tree | fb8dc3c1948512943db80c33abf64ace4c5ad55b /include | |
parent | e2c2f3b86293be44009838be94c2f3aaf23b0a1d (diff) | |
download | FreeBSD-src-8e1cb92b6b284beb94e09cfdf1027e4e8e63340b.zip FreeBSD-src-8e1cb92b6b284beb94e09cfdf1027e4e8e63340b.tar.gz |
Revert the definitions of _PW_KEY* to their previous values. There is
at least one consumer outside of libc and pwd_mkdb.
Adjust the versioning in libc and pwd_mkdb accordingly.
named was the application affected, and that fact was first
Reported by: Zherdev Anatoly <tolyar@mx.ru>
Sponsored by: DARPA, Network Associates Laboratories
Diffstat (limited to 'include')
-rw-r--r-- | include/pwd.h | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/include/pwd.h b/include/pwd.h index cda449a..e045f18 100644 --- a/include/pwd.h +++ b/include/pwd.h @@ -78,17 +78,36 @@ typedef __size_t size_t; #define _PATH_PWD_MKDB "/usr/sbin/pwd_mkdb" -#define _PWD_VERSION_KEY "\xFF" "VERSION" -#define _PWD_CURRENT_VERSION '\x04' +/* Historically, the keys in _PATH_MP_DB/_PATH_SMP_DB had the format + * `1 octet tag | key', where the tag is one of the _PW_KEY* values + * listed below. These values happen to be ASCII digits. Starting + * with FreeBSD 5.1, the tag is now still a single octet, but the + * upper 4 bits are interpreted as a version. Pre-FreeBSD 5.1 format + * entries are version `3' -- this conveniently results in the same + * key values as before. The new, architecture-independent entries + * are version `4'. + * As it happens, some applications read the database directly. + * (Bad app, no cookie!) Thus, we leave the _PW_KEY* symbols at their + * old pre-FreeBSD 5.1 values so these apps still work. Consequently + * we have to do muck around a bit more to get the correct, versioned + * tag, and that is what the _PW_VERSIONED macros is about. + */ #define _PW_VERSION_MASK '0xF0' -#define _PW_VERSION(x) ((unsigned char)((x)<<4)) +#define _PW_VERSIONED(x, v) ((unsigned char)(((x) & 0xCF) | ((v)<<4))) + +#define _PW_KEYBYNAME '\x31' /* stored by name */ +#define _PW_KEYBYNUM '\x32' /* stored by entry in the "file" */ +#define _PW_KEYBYUID '\x33' /* stored by uid */ +#define _PW_KEYYPENABLED '\x34' /* YP is enabled */ +#define _PW_KEYYPBYNUM '\x35' /* special +@netgroup entries */ -#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 */ +/* The database also contains a key to indicate the format version of + * the entries therein. There may be other, older versioned entries + * as well. + */ +#define _PWD_VERSION_KEY "\xFF" "VERSION" +#define _PWD_CURRENT_VERSION '\x04' #define _PASSWORD_EFMT1 '_' /* extended encryption format */ |