summaryrefslogtreecommitdiffstats
path: root/libutil/gr_util.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix renaming a group via the gr_copy functionBaptiste Daroussin2014-10-281-5/+12
| | | | | | | | | | Add a regression test to pw(8) because the bug was discovered via using: pw groupmod PR: 187189 Reported by: mcdouga9@egr.msu.edu Tested by: mcdouga9@egr.msu.edu Patch by: Marc de la Gueronniere
* commit correct tested fix for gr_util.cDiane Bruce2013-03-091-46/+58
| | | | Approved by: theraven
* Cleanup gr_add() so it does not leak memDiane Bruce2013-03-071-52/+85
| | | | | | | | | This is part of ongoing work on sbin/pw M libutil.h M gr_util.c Approved by: theraven
* libutil: fix typo in comment for gr_fini.Mateusz Guzik2013-01-131-1/+1
| | | | Submitted by: Christoph Mallon <christoph.mallon gmx.de>
* libutil: utilize strsep instead of strcat in a loop in gr_makeMateusz Guzik2013-01-131-6/+10
| | | | Submitted by: Christoph Mallon <christoph.mallon gmx.de>
* libutil: move group_line_format into the scop of its only user.Mateusz Guzik2013-01-131-2/+1
| | | | Submitted by: Christoph Mallon <christoph.mallon gmx.de>
* libutil: eliminate 'found' variable in gr_equalMateusz Guzik2013-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 newgrBaptiste Daroussin2012-12-281-2/+1
| | | | | Submitted by: pjd Reviewed by: db
* errno = ENOMEM was supposed to be removed not return (NULL);Baptiste Daroussin2012-12-281-1/+1
| | | | Submitted by: gcooper
* malloc() sets errno to ENOMEM already.Baptiste Daroussin2012-12-281-5/+1
| | | | Submitted by: Christoph Mallon <christoph.mallon@gmx.de>
* Do not leave parts of the new group uninitialized in gr_dup().Baptiste Daroussin2012-12-281-0/+4
| | | | | Submitted by: Christoph Mallon <christoph.mallon@gmx.de> Reported by: pjd
* avoid arithmetic on uintptr_tBaptiste Daroussin2012-12-271-1/+1
| | | | | Submitted by: pjd Reviewed by: jilles
* cast to uintptr_t to properly calculate offsetBaptiste Daroussin2012-12-271-1/+1
| | | | | Reported by: mdf Submitted by: db
* Add O_CLOEXEC to flopenBaptiste Daroussin2012-12-271-1/+1
| | | | Requested by: jilles
* gr_dup: simplify duplication of groupBaptiste Daroussin2012-12-271-21/+20
| | | | Submitted by: db
* - Clean up previous gr_add use malloc instead of callocBaptiste Daroussin2012-12-271-4/+3
| | | | | | - Fix tinderbox error Submitted by: db
* New gr_add function to provide a clean and safe method to append a new memberBaptiste Daroussin2012-12-271-0/+40
| | | | | | into an existing group. Submitted by: db
* Use flopen(3) instead of open(2) + flock(2)Baptiste Daroussin2012-12-271-4/+2
|
* only rename(2) after chmod(2) has succeedBaptiste Daroussin2012-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)Baptiste Daroussin2012-11-201-1/+8
|
* backout r242319, racy and not done in the right placeBaptiste Daroussin2012-10-291-9/+0
| | | | Reported by: Garrett Cooper <yanegomi@gmail.com>
* make pw_init and gr_init fail if the specified master password or group file isBaptiste Daroussin2012-10-291-0/+11
| | | | | | a directory. MFC after: 1 month
* Modify pw_copy:Baptiste Daroussin2011-12-151-0/+546
| | | | | | | | | | | | | - if pw is NULL and oldpw is not NULL then the oldpw is deleted - if pw->pw_name != oldpw->pw_name but pw->pw_uid == oldpw->pw_uid then it renames the user add new gr_* functions so now gr_util API is similar to pw_util API, this allow to manipulate groups in a safe way. Reviewed by: des Approved by: des MFC after: 1 month
* Create the altix project branch. The altix project will add supportMarcel Moolenaar2010-03-101-250/+0
| | | | | | | 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.
* Remove a dead store.Sean Farley2009-12-121-2/+2
| | | | MFC after: 5 days
* Fixed style issues with variable ordering and naming, spacing andSean Farley2008-11-231-75/+97
| | | | | | | | | | | | | | | | | parentheses. Fixed alignment issue in gr_dup() in its assignment of gr_mem using a struct to force alignment without performing alignment mathematics. This was noticed recently with libutil was built with WARNS=6 on platform such as sparc64. Added checks to gr_dup(), gr_equal() and gr_make() to prevent segfaults when examining struct group's with the struct members pointing to NULL's. With fix of alignment issue, restore WARNS?=6. Reviewed by: des MFC after: 1 week
* style(9) fixes.Sean Farley2008-11-111-20/+14
| | | | MFC after: 1 week
* Add four utility functions related to struct grp processing modeled in-partSean Farley2008-04-231-0/+234
after similar calls related to struct pwd in libutil/pw_util.c: - gr_equal() Perform a deep comparison of two struct grp's. It does a thorough, yet unoptimized comparison of all the members regardless of order. - gr_make() Create a string (see group(5)) from a struct grp. - gr_dup() Duplicate a struct grp. Returns a value that is a single contiguous block of memory. - gr_scan() Create a struct grp from a string (as produced by gr_make()). MFC after: 3 weeks