History log of /freebsd-current/usr.sbin/pw/tests/pw_useradd_test.sh
Revision Date Author Comments
# e12b7446 06-May-2024 Dag-Erling Smørgrav <des@FreeBSD.org>

pw: Test home directory ownership and mode.

MFC after: 3 days
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D45099


# d0b2dbfa 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line sh pattern

Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/


# 181692ab 19-Jul-2023 Naman Sood <mail@nsood.in>

pw: Add regression tests for useradd bug fixes

PR: 238995
Reviewed by: jrm
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41080


# bbb2d2ce 23-May-2023 Mike Karels <karels@FreeBSD.org>

pw: do not move /home/$user to /usr/home

When adding a user, pw will create the path to the home directory
if needed. However, if creating a path with just one component,
i.e. that appears to be in the root directory, pw would create the
directory in /usr, and create a symlink from the root directory.
Most commonly, this meant that the default of /home/$user would turn
into /usr/home/$user. This was added in a self-described kludge 26
years ago. It made (some) sense when root was generally a small
partition, with most of the space in /usr. However, the default is
now one large partition. /home really doesn't belong under /usr,
and anyone who wants to use /usr/home can specify it explicitly.
Remove the kludge to move /home under /usr and create the symlink,
and just use the specified path. Note that this operation was
done only on the first invocation for a path, and this happened most
commonly when adding a user during the install.

Modify the test that checked for the creation of the symlink to
verify that the symlink is *not* made, but rather a directory.
Add a test that intermediate directories are still created.

Reviewed by: rgrimes, bapt
Differential Revision: https://reviews.freebsd.org/D40085


# 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


# 32bd1c2b 01-Mar-2018 David Bright <dab@FreeBSD.org>

Allow the "@" and "!" characters in passwd file GECOS fields.

Two PRs (152084 & 210187) request allowing the "@" and/or "!"
characters in the passwd file GECOS field. The man page for pw does
not mention that those characters are disallowed, Linux supports those
characters in this field, and the "@" character in particular would be
useful for storing email addresses in that field.

PR: 152084, 210187
Submitted by: jschauma@netmeister.org, Dave Cottlehuber <dch@freebsd.org>
Reported by: jschauma@netmeister.org, Dave Cottlehuber <dch@freebsd.org>
Reviewed by: delphij (secteam), vangyzen
MFC after: 1 week
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D14519


# 8d2dbd28 18-Aug-2017 Ed Maste <emaste@FreeBSD.org>

pw useradd: Validate the user name before creating the entry

Previouly it was possible to create users with spaces in the name with:
pw useradd -u 1234 -g 1234 -n 'test user'

The "-g 1234" is relevant, without it the name was already rejected
as expected:

[fk@test ~]$ sudo pw useradd -u 1234 -n 'test user'
pw: invalid character ` ' at position 4 in userid/group name

Bug unintentionally found with a salt config without explicit name entry:

test user:
user.present:
- uid: 1234
- gid: 1234
- fullname: Test user
- shell: /usr/local/bin/bash
- home: /home/test
- groups:
- wheel
- salt

"Luckily" salt modules rarely bother with input validation either ...

PR: 221416
Submitted by: Fabian Keil
Obtained from: ElectroBSD
MFC after: 1 week


# d1005f6a 25-Mar-2017 Baptiste Daroussin <bapt@FreeBSD.org>

Add a regression test for r31512 fix

PR: 217934
MFC after: 1 week


# 458cbf0a 22-Mar-2017 Enji Cooper <ngie@FreeBSD.org>

Rename tests from <foo> to <foo>_test to match the FreeBSD test suite
naming scheme

usr.bin/diff/diff_test was renamed to usr.bin/diff/netbsd_diff_test
to avoid collisions with the renamed FreeBSD test.

MFC after: 1 week
Sponsored by: Dell EMC Isilon