History log of /freebsd-current/usr.sbin/pw/pw_conf.c
Revision Date Author Comments
# eba230af 25-Sep-2023 John Baldwin <jhb@FreeBSD.org>

Purge more stray embedded $FreeBSD$ strings

These do not use __FBSDID but instead use bare char arrays.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D41957


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 0cd4b781 26-Apr-2021 Baptiste Daroussin <bapt@FreeBSD.org>

pw(8): use openmemstream instead of sbuf(9)


# ea7fdebe 21-Oct-2018 Yuri Pankov <yuripv@FreeBSD.org>

pw: fix the checks in boolean_str() after r326738. Add related test
cases for `pw useradd -D -w`.

PR: 231649
Reviewed by: eugen
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D17299


# 4835c3b1 16-Oct-2018 Yuri Pankov <yuripv@FreeBSD.org>

pw: (file == NULL) check is always false in read_userconfig(), remove
it. Drop the now unused _PATH_PW_CONF definition. [1]

While here, change the last remaining hardcoded "/etc" to _PATH_PWD.

Noted by: glebius [1]
Reviewed by: eugen
Approved by: re (gjb), kib (mentor)
Differential Revision: https://reviews.freebsd.org/D17575


# 03da20c5 15-Oct-2018 Yuri Pankov <yuripv@FreeBSD.org>

pw: respect path specified using -V when writing pw.conf, and -C is not
explicitly specified. -V path is already used to determine which file
to read default values from, so it's only logical to write them to the
same file.

PR: 231653
Reviewed by: eugen, bapt
Approved by: re (gjb), kib (mentor)
Differential Revision: https://reviews.freebsd.org/D17566


# d30f122f 09-Dec-2017 Eugene Grosbein <eugen@FreeBSD.org>

pw(8): correct expiration period handling and command line overrides
to preconfigured values for -e, -p and -w flags.

Use non-negative symbols instead of magic values
in passwd_val/pw_password functions.

PR: 223431
Submitted by: Yuri Pankov (in part, patch for the manual)
Reported by: mav (mentor)
MFC after: 3 days
Relnotes: yes


# 1de7b4b8 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

various: general adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

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.

No functional change intended.


# 7c46e6ef 13-Jul-2016 Alan Somers <asomers@FreeBSD.org>

pw should sanitize the argument of -w.

Otherwise, it will silently disable the login for the selected account if
the argument is unrecognizable.

usr.sbin/pw/pw.h
usr.sbin/pw/pw_conf.c
usr.sbin/pw/pw_user.c
Use separate rules to validate boolean parameters and passwd
parameters. Error out if a password parameter cannot be parsed.

usr.sbin/pw/tests/Makefile
usr.sbin/pw/tests/crypt.c
usr.sbin/pw/tests/pw_useradd.sh
usr.sbin/pw/tests/pw_usermod.sh
Add tests for the validation. Also, enhance existing
password-related tests to actually validate that the correct hash is
written to master.passwd.

Reviewed by: bapt
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6840


# 49d448f5 28-Dec-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Simplify code for parsing extra groups


# 5cc12db1 02-Aug-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Use intmax_t rather than long long


# fc507945 02-Aug-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Fix build on 32bits


# bcbdb01e 02-Aug-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Cleanup a bit includes


# d2d022b9 01-Aug-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Rewrite parsing subcommands arguments of pw(8)

Now each subcommands checks its arguments in a dedicated functions.

This helps improving input validation, code readability/maintainability
While here:
- Add a -y option to pw userdel/usermod so it can maintain NIS servers if
nispasswd is not defined in pw.conf(5)
- Allow pw -r <rootdir> to remove directory with userdel -r
- Fix bug when renaming a user which was not renaming the user name it groups
it is a member of.
- Only parse pw.conf(5) when needed.


# 458fdd97 31-Jul-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Remove things that crept in after badly checked revert


# 7493058f 31-Jul-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Partial revert of r286152

More work needed on the cli validation


# 7391bf5a 01-Aug-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Fix build


# 510113b8 01-Aug-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Fix formatting of new code
Fix sorting or errstr
Remove useless initialisation or errstr

Reported by: bde


# 80d9f892 01-Aug-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Validate expiration days and password days from commmand line and pw.conf


# e5e7ef48 01-Aug-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Validate the max_uid/max_gid boundaries and entry type in pw.conf


# 50698e67 01-Aug-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Cast uid/git to uintmax_t when using printf-like functions so the size of
uid/gid size remains a implementation detail


