Commit graph

261 commits

Author SHA1 Message Date
Dag-Erling Smørgrav 1e25eb287f login: Missed an instance of getpwnam().
Fixes:		a3d80dd8aa
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D43423
2024-01-12 17:40:55 +01:00
Dag-Erling Smørgrav a3d80dd8aa login: Use getpwnam_r() instead of getpwnam().
Since we expect the entry to still be valid after calling into PAM,
which may call getpwnam() itself, we need to use getpwnam_r().

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans, imp, allanjude, markj
Differential Revision:	https://reviews.freebsd.org/D43376
2024-01-12 16:43:42 +01:00
Warner Losh 5e3934b15a usr.bin: 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 bdcbfde31e usr.bin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by:		Netflix
2023-11-26 22:23:30 -07:00
Warner Losh 05248206f7 Remove $FreeBSD$: one-line bare tag
Remove /^\s*\$FreeBSD\$$\n/
2023-08-16 11:55:20 -06: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 42b388439b Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
2023-08-16 11:54:23 -06:00
Warner Losh b3e7694832 Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-16 11:54:16 -06:00
Warner Losh 4d846d260e spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with:		pfg
MFC After:		3 days
Sponsored by:		Netflix
2023-05-12 10:44:03 -06: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
Jessica Clarke b58ea3e1f7 Fix hand-rolled METALOG entries for installconfig during distributeworld
During distributeworld we call distribute on subdirectories, which in
turn calls installconfig. However, this recursive installconfig call
appends the distribution name (in these cases, "base") to DESTDIR. For
install(1) this works fine as its -D argument comes from the top-level
Makefile.inc1, which passes the original DESTDIR, thereby resulting in
the METALOG entry having the distribution name as a prefix representing
its true installed path relative to the root, but for the hand-rolled
entries they do not use install(1) and thus do not have access to what
the original DESTDIR was, resulting in the METALOG missing this prefix.

