Commit Graph

15655 Commits

Author SHA1 Message Date
Renato Botelho
d32a66b2a2 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 infor 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:	bapt
Sponsored by:	Netgate
2015-07-02 17:30:59 +00:00
Pedro F. Giffuni
3237628999 dconschat(8): Use NULL instead of 0 for the last argument in execl(3)
Found while experimenting with the gcc sentinel attribute.

MFC after:	3 days
2015-06-28 20:32:03 +00:00
Neel Natu
f429b905b8 Fix issues detected by 'mandoc -Tlint bhyveload.8'
Pointed out by:		wblock
Differential Revision:	https://reviews.freebsd.org/D2762
2015-06-27 18:24:23 +00:00
Alexander Motin
0bb4b98984 Plug minor memory leak at r284765.
Reported by:	Coverity
CID:		1308401
MFC after:	3 days
2015-06-26 16:14:00 +00:00
Cy Schubert
b1cf398e01 Add support for additional architectures in ntp.
Differential Revision:	D2720
Reviewed by:	jmg, reoberto, andrew, ian, imp
2015-06-26 03:29:23 +00:00
Alexander Motin
d83595b2a8 Teach ctld about CTL's physical_port and virtual_port fields.
This allows ctld to work with isp(4) virtual ports, specifying them as
isp0/1, isp0/2, etc.  There are still problems on isp(4) layer with
disabling those ports after enabling, but hopefully they can be fixed.

MFC after:	3 days
Sponsored by:	iXsystems, Inc.
2015-06-24 15:13:27 +00:00
Allan Jude
69f172f27d Switch fstyp build to toggle ZFS support on WITHOUT_ZFS rather than WITHOUT_CDDL
PR:		200976
Approved by:	imp
MFC after:	1 week
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D2045
2015-06-23 16:34:43 +00:00
Allan Jude
e3ef9bb29e Fix the build for gcc by lowering the WARNS level
Approved by:	sbruno
X-MFC-With:	r284589
2015-06-20 15:03:02 +00:00
John-Mark Gurney
4afea7f994 add SO_REUSEADDR when starting debug port, lets you still bind when
a TIME_WAIT socket is still around...

Reviewed by:	grehan
Review:		https://reviews.freebsd.org/D2875
2015-06-20 07:49:08 +00:00
Devin Teske
e8e8c93935 Interim fix for "Login not found" error.
PR:		bin/196514
MFC after:	3 days
X-MFC-to:	stable/10
2015-06-19 21:32:20 +00:00
Allan Jude
398e498e49 Add the ability to detect ZFS and GELI encrypted file systems to fstyp(8)
Functionality is hidden behind the -u flag to avoid confusing automounters

PR:		200823
Reviewed by:	asomers, eadler, wblock (man page)
Approved by:	trasz
MFC after:	10 days
Relnotes:	yes
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D2045
2015-06-19 05:09:02 +00:00
Edward Tomasz Napierala
628b712826 Fix off-by-one error in fstyp(8) and geom_label(4) that made them use
a single space (" ") as a CD9660 label name when no label was present.
Similar problem was also present in msdosfs label recognition.

PR:		200828
Differential Revision:	https://reviews.freebsd.org/D2830
Reviewed by:	asomers@, emaste@
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2015-06-18 21:55:55 +00:00
Edward Tomasz Napierala
a66d51f3bf Allow '@' in unquoted strings, such as with the "path" statement. Note
that one can use any character they like by using double quotes.

PR:		200895
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2015-06-18 10:17:47 +00:00
Neel Natu
9b1aa8d622 Restructure memory allocation in bhyve to support "devmem".
devmem is used to represent MMIO devices like the boot ROM or a VESA framebuffer
where doing a trap-and-emulate for every access is impractical. devmem is a
hybrid of system memory (sysmem) and emulated device models.

devmem is mapped in the guest address space via nested page tables similar
to sysmem. However the address range where devmem is mapped may be changed
by the guest at runtime (e.g. by reprogramming a PCI BAR). Also devmem is
usually mapped RO or RW as compared to RWX mappings for sysmem.

Each devmem segment is named (e.g. "bootrom") and this name is used to
create a device node for the devmem segment (e.g. /dev/vmm/testvm.bootrom).
The device node supports mmap(2) and this decouples the host mapping of
devmem from its mapping in the guest address space (which can change).

Reviewed by:	tychon
Discussed with:	grehan
Differential Revision:	https://reviews.freebsd.org/D2762
MFC after:	4 weeks
2015-06-18 06:00:17 +00:00
Simon J. Gerraty
2ef6d5a7b9 new depends 2015-06-16 23:37:19 +00:00
Rui Paulo
baa557331e syslogd: re-read the timezone when receive a SIGHUP.
syslogd already re-reads the configuration file and the hostname when
receiving a SIGHUP, so it makes sense to reset the timezone.
Special care was taken to ensure we don't break installations running
with a custom TZ variable.

PR:		196905
Submitted by:	Kurt Lidl <lidl pix.net>
Sponsored by:	Pi-Coral, Inc.
2015-06-16 22:42:19 +00:00
Rui Paulo
e87161769c syslogd: don't leak finet0.
Submitted by:	Kurt Lidl <lidl pix.net>
Sponsored by:	Pi-Coral, Inc.
2015-06-16 22:31:38 +00:00
Rui Paulo
38076b4ba5 syslogd: support multiple -b options.
It's now possible to bind multiple sockets to different IP addresses.

