<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libutil, branch releng/10.2</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=releng%2F10.2</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=releng%2F10.2'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>2015-07-06T13:01:01Z</updated>
<entry>
<title>MFC r285050, r285053, r285059:</title>
<updated>2015-07-06T13:01:01Z</updated>
<author>
<name>Renato Botelho</name>
<email>garga@FreeBSD.org</email>
</author>
<published>2015-07-06T13:01:01Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=8e508f771a608001db8e53f25a108688d50a1991'/>
<id>urn:sha1:8e508f771a608001db8e53f25a108688d50a1991</id>
<content type='text'>
When passwd or group information is changed (by pw, vipw, chpass, ...)
temporary file is created and then a rename() call move it to official file.
This operation didn't have any check to make sure data was written to disk
and if a power cycle happens system could end up with a 0 length passwd
or group database.

There is a pfSense bug with more information about it:

https://redmine.pfsense.org/issues/4523

The following changes were made to protect passwd and group operations:

* lib/libutil/gr_util.c:
 - Replace mkstemp() by mkostemp() with O_SYNC flag to create temp file
 - After rename(), fsync() call on directory for faster result

* lib/libutil/pw_util.c
 - Replace mkstemp() by mkostemp() with O_SYNC flag to create temp file

* usr.sbin/pwd_mkdb/pwd_mkdb.c
 - Added O_SYNC flag on dbopen() calls
 - After rename(), fsync() call on directory for faster result

* lib/libutil/pw_util.3
 - pw_lock() returns a file descriptor to master password file on success

Differential Revision:	https://reviews.freebsd.org/D2978
Approved by:	re (kib), bapt (implicit agreed)
Sponsored by:	Netgate
</content>
</entry>
<entry>
<title>MFC, r284192:</title>
<updated>2015-06-16T02:31:11Z</updated>
<author>
<name>Kenneth D. Merry</name>
<email>ken@FreeBSD.org</email>
</author>
<published>2015-06-16T02:31:11Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=90808dc9a7845daa6d823a4c9c95ac87fe33ae47'/>
<id>urn:sha1:90808dc9a7845daa6d823a4c9c95ac87fe33ae47</id>
<content type='text'>
  ------------------------------------------------------------------------
  r284192 | ken | 2015-06-09 15:39:38 -0600 (Tue, 09 Jun 2015) | 102 lines

  Add support for reading MAM attributes to camcontrol(8) and libcam(3).

  MAM is Medium Auxiliary Memory and is most commonly found as flash
  chips on tapes.

  This includes support for reading attributes and decoding most
  known attributes, but does not yet include support for writing
  attributes or reporting attributes in XML format.

  libsbuf/Makefile:
  	Add subr_prf.c for the new sbuf_hexdump() function.  This
  	function is essentially the same function.

  libsbuf/Symbol.map:
  	Add a new shared library minor version, and include the
  	sbuf_hexdump() function.

  libsbuf/Version.def:
  	Add version 1.4 of the libsbuf library.

  libutil/hexdump.3:
  	Document sbuf_hexdump() alongside hexdump(3), since it is
  	essentially the same function.

  camcontrol/Makefile:
  	Add attrib.c.

  camcontrol/attrib.c:
  	Implementation of READ ATTRIBUTE support for camcontrol(8).

  camcontrol/camcontrol.8:
  	Document the new 'camcontrol attrib' subcommand.

  camcontrol/camcontrol.c:
  	Add the new 'camcontrol attrib' subcommand.

  camcontrol/camcontrol.h:
  	Add a function prototype for scsiattrib().

  share/man/man9/sbuf.9:
  	Document the existence of sbuf_hexdump() and point users to
  	the hexdump(3) man page for more details.

  sys/cam/scsi/scsi_all.c:
  	Add a table of known attributes, text descriptions and
  	handler functions.

  	Add a new scsi_attrib_sbuf() function along with a number
  	of other related functions that help decode attributes.

  	scsi_attrib_ascii_sbuf() decodes ASCII format attributes.

  	scsi_attrib_int_sbuf() decodes binary format attributes, and
  	will pass them off to scsi_attrib_hexdump_sbuf() if they're
  	bigger than 8 bytes.

  	scsi_attrib_vendser_sbuf() decodes the vendor and drive
  	serial number attribute.

  	scsi_attrib_volcoh_sbuf() decodes the Volume Coherency
  	Information attribute that LTFS writes out.

  sys/cam/scsi/scsi_all.h:
  	Add a number of attribute-related structure definitions and
  	other defines.

  	Add function prototypes for all of the functions added in
  	scsi_all.c.

  sys/kern/subr_prf.c:
  	Add a new function, sbuf_hexdump().  This is the same as
  	the existing hexdump(9) function, except that it puts the
  	result in an sbuf.

  	This also changes subr_prf.c so that it can be compiled in
  	userland for includsion in libsbuf.

  	We should work to change this so that the kernel hexdump
  	implementation is a wrapper around sbuf_hexdump() with a
  	statically allocated sbuf with a drain.  That will require
  	a drain function that goes to the kernel printf() buffer
  	that can take a non-NUL terminated string as input.
  	That is because an sbuf isn't NUL-terminated until it is
  	finished, and we don't want to finish it while we're still
  	using it.

  	We should also work to consolidate the userland hexdump and
  	kernel hexdump implemenatations, which are currently
  	separate.  This would also mean making applications that
  	currently link in libutil link in libsbuf.

  sys/sys/sbuf.h:
  	Add the prototype for sbuf_hexdump(), and add another copy
  	of the hexdump flag values if they aren't already defined.

  	Ideally the flags should be defined in one place but the
  	implemenation makes it difficult to do properly.  (See
  	above.)

  Sponsored by:	Spectra Logic Corporation