Thus, pass down the name of the distribution via a new variable DISTBASE
(chosen as Makefile.inc1 already uses that to convey this exact same
information to etc's distrib-dirs during distributeworld) and prepend
this to the handful of manually-generated METALOG entries. For the
installworld case this variable will be empty and so this behaves as
before.

Note that we need to be careful to avoid double slashes in the METALOG;
distributeworld uses find | awk to split the single METALOG up into
multiple dist.meta files, and this relies on the paths in the METALOG
having the exact prefix ./dist (or ./dist/usr/lib/debug).

Reviewed by:	brooks, emaste
Differential Revision:	https://reviews.freebsd.org/D33997
2022-02-28 22:36:39 +00:00
Emmanuel Vadot 93c4369096 pkgbase: Put more binaries/lib in runtime
Move some needed binaries/libs from FreeBSD-utilities to FreeBSD_runtime.
This is everything needed to boot to multiuser with FreeBSD-rc installed.

MFC after:	2 weeks
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33435
2021-12-21 10:17:27 +01:00
Danilo G. Baio ec80eab8a1 motd: Fix Questions List address
Following mailing lists migration from Mailman to Mlmmj.

https://lists.FreeBSD.org/mailman/listinfo/freebsd-questions/
-->
https://lists.freebsd.org/subscription/freebsd-questions

Adding a short link (as we already have for Faq and Handbook), so all
links can be indented the same way.

Reviewed by:	imp (earlier version)
Approved by:	lwhsu
Differential Revision: https://reviews.freebsd.org/D33101
2021-11-28 18:15:04 -03:00
Kyle Evans 7f4bb50176 login: use sizeof(audit_cond) consistently, NFC
The other three instances were already converted to use audit_cond, this
one was just changed from sizeof(long) -> sizeof(int).
2021-10-05 23:25:29 -05:00
Alex Richardson 4d552825ec usr.bin/login: send errors to console if syslog isn't running
I was debugging why login(1) wasn't working as expected on a minimal
MFS_ROOT disk image. This image doesn't have syslogd running so the
warnings were lost and I had to use GDB to find out why login(1) was
failing (missing PAM libraries) instead of being able to see it in
the console output.

MFC after:	1 week
Reviewed By:	pfg
Differential Revision: https://reviews.freebsd.org/D30892
2021-07-06 10:51:16 +01:00
Pedro F. Giffuni dcc6f62526 login(1): when exporting variables check the result of setenv(3)
When exporting a variable we correctly check all the preconditions that
could make setenv(3) fail. Checking the setenv(3) return value seems
redundant, but given that login(1) is critical, it doesn't hurt to have
a post-check.

This change is based on the "Principles of Secure Coding" course by
Matthew Bishop, PhD., which specifically discusses this code in FreeBSD.

(This change redoes r368776 due to a silly mistake)
2020-12-19 03:07:38 +00:00
Pedro F. Giffuni a0bed90198 Revert r368776:
login(1): when exporting variables check the result of setenv(3)

mismatch: the return value upon error is -1, so the code was not
doing nothing.
2020-12-19 02:42:14 +00:00
Pedro F. Giffuni ebb4fcc7cf login(1): when exporting variables check the result of setenv(3)
When exporting a variable we correctly check all the preconditions that
could make setenv(3) fail. Checking the setenv(3) return value seems
redundant, but given that login(1) is critical, it doesn't hurt to have
a post-check.

This change is based on the "Principles of Secure Coding" course by
Matthew Bishop, PhD., which specifically discusses this code in FreeBSD.

Differential Revision:	https://reviews.freebsd.org/D26966
2020-12-19 02:23:53 +00:00
Baptiste Daroussin 09ef995baf Change the default locale to C.UTF-8
The C.UTF-8 locales is the same as the actual C locale except it does support
the unicode character set. But the collation etc are still the same as the C
locale one.

Reviewed by:	many
Approved by:	many
Differential Revision:	https://reviews.freebsd.org/D26973
2020-11-14 19:16:39 +00:00
Warner Losh 618cdd8964 Add more explicit instructions about updating motd
Not that you can regenerate the motd by editing motd.template and
running 'service motd restart' rather than rebooting.

Small wordsmithing by me, and updated the example from FreeBSD 2.1.6.1
release to 12.1 release.

Submitted by: Dan Mack
2020-10-19 01:16:39 +00:00
Maxim Sobolev a8b8edb25e Normalize deployment tools usage and definitions by putting into one place
instead of sprinkling them out over many disjoint files. This is a follow-up
to achieve the same goal in an incomplete rev.348521.

Approved by:	imp
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D20520
2020-04-07 02:46:22 +00:00
Kyle Evans 020419b665 login.conf(5): update commented-out standard, too
MAIL now has a mail capability, instead, as of r357560.
2020-02-09 22:35:49 +00:00
Kyle Evans ed6f64ff8a login.conf(5): set a default PATH for the daemon class
This is a sensible default used by, e.g., cron(8), and useful if one wanted
to honor it.

This is a part of D21481.

Submitted by:	Andrew Gierth <andrew_tao173.riddles.org.uk>
2020-02-05 04:27:08 +00:00
Kyle Evans acf2957e49 login.conf(5): split MAIL env var out into a "mail" capability
This allows it to be easily suppressed in, e.g., the "daemon" class where it
will not be properly expanded.

This is a part of D21481.

Submitted by:	Andrew Gierth <andrew_tao173.riddles.org.uk>
2020-02-05 04:17:14 +00:00
Simon J. Gerraty 2c9a9dfc18 Update Makefile.depend files
Update a bunch of Makefile.depend files as
a result of adding Makefile.depend.options files

Reviewed by:	 bdrewery
MFC after:	1 week
Sponsored by:   Juniper Networks
Differential Revision:  https://reviews.freebsd.org/D22494
2019-12-11 17:37:53 +00:00
Simon J. Gerraty 5ab1c5846f Add Makefile.depend.options
Leaf directories that have dependencies impacted
by options need a Makefile.depend.options file
to avoid churn in Makefile.depend

DIRDEPS for cases such as OPENSSL, TCP_WRAPPERS etc
can be set in local.dirdeps-options.mk
which can add to those set in Makefile.depend.options

See share/mk/dirdeps-options.mk

Reviewed by:	 bdrewery
MFC after:	1 week
Sponsored by:   Juniper Networks
Differential Revision:  https://reviews.freebsd.org/D22469
2019-12-11 17:37:37 +00:00
Conrad Meyer 2826da432c motd: Generate from template to /var/run
Update login(1), its manual pages, similar utilities, and motd.5 to refer to
the new location.

Suggested by:	delphij@ (re: r349256)
Reviewed by:	bcr (manpages), delphij
Differential Revision:	https://reviews.freebsd.org/D20721
2019-07-20 20:56:31 +00:00
Maxim Sobolev 5ec57af4b2 Fix several places where tool name has been hardcoded:
install -> ${INSTALL}
    mtree -> ${MTREE_CMD}
    services_mkdb -> ${SERVICES_MKDB_CMD}
    cap_mkdb -> ${CAP_MKDB_CMD}
    pwd_mkdb -> ${PWD_MKDB_CMD}
    kldxref -> ${KLDXREF_CMD}

If you do custom FreeBSD builds you may want to override those
in some cases.

Sponsored by:	Sippy Software, Inc.
2019-06-02 23:38:19 +00:00
Emmanuel Vadot d3bb120822 pkgbase: Really move login.access
Messed up with git->svn r348102
2019-05-22 07:41:58 +00:00
Emmanuel Vadot a8b94f3d79 pkgbase: Move login.access to usb.bin/login
Also remove the etc-examples target as we don't have any files
to handle here.

Reviewed by:	bapt
2019-05-22 07:23:03 +00:00
Brad Davis d3b764acc6 Move fbtab, login.conf, and motd to usr.bin/login/
Approved by:	Approved by: re (gjb), bapt (mentor), will (mentor)
Differential Revision:	https://reviews.freebsd.org/D16947
2018-08-30 15:52:03 +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
Pedro F. Giffuni 8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

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.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Pedro F. Giffuni df57947f08 spdx: initial adoption of licensing ID tags.
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.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.

Initially, only tag files that use BSD 4-Clause "Original" license.

RelNotes:	yes
Differential Revision:	https://reviews.freebsd.org/D13133
2017-11-18 14:26:50 +00:00
Bryan Drewery ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Warner Losh fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
Robert Watson f534f01f1a Clarify warning message when failing to configure audit on user login:
when au_user_mask() fails, it's not a failure to set the audit mask,
but to calculate the audit mask -- and hence a condfiguration-file
issue (of some sort).

MFC after:	3 days
Sponsored by:	DARPA, AFRL
2016-11-30 14:02:36 +00:00
Ed Maste d41042ad84 login: fix capitalization in errx messages
Reported by:	bde
2016-10-06 13:21:42 +00:00
Ed Maste b1ca2de9e9 login: clean up errx strings
errx() prefixes the error string with argv[0] so including "login: "
in the string is redundant. Also remove a superfluous newline.

Sponsored by:	The FreeBSD Foundation
2016-09-15 01:55:18 +00:00
Marcelo Araujo 6a3f9a213a Use NULL instead of 0.
strtok(3) will return NULL when no more tokens remain.

MFC after:	2 weeks.
2016-04-18 05:26:32 +00:00
Xin LI 60b0aa6a8f login.c doesn't really need libutil.h, don't include it.
login_fbtab.c includes paths.h and pathnames.h, and pathnames.h includes
paths.h.  Eliminate the paths.h inclusion in login_fbtab.c.

MFC after:	2 weeks
2015-09-10 22:25:40 +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 3e11bd9e2a Convert to usr.bin/ to LIBADD
Reduce overlinking
2014-11-25 14:29:10 +00:00
Simon J. Gerraty 9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Neel Natu 06224a9492 Remove LOG_ODELAY because it does nothing.
Reviewed by:	jilles
CR:		https://reviews.freebsd.org/D611
2014-08-17 19:06:26 +00:00
Simon J. Gerraty fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00