# 10e6a51c 11-Jul-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Replace custom string array with stringlist(3)


# 68cea7d5 31-May-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Remove useless cast in printf and printf-like functions:
use %u for uid_t and gid_t


# 7fc593dd 30-May-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Move cleanup functions to the right place


# 2e6d97a4 31-May-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Remove useless test before free()


# c69b42d0 31-May-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Return early in case we cannot read the configuration file

This drops one level of indentation


# a1d3bf2e 10-May-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Use calloc(3) instead of malloc(3) + memset(3)
While here check the return of calloc(3)


# 36dc2e68 10-May-2015 Baptiste Daroussin <bapt@FreeBSD.org>

The initial logic for allocating the new string was wrong, the conversion
to strndup(3) duplicated the same mistake, actually strdup(3) is good enough
to allocate the new string.


# a84caa72 10-May-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Use strndup(3) instead of malloc(3) + memcpy(3)
Check the return of strndup


# 2c3065da 10-May-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Remove useless call to extendarray


# 8592cfc5 09-May-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Remove now unused LNBUFSZ buffer size


# 5963cf64 09-May-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Return from the function as early as possible

This reduces the depth of the if statements and improves clarity of the code


# a8e37ee0 09-May-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Use sbuf(9) instead of homebrewed buffered string


# c145c34c 22-Apr-2014 Baptiste Daroussin <bapt@FreeBSD.org>

Simplify reading pw.conf(5) by using getline(3)


# 644af48d 08-Mar-2011 Jung-uk Kim <jkim@FreeBSD.org>

Stop hard-coding default directory mode as 0777.


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 85204142 30-Mar-2007 Lukas Ertl <le@FreeBSD.org>

Add home directory creation mode to pw.conf(5) and be a bit
more specific about the effect of the current umask on -M.


# 2313781d 20-Aug-2001 Brian Somers <brian@FreeBSD.org>

Handle snprintf() returning < 0 (not just -1)

MFC after: 2 weeks


# 36c1612b 20-Aug-2001 Brian Somers <brian@FreeBSD.org>

Handle snprintf() returning -1.

MFC after: 2 weeks


# fc308a54 17-Dec-2000 Doug Barton <dougb@FreeBSD.org>

Make the comment generated in /etc/pw.conf match reality

PR: misc/23451
Submitted by: Ben Rosengart, ben@narcissus.net


# 670eb236 15-Jul-2000 David Nugent <davidn@FreeBSD.org>

Catch up to the fact that we now have tcsh in the tree.


# 97d92980 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# 479bcf69 27-Jul-1999 David Nugent <davidn@FreeBSD.org>

Remove some more warnings.


# 5f12594a 23-Feb-1999 David Nugent <davidn@FreeBSD.org>

1) Do not blindly ignore file update errors which may occur due to concurrent
updating
2) Add -V <etcdir>, which allows maintaining user/group database in alternate
locations other than /etc.


# 1dcc6ec7 10-Oct-1997 Philippe Charnier <charnier@FreeBSD.org>

Use err(3) instead of local redefinition. Add rcsid string.


# d3329f56 01-Sep-1997 David Nugent <davidn@FreeBSD.org>

Unquote default group in pw.conf.
PR: 4365
Submitted by: "Andrew L. Moore" <alm@mclink.com>


# 476602a9 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Revert $FreeBSD$ to $Id$


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# f1d684fa 05-Jan-1997 David Nugent <davidn@FreeBSD.org>

Adds optional NIS passwd file updating and optionally rebuilding
NIS maps.

Suggested by: Peter Wemm


# 0970881f 21-Dec-1996 David Nugent <davidn@FreeBSD.org>

1) 200 users per group limitation removed and pw
will handle lines of any length in /etc/group.
2) Fixed bug with usermod -d not updating user's home
directory.
3) Minor formatting display changes/fixes with *show -P.


# ad7cf975 10-Dec-1996 Joerg Wunsch <joerg@FreeBSD.org>

Copyright update by the author, to be more in line with our sample
copyright.

Submitted by: David Nugent


# d6f907dc 09-Dec-1996 Joerg Wunsch <joerg@FreeBSD.org>

pw(8) -- a backend utility to manage the user and group databases.

sysinstall's new User&group menu will use it, hence it's a 2.2
candidate despite of providing new functionality.

Submitted by: David L. Nugent, <davidn@blaze.net.au>