| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
These sys/cdefs.h are not needed. Purge them. They are mostly left-over
from the $FreeBSD$ removal. A few in libc are still required for macros
that cdefs.h defines. Keep those.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D42385
|
|
|
|
| |
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
|
|
|
|
|
| |
Reported by: Daniel Braniss <danny@cs.huji.ac.il>
MFC after: 1 week
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The getpwent(3) and getgrent(3) implementations maintain some internal
iterator state. Interleaved calls to functions which do passwd/group
lookups using a key, such as getpwnam(3), would in some cases clobber
this state, causing a subsequent getpwent() or getgrent() call to
restart iteration from the beginning of the database or to terminate
early. This is particularly troublesome in programming environments
where execution of green threads is interleaved within a single OS
thread.
Take care to restore any iterator state following a keyed lookup. The
"files" provider for the passwd database was already handling this
correctly, but "compat" was not, and both providers had this problem
when accessing the group database.
PR: 252094
Submitted by: Viktor Dukhovni <ietf-dane@dukhovni.org>
MFC after: 1 month
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sometimes nscd(8) will return a 1-byte buffer for a nonexistent entry. This
triggered an integer underflow in grp_unmarshal_func, causing getgrnam_r to
return ERANGE instead of 0.
Fix the user's buffer size check, and add a correct check for a too-small
nscd buffer.
PR: 248932
Event: September 2020 Bugathon
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D26204
Notes:
svn path=/head/; revision=365910
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This pattern is used in callbacks with void * data arguments and seems
both relatively uncommon and relatively harmless. Silence the warning
by casting through uintptr_t.
This warning is on by default in Clang 11.
Reviewed by: arichardson
Obtained from: CheriBSD (partial)
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24425
Notes:
svn path=/head/; revision=359978
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
data from /etc/passwd rather than /etc/master.passwd.
The libc getpwent(3) and related functions automatically read master.passwd
when run by root, or passwd when run by a non-root user. When run by non-
root, getpwent() copes with the missing data by setting the corresponding
fields in the passwd struct to known values (zeroes for numbers, or a
pointer to an empty string for literals). When libutil's pw_scan(3) was
used to parse a line without the root-accessible data, it was leaving
garbage in the corresponding fields.
These changes rename the static pw_init() function used by getpwent() and
friends to __pw_initpwd(), and move it into pw_scan.c so that common init
code can be shared between libc and libutil. pw_scan(3) now calls
__pw_initpwd() before __pw_scan(), just like the getpwent() family does, so
that reading an arbitrary passwd file in either format and parsing it with
pw_scan(3) returns the same results as getpwent(3) would.
This also adds a new pw_initpwd(3) function to libutil, so that code which
creates passwd structs from scratch in some manner that doesn't involve
pw_scan() can initialize the struct to the values expected by lots of
existing code, which doesn't expect to encounter NULL pointers or garbage
values in some fields.
Notes:
svn path=/head/; revision=336746
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using mis-identified 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.
Notes:
svn path=/head/; revision=326193
|
|
|
|
|
|
|
|
|
|
|
| |
We have an nitems() macro in the <sys/param.h> header that is
convenient to re-use as it makes things easier to read.
Given that it is available already without adding additional
headers and other parts of libc already use it, extend a bit
more its use.
Notes:
svn path=/head/; revision=298120
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
MK_NIS == no by converting `i` back to an int, and instead cast the loop
comparison to `int`
The loop comparison is iterating the len(ns_dtab)-1, because
the last element is the sentinel tuple { NULL, NULL, NULL, }, so when
both HESOID and NIS are off, len(ns_dtab)-1 == 1 - 1 == 0, and the loop
is skipped because the expression is tautologically false
While here, convert `(sizeof(x) / sizeof(x[0]))` to `nitems(x)`
Tested with: clang 3.7.0, gcc 4.2.1, and gcc 4.9.4 [*] with MK_NIS={no,yes}
and by running bash -lc 'id -u && id -g && id'
* gcc 4.9.4 needs another patch in order for the compile to succeed
with -Werror with lib/libc/gen/getgrent.c
Reported by: jhibbits
Notes:
svn path=/head/; revision=289925
|
|
|
|
|
|
|
| |
Eliminates gcc 4.9 warnings.
Notes:
svn path=/head/; revision=287797
|
|
|
|
|
|
|
| |
CID: 1018731
Notes:
svn path=/head/; revision=279712
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These only occur upon error.
Code Review: https://reviews.freebsd.org/D1849
Reviewed by: delphij
CID: 1016715
CID: 1016717
Notes:
svn path=/head/; revision=279035
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As a followup to r278363, there is one more case where
stayopen can be accessed uninitialized, but even after
swapping arguments, access is possible in some other
cases so prevent it completely by initializing stayopen.
CID: 1018729
CID: 1018732
Notes:
svn path=/head/; revision=278804
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In a couple of cases a variable "stayopen" can be checked
unitialized. This is of no danger as the complementary
condition is false but prevent the access by switching
the checks.
CID: 1018729
CID: 1018732
Notes:
svn path=/head/; revision=278363
|
|
|
|
|
|
|
|
|
|
|
| |
databases.
- Make nsswitch support caching.
Submitted by: Michael Bushkov <bushman__at__rsu.ru>
Sponsored by: Google Summer of Code 2005
Notes:
svn path=/head/; revision=158115
|
|
|
|
|
|
|
|
|
|
|
| |
Correct my previous commit and add a comment to the manpage
indicating that the user must set errno to 0 if they wish to
distinguish "no such user" from "error".
Pointed out by: Jacques Vidrine (nectar@)
Notes:
svn path=/head/; revision=129349
|
|
|
|
| |
Notes:
svn path=/head/; revision=129319
|
|
|
|
|
|
|
|
|
|
| |
adjunct maps are used. One symtom of this bug is sshd saying:
login_get_lastlog: Cannot find account for uid X
when logging in. The problem here is caused by an incorrect reuse of the rv
variable when previous values are needed later.
Notes:
svn path=/head/; revision=128537
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
that this provokes. "Wherever possible" means "In the kernel OR NOT
C++" (implying C).
There are places where (void *) pointers are not valid, such as for
function pointers, but in the special case of (void *)0, agreement
settles on it being OK.
Most of the fixes were NULL where an integer zero was needed; many
of the fixes were NULL where ascii <nul> ('\0') was needed, and a
few were just "other".
Tested on: i386 sparc64
Notes:
svn path=/head/; revision=126643
|
|
|
|
| |
Notes:
svn path=/head/; revision=124432
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
getpwent(3) or getpwuid(3) when using NIS adjunct maps. The bug was
present in the internal `nis_passwd' function. The lookup in the
adjunct map used the name passed into `nis_passwd', however no name
was of course supplied by getpwent or getpwuid. Correctly use the
name from the `struct pwd' that was found instead.
PR: bin/59962
Submitted by: Gabriel Gomez <ggomez@fing.edu.uy>
Notes:
svn path=/head/; revision=124431
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
don't probe the server at all for passwd.by* maps. This fixes
interoperability with the Services For UNIX NIS server (which is
really a front end to Captive^WActiveDirectory). This server
incorrectly returns success for all YPPROC_MASTER requests,
even for maps that don't exist, which makes it impossible to
(ab)use it to probe for the existence of the master.passwd.by*
maps.
This is a little kludgey, but basically restores the original
behavior of getpwent.c as it is in -stable, and works around both
the lack of YPPROC_ORDER on NIS+ servers as well as the broken
YPPROC_MASTER on Services For UNIX servers.
Notes:
svn path=/head/; revision=117750
|
|
|
|
|
|
|
|
| |
PR: bin/52792
Submitted by: TOMITA Yoshinori <yoshint@flab.fujitsu.co.jp>
Notes:
svn path=/head/; revision=116901
|
|
|
|
|
|
|
| |
vocally objected to this safety belt.
Notes:
svn path=/head/; revision=114443
|
|
|
|
|
|
|
|
|
|
| |
technique) so that we don't wind up calling into an application's
version if the application defines them.
Inspired by: qpopper's interfering and buggy version of strlcpy
Notes:
svn path=/head/; revision=114256
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
setgrent, and endgrent also. (The previous NSS implementation used to
simply twiddle the internal data of the various modules directly.)
A symptom (group list set incorrectly in sshd) was
Reported by: Glenn Johnson <gjohnson@srrc.ars.usda.gov>
Sponsored by: DARPA, Network Associates Laboratories
Notes:
svn path=/head/; revision=114021
|
|
|
|
|
|
|
|
|
|
|
| |
idea to re-initialize `struct passwd', because e.g. pw_class might
get set by one module, but not by another. Add another call to the
internal pwd_init function to accomplish this.
Sponsored by: DARPA, Network Associates Laboratories
Notes:
svn path=/head/; revision=113992
|
|
|
|
|
|
|
|
|
|
|
| |
privileges. To do so may cause the NIS server to log spurious and
annoying `access denied' messages.
Reported by: Philip Paeps <philip@paeps.cx>
Sponsored by: DARPA, Network Associates Laboratories
Notes:
svn path=/head/; revision=113794
|
|
|
|
|
|
|
|
|
|
| |
string was an incredibly dumb idea (of course it will be changed by an
NSS module on success!). Use a static empty string instead.
Sponsored by: DARPA, Network Associates Laboratories
Notes:
svn path=/head/; revision=113694
|
|
|
|
|
|
|
|
|
|
| |
but user is found in local file.
Reported by: Shizuka Kudo <shizukakudo_99@yahoo.com>
Sponsored by: DARPA, Network Associates Laboratories
Notes:
svn path=/head/; revision=113691
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
may not fill in all fields, and in the case of string fields, this could
cause trouble for applications. (The only likely example is `pw_class',
because this field is not used by all modules in all cases.)
Move initialization of struct passwd from module-specific code to the
dispatch code.
The problem of a NULL pw_class was
Noticed by: Philip Paeps <philip@paeps.cx>
and the c^Htrusty ssh(1) command.
Déjà vu by: getpwent.c revision 1.56
Sponsored by: DARPA, Network Associates Laboratories
Notes:
svn path=/head/; revision=113672
|
|
|
|
|
|
|
|
|
|
| |
(_PWF_NIS and _PWF_HESIOD were already being set.)
Reported by: Shizuka Kudo <shizukakudo_99@yahoo.com>
Sponsored by: DARPA, Network Associates Laboratories
Notes:
svn path=/head/; revision=113670
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
at least one consumer outside of libc and pwd_mkdb.
Adjust the versioning in libc and pwd_mkdb accordingly.
named was the application affected, and that fact was first
Reported by: Zherdev Anatoly <tolyar@mx.ru>
Sponsored by: DARPA, Network Associates Laboratories
Notes:
svn path=/head/; revision=113666
|
|
|
|
|
|
|
|
|
|
| |
hated `compat' source, not `files'.
Reported by: Philip Paeps <philip@paeps.cx>
Sponsored by: DARPA, Network Associates Laboratories
Notes:
svn path=/head/; revision=113643
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
family of functions using the new nsdispatch(3) core. Remove
arbitrary size limits when using the thread-safe versions.
= Re-implement the traditional getpwent(3)/getgrent(3) functions on
top of the thread-safe versions.
= Update the on-disk format of the hashed version of the passwd(5)
databases to allow for versioned entries. The legacy version is
`3'. (Don't ask.)
= Add support for version `4' entries in the passwd(5) database.
Entries in this format are identical to version 3 entries except
that all integers are stored as 32-bit integers in network byte
order (big endian).
= pwd_mkdb is updated to generate both version 3 and version 4
entries.
Sponsored by: DARPA, Network Associates Laboratories
Notes:
svn path=/head/; revision=113596
|
|
|
|
|
|
|
| |
`implicit declaration of function' variety.
Notes:
svn path=/head/; revision=111618
|
|
|
|
|
|
|
|
|
|
| |
Only warnings that could be fixed without changing the generated object
code and without restructuring the source code have been handled.
Reviewed by: /sbin/md5
Notes:
svn path=/head/; revision=111010
|
|
|
|
|
|
|
|
|
| |
their passwd file for NIS because _PWF_SOURCE is not set.
Submitted by: amigus (perforce change 10969)
Notes:
svn path=/head/; revision=96186
|
|
|
|
|
|
|
| |
Sponsored by: DARPA, NAI Labs
Notes:
svn path=/head/; revision=94700
|
|
|
|
|
|
|
|
|
| |
the source of the data contained in the structure.
Sponsored by: DARPA, NAI Labs
Notes:
svn path=/head/; revision=94688
|
|
|
|
|
|
|
|
| |
* Remove 'register'. (some functions had 7+ register functions...)
* Fix SCM ID's.
Notes:
svn path=/head/; revision=90045
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
commit.
Fixed related style bugs:
basename.c: misplaced '#if 0'
dirname.c: misplaced '#if 0'
getgrent.c: missing '#if 0', and tab lossage in vendor id (the previous
commit fixed the complete corruption of the vendor id but
lost a tab)
getpwent.c: missing '#if 0'
Notes:
svn path=/head/; revision=90016
|
|
|
|
| |
Notes:
svn path=/head/; revision=89999
|
|
|
|
|
|
|
|
|
| |
since that is what we use now and this insulates us from any time_t
tweaks here. We can define a record format that uses 64 bit times if/when
we need to.
Notes:
svn path=/head/; revision=85572
|
|
|
|
|
|
|
|
|
|
|
| |
the buffer then act like it doesn't exist. The buffer is always big enough
for any valid username.
PR: 27860
Reviewed by: nectar
Notes:
svn path=/head/; revision=78418
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
adding (weak definitions to) stubs for some of the pthread
functions. If the threads library is linked in, the real
pthread functions will pulled in.
Use the following convention for system calls wrapped by the
threads library:
__sys_foo - actual system call
_foo - weak definition to __sys_foo
foo - weak definition to __sys_foo
Change all libc uses of system calls wrapped by the threads
library from foo to _foo. In order to define the prototypes
for _foo(), we introduce namespace.h and un-namespace.h
(suggested by bde). All files that need to reference these
system calls, should include namespace.h before any standard
includes, then include un-namespace.h after the standard
includes and before any local includes. <db.h> is an exception
and shouldn't be included in between namespace.h and
un-namespace.h namespace.h will define foo to _foo, and
un-namespace.h will undefine foo.
Try to eliminate some of the recursive calls to MT-safe
functions in libc/stdio in preparation for adding a mutex
to FILE. We have recursive mutexes, but would like to avoid
using them if possible.
Remove uneeded includes of <errno.h> from a few files.
Add $FreeBSD$ to a few files in order to pass commitprep.
Approved by: -arch
Notes:
svn path=/head/; revision=71579
|
|
|
|
|
|
|
|
|
| |
had uid, gid set to 0 if not otherwise specified!
Submitted by: eivind
Notes:
svn path=/head/; revision=68691
|