History log of /freebsd-10.1-release/lib/libutil/gr_util.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 248102 09-Mar-2013 db

commit correct tested fix for gr_util.c

Approved by: theraven


# 247919 07-Mar-2013 db

Cleanup gr_add() so it does not leak mem
This is part of ongoing work on sbin/pw

M libutil.h
M gr_util.c

Approved by: theraven


# 245390 13-Jan-2013 mjg

libutil: fix typo in comment for gr_fini.

Submitted by: Christoph Mallon <christoph.mallon gmx.de>


# 245387 13-Jan-2013 mjg

libutil: utilize strsep instead of strcat in a loop in gr_make

Submitted by: Christoph Mallon <christoph.mallon gmx.de>


# 245386 13-Jan-2013 mjg

libutil: move group_line_format into the scop of its only user.

Submitted by: Christoph Mallon <christoph.mallon gmx.de>


# 245385 13-Jan-2013 mjg

libutil: eliminate 'found' variable in gr_equal

Submitted by: Christoph Mallon <christoph.mallon gmx.de>


# 244780 28-Dec-2012 bapt

Simplify pointing dst after the end of all the gr_mem pointers in newgr

Submitted by: pjd
Reviewed by: db


# 244779 28-Dec-2012 bapt

errno = ENOMEM was supposed to be removed not return (NULL);

Submitted by: gcooper


# 244778 28-Dec-2012 bapt

malloc() sets errno to ENOMEM already.

Submitted by: Christoph Mallon <christoph.mallon@gmx.de>


# 244777 28-Dec-2012 bapt

Do not leave parts of the new group uninitialized in gr_dup().

Submitted by: Christoph Mallon <christoph.mallon@gmx.de>
Reported by: pjd


# 244747 27-Dec-2012 bapt

avoid arithmetic on uintptr_t

Submitted by: pjd
Reviewed by: jilles


# 244745 27-Dec-2012 bapt

cast to uintptr_t to properly calculate offset

Reported by: mdf
Submitted by: db


# 244744 27-Dec-2012 bapt

Add O_CLOEXEC to flopen

Requested by: jilles


# 244742 27-Dec-2012 bapt

gr_dup: simplify duplication of group

Submitted by: db


# 244739 27-Dec-2012 bapt

- Clean up previous gr_add use malloc instead of calloc
- Fix tinderbox error

Submitted by: db


# 244736 27-Dec-2012 bapt

New gr_add function to provide a clean and safe method to append a new member
into an existing group.

Submitted by: db


# 244735 27-Dec-2012 bapt

Use flopen(3) instead of open(2) + flock(2)


# 243334 20-Nov-2012 bapt

only rename(2) after chmod(2) has succeed
report error if chmod(2) fails

Reported by: jh


# 243328 20-Nov-2012 bapt

change mode the group file to 0644 after a successfull rename(2)


# 242324 29-Oct-2012 bapt

backout r242319, racy and not done in the right place

Reported by: Garrett Cooper <yanegomi@gmail.com>


# 242319 29-Oct-2012 bapt

make pw_init and gr_init fail if the specified master password or group file is
a directory.

MFC after: 1 month


# 228545 15-Dec-2011 bapt

Modify pw_copy:
- 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


# 200423 11-Dec-2009 scf

Remove a dead store.

MFC after: 5 days


# 185237 23-Nov-2008 scf

Fixed style issues with variable ordering and naming, spacing and
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


# 184831 10-Nov-2008 scf

style(9) fixes.

MFC after: 1 week


# 178431 22-Apr-2008 scf

Add four utility functions related to struct grp processing modeled in-part
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