Commit Graph

77 Commits

Author SHA1 Message Date
Lexi Winter
961bcbeef2 mailwrapper(8): change behaviour if mailer.conf cannot be opened
Previously, mailwrapper(8) would default to invoking _PATH_DEFAULTMTA
(i.e., dma) if mailer.conf couldn't be opened for any reason, including
transient errors like ENFILE.  This behaviour is undesirable, because if
the administrator has configured a different MTA in mailer.conf, they
almost certainly don't want mailwrapper to unpredictably fall back to
the compiled-in default; and in any case, the default MTA is probably
not running, meaning the mail may be queued and then never delivered,
which is worse than not accepting it to begin with.

Change this behaviour depending on why mailer.conf can't be opened:

- If it doesn't exist, keep the existing behaviour of falling back to
  the default MTA, on the assumption that this is a reasonable default
  if mailer.conf hasn't been configured at all.

- If it cannot be opened for any other reason, do not invoke an MTA and
  instead return an error to the caller.

PR: 25218
Reviewed by: imp, emaste, markj
Pull Request: https://github.com/freebsd/freebsd-src/pull/969
2024-04-19 16:20:44 -06:00
Warner Losh
4d65a7c695 usr.sbin: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by:		Netflix
2023-11-26 22:24:01 -07:00
Warner Losh
b2c76c41be Remove $FreeBSD$: one-line nroff pattern
Remove /^\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:15 -06:00
Warner Losh
d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Warner Losh
1d386b48a5 Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:42 -06:00
Warner Losh
2a63c3be15 Remove $FreeBSD$: one-line .c comment pattern
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
2023-08-16 11:54:29 -06:00
Simon J. Gerraty
d9a4274795 Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
Emmanuel Vadot
431b9b6692 pkgbase: Put sendmail example in the sendmail package
Reviewed by:	bapt
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38297
2023-02-08 08:50:31 +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
Baptiste Daroussin
3467e28f3d mailwrapper: create mailwrapper symlinks for dma(8)
The Dragonfy Mail Agent (dma) can be used with mailwrapper as a
replacement for sendmail(8)

Even if mailwrapper and sendmail are disabled from the build but
dma is not create all the expect symlinks on mailwrapper and make
mailwrapper a symlink to dma, the same way it was done before when
mailwrapper is disabled by sendmail was not.

Discussed with:	emaste
2022-10-18 16:42:27 +02:00
Stefan Eßer
56d11d4a37 Make use of the getlocalbase() function for run-time adjustment of the
local software base directory, as committed in SVN rev. 367813.

The pkg and mailwrapper programs used the LOCALBASE environment variable
for this purpose and this functionality is preserved by getlocalbase().

After this change, the value of the user.localbase sysctl variable is used
if present (and not overridden in the environment).

The nvmecontrol program gains support of a dynamic path to its plugin
directory with this update.

Differential Revision:	https://reviews.freebsd.org/D27237
2020-11-18 20:00:55 +00:00
Scott Long
8e1031086d Revert the whole getlocalbase() set of changes while a different design is
hashed out.
2020-11-15 20:24:59 +00:00
Scott Long
1b249101df Fix the previous revision, it suffered from an incomplete change to the
getlocalbase API.  Also don't erroneously subtract the lenth from the
buffer a second time.
2020-11-15 07:50:29 +00:00
Scott Long
7ca0d5403e Replace hardcoded references to _PATH_LOCALBASE with calls to getlocalbase.3
Reviewed by:	imp, se
2020-11-14 18:01:14 +00:00
Stefan Eßer
1f474190fc Replace literal uses of /usr/local in C sources with _PATH_LOCALBASE
Literal references to /usr/local exist in a large number of files in
the FreeBSD base system. Many are in contributed software, in configuration
files, or in the documentation, but 19 uses have been identified in C
source files or headers outside the contrib and sys/contrib directories.

This commit makes it possible to set _PATH_LOCALBASE in paths.h to use
a different prefix for locally installed software.

In order to avoid changes to openssh source files, LOCALBASE is passed to
the build via Makefiles under src/secure. While _PATH_LOCALBASE could have
been used here, there is precedent in the construction of the path used to
a xauth program which depends on the LOCALBASE value passed on the compiler
command line to select a non-default directory.

This could be changed in a later commit to make the openssh build
consistently use _PATH_LOCALBASE. It is considered out-of-scope for this
commit.

Reviewed by:	imp
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D26942
2020-10-27 11:29:11 +00:00
Kyle Evans
70448a5414 mailwrapper: switch mailer.conf to CONFS
This matches what was already being done in dma(8), and should again make
this merge with etcupdate/mergemaster.

Reported by:	jhb
2020-06-29 18:06:00 +00:00
Kyle Evans
cb99e93575 pkgbase: resolve mailer.conf conflict WITHOUT_SENDMAIL
When WITHOUT_SENDMAIL is set, we end up with two different mailer.conf that
conflict, and hilarity ensues. There's currently three different places that
we might install mailer.conf:

- ^/etc/Makefile (package=runtime, contingent on MK_MAIL != no)
- ^/libexec/dma/dmagent/Makefile (package=dma, contingent on MK_SENDMAIL !=
no)
- ^/usr.sbin/mailwrapper/Makefile (package=utilities, contingent on
not-installed)

The mailwrapper installation will effectively never happen because the ^/etc
one will first.

This patch simplifies the whole situation; remove the ^/etc/Makefile version
and install it primarily in mailwrapper if MK_MAILWRAPPER != "no". The
scenarios covered in mailwrapper are:

- sendmail(8) is installed, dma(8) may or may not be installed
- neither sendmail(8) nor dma(8) is installed

