Commit Graph

2814 Commits

Author SHA1 Message Date
Dag-Erling Smørgrav
cf325fda86 tftpd: type nit
Sponsored by:	Klara, Inc.
2022-11-18 17:26:54 +01:00
Dag-Erling Smørgrav
b15e052e74 tftpd: Plug memory leaks in option handling code.
Sponsored by:	Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37423
2022-11-18 16:39:44 +01:00
Dag-Erling Smørgrav
bacb00ab40 tftpd: whitespace cleanup 2022-11-17 16:42:30 +00:00
Dag-Erling Smørgrav
eb0292d929 tftpd: cleanup
Sponsored by:	Klara, Inc.
2022-11-15 23:37:54 +01:00
Baptiste Daroussin
616f32ea6d othermta: remove leftover from 20 years ago
othermta (along with mta_start_script configuration entry in rc.conf)
was a mechanism used to be able to run another mta than sendmail(8) before
"rcng" time 20 years ago.

othermta has not been used since.
2022-11-14 09:08:37 +01:00
Konstantin Belousov
8cc44a1e59 rtld: add support for the $LIB token
similar to the same token in glibc.

Requested and reviewed by:	bapt
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37329
2022-11-11 12:06:30 +02:00
Baptiste Daroussin
0b1adc42a1 rc.sendmail: remove unused script
20 years ago the use of rc.sendmail script was dropped in favor
of /etc/rc.d/sendmail, it is time to retire the script entirely
now.

MFC after:	1 week
2022-11-09 16:55:18 +01:00
Jose Luis Duran
c7c9836853 sendmail: Add back a comment about "NONE"
Differential Revision:	https://reviews.freebsd.org/D37315
2022-11-09 16:54:34 +01:00
Baptiste Daroussin
7cadc52638 sendmail: do not use NONE
NONE is deprecated, instead of using NONE, switch to "NO" all
the sendmail_*_enable which sendmail_enable=NONE would have done
2022-11-09 15:20:30 +01:00
Baptiste Daroussin
b7104f1914 sendmail: document that sendmail_enable can be set to NONE
setting sendmail_enable to NONE (which is now the default)
turns all the sendmail_*_enable variables to NO

Reported by:	many
2022-11-08 14:39:27 +01:00
Baptiste Daroussin
a67b925ff3 mail: make The Dragonfly Mail Agent (dma) the default mta.
dma accepts mail from a local Mail User Agent (MUA) and delivers it
locally or to a smarthost for delivery. dma does not accept inbound
mail (i.e., it does not listen on port 25) and is not intended to
provide the same functionality as a full MTA like postfix or sendmail.
It is intended for use cases such as delivering cron(8) mail. which
is the default configuration and usage of sendmail in the default
setup of the base system.

In order to switch the default from sendmail to dma, we teach
mailwrapper to fallback on dma directly if the mailer.conf file cannot
be opened.
We install by default a mailer.conf file which points at dma
We install a mailer.conf file for sendmail in the examples.

Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D37035
2022-11-07 12:49:56 +01:00
Li-Wen Hsu
72a1cb05cd
rc(8): Add a zpoolupgrade rc.d script
If a zpool is created by makefs(8), its version is 5000, i.e., all
feature flags are off.  Introduce an rc script to run `zpool upgrade`
over the assigned zpools on the first boot.  This is useful to the
ZFS based VM images built from release(7).

Reviewed by:	imp, markj, mav
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37282
2022-11-07 11:30:09 +08:00
Dag-Erling Smørgrav
eb4d86d529 getty: Avoid NULL deref if stdin is not a tty.
Sponsored by:	Klara, Inc.
Obtained from:	Apple OSS Distributions
Differential Revision: https://reviews.freebsd.org/D37265
2022-11-04 15:54:01 +01:00
Dag-Erling Smørgrav
f285f41498 getty: code cleanup, part 2
* Clean up whitespace
* Reindent

Sponsored by:	Klara, Inc.
2022-11-04 15:22:04 +01:00
Dag-Erling Smørgrav
8ad7a14ab4 getty: code cleanup, part 1
* Avoid unnecessary use of `unsigned char *`
* Use explicit casts when assigning `unsigned char *` to `char *` or vice versa
* Drop unused global variables (and fix memory leak in `gettable()`)
* Use `snprintf()` instead of `strcpy()` + `strcat()`
* Drop spurious braces in switch

