summaryrefslogtreecommitdiffstats
path: root/pw/tests
Commit message (Collapse)AuthorAgeFilesLines
* pw useradd: Validate the user name before creating the entryEd Maste2017-08-191-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* pw usermod: Properly deal with empty secondary group lists (-G '')Ed Maste2017-08-191-0/+3
| | | | | | | | | | | | | | | "pw usermod someuser -G ''" is supposed make sure that someuser doesn't have any secondary group memberships. Previouly it was a nop because split_groups() only intitialised "groups" if at least one group was specified. As a result the existing secondary group memberships were kept. PR: 221417 Submitted by: Fabian Keil Obtained from: ElectroBSD MFC after: 1 week Relnotes: yes
* pw: add some basic testcases for groupshow and usershowEnji Cooper2017-05-283-1/+115
| | | | | | | | - groupshow: test out -a/-g/-n . - usershow: test out -a/-n/-u . MFC after: 1 week Sponsored by: Dell EMC Isilon
* Add a regression test for r31512 fixBaptiste Daroussin2017-03-251-0/+14
| | | | | PR: 217934 MFC after: 1 week
* Rename tests from <foo> to <foo>_test to match the FreeBSD test suiteEnji Cooper2017-03-2311-10/+10
| | | | | | | | | | 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
* Increase WARNS for pw testsAlan Somers2017-03-111-0/+1
| | | | | | | | | ATF tests have a default WARNS of 0, unlike other usermode programs. Reviewed by: ngie, julian MFC after: 3 weeks Sponsored by: Spectra Logic Corporation Differential Revision: https://reviews.freebsd.org/D9933
* Really restore the old behaviour for pw usermod -mBaptiste Daroussin2017-01-221-0/+21
| | | | | | | | It again reinstall missing skel files without overwriting changed one Add a regression test about it Reported by: ae MFC after: 3 days
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2016-08-311-0/+7
| | | | Sponsored by: EMC / Isilon Storage Division
* Do not try to delete the home of the user if is is not a directory for exampleBaptiste Daroussin2016-07-231-0/+9
| | | | | | | | | "/dev/null" PR: 211195 Submitted by: rday <ryan@ryanday.net> Reported by: eniorm <eniorm@gmail.com> MFC after: 1 day
* pw should sanitize the argument of -w.Alan Somers2016-07-134-12/+155
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installedEnji Cooper2016-05-041-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | after r298107 Summary of changes: - Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that namespacing is kept with FILES appropriately, and that this shouldn't need to be repeated if the namespace changes -- only the definition of PACKAGE needs to be changed - Allow PACKAGE to be overridden by callers instead of forcing it to always be `tests`. In the event we get to the point where things can be split up enough in the base system, it would make more sense to group the tests with the blocks they're a part of, e.g. byacc with byacc-tests, etc - Remove PACKAGE definitions where possible, i.e. where FILES wasn't used previously. - Remove unnecessary TESTSPACKAGE definitions; this has been elided into bsd.tests.mk - Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES; ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk. - Fix installation of files under data/ subdirectories in lib/libc/tests/hash and lib/libc/tests/net/getaddrinfo - Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup) Document the proposed changes in share/examples/tests/tests/... via examples so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of replacing FILES. share/mk/bsd.README didn't seem like the appropriate method of communicating that info. MFC after: never probably X-MFC with: r298107 PR: 209114 Relnotes: yes Tested with: buildworld, installworld, checkworld; buildworld, packageworld Sponsored by: EMC / Isilon Storage Division
* MFHGlen Barber2016-03-101-0/+11
|\ | | | | | | Sponsored by: The FreeBSD Foundation
| * DIRDEPS_BUILD: Connect MK_TESTS.Bryan Drewery2016-03-091-0/+11
| | | | | | | | Sponsored by: EMC / Isilon Storage Division
* | First pass to fix the 'tests' packages.Glen Barber2016-02-021-0/+4
|/ | | | Sponsored by: The FreeBSD Foundation
* Fix handling of numeric-only names with pw lockBaptiste Daroussin2015-12-021-0/+20
| | | | | | | Add a regression test about it PR: 204968 MFC after: 1 week
* Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) andEnji Cooper2015-10-121-2/+0
| | | | | | | | | | | | netbsd-tests.test.mk (r289151) - Eliminate explicit OBJTOP/SRCTOP setting - Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk - Remove unnecessary TESTSDIR setting - Use SRCTOP where possible for clarity MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Divison
* Fix err pointer not initialized to NULL resultingBaptiste Daroussin2015-08-211-0/+15
| | | | Reported by: "O. Hartmann" <ohartman@zedat.fu-berlin.de>
* Fix typo in regression testBaptiste Daroussin2015-08-211-1/+1
|
* Fix /home symlink creationBaptiste Daroussin2015-08-211-0/+13
| | | | Add regression test about it
* Fix useradd regression:Baptiste Daroussin2015-08-211-2/+1
| | | | | | | | Readd the function to create the parents home directory if it does not exists. if it is only a directory at the top level of the hierarchy symlink it into /usr as it used to be done before. Reported by: kevlo, adrian
* Regression: fix pw usermod -w xxxBaptiste Daroussin2015-08-141-0/+14
| | | | Reported by: gjb
* Add regression tests for a bug reported in stable/10Baptiste Daroussin2015-08-051-0/+9
| | | | | While pw(8) on head is not affected it is worth adding more regression tests ensuring this bug will not happen unnoticed in the futur
* Convert the year used for regression test fro 2043 to 2037Baptiste Daroussin2015-08-021-11/+11
| | | | This makes the regression tests pass on systems where time_t is 32bits
* Add regression tests about adding already existsing groups/usersBaptiste Daroussin2015-08-022-0/+22
|
* Rewrite parsing subcommands arguments of pw(8)Baptiste Daroussin2015-08-024-8/+60
| | | | | | | | | | | | | 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.
* Remove netbsd tests on pw(8)Baptiste Daroussin2015-08-021-11/+0
| | | | | | First they are redundant with the tests we currently have on pw(8) Second they to modify the host database instead of being self contained withing the test directory
* Check uid/gid used when creating a user/group are not larger than ↵Baptiste Daroussin2015-07-283-0/+24
| | | | | | | UID_MAX/GID_MAX PR: 173977 Reported by: nvass@gmx.com
* when -n is passed to any pw subcommand it is always expected to be considered asBaptiste Daroussin2015-07-281-0/+10
| | | | | | | | a name so do not try to convert it to an id if it is a numeric value PR: 31933 Reported by: ted@impulse.net Sponsored by: gandi.net
* Add regression tests to ensure we keep allowing creating users with uid0Baptiste Daroussin2015-07-131-0/+11
|
* Ensure skeldir is abolute path (relatively to the rootdir)Baptiste Daroussin2015-07-122-2/+2
|
* pw -R <rootdir> userdel can now cleanup installationBaptiste Daroussin2015-07-121-0/+20
| | | | | | | Rewrite rm_r to use *at function, allowing to remove home directories along with users. only crontabs and at(1) installation are not removed Relnotes: yes
* Rework the home directory creation and copy or the skel content to use *atBaptiste Daroussin2015-07-121-0/+25
| | | | | | | | | functions This allows to simplify the code a bit for -R by not having to keep modifying path and also prepare the code to improve support -R in userdel While here, add regression tests for the functionality
* Add minimum regression tests for pw -RBaptiste Daroussin2015-07-122-1/+31
|
* Rework groupmod modification:Baptiste Daroussin2015-07-111-0/+27
| | | | | Use gr_add(3) when possible to avoid code duplication. Use a simpler logic to delete members of a group
* Do not try to set password on group if the group is added as a consequence ofBaptiste Daroussin2015-07-091-0/+10
| | | | | | of creating a user (regression from r285136) Reported by: Fabian Keil <fk@fabiankeil.de>
* pw: fail if an invalid entry is found while parsing master.passwd and groupBaptiste Daroussin2015-07-071-0/+26
| | | | | | PR: 198554 Reported by: diaran <fbsd@centraltech.co.uk> MFC after: 2 days
* Also validate hours via strptime_l(3)Baptiste Daroussin2015-07-051-0/+6
| | | | | Simplify the code, by only using one parser, ensure the dates (hours and dates) are valid
* Validate expiration datesBaptiste Daroussin2015-07-051-0/+26
| | | | Use strptime_l(3) to validate the dates provided in input
* Validate input of pw usermod -h and pwusermod -HBaptiste Daroussin2015-07-041-0/+37
| | | | | | | Push the code that set the password into a separate function to improve readability Add regression tests about pw usermod -h and pw usermod -H
* Fix setting uid/gid min/max via pwBaptiste Daroussin2015-06-073-1/+74
|
* Fix generating configuration fileBaptiste Daroussin2015-06-073-1/+80
|
* In case of rename validate the length of the new nameBaptiste Daroussin2015-06-072-3/+35
| | | | Check early that the new name fits MAXLOGNAME and store it in pwconf
* Refactor input validationBaptiste Daroussin2015-06-071-1/+9
| | | | | Mutualize code to validate inputs of both 'user' and 'group' command Test that the input name fits into MAXLOGNAME
* Fix a race condition by allowing up to 5 seconds of difference between the ↵Brad Davis2015-02-241-4/+8
| | | | | | | time stamps. PR: 197861 Approved by: will
* Add tests for account and password expiration.Brad Davis2015-02-171-0/+111
| | | | Approved by: will
* Really fix the pw_usernext tests.Brad Davis2015-02-151-12/+15
| | | | | PR: 197612 Approved by: will
* Remove an extra curly bracket that was causing intermittent failures.Brad Davis2015-02-141-1/+1
| | | | | | PR: 197612 Submitted by: Robert O'Niel <oneil.rs@gmail.com> Approved by: will
* Add tests for `pw usernext'.Brad Davis2015-02-092-1/+44
| | | | | | PR: 197120 Submitted by: Robert O'Neil <oneil.rs@gmail.com> Approved by: will
* Revert r277652Baptiste Daroussin2015-01-263-41/+1
| | | | | | uid and gid are never and should never be negative. The pw(8) manpage clearly states the -u and -g arguments are for uids/gids, hence using negative values is abusing a bug in former versions of pw(8)
* Allow negative numbers in -u and -g optionsBaptiste Daroussin2015-01-243-1/+41
| | | | | PR: 196514 MFC after: 1 week