In the first scenario, sendmail(8) is dominant so we can go ahead and
install the version in ^/etc/mail. In the unlisted scenario, sendmail(8) is
not installed but dma(8) is, we'll let ^/libexec/dma/dmagent do the
installation. In the second listed scenario, we still want to install an
example mailer.conf so just install the base sendmail(8) version.

Reviewed by:	bapt
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D24924
2020-06-02 02:38:54 +00:00
Xin LI
02371ceb33 Sync with NetBSD/OpenBSD. 2020-04-16 03:23:19 +00:00
Baptiste Daroussin
8b081eaa55 Revert r326844
There has been some fallout from the change. The change itself was not valueable
enough to spend time investigating the corner cases, let's just back it out.

Reported by:	flo
2018-01-02 16:50:57 +00:00
Baptiste Daroussin
b37b09244c Replace usage of fparselen(3) by a getline(3)
This allow to remove the dependency on libutil
2017-12-14 08:57:37 +00:00
Pedro F. Giffuni
1de7b4b805 various: general adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
2017-11-27 15:37:16 +00:00
Bryan Drewery
ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Rodney W. Grimes
ce9f2d31b3 Convert absolute links to relative links.
Style.Makefile(9) has been ignored to produce minimal diffs.

Approved by:	grehan (mentor)
MFC after:	1 week
2017-03-07 05:10:38 +00:00
Enji Cooper
64a0982bee usr.sbin: normalize paths using SRCTOP-relative paths or :H when possible
This simplifies make logic/output

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-03-04 11:38:03 +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
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Baptiste Daroussin
c6db8143ed Convert usr.sbin to LIBADD
Reduce overlinking
2014-11-25 16:57:27 +00:00
Simon J. Gerraty
9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Baptiste Daroussin
24ed0a5759 Allow mailwrapper to use mailer.conf from localbase (respecting LOCALBASE env var if set)
Phabric:	https://reviews.freebsd.org/D412
Reviewed by:	bdrewery
MFC after:	2 weeks
Relnotes:	yes
2014-08-26 22:20:02 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Baptiste Daroussin
01c2b8ac0d use .Mt to mark up email addresses consistently (part2)
PR:		191174
Submitted by:	Franco Fichtner  <franco@lastsummer.de>
2014-06-20 09:57:27 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
cc3f4b9965 Merge from head 2014-05-08 23:54:15 +00:00
Warner Losh
c6063d0da8 Use src.opts.mk in preference to bsd.own.mk except where we need stuff
from the latter.
2014-05-06 04:22:01 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Mark Murray
4f6fbcd5db Create the /bin/rmail symlink (which mailers such as postfix
and Exim can use).

This is something I thought I committed MONTHS ago, but it appears
that I fatfingered it and made a local commit.

Pass the pointy hat, please.
2010-10-12 21:01:26 +00:00
Xin LI
ded7840825 Sync with OpenBSD:
- avoid coredump when there's only one token on a line;
 - Use calloc();
 - Remove a line inherited from example mdoc.

Obtained from:	OpenBSD
MFC after:	1 month
2010-03-30 21:54:25 +00:00
Ed Schouten
71ccf09269 The last big commit: let usr.sbin/ use WARNS=6 by default. 2010-01-02 11:07:44 +00:00
Ruslan Ermilov
bc84aa4ba3 Markup fixes. 2006-09-29 17:57:04 +00:00
Xin LI
49fe7301af Update NetBSD and OpenBSD SCM tags to match the reality. Note that
NetBSD revisions 1.8 and 1.9 are not actually applied to our code base
because we have solved the problem differently, therefore, these changes
can be safely skipped.
2006-08-07 10:29:18 +00:00
Xin LI
7e87aff9d5 Merge all applicable NetBSD and OpenBSD improvements over this manpage
till NetBSD mailwrapper.8,v 1.11 and OpenBSD mailwrapper.8,v 1.8:

 - Separate exit status out from diagnostics section.
 - Fix typos.

Obtained from:	NetBSD, OpenBSD
MFC After:	Along with mailwrapper(8) updates.
2006-08-07 10:22:08 +00:00
Xin LI
8fe1b8c03e Cleanups for mailwrapper(8):
- K&R -> ANSI prototype [O]
 - Do not bother to do free right before exit() or execve() [O]
 - Remove some dead code in addarg()
 - Make additional parameters specified in mailer.conf(5)
   actually work and document the fact. [N]
 - Avoid using __progname but instead use getprogname()
   and setprogname() to provide more sensible messages. [O, N]
 - Update $OpenBSD$ and $NetBSD$ to reflect the fact that we
   have sync'ed with their code.
 - WARNS=6

Obtained from/Inspired by:	OpenBSD [O], NetBSD [N] (partially)
2006-06-06 05:01:12 +00:00
Ruslan Ermilov
e1fe3dba5c Reimplementation of world/kernel build options. For details, see:
http://lists.freebsd.org/pipermail/freebsd-current/2006-March/061725.html

The src.conf(5) manpage is to follow in a few days.

Brought to you by:	imp, jhb, kris, phk, ru (all bugs are mine)
2006-03-17 18:54:44 +00:00
Ruslan Ermilov
a5d15979f2 Replaced afterinstall: with FILES. 2004-10-18 17:20:29 +00:00
Ruslan Ermilov
07bfccd71e Mechanically kill hard sentence breaks. 2004-07-02 23:13:00 +00:00
Johan Karlsson
ef271e5858 Do not install SYMLINKS if both NO_MAILWRAPPER and
NO_SENDMAIL is defined.

PR:		57058
Reported by:	Henri Hennebert <hlh@cocoon.cercle.be>
		Melvyn Sopacua on current@
Submitted by:	ru@
MFC after:	2 weeks
2004-01-17 23:58:23 +00:00