summaryrefslogtreecommitdiffstats
path: root/lib/libutil
Commit message (Collapse)AuthorAgeFilesLines
* MFC: 272445,272578,273772,273779,273782,273786,273787,273791bapt2014-11-041-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a test for bug 191427 where pw(8) will go into an infinite loop Add some tests for modifying groups When a group is renamed then the group has been invalidated for sure. In that case get the group information using the new name. Fix a regression in pw usermod -G list The user was perperly adding the to different groups from "list" but was not removed from the other groups it could have belong to. Do not delete the group wheel when bad argument is passed to pw groupdel -g Check that the -g argument is actually a number, if not report an error. This argument is converted without checking with atoi(3) later so without this check it converts any alpha entries into 0 meaning it deletes the group wheel Ensure pw userdel -u <invalid> do not try to remove root Check the uid passed is actually a number as early as possible Fix renaming a group via the gr_copy function Add a regression test to pw(8) because the bug was discovered via using: pw groupmod PR: 193704 [1], 185666 [2], 90114 [3], 187189 [4] Submitted by: Marc de la Gueronniere [4] Reported by: az [1], sub.mesa@gmail.com [2], bkoenig@cs.tu-berlin.de [3], mcdouga9@egr.msu.edu [4]
* MFC r273837:dim2014-11-011-5/+5
| | | | | | | | | Fix a clang 3.5 warning about abs(3) being given an argument of type quad_t in setusercontext(). While here, sanitize the clamping of the priority value, and use the correct type for the return value of login_getcapnum(). Reviewed by: kib
* MFC r270180:ngie2014-08-278-0/+1406
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r269906: Add missing BSD.tests.dist entry for lib/libutil to unbreak installworld with MK_TESTS == no Phabric: D555 Approved by: jmmv (mentor, implicit) Pointyhat to: ngie r269904: Integrate lib/libutil into the build/kyua Remove the .t wrappers Rename all of the TAP test applications from test-<test> to <test>_test to match the convention described in the TestSuite wiki page humanize_number_test.c: - Fix -Wformat warnings with counter variables - Fix minor style(9) issues: -- Header sorting -- Variable declaration alignment/sorting in main(..) -- Fit the lines in <80 columns - Fix an off by one index error in the testcase output [*] - Remove unnecessary `extern char * optarg;` (this is already provided by unistd.h) Phabric: D555 Approved by: jmmv (mentor) Obtained from: EMC / Isilon Storage Division [*] Submitted by: Casey Peel <cpeel@isilon.com> [*] Sponsored by: EMC / Isilon Storage Division
* MFC r269015:pfg2014-08-161-5/+11
| | | | | | | | | | | | | | | | | fparseln(3): Update from NetBSD sources. -fix a condition so that fparseln() doesn't report spurious empty lines eg after 2 comment lines, or on EOF after a single comment line -no escape character means no escaped characters modify the previous fix so that no pointless realloc()s are done in the case of multiple empty continuation lines, and comment the code to make the logics obvious. fparseln is now part of libc in NetBSD so this changes the previous revision numbering. Obtained from: NetBSD (CVS Rev. 1.6-1.7)
* MFC r265276:markj2014-07-291-1/+1
| | | | Fix a typo.
* MFC r261824:eadler2014-02-161-2/+2
| | | | libutil/pw_util.3: Fix two prototypes.
* don't assert on bad args, instead return an error..jmg2013-10-072-37/+54
| | | | | | | | | | | | | | | Since so many programs don't check return value, always NUL terminate the buf... fix rounding when using base 1024 (the bug that started it all)... add a set of test cases so we can make sure that things don't break in the future... Thanks to Clifton Royston for testing and the test program... Approved by: re (hrs, glebius) MFC after: 1 week
* The round of expand_number() cleanups.pluknet2013-08-301-29/+10
| | | | | | | | | o Fix range error checking to detect overflow when uint64_t < uintmax_t. o Remove a non-functional check for no valid digits as pointed out by Bruce. o Remove a rather pointless comment describing what the function does. o Clean up a bunch of style bugs. Brucified by: bde
* libutil: Use O_CLOEXEC for internal file descriptors from open().jilles2013-08-285-9/+12
|
* Reset errno before strtoumax() call to properly detect ERANGE.pluknet2013-08-211-0/+7
| | | | | | | | Restore saved errno if strtoumax() call is successful. Reported by: ache Reviewed by: jilles MFC after: 1 week
* Check strtoumax(3) for ERANGE in case of non-prefixed string.pluknet2013-08-211-0/+4
| | | | | OK'd by: silence on current@ MFC after: 1 week
* Fix -Wunsequenced warningkientzle2013-06-291-1/+1
| | | | Submitted by: dt71@gmx.com
* When pidptr was passed as NULL to pidfile_open(3), we were returningpjd2013-03-141-13/+18
| | | | | | | | | EAGAIN/EWOULDBLOCK when another daemon was running and had the pidfile open. We should return EEXIST in that case, fix it. Reported by: Dirk Engling <erdgeist@erdgeist.org> Reviewed by: jhb, Dirk Engling <erdgeist@erdgeist.org> MFC after: 1 week
* commit correct tested fix for gr_util.cdb2013-03-091-46/+58
| | | | Approved by: theraven
* Cleanup gr_add() so it does not leak memdb2013-03-072-53/+86
| | | | | | | | | This is part of ongoing work on sbin/pw M libutil.h M gr_util.c Approved by: theraven
* Fixed documented prototype of kinfo_getproc(3).ru2013-03-011-2/+2
|
* libutil: fix typo in comment for gr_fini.mjg2013-01-131-1/+1
| | | | Submitted by: Christoph Mallon <christoph.mallon gmx.de>
* libutil: utilize strsep instead of strcat in a loop in gr_makemjg2013-01-131-6/+10
| | | | Submitted by: Christoph Mallon <christoph.mallon gmx.de>
* libutil: move group_line_format into the scop of its only user.mjg2013-01-131-2/+1
| | | | Submitted by: Christoph Mallon <christoph.mallon gmx.de>
* libutil: eliminate 'found' variable in gr_equalmjg2013-01-131-8/+5
| | | | Submitted by: Christoph Mallon <christoph.mallon gmx.de>
* Simplify pointing dst after the end of all the gr_mem pointers in newgrbapt2012-12-281-2/+1
| | | | | Submitted by: pjd Reviewed by: db
* errno = ENOMEM was supposed to be removed not return (NULL);bapt2012-12-281-1/+1
| | | | Submitted by: gcooper
* malloc() sets errno to ENOMEM already.bapt2012-12-281-5/+1
| | | | Submitted by: Christoph Mallon <christoph.mallon@gmx.de>
* Do not leave parts of the new group uninitialized in gr_dup().bapt2012-12-281-0/+4
| | | | | Submitted by: Christoph Mallon <christoph.mallon@gmx.de> Reported by: pjd
* avoid arithmetic on uintptr_tbapt2012-12-271-1/+1
| | | | | Submitted by: pjd Reviewed by: jilles
* cast to uintptr_t to properly calculate offsetbapt2012-12-271-1/+1
| | | | | Reported by: mdf Submitted by: db
* Add O_CLOEXEC to flopenbapt2012-12-272-2/+2
| | | | Requested by: jilles
* gr_dup: simplify duplication of groupbapt2012-12-271-21/+20
| | | | Submitted by: db
* - Clean up previous gr_add use malloc instead of callocbapt2012-12-272-5/+4
| | | | | | - Fix tinderbox error Submitted by: db
* New gr_add function to provide a clean and safe method to append a new memberbapt2012-12-272-0/+42
| | | | | | into an existing group. Submitted by: db
* Use flopen(3) instead of open(2) + flock(2)bapt2012-12-272-9/+4
|
* only rename(2) after chmod(2) has succeedbapt2012-11-201-7/+3
| | | | | | report error if chmod(2) fails Reported by: jh
* change mode the group file to 0644 after a successfull rename(2)bapt2012-11-201-1/+8
|
* Fix typobapt2012-11-031-1/+1
|
* Correct attribution.des2012-10-311-3/+8
|
* Minor mdoc and language fixes.joel2012-10-301-3/+2
|
* Removed unnecessary bits in the header that shows where I stole the templatebapt2012-10-301-3/+0
|
* Document the pw_util(3) functionsbapt2012-10-302-1/+299
| | | | Reviewed by: des, gjb
* backout r242319, racy and not done in the right placebapt2012-10-292-18/+0
| | | | Reported by: Garrett Cooper <yanegomi@gmail.com>
* make pw_init and gr_init fail if the specified master password or group file isbapt2012-10-292-0/+20
| | | | | | a directory. MFC after: 1 month
* Fix IEC / SI binary prefixes (Ki, Mi, Gi, etc) production by humanize_number(3)bapt2012-09-121-1/+1
| | | | | | PR: bin/171487 Submitted by: matthew MFC after: 1 week
* Switch the default password hash from md5 to sha512.des2012-06-191-1/+1
| | | | MFC after: 1 week
* Revert user comparison back to user names as some user can share uids (root/toorbapt2012-06-191-6/+13
| | | | | | | | | | | for example) get the username information from old_pw structures to still allow renaming of a user. Reported by: Claude Buisson <clbuisson@orange.fr> Approved by: des (mentor) MFC after: 3 weeks
* Finally nuke auth.conf, nine years after it was deprecated. The onlydes2012-06-125-127/+7
| | | | | | | | | | | | | | | | | | thing it was still used for was to set the "global default" password hash. Since the stock auth.conf contained nothing but comments, the global default was actually the first algorithm in crypt(3)'s list, which happens to be DES; I take the fact that nobody noticed as proof that it was not used outside of crypt(3). The only other use in our tree was in the Kerberos support code in in tinyware's passwd(1). I removed that code in an earlier commit; it would not have compiled anyway, as it only supported Kerberos IV. The auth_getval() function is now a stub that always returns NULL, which has the same effect as a functional auth_getval() with an empty auth.conf. MFC after: 3 weeks
* Document that we also support sha256 and sha512.des2012-06-081-1/+3
| | | | MFC after: 1 week
* General mdoc(7) and typo fixes.gjb2012-05-121-1/+2
| | | | | | PR: 167804 Submitted by: Nobuyuki Koganemaru (kogane!jp.freebsd.org) MFC after: 3 days
* mdoc: terminate quoted strings.joel2012-03-301-53/+53
|
* mandoc complains loudly when <TAB>s are misused in columnated lists. Fixjoel2012-03-291-1/+1
| | | | | this syntax violation and while I'm here also convert <TAB> to Ta and adjust quotation marks in order to prevent this problem in the future.
* Remove trailing whitespace per mdoc lint warningeadler2012-03-292-4/+4
| | | | | | | Disussed with: gavin No objection from: doc Approved by: joel MFC after: 3 days
* mdoc: sort prologue macros.joel2012-03-262-2/+2
|
OpenPOWER on IntegriCloud