aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/pwd_mkdb
Commit message (Collapse)AuthorAgeFilesLines
* Fix bootstrapping of pwd_mkdb after r364049Alex Richardson2020-08-111-1/+1
| | | | | | | | I moved the bootstrap pwd.h to a subdirectory in r364049 but forgot to adjust the #include path. Notes: svn path=/head/; revision=364121
* Fix i386 build of chpass after r363992Alex Richardson2020-08-082-1/+1
| | | | | | | | | | | | | | My change to allow bootstrapping pwd_mkdb (r363992) resulted in i386 build failures because the bootstrap header was being included in non-bootstrap chpass. Dropping the no longer required pwd_mkdb include path from chpass fixes the build, but to be certain that the failure doesn't get re-introduced, I've also moved the bootstrap pwd.h into a subdirectory so that adding -I${SRCTOP}/usr.sbin/pwd_mkdb doesn't pull it in. Reported by: mjg Notes: svn path=/head/; revision=364049
* Allow bootstrapping pwd_mkdb on Linux/macOSAlex Richardson2020-08-062-0/+69
| | | | | | | | | | | | | | | We need to provide a struct passwd that is compatible with the target system and this is not the case when cross-building from macOS/Linux. It should also be a problem when bootstrapping for an i386 target from a FreeBSD amd64 host since time_t does not match across those systems. However, pwd_mkdb always truncates integer values to 32-bit so this difference does not result in different databases. Reviewed By: brooks Differential Revision: https://reviews.freebsd.org/D25931 Notes: svn path=/head/; revision=363992
* pkgbase: Put a lot of binaries and lib in FreeBSD-runtimeEmmanuel Vadot2019-09-051-0/+1
| | | | | | | | | | | | All of them are needed to be able to boot to single user and be able to repair a existing FreeBSD installation so put them directly into FreeBSD-runtime. Reviewed by: bapt, gjb Differential Revision: https://reviews.freebsd.org/D21503 Notes: svn path=/head/; revision=351855
* pwd_mkdb: retire -B and -L endianness optionsEd Maste2018-10-212-20/+3
| | | | | | | | | | | Legacy v3 db support was retired in r333133, and it was v3 support that required the -B and -L options. The options were retained temporarily, but now that stable/12 has branched they can be removed. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=339515
* pwd_mkdb: retire legacy v3 db support (-l option)Ed Maste2018-05-012-135/+9
| | | | | | | | | | | | | | | | | | | | | | pwd_mkdb has emitted v4 password database records since 2003 (r113596) in addition to v3, and as of r283981 by default it emitted only v4. As described in r283981, retire the -l legacy option. The -B and -L options were originally added to set the endianness of v3 records emitted by pwd_mkdb, but they also set the db hash endiannes and so have been retained temporarily. Announced on the FreeBSD-Current and FreeBSD-Stable lists. In stable/11 the man page contains a deprecation notice, and pwd_mkdb will emit a deprecation notice if the -l option is specified. Reviewed by: delphij, lidl, rgrimes Relnotes: Yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D15144 Notes: svn path=/head/; revision=333133
* pwd_mkdb: default to network (big) endian hash orderEd Maste2018-04-241-1/+1
| | | | | | | | | | | | | | | | | | For cross-architecture reproducibility. The db(3) functions work with hashes of either endianness, and the current (v4) version password db entries already store integers in network order. Do so with the hash as well so that identical password databases can be created on big- and little-endian hosts. The -B and -L flags exist to set the endianness for legacy (v3) entries when the -l flag is used, and they will still control hash endianness (at least until the backwards compatibility infrastructure is removed). MFC after: 1 week Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=332902
* pwd_mkdb: add deprecation notice in manpage tooEd Maste2018-04-221-1/+6
| | | | | | | | Followon to r332789; as reported on the -current and -stable lists and in review D15144 the -l option will be removed before FreeBSD 12.0. Notes: svn path=/head/; revision=332875
* pwd_mkdb: warn that legacy support is deprecated (if specified)Ed Maste2018-04-191-0/+2
| | | | | | | | | | r283981 switched pwd_mkdb to emit only v4 database entries by default, and introduced a -l (legacy) option emit v3 entries in addition. The commit message claims that legacy support will be removed in 12.0, so emit a warning now if it is used. Notes: svn path=/head/; revision=332789
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* usr.sbin: normalize paths using SRCTOP-relative paths or :H when possibleEnji Cooper2017-03-041-2/+2
| | | | | | | | | | This simplifies make logic/output MFC after: 1 month Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=314659
* Renumber copyright clause 4Warner Losh2017-02-282-2/+2
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Following revision r295924, the changes to a db file should be fsyncedDavid Malone2016-02-231-4/+4
| | | | | | | | | | | | | | | | | before the file is closed. Consequently, it shouldn't be necessary to open the file with O_SYNC any more. This improves the performance of building large .db files for large password files a lot and should resolve this problem: https://forums.freebsd.org/threads/10-2-pre-pwd_mkdb-slow-on-larger-master-passwd.52700/ Differential Revision: https://reviews.freebsd.org/D5186 Reviewed by: garga, vangyzen, bapt, se MFC after: 1 week Notes: svn path=/head/; revision=295925
* The sdp opens the database with PERM_SECURE mode and it is different thanMarcelo Araujo2015-12-281-1/+1
| | | | | | | | | | | | | dp that opens the database with PERM_INSECURE, so we need to check sdp->put against sdp instead of use dp->put. PR: bin/191720 Submitted by: Miles Ohlrich <turingsboy@yahoo.com> Approved by: rodrigc (mentor) Differential Revision: https://reviews.freebsd.org/D4255 Notes: svn path=/head/; revision=292828
* Fix a few mandoc warnings.Christian Brueffer2015-08-121-1/+0
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=286660
* When passwd or group information is changed (by pw, vipw, chpass, ...)Renato Botelho2015-07-021-5/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | temporary file is created and then a rename() call move it to official file. This operation didn't have any check to make sure data was written to disk and if a power cycle happens system could end up with a 0 length passwd or group database. There is a pfSense bug with more infor about it: https://redmine.pfsense.org/issues/4523 The following changes were made to protect passwd and group operations: * lib/libutil/gr_util.c: - Replace mkstemp() by mkostemp() with O_SYNC flag to create temp file - After rename(), fsync() call on directory for faster result * lib/libutil/pw_util.c - Replace mkstemp() by mkostemp() with O_SYNC flag to create temp file * usr.sbin/pwd_mkdb/pwd_mkdb.c - Added O_SYNC flag on dbopen() calls - After rename(), fsync() call on directory for faster result * lib/libutil/pw_util.3 - pw_lock() returns a file descriptor to master password file on success Differential Revision: https://reviews.freebsd.org/D2978 Approved by: bapt Sponsored by: Netgate Notes: svn path=/head/; revision=285050
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+19
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp Notes: svn path=/head/; revision=284345
| * dirdeps.mk now sets DEP_RELDIRSimon J. Gerraty2015-06-081-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=284172
| * Updated dependenciesSimon J. Gerraty2014-05-161-1/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=266219
| * Updated dependenciesSimon J. Gerraty2014-05-101-0/+2
| | | | | | | | Notes: svn path=/projects/bmake/; revision=265802
| * Merge headSimon J. Gerraty2014-04-281-1/+7
| |\ | | | | | | | | | Notes: svn path=/projects/bmake/; revision=265044
| * | Updated dependenciesSimon J. Gerraty2013-03-111-0/+1
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=248169
| * | Updated dependenciesSimon J. Gerraty2013-02-161-2/+0
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=246868
| * | Sync FreeBSD's bmake branch with Juniper's internal bmake branch.Marcel Moolenaar2012-08-221-0/+20
| | | | | | | | | | | | | | | | | | | | | Requested by: Simon Gerraty <sjg@juniper.net> Notes: svn path=/projects/bmake/; revision=239572
* | | Whitespace changes for r283981. No actual code changes.Xin LI2015-06-041-88/+88
| | | | | | | | | | | | Notes: svn path=/head/; revision=283982
* | | In r113596, version 4 of entries have been added but pwd_mkdb haveXin LI2015-06-042-8/+39
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | been generating both new (machine independent) and legacy version entries (endianness sensitive). The base system have been using the new format for quite some time, so disable the generation by default. An interim option, -l, have been added to re-enable old behavior. The -l, -B and -L options are considered deprecated and will be removed in FreeBSD 12.0 release. Notes: svn path=/head/; revision=283981
* | Add -p to the example (why isn't this the default?)Dag-Erling Smørgrav2014-02-061-1/+1
| | | | | | | | | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=261542
* | Add an example of the most common use case.Dag-Erling Smørgrav2014-02-051-1/+7
|/ | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=261511
* Mark global functions and/or variables in pwd_mkdb(8) static where possible.Ed Schouten2011-11-061-1/+1
| | | | | | | This allows compilers and static analyzers to do more thorough analysis. Notes: svn path=/head/; revision=227257
* Only increment the ypcnt once per data record. The old implementationGordon Tetlow2011-07-061-4/+4
| | | | | | | | | | was incrementing it twice making it impossible to iterate the table since the records were 1, 3, 5, 7 (or 2, 4, 6, 8 for the v3 records). MFC after: 10 days Notes: svn path=/head/; revision=223818
* The last big commit: let usr.sbin/ use WARNS=6 by default.Ed Schouten2010-01-021-1/+0
| | | | Notes: svn path=/head/; revision=201390
* Verify that the username length is smaller than MAXLOGNAME whenBrian Somers2009-05-201-1/+5
| | | | | | | | | | | | | | | | | | | asked to verify a passwd file (pwd_mkdb -C). Entries with oversized usernames are still permitted when building the passwd database. When entries are >= MAXLOGNAME in length, they are correctly stored in passwd, pwd.db and spwd.db but are only correctly retrieved by getpwent*() and getpwuid*(). getpwnam*() truncates to MAXLOGNAME - 1 when reading from a file (breaking at least sh, tcsh and bash) and utilities such as su(1) check, complain and fail if the passed name is >= MAXLOGNAME in length. MFC after: 3 weeks Notes: svn path=/head/; revision=192432
* Correctly handle an input file without a newline on the last line (andDima Dorfman2005-06-151-9/+9
| | | | | | | | | | | | avoid the confusing error message about the line being too long). This change uses fgetln to detect the right conditions, but the fixed-width line buffer is kept because too many other places in the program make assumptions about its maximum width. Approved by: re (scottl) Notes: svn path=/head/; revision=147395
* Even if variable is never used uninitialized by the semantic, reduce compilerPhilippe Charnier2005-05-291-0/+2
| | | | | | | warning by giving an initial value in all cases. Notes: svn path=/head/; revision=146755
* Add endianness support.Ruslan Ermilov2005-02-282-41/+47
| | | | | | | | | | | | | | While version 4 entries are architecture-independent, we also store old (version 3) entries in native byte order. Also, the hash itself is created in a native byte order. With this change, pwd_mkdb(8) can be used to cross-build *pwd.db files for another architecture. Tested on: i386, amd64, alpha, sparc64 Notes: svn path=/head/; revision=142832
* Turn K&R functions into prototypes.Stefan Farfeleder2005-02-101-12/+6
| | | | Notes: svn path=/head/; revision=141607
* Sort sections.Ruslan Ermilov2005-01-181-17/+17
| | | | Notes: svn path=/head/; revision=140442
* Per letter dated July 22, 1999 remove 3rd clause of Berkeley derived softwareWarner Losh2004-08-072-8/+0
| | | | | | | (with permission of addtional copyright holders where appropriate) Notes: svn path=/head/; revision=133249
* Add 'i' to the getopt string.Warner Losh2004-08-051-1/+1
| | | | | | | Noticed by: jhein Notes: svn path=/head/; revision=133176
* Add support for ignoring locking failures. This is only enabled whenWarner Losh2004-07-212-4/+19
| | | | | | | | | | | | | you've specified a directory. It is intended to be used in building custom releases over NFS where locking may be unreliable at best and there is no contention that the locking is designed to arbitrate. Other uses of this flag are discouraged. Document same in usage and man page (including the warning about unwise). Sponsored by: Timing Solutions Notes: svn path=/head/; revision=132509
* Two style related changes:Warner Losh2004-07-211-5/+5
| | | | | | | | | | (1) use strlcpy instead of strncpy since the use here of the latter was incorrect. (2) Move 'N' case into proper sorted order (sorted the same way that ls sorts its args). Notes: svn path=/head/; revision=132507
* Mechanically kill hard sentence breaks.Ruslan Ermilov2004-07-021-5/+10
| | | | Notes: svn path=/head/; revision=131500
* Use __FBSDID over rcsid[]. Protect copyright[] where needed.David E. O'Brien2003-05-031-4/+4
| | | | Notes: svn path=/head/; revision=114601
* When updating a single entry (i.e. when the `-u' option is given),Jacques Vidrine2003-04-281-13/+29
| | | | | | | | | | | | | | | | | | do not add the "\xFF" "VERSION" key --- it should only be added once ALL entries have been updated. While I'm here, correct the logic that detects whether or not the user-ID has changed so that it works even if all entries have not yet been updated to the new format. Users missing-in-action were Reported by: tjr, Vallo Kallaste <vallo@estcard.ee>, leafy <leafy@leafy.idv.tw> Sponsored by: DARPA, Network Associates Laboratories Notes: svn path=/head/; revision=114159
* Revert the definitions of _PW_KEY* to their previous values. There isJacques Vidrine2003-04-181-19/+25
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=113666
* = Implement thread-safe versions of the getpwent(3) and getgrent(3)Jacques Vidrine2003-04-171-11/+124
| | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=113596
* style.Makefile(5)David E. O'Brien2003-04-041-2/+1
| | | | Notes: svn path=/head/; revision=113091
* Uniformly refer to a file system as "file system".Ruslan Ermilov2002-12-121-1/+1
| | | | | | | Approved by: re Notes: svn path=/head/; revision=107788
* The .Nm utilityPhilippe Charnier2002-07-141-4/+6
| | | | Notes: svn path=/head/; revision=99968