------------------------------------------------------------------------
</content>
</entry>
<entry>
<title>MFC: 272445,272578,273772,273779,273782,273786,273787,273791</title>
<updated>2014-11-04T07:50:48Z</updated>
<author>
<name>Baptiste Daroussin</name>
<email>bapt@FreeBSD.org</email>
</author>
<published>2014-11-04T07:50:48Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=cb07b25a192ea00807c9109284ca7e2b26cd713e'/>
<id>urn:sha1:cb07b25a192ea00807c9109284ca7e2b26cd713e</id>
<content type='text'>
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 &lt;invalid&gt; 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]
</content>
</entry>
<entry>
<title>MFC r273837:</title>
<updated>2014-11-01T13:45:01Z</updated>
<author>
<name>Dimitry Andric</name>
<email>dim@FreeBSD.org</email>
</author>
<published>2014-11-01T13:45:01Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=62ea2fd51cec44009e996999ac1e8773ea1d8f38'/>
<id>urn:sha1:62ea2fd51cec44009e996999ac1e8773ea1d8f38</id>
<content type='text'>
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
</content>
</entry>
<entry>
<title>MFC r270180:</title>
<updated>2014-08-27T18:25:14Z</updated>
<author>
<name>Enji Cooper</name>
<email>ngie@FreeBSD.org</email>
</author>
<published>2014-08-27T18:25:14Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=1b65ce53fb230898e18d793d53f489bb496fa6c3'/>
<id>urn:sha1:1b65ce53fb230898e18d793d53f489bb496fa6c3</id>
<content type='text'>
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-&lt;test&gt; to
 &lt;test&gt;_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 &lt;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 &lt;cpeel@isilon.com&gt; [*]
 Sponsored by: EMC / Isilon Storage Division
</content>
</entry>
<entry>
<title>MFC	r269015:</title>
<updated>2014-08-16T00:54:56Z</updated>
<author>
<name>Pedro F. Giffuni</name>
<email>pfg@FreeBSD.org</email>
</author>
<published>2014-08-16T00:54:56Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=6f67f9a4dd36f9caefe6c9496bd027753f0b4306'/>
<id>urn:sha1:6f67f9a4dd36f9caefe6c9496bd027753f0b4306</id>
<content type='text'>
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)
</content>
</entry>
<entry>
<title>MFC r265276:</title>
<updated>2014-07-29T22:29:31Z</updated>
<author>
<name>Mark Johnston</name>
<email>markj@FreeBSD.org</email>
</author>
<published>2014-07-29T22:29:31Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=5d896639fb7027f32ea7646f47476e9a6c4e8563'/>
<id>urn:sha1:5d896639fb7027f32ea7646f47476e9a6c4e8563</id>
<content type='text'>
Fix a typo.
</content>
</entry>
<entry>
<title>MFC r261824:</title>
<updated>2014-02-16T02:33:59Z</updated>
<author>
<name>Eitan Adler</name>
<email>eadler@FreeBSD.org</email>
</author>
<published>2014-02-16T02:33:59Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=170dcbd4267509f456351ba37352603142e957e7'/>
<id>urn:sha1:170dcbd4267509f456351ba37352603142e957e7</id>
<content type='text'>
libutil/pw_util.3: Fix two prototypes.
</content>
</entry>
<entry>
<title>don't assert on bad args, instead return an error..</title>
<updated>2013-10-07T22:22:57Z</updated>
<author>
<name>John-Mark Gurney</name>
<email>jmg@FreeBSD.org</email>
</author>
<published>2013-10-07T22:22:57Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=44f01c419d1e84684fa53b3814459419ded71a6b'/>
<id>urn:sha1:44f01c419d1e84684fa53b3814459419ded71a6b</id>
<content type='text'>
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
</content>
</entry>
<entry>
<title>The round of expand_number() cleanups.</title>
<updated>2013-08-30T11:21:52Z</updated>
<author>
<name>Sergey Kandaurov</name>
<email>pluknet@FreeBSD.org</email>
</author>
<published>2013-08-30T11:21:52Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=8d99b9cebd80ba6c1e85969fe9d9ea0962d31d14'/>
<id>urn:sha1:8d99b9cebd80ba6c1e85969fe9d9ea0962d31d14</id>
<content type='text'>
o Fix range error checking to detect overflow when uint64_t &lt; 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
</content>
</entry>
</feed>