Sponsored by:	Klara, Inc.
Obtained from:	Apple OSS Distributions (in part)
Differential Revision: https://reviews.freebsd.org/D37263
2022-11-04 15:19:27 +01:00
Konstantin Belousov
f585d13dd6 rtld: remove unused macro FPTR_TARGET
It is a remnant from the ia64 removal

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-10-22 05:15:06 +03:00
Konstantin Belousov
ca2560bd85 rtld: fix typo in comment
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-10-17 17:10:03 +03:00
Dag-Erling Smørgrav
0aa2700123 Put OPIE to rest.
Differential Revision: https://reviews.freebsd.org/D36592
2022-10-02 03:37:29 +02:00
Brooks Davis
b4cfdbfed2 manpages: Remove telnetd references
Mostly remove from the SEE ALSO section, adding a mention of the port
where not removed. Elsewhere, remove as appropriate and change from .Xr
to .Nm where a mention of telnetd continues to make sense (or removing
it would require significant reworking of the surrounding text).

Reviewed by:	imp, delphij, emaste
Differential Revision:	https://reviews.freebsd.org/D36785
2022-09-29 17:56:41 +01:00
Brooks Davis
0eea46fb1f Remove telnetd
The telnetd codebase is unmaintained and has a number of quality
issues. Telnet has been largely supplanted by ssh. If needed, a port is
available (net/freebsd-telnetd), but a more maintained implementation
should be prefered.

While the telnet client suffers from the same issues, it is deemed
to be of lower risk and is required to connect to legacy devices, so
it remains.

Reviewed by:	emaste, imp
Differential Revision:	https://reviews.freebsd.org/D36620
2022-09-28 19:53:49 +01:00
Konstantin Belousov
2f72ee987d ldd: remove '[preloaded]' marker for the preloaded objects
for the default output.  For '-a' (per-object needed printout) the
[preloaded] banner is kept.

Instead, use special format2 for printing the preloaded objects (and
vdso), which does not include DT_NEEDED, since there is no object
needing the printed one.

In this way, the output is more compatible with glibc.

Example:
LD_PRELOAD=/lib/libthr.so.3 LD_TRACE_LOADED_OBJECTS=1 /libexec/ld-elf.so.1 /bin/ls
        libutil.so.9 => /lib/libutil.so.9 (0x801099000)
        libncursesw.so.9 => /lib/libncursesw.so.9 (0x8010b0000)
        libc.so.7 => /lib/libc.so.7 (0x801123000)
        [vdso] (0x7ffffffff000)
        /lib/libthr.so.3 (0x80106c000)
Note the absense of the part before and including '=>' for preloaded
libthr.so.3, and for vdso.

PR:	265750
Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36616
2022-09-22 14:20:13 +03:00
Cy Schubert
b77b309968 rc.d/var_run: Add needed "shutdown" keyword
The "shutdown" keyword invokes rcorder with the -k flag, for rc scripts
with the keyword at shutdown.

Reported by:	bdrewery
Fixes:		27b9777c28
MFC after:	3 days
Differential Revision:
2022-09-20 11:44:11 -07:00
Konstantin Belousov
1251cf8a30 rtld-elf/libmap.c: correct comment
There is no intent to support TLS for rtld.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2022-09-19 01:49:41 +03:00
Konstantin Belousov
1fd4dec26e rtld-elf/libmap.h: style declarations
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2022-09-19 01:49:41 +03:00
Konstantin Belousov
3aed5ddb8b rtld-elf/libmap.h: add include guard
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2022-09-19 01:49:41 +03:00
Konstantin Belousov
daa85548d5 rtld: teach LD_SHOW_AUXV about AT_USRSTACK*
Reviewed by:	brooks, imp (previous version)
Discussed with:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D36540
2022-09-16 23:24:18 +03:00
Gordon Bergling
4732904942 bootptest: Fix a typo in a source code comment
- s/avaible/available/

MFC after:	3 days
2022-09-15 10:28:52 +02:00
Cy Schubert
27b9777c28 libexec/rc: Add var_run rc script
Users with a tmpfs /var/run will lose the directory tree state of
/var/run at reboot. This rc script will optionally (by default)
capture the state of the directory structure in /var/run prior to
shutdown and recreate it at system boot.

Alternatively a user can save the state of the /var/run directories
manually using service var_run save and disable the autosaving of
/var/run state using the var_run_autosave variable, for those
paranoid SSD users.

PR:			259585, 259699
Reported by:		freebsd@walstatt-de.de,
Reviewed by:		philip, gbe (previous version)
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D36386
2022-09-05 06:19:42 -07:00
Gordon Bergling
7ed279f58f ntpd(8): Correct a typo in comment of the rc script
- s/the the/the/

