summaryrefslogtreecommitdiff
path: root/lib/libutil
AgeCommit message (Collapse)Author
12 dayslogin.conf.5: Remove mention of login copyright settingSimon Wollwage
PR: 291649 Fixes: 905571c03119 ("Remove copyright strings printed at login time via login(1) or sshd(8).") Signed-off-by: Simon Wollwage rootnode+freebsd@wollwage.com Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1926
2025-10-28libutil: defer setting the MAC label until after the login classKyle Evans
MAC policies, like mac_biba(4), may forbid changing the login class once a label has been applied. For setting up the initial login context, this isn't really expected and in-fact may break some class-based configuration. Defer setting the MAC label until after the login class is set, and remove the requirement that we have a pwd entry since the label is pulled from the login class -- we only use pwd for syslog in this path. Patch is largely by Kevin Barry, with some modifications and this commit message by kevans@. PR: 177698 Reviewed by: des, olce MFC after: 3 days Co-authored-by: Kevin Barry <ta0kira gmail com> Differential Revision: https://reviews.freebsd.org/D53362
2025-10-26packages: Install development manpages in the -dev packageLexi Winter
Add a new per-group SUBPACKAGE option to bsd.man.mk. When MANSPLITPKG is enabled, this is forced to "-man", otherwise it defaults to empty but can be overridden by the caller. Use this in bsd.lib.mk to install library manpages in the -dev package instead of the base package. This is nearly always preferable, since library manpages are usually in section 2 or 3 and are only relevant to people with development packages installed. For manpages which should be installed in the base package even for libraries, add a new MANNODEV group in bsd.lib.mk. Update existing Makefiles to use this where appropriate. MFC after: 3 days Discussed with: olce Reviewed by: olce Sponsored by: https://www.patreon.com/bsdivy Differential Revision: https://reviews.freebsd.org/D52832
2025-10-22Fix getmntpoint(3) to operate as it is documented in its manual page.Kirk McKusick
The -libutil function getmntpoint(3) is documented as accepting a device name “with or without /dev/ prepended to it” but did not attempt to prepend /dev/. This patch corrects the problem by prepending /dev/ to names that do not begin with a '/'. Reported-by: Dag-Erling Smørgrav Differential Revision: https://reviews.freebsd.org/D53185 MFC-after: 1 week Sponsored-by: Netflix
2025-09-29Remove ftpd(8)Lexi Winter
This was previously deprecated and is slated for removal in 15.0. Users who still need ftpd(8) can install the ftp/freebsd-ftpd port. Retain the ftp(d) PAM services since other FTP daemons use them. Update /etc/inetd.conf to point to /usr/local. Add ftpd to ObsoleteFiles, but do not list configuration files since users may want to preserve these to use with the freebsd-ftpd port. There is still some language in the manual referring to ftpd(8) which is relevant to the port, which has been retained but updated to reference the port. MFC after: 3 days Relnotes: yes Reviewed by: cperciva Differential Revision: https://reviews.freebsd.org/D52739
2025-08-17getmntpoint: Don't compare st_rdev for non-devicesDag-Erling Smørgrav
If the mntfromname of a mountpoint is not a device (e.g. nullfs, tarfs, procfs) we shouldn't compare st_rdev, as any match will be spurious. MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D51945
2025-08-12libutil: Fix manlint failuresDag-Erling Smørgrav
MFC after: 1 week Reviewed by: ziaee Differential Revision: https://reviews.freebsd.org/D51864
2025-08-12libutil: Remove manual link for nonexistent functionDag-Erling Smørgrav
I believe quota_statfs() was the original name of the function now called quota_check_path(). I must have forgotten to update the MLINK when I renamed it. MFC after: 1 week Fixes: 5666aadb3ddf ("Further extend the quotafile API.") Fixes: 22afc767869a ("libutil: Add missing MLINKs") Reviewed by: bcr Differential Revision: https://reviews.freebsd.org/D51863
2025-08-07libutil: Fix 32-bit buildDag-Erling Smørgrav
In the expand_generic test case for expand_number(), leave out size_t if it's not 64 bits wide. Fixes: ab1c6874e500
2025-08-06libutil: Fix login_setcryptfmt()Dag-Erling Smørgrav
Our dummy crypt_set_format() needs to be exported, otherwise it will be resolved at link time instead of load time, preventing the real crypt_set_format() in libcrypt from replacing it when present. PR: 288677 Fixes: 0c381b7f0570 Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D51746
2025-08-06libutil: Backward compatibility for expand_number()Dag-Erling Smørgrav
Reimplement expand_number() in terms of expand_unsigned(), which takes a pointer to uint64_t like expand_number() did before. Provide a macro that picks the correct version based on the type of the argument. Fixes: 2e0caa7c7e14 Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D51723
2025-08-03libutil: Add missing MLINKsDag-Erling Smørgrav
MFC after: 1 week Reviewed by: olce, imp, emaste Differential Revision: https://reviews.freebsd.org/D51706
2025-08-03libutil: Document pidfile_signal()Dag-Erling Smørgrav
Fixes: 287451fd0192 MFC after: 1 week Reviewed by: pauamma_gundo.com, emaste Differential Revision: https://reviews.freebsd.org/D51705
2025-08-02libutil: Drop auth_getval()Dag-Erling Smørgrav
This function has been an empty stub for years; now that we're bumping the library version, we can finally get rid of it. Fixes: 0c381b7f0570 Reviewed by: kib, emaste Differential Revision: https://reviews.freebsd.org/D51704
2025-08-02libutil: Better tests for expand_number(3)Dag-Erling Smørgrav
Replace the current tests with jhb's earlier, more extensive proposal, updated to take into account the switch back to signed integers. Reviewed by: pstef Differential Revision: https://reviews.freebsd.org/D20796
2025-08-02libutil: Really fix expand_number(3)Dag-Erling Smørgrav
It is unclear whether this function was originally intended to support negative numbers. The original implementation used signed integers, but actually giving it a negative number as input would have invoked undefined behavior, and the comments (since removed) only mentioned positive numbers. Fifteen years ago, I “fixed” this by changing the type from signed to unsigned. However, it would still have accepted an input with a leading minus sign (though it would have returned its absolute value). Fifteen years on, change the type back to signed and fix the logic so it correctly handles both positive and negative numbers without invoking undefined behavior. This makes it a better match for humanize_number(3), which it is supposed to complement. Fixes: bbb2703b4f46 Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D51542
2025-08-02libutil: Add symbol versioningDag-Erling Smørgrav
Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D51694
2025-07-27libutil: Move cpuset(1) domain policy parsing code into libutilBojan Novković
cpuset(1) implements a domainset(9) policy parser that is used to translate a <policy>:<domain_list> string into a domainset_t mask and a valid domainset policy. This change moves the domainset parsing code into a new cpuset.c function - 'domainset_parselist'. The existing cpuset.c code was refactored into a generalized list parsing function which is now used to parse both CPU sets and domain sets. This is the same approach used in cpuset(1). Reviewed by: markj, ziaee (manpages) Differential Revision: https://reviews.freebsd.org/D46607
2025-04-22Search for mntopts.h globally, not locallyBrooks Davis
Change the include directives to use <mntopts.h> instead of "mntopts.h" now that it's installed by libutil (the latter option was dubious regardless since a -I${SRCTOP}/sbin/mount was required anyway). Reviewed by: olce, imp, dim, emaste Differential Revision: https://reviews.freebsd.org/D49952
2025-04-22Move mntopts(3) suppport into libutilBrooks Davis
Many programs use this functionality so it should be available centrally rather than compiled into each program independently. This has the modest downside of adding libutil dependencies to some mount_<foo> programs, but many (plus mount(8)) already have those depndencies so this shouldn't be a major imposition. In commit 906c312bbf74, Kirk said this could be done once the change was merged to FreeBSD 13. That happened in commit 668dfa016698 in 2023. While here perform related tidying including removing SRCS where the only entry is ${PROG}.c rendering it unnecessary. Reviewed by: olce, dim, emaste Differential Revision: https://reviews.freebsd.org/D49951
2025-04-11kinfo_getfile: Add a comment explaining 4/3 ratioEd Maste
We first get the expected size of the data from the kern.proc.filedesc sysctl, allocate 4/3 of that size, and then fetch the data. Add a comment about the reason (the fd table may grow between the two calls). Sponsored by: The FreeBSD Foundation
2024-12-11login.conf.5: remove a stray quoteMaxim Konovalov
PR: 282858
2024-11-21hexdump.3: Add missing LIBRARY sectionDavid Gilbert
All the other libutil section 3 manpages document this, and although it's heavily implied by the libutil.h header in the synopsis, we should still be explicit and consistent. PR: 280078 Reviewed by: jrtc27 MFC after: 1 week
2024-10-18ftime.3: fix typo in spelling of libutilKeith White
PR: 282171 MFC after: 3 days
2024-09-20libutil: support RLIMIT_PIPEBUFKonstantin Belousov
Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D46619
2024-07-15Remove residual blank line at start of MakefileWarner Losh
This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
2024-07-13include: ssp: round out fortification of current set of headersKyle Evans
ssp/ssp.h needed some improvements: - `len` isn't always a size_t, it may need casted - In some cases we may want to use a len that isn't specified as a parameter (e.g., L_ctermid), so __ssp_redirect() should be more flexible. - In other cases we may want additional checking, so pull all of the declaration bits out of __ssp_redirect_raw() so that some functions can implement the body themselves. strlcat/strlcpy should be the last of the fortified functions that get their own __*_chk symbols, and these cases are only done to be consistent with the rest of the str*() set. Reviewed by: markj Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D45679
2024-06-15fparseln: Update licensePedro F. Giffuni
Remove 3rd and 4th clauses in christos' license. OK christos. Obtained from: NetBSD
2024-06-15Revert "fparseln: Update NetBSD version strings"Pedro F. Giffuni
This reverts commit 1a968da448b0795184884ffe428fb24d7e695628. I was mistakenly looking at the version strings in the CVS attic but the function was moved to libc/stdio where it matches the current string.
2024-06-15fparseln: Update NetBSD version stringsPedro F. Giffuni
The correponding changes (mostly ANSIfication) were done long ago locally. No functional change. Obtained from: NetBSD (libutil CVS Attic)
2024-05-29libutil: move ftime to libutilMariusz Zaborski
It seems that there are still some applications that use ftime(3) (for example, science/siconos and sysutils/lcdproc). The issue is that we don't build libcompat as a shared library anymore. The easiest solution is to move it to libutil, until we deprecate it for good. This solution was proposed by kib@ in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257789. PR: 257789 MFC after: 1 month Reviewed by: kib (ages ago) Differential Revision: https://reviews.freebsd.org/D39994
2024-01-29login_cap.h: Remove LOGIN_DEFPRIOlivier Certner
This is an implementation detail which is likely to become irrelevant in the future, as we move to not resetting the priority if the corresponding capability is not present in the configuration file ('/etc/login.conf'). GitHub's code search and Google show no use of this public constant, and it doesn't exist in OpenBSD and NetBSD. So, remove this definition and its sole use in-tree. PR: 276570 (exp-run) Reviewed by: emaste Approved by: emaste (mentor) MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D43609
2024-01-29login_cap.h: Remove LOGIN_DEFUMASKOlivier Certner
This public constant has not been used in-tree since 1997 (this was noticed while working on previous commit "setusercontext(): umask: Set it only once (in the common case)"). Since it was an implementation detail and GitHub's code search and Google show no use of this symbol today, simply remove it. PR: 276570 (exp-run) Reviewed by: emaste, kib (earlier version, then part of D40344) Approved by: emaste (mentor) MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D43608
2024-01-29setusercontext(): Set priority from '~/.login_conf' as wellOlivier Certner
Setting the process priority is done only when the current process' effective UID corresponds to that for which context is to be set. Consequently, setting priority is done with appropriate credentials and will fail if the target user tries to raise it unduly via his '~/.login_conf'. PR: 271751 Reviewed by: kib, Andrew Gierth <andrew_tao173.riddles.org.uk> Approved by: emaste (mentor) MFC after: 3 days Relnotes: yes Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40352
2024-01-29login.conf(5): Document priority's special value 'inherit'Olivier Certner
Reviewed by: emaste, yuripv (older version) Approved by: emaste (mentor) MFC after: 3 days Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40691
2024-01-29setclasspriority(): New possible value 'inherit'Olivier Certner
It indicates to the login.conf machinery (setusercontext() / setclasscontext()) to leave priority alone, effectively inheriting it from the parent process. PR: 271749 Reviewed by: emaste, yuripv Approved by: emaste (mentor) MFC after: 3 days Relnotes: yes Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40690
2024-01-29setusercontext(): Move priority setting in new setclasspriority()Olivier Certner
In preparation for setting priorities from '~/.login_conf' and to ease reading of setusercontext(). No functional change. Reviewed by: emaste Approved by: emaste (mentor) MFC after: 3 days Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40350
2024-01-29login.conf(5): Document priority's default and possible valuesOlivier Certner
Priority is reset to 0 if not explicitly specified. While here, be more explicit about what "Initial priority (nice) level" means and document that it is possible to set real-time or idle class' priorities with this capability. Reviewed by: emaste Approved by: emaste (mentor) MFC after: 3 days Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40689
2024-01-29setusercontext(): Better error messages when priority is not set correctlyOlivier Certner
Polish the syslog messages to contain readily useful information. Behavior of capability 'priority' is inconsistent with what is done for all other contexts: 'umask', 'cpumask', resource limits, etc., where an absence of capability means to inherit the value. It is currently preserved for compatibility, but is subject to change on a future major release. Reviewed by: emaste, kib (older version) Approved by: emaste (mentor) MFC after: 3 days Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40349
2024-01-29login.conf(5): Default values: Rename column, elaborate on absence of suchOlivier Certner
Column "Notes" in fact only contains default values for capabilities, so make this clear by renaming it to "Default". Add a small introductory text mentioning it, and what an absence of default value means (inheritance). PR: 271748 Reviewed by: emaste Approved by: emaste (mentor) MFC after: 3 days Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40347
2024-01-29setlogincontext(): Comply to style(9)Olivier Certner
Remove indentation by inverting the big 'if (lc)' and using 'return'. Use explicit binary operators to produce booleans. Reviewed by: emaste, kib, dchagin Approved by: emaste (mentor) MFC after: 3 days Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40346
2024-01-29login.conf(5): Document umask's special value 'inherit'Olivier Certner
Reviewed by: emaste Approved by: emaste (mentor) MFC after: 3 days Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40688
2024-01-29setclassumask(): Accept 'inherit' as a valueOlivier Certner
'inherit' explicitly indicates that the umask should not be changed. Reviewed by: emaste Approved by: emaste (mentor) MFC after: 3 days Relnotes: yes Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40687
2024-01-29setusercontext(): Set umask in a separate function, setclassumask()Olivier Certner
Reviewed by: emaste Approved by: emaste (mentor) MFC after: 3 days Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40686
2024-01-29login_cap(3): Document login_getcapenum()Olivier Certner
Reviewed by: emaste Approved by: emaste (mentor) MFC after: 3 days Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40685
2024-01-29New login_getcapenum(): Allows to read named enum valuesOlivier Certner
Reviewed by: emaste Approved by: emaste (mentor) MFC after: 3 days Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40684
2024-01-29login.conf(5): umask has no default valueOlivier Certner
The umask is simply left unchanged if no explicit value is specified in the login class capabilities database. PR: 271747 Reviewed by: emaste Approved by: emaste (mentor) MFC after: 3 days Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40345
2024-01-29setusercontext(): umask: Set it only once (in the common case)Olivier Certner
Simplify the code and make it more coherent (umask was the only context setting not modified by setlogincontext() directly). Preserve the current behavior of not changing the umask if none is specified in the login class capabilities database, but without the superfluous umask() dance. (The only exception to this is that a special value no user is likely to input in the database now stands for no specification.) If some user has a 'umask' override in its '~/.login_conf', the umask will still be set twice as before (as is the case for all other context settings overriden in '~/.login_conf'). Log a warning in case of an invalid umask specification. This change makes it apparent that the value of LOGIN_DEFUMASK doesn't matter. It will be removed in a subsequent commit. PR: 271747 Reviewed by: emaste, kib (earlier version) Approved by: emaste MFC after: 3 days Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40344
2023-11-26lib: Automated cleanup of cdefs and other formattingWarner Losh
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-26lib: Remove ancient SCCS tags.Warner Losh
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