PR:		159305
Submitted by:	Kurt Lidl <lidl pix.net>
Sponsored by:	Pi-Coral, Inc.
2015-06-16 22:26:22 +00:00
Xin LI
5a74378c7b Skip src component if /usr/src is empty.
Differential Revision:	https://reviews.freebsd.org/D2364
Submitted by:		kczekirda
Reviewed by:		cperciva, delphij, nwhitehorn, allanjude
MFC after:		2 weeks
2015-06-15 20:12:15 +00:00
Tijl Coosemans
19e58304b3 Change -Wl,-r back to -r so gcc doesn't pass --relax to the linker on some
architectures.

PR:		200881
2015-06-15 19:48:28 +00:00
Baptiste Daroussin
4369c82dc6 Change the documentation to reflect where the -V option should be used
Suggested by:	kientzle
2015-06-14 21:50:38 +00:00
Tijl Coosemans
7a51826c2a Tell the compiler that -dc and -r are linker flags.
Reviewed by:	adrian
2015-06-14 15:40:17 +00:00
Adrian Chadd
8d769a021c Fix typo - this upsets llvm/gcc-4.9, but not gcc-4.2 for some reason. 2015-06-14 00:31:22 +00:00
Adrian Chadd
c1e0b4d15b Fix up crunchgen binary generation to work with external cross-build
tools.

* Allow STRIP to be overridden by the environment
* Use CC to tie things together, not LD

Tested:

* i386, mips32

Submitted by:	kan
2015-06-13 22:01:21 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
122b6b61c7 Get rid of some more NO_OBJs
Differential Revision:       D2748
2015-06-12 14:30:27 +00:00
Simon J. Gerraty
5b381db8cc Remove NO_OBJ
For meta mode we will want objdirs.

Differential Revision:	D2748
Reviewed by:	brooks imp
2015-06-11 04:22:17 +00:00
Simon J. Gerraty
b589e6297b Remove extra blank lines 2015-06-10 14:08:36 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Baptiste Daroussin
3bfc59e83b backout remove of -q option for pw [user|group] next
While the return code is broken, some corner case usage depends on the
functionnality, so backout until we get better regression tests covering those
corner case usage.
2015-06-08 05:27:34 +00:00
Baptiste Daroussin
6328a4be57 Fix typo 2015-06-08 05:06:17 +00:00
Baptiste Daroussin
a57d4bf3a1 Fix mistakes than came along with r284139 2015-06-07 21:59:43 +00:00
Baptiste Daroussin
0958dffde2 Remove '-q' support for pw [user|group] next
the intent of -q in this command is to return as exit status the value of the
next group/user id, which does not make sense given exit status are limited to
values between 0 and 255.
2015-06-07 21:57:20 +00:00
Baptiste Daroussin
1718a38ffd Fix setting uid/gid min/max via pw 2015-06-07 20:59:59 +00:00
Baptiste Daroussin
a68fbadb63 Fix generating configuration file 2015-06-07 20:44:06 +00:00
Baptiste Daroussin
91860967e2 Fix duplicate checking 2015-06-07 19:59:01 +00:00
Baptiste Daroussin
c40bbdb4af Remove uneeded code (already done by pw_make_v7) 2015-06-07 19:39:06 +00:00
Baptiste Daroussin
bae068d22e In case of rename validate the length of the new name
Check early that the new name fits MAXLOGNAME and store it in pwconf
2015-06-07 19:33:25 +00:00
Baptiste Daroussin
a923718979 Refactor input validation
Mutualize code to validate inputs of both 'user' and 'group' command
Test that the input name fits into MAXLOGNAME
2015-06-07 19:03:41 +00:00
Baptiste Daroussin
3438d7decf Finish converting -7 to pwconf 2015-06-07 15:54:57 +00:00
Baptiste Daroussin
c86f7ad56d Handle -7 via gloval pwconf 2015-06-07 15:33:08 +00:00
Baptiste Daroussin
bbe09b2e19 Initialize conf using menset(3) 2015-06-07 15:29:58 +00:00
Baptiste Daroussin
2166b4d190 Handle pretty print (-P) via global pwconf 2015-06-07 15:27:17 +00:00
Baptiste Daroussin
363cefdbb1 Handle dryrun (-N) via global pwconf 2015-06-07 15:09:53 +00:00
Baptiste Daroussin
be7f5ba991 Sort headers 2015-06-07 14:57:16 +00:00
Baptiste Daroussin
82a3c75aa8 Handle -C and -Y locally and stop adding them to arglist 2015-06-07 14:54:07 +00:00
Baptiste Daroussin
2cc63cd136 Add a new global struct pwconf to store etcpath, rootdir and struct userconf
Do not add anymore -R and -V to arglist
Add an error message if both -V and -R are set in arguments
2015-06-07 14:34:38 +00:00
Baptiste Daroussin
fe084e12a5 Fix pw userdel -r not deleting homedir 2015-06-07 14:32:52 +00:00
Baptiste Daroussin
a68be5f7eb Test explicitly the result of strcmp to be consistent with the rest of the code 2015-06-07 11:38:26 +00:00
Baptiste Daroussin
fc606d2b2c Improve readability by reducing indentations levels 2015-06-07 11:35:34 +00:00