MFC after:	3 days
2022-09-04 13:02:21 +02:00
Konstantin Belousov
832b40f7ff rtld.c: remove extra blank line
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D36396
2022-09-04 07:28:02 +03:00
Konstantin Belousov
7444f54bd3 rtld: style the rest of rtld_lock.c
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D36396
2022-09-04 07:28:02 +03:00
Konstantin Belousov
a687683b99 rtld: mask signals for default read locks
Rtld locks from libthr defer signals delivery, which means that binding
is not possible while a signal handler is executed.

Binding might upgrade read-locked rtld_bind_lock to write-lock, if
symbol resolution requires loading filters.  If a signal would be delivered
while rtld is in read-locked section, and signal handler needs binding
which upgrades the lock, for non-threaded image that uses default rtld
locks, we get the rtld data structures modified under the top-level
active rtld frame.

To correct the problem, mask signals for read-locking of default locks
in addition to the write-locking.  It is very cheap now with
sigfastblock(2).

Note that the global state is used to track pre-locked state of either
sigfastblock(2) or signal mask (if sigfastblock(2) is administratively
disabled).  It is fine for non-threaded images since there are no other
threads.  But I believe that it is fine for threaded images using libc_r
as well, since masking signals disables preemption (I did not tested
it).

NetBSD PR:	https://gnats.netbsd.org/56979
Reported by:	tmunro
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D36396
2022-09-04 07:28:02 +03:00
Gordon Bergling
3576233cd3 rtld(1): Fix a typo in a source code comment
- s/interger/integer/

MFC after:	3 days
2022-09-03 19:16:32 +02:00
Gordon Bergling
0a81527da8 rc.conf: Fix a typo in a comment
- s/overriden/overridden/

MFC after:	3 days
2022-09-03 14:57:39 +02:00
Bjoern A. Zeeb
e196317370 local_unbound: rc: allow to overwrite pid file path
Certain configurations need to use a different path for pidfile.
Allow rc.conf to overwrite it.

Reviewed by:	cy, 0mp
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D36141
2022-09-01 23:51:42 +00:00
Eugene Grosbein
160a2f2cdd rc.conf(5): add <service>_umask to run the service using this value
None of tools working with login classes change umask(1)
and we had no ways to specify non-default umask for a service
not touching its startup script. This change makes in possible.

Some file-sharing services that create new files may benefit from it.

Differential:	https://reviews.freebsd.org/D36309
MFC-after:	3 days
2022-08-28 12:48:58 +07:00
Franco Fichtner
c9be47b34d rc: add ${name}_setup script support
Run a service-based setup script before running the start command.
Useful for automatic configuration file generation.

Reviewed by:	https://reviews.freebsd.org/D36006
2022-08-15 16:43:12 +02:00
Konstantin Belousov
008475d3c8 rtld: fix display of the mapbase for the traced objects
Commit 24d0c9c1f5 introduced the following regression:
% ldd /bin/ls
/bin/ls:
        libutil.so.9 => /lib/libutil.so.9 (0x1021000)
        libncursesw.so.9 => /lib/libncursesw.so.9 (0x1021000)
        libc.so.7 => /lib/libc.so.7 (0x1021000)
Note that the base address is the same for all displayed libraries.

Fix it by passing correct object to trace_print_obj().

Fixes:	24d0c9c1f5
Reviewed by:	jrtc27
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential revision:	https://reviews.freebsd.org/D36198
2022-08-14 18:11:06 +03:00
Colin Percival
cc495d3b67 rc.d/hostid: Skip warning on systems w/o smbios
The first time a FreeBSD system boots, it obtains a hostuuid and hostid
from the smbios.system.uuid kernel environment variable.  If this value
is found to be invalid, a warning is printed and the boot pauses for
two seconds to give the user a chance to read it.

If the FreeBSD kernel is launched directly in a virtual machine rather
than via the FreeBSD boot loader, the smbios.system.uuid environment
variable might not be set; in this case, there's no need to alert the
user and delay the boot process since the lack of a "hardware" uuid is
entirely expected.

Distinguish between the cases of "invalid UUID" and "no UUID", warning
and delaying the boot only in the former case.  In both cases we still
generate a random UUID in software.

Reviewed by:	delphij
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D36185
2022-08-13 15:58:16 -07:00
Mateusz Piotrowski
e7437ae907 rc: Start testing the rc(8) framework (beginning with *_oomprotect)
This change adds 2 tests to make sure that the *_oomprotect variable
sets the protection against OOM killer properly within rc(8) scripts.

This is also adding the first tests for the rc(8) framework. More tests
will be added as we go.

PR:		256148
Approved by:	des
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D35745
2022-07-26 15:39:39 +02:00
Jessica Clarke
becd9908be rtld-elf: Fix leaks and wild frees in origin_subst
55abf23dd3 inverted the value passed to origin_subst_one when rolling
up the existing code into a loop. If the first token is found ($ORIGIN),
this results in a wild free of part of strtab. Processing the second
token works fine and will act how the first should have regardless of
whether found, allocating memory for the string without freeing.
Processing subsequent tokens however will then leak, regardless of
whether found, as they will also believe they need to allocate memory
and can't free the string.

Found by:	CHERI
Reviewed by:	kib, markj
Fixes:		55abf23dd3 ("rtld: make token substitution table-driven")
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D35792
2022-07-12 17:47:47 +01:00
Mateusz Piotrowski
7f6754d965 rc.subr: Fix a typo
MFC after:	3 days
2022-07-08 21:35:34 +02:00
Mike Walker
68e035c017 rc.subr: Make sure oomprotect protects existing children
The rc(8) framework support protecting services from OOM killer.
The current implementation applies the protection after the service has
already started. This works fine if only the main process is to be
protected (*_oomprotect=yes). However, the current implementation fails
to protect existing children when children are also to be protected
(*_oomprotect=all). This patch fixes that.

Note: it is not easy to apply the protectoin earlier because we want to
support both the services which use the "command" variable and those
that use the "start_cmd" variable.

PR:		256148
Approved by:	adrian, osogbo
Tested by:	Jamie Landeg-Jones <jamie@catflap.org>
Fixes:		3bead71e95 - Add a global option where we can protect
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D35747
2022-07-08 08:19:50 +02:00
Alexander V. Chernikov
2bfd8b5b94 testing: provide meaningful error when pytest is not available
atf format does not provide any way of signalling any error message
 back to the atf runner when listing tests. Work this around by
 reporting "__test_cases_list_pytest_binary_not_found__" test instead.

Reviewed By: kp
Differential Revision: https://reviews.freebsd.org/D35721
2022-07-06 19:55:58 +00:00
Mike Karels
1cf8e6339e mountd startup: enable NFSv4 if needed on restart
The mountd script in rc.d sets vfs.nfsd.server_max_nfsvers correctly
when it is run at system startup, relying on the kernel default.
However, if NFSv4 was enabled in /etc/rc.conf later, and the script
was re-run to restart mountd, the sysctl was still set to 3.
Set the sysctl to the right value in all cases.

Reviewed by:	rmacklem
MFC after:	1 week
2022-07-04 08:00:10 -05:00
Mateusz Piotrowski
bad2f716f4 ftp: Use /var/spool/ftp as ftp's home consistently
The home directory of the ftp user is /var/spool/ftp according to
hier(7). Update the manual page of ftpd(8) to reflect that.

MFC after:	2 weeks
2022-06-28 15:20:05 +02:00
Alexander V. Chernikov
513ce835b5 testing: pass ATF vars to pytest via env instead of arguments.
This change is a continuation of 9c42645a1e workaround.
Apparently pytest argument parser is not happy when parsing values
 with spaces or just more than one --atf-var argument.
Switch wrapper to send these kv pairs as env variables. Specifically,
 use _ATF_VAR_key=value format to distinguish from the other vars.

Add the `atf_vars` fixture returning all passed kv pairs as a dict.

Reviewed by:	lwhsu
Differential Revision: https://reviews.freebsd.org/D35625
MFC after:	2 weeks
2022-06-28 12:20:16 +00:00
Alexander V. Chernikov
9c42645a1e testing: workaround pytest parser bug in pytest-atf-wrapper.
Reviewed by:	lwhsu, kp
Differential Revision: https://reviews.freebsd.org/D35614
MFC after:	2 weeks
2022-06-27 17:30:53 +00:00
Alexander V. Chernikov
924226fba1 testing: move atf-pytest-wrapper to /usr/libexec
Move pytest wrapper to the collection of the other atf wrappers
 in libexec. It solves the problem of combining bits & pieces from
 bsd.test.mk and bgs.prog.mk to address "test binary, but not the
 suite binary".

Reviewed by:	kp
Differential Revision: https://reviews.freebsd.org/D35604
MFC after:	2 weeks
2022-06-26 13:25:47 +00:00
наб
11bd40d04a rc.d/hostid: remove useless cat
We've already read it and validated it ‒ re-reading is wasteful

PR:		264376
2022-06-17 21:27:19 -04:00