about summary refs log tree commit diff
path: root/nss/Makefile
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright dates with scripts/update-copyrightsPaul Eggert2024-01-011-1/+1
|
* Move getnameinfo from 'inet' to 'nss'Arjun Shankar2023-10-241-0/+1
| | | | | | | getnameinfo is an entry points for nss functionality. This commit moves it from the 'inet' subdirectory to 'nss'. The corresponding Versions entry is also moved from 'posix' into 'nss'. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Move getaddrinfo from 'posix' into 'nss'Arjun Shankar2023-10-241-2/+17
| | | | | | | getaddrinfo is an entry point for nss functionality. This commit moves it from 'sysdeps/posix' to 'nss', gets rid of the stub in 'posix', and moves all associated tests as well. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Move 'services' routines from 'inet' into 'nss'Arjun Shankar2023-10-241-0/+15
| | | | | | | The getservby* and getservent* routines are entry points for nss functionality. This commit moves them from the 'inet' subdirectory to 'nss'. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Move 'rpc' routines from 'inet' into 'nss'Arjun Shankar2023-10-241-0/+16
| | | | | | | | The getrpcby* and getrpcent* routines are entry points for nss functionality. This commit moves them from the 'inet' subdirectory to 'nss'. The Versions entries for these routines along with a test, located in the 'sunrpc' subdirectory, are also moved into 'nss'. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Move 'protocols' routines from 'inet' into 'nss'Arjun Shankar2023-10-241-0/+15
| | | | | | | The getprotoby* and getprotoent* routines are entry points for nss functionality. This commit moves them from the 'inet' subdirectory to 'nss'. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Move 'networks' routines from 'inet' into 'nss'Arjun Shankar2023-10-241-0/+19
| | | | | | | The getnetby* and getnetent* routines are entry points for nss functionality. This commit moves them from the 'inet' subdirectory to 'nss'. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Move 'netgroup' routines from 'inet' into 'nss'Arjun Shankar2023-10-241-0/+11
| | | | | | | These netgroup routines are entry points for nss functionality. This commit moves them along with netgroup.h from the 'inet' subdirectory to 'nss', and adjusts any references accordingly. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Move 'hosts' routines from 'inet' into 'nss'Arjun Shankar2023-10-241-0/+24
| | | | | | | The gethostby* and gethostent* routines are entry points for nss functionality. This commit moves them from the 'inet' subdirectory to 'nss'. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Move 'ethers' routines from 'inet' into 'nss'Arjun Shankar2023-10-241-0/+6
| | | | | | | ether_hostton and ether_ntohost are entry points for nss functionality. This commit moves them from the 'inet' subdirectory to 'nss', and adjusts any references accordingly. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Move 'aliases' routines from 'inet' into 'nss'Arjun Shankar2023-10-241-0/+14
| | | | | | | The aliases routines are entry points for nss functionality. This commit moves aliases.h and the aliases routines from the 'inet' subdirectory to 'nss', and adjusts any external references. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Remove 'shadow' and merge into 'nss'Arjun Shankar2023-10-241-0/+27
| | | | | | | | The majority of shadow routines are entry points for nss functionality. This commit removes the 'shadow' subdirectory and moves all functionality and tests to 'nss'. References to shadow/ are accordingly changed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Remove 'pwd' and merge into 'nss'Arjun Shankar2023-10-241-0/+24
| | | | | | | The majority of pwd routines are entry points for nss functionality. This commit removes the 'pwd' subdirectory and moves all functionality and tests to 'nss'. References to pwd/ are accordingly changed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Remove 'gshadow' and merge into 'nss'Arjun Shankar2023-10-241-0/+28
| | | | | | | | The majority of gshadow routines are entry points for nss functionality. This commit removes the 'gshadow' subdirectory and moves all functionality and tests to 'nss'. References to gshadow/ are accordingly changed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Remove 'grp' and merge into 'nss' and 'posix'Arjun Shankar2023-10-241-1/+42
| | | | | | | | | | | | | | The majority of grp routines are entry points for nss functionality. This commit removes the 'grp' subdirectory and moves all nss-relevant functionality and all tests to 'nss', and the 'setgroups' stub into 'posix' (alongside the 'getgroups' stub). References to grp/ are accordingly changed. In addition, compat-initgroups.c, a fallback implementation of initgroups is renamed to initgroups-fallback.c so that the build system does not confuse it for nss_compat/compat-initgroups.c. Build time improves very slightly; e.g. down from an average of 45.5s to 44.5s on an 8-thread mobile x86_64 CPU. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nss: Rearrange and sort Makefile variablesArjun Shankar2023-10-041-14/+41
| | | | | | Rearrange lists of routines, tests, etc. into one-per-line in nss/Makefile and sort them using scripts/sort-makefile-lines.py. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* Fix leak in getaddrinfo introduced by the fix for CVE-2023-4806 [BZ #30843]Romain Geissler2023-09-251-0/+20
| | | | | | This patch fixes a very recently added leak in getaddrinfo. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* getaddrinfo: Fix use after free in getcanonname (CVE-2023-4806)Siddhesh Poyarekar2023-09-151-2/+13
| | | | | | | | | | | | | | | | | | | | | | | When an NSS plugin only implements the _gethostbyname2_r and _getcanonname_r callbacks, getaddrinfo could use memory that was freed during tmpbuf resizing, through h_name in a previous query response. The backing store for res->at->name when doing a query with gethostbyname3_r or gethostbyname2_r is tmpbuf, which is reallocated in gethosts during the query. For AF_INET6 lookup with AI_ALL | AI_V4MAPPED, gethosts gets called twice, once for a v6 lookup and second for a v4 lookup. In this case, if the first call reallocates tmpbuf enough number of times, resulting in a malloc, th->h_name (that res->at->name refers to) ends up on a heap allocated storage in tmpbuf. Now if the second call to gethosts also causes the plugin callback to return NSS_STATUS_TRYAGAIN, tmpbuf will get freed, resulting in a UAF reference in res->at->name. This then gets dereferenced in the getcanonname_r plugin call, resulting in the use after free. Fix this by copying h_name over and freeing it at the end. This resolves BZ #30843, which is assigned CVE-2023-4806. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* Restore lookup of IPv4 mapped addresses in files database (bug 25457)Andreas Schwab2023-07-241-0/+1
| | | | | This was broken by commit 9c02d0784d ("nss_files: Remove RES_USE_INET6 from hosts processing"), which removed too much.
* Update copyright dates with scripts/update-copyrightsJoseph Myers2023-01-061-1/+1
|
* nss: Add tests for the nss_hash in nss_hash.hNoah Goldstein2022-05-231-0/+1
| | | | | If we want to further optimize the function tests are needed. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* Simplify allocations and fix merge and continue actions [BZ #28931]Siddhesh Poyarekar2022-03-221-0/+1
| | | | | | | | | | | | | | | | | | | | | Allocations for address tuples is currently a bit confusing because of the pointer chasing through PAT, making it hard to observe the sequence in which allocations have been made. Narrow scope of the pointer chasing through PAT so that it is only used where necessary. This also tightens actions behaviour with the hosts database in getaddrinfo to comply with the manual text. The "continue" action discards previous results and the "merge" action results in an immedate lookup failure. Consequently, chaining of allocations across modules is no longer necessary, thus opening up cleanup opportunities. A test has been added that checks some combinations to ensure that they work correctly. Resolves: BZ #28931 Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: DJ Delorie <dj@redhat.com>
* nss: Sort tests and tests-container and put one test per lineSiddhesh Poyarekar2022-03-171-15/+24
| | | | Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* nss: Protect against errno changes in function lookup (bug 28953)Florian Weimer2022-03-111-3/+12
| | | | | | | | | | | | | dlopen may clobber errno. The nss_test_errno module uses an ELF constructor to achieve that, but there could be internal errors during dlopen that cause this, too. Therefore, the NSS framework has to guard against such errno clobbers. __nss_module_get_function is currently the only function that calls __nss_module_load, so it is sufficient to save and restore errno around this call. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* nss: Do not mention NSS test modules in <gnu/lib-names.h>Florian Weimer2022-03-111-8/+5
| | | | | | | | They are not actually installed. Use the nss_files version instead in nss/Makefile, similar to how __nss_shlib_revision is derived from LIBNSS_FILES_SO. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Update copyright dates with scripts/update-copyrightsPaul Eggert2022-01-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 7061 files FOO. I then removed trailing white space from math/tgmath.h, support/tst-support-open-dev-null-range.c, and sysdeps/x86_64/multiarch/strlen-vec.S, to work around the following obscure pre-commit check failure diagnostics from Savannah. I don't know why I run into these diagnostics whereas others evidently do not. remote: *** 912-#endif remote: *** 913: remote: *** 914- remote: *** error: lines with trailing whitespace found ... remote: *** error: sysdeps/unix/sysv/linux/statx_cp.c: trailing lines
* Disable DT_RUNPATH on NSS tests [BZ #28455]H.J. Lu2021-12-131-0/+8
| | | | | | | | | | | The glibc internal NSS functions should always load NSS modules from the system. For testing purpose, disable DT_RUNPATH on NSS tests so that the glibc internal NSS functions can load testing NSS modules via DT_RPATH. This partially fixes BZ #28455. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* nss: Do not install static linker input files for libnss_filesFlorian Weimer2021-07-081-0/+8
|
* nss: Access nss_files through direct referencesFlorian Weimer2021-07-071-1/+2
| | | | | | | | This partially fixes static-only NSS support (bug 27959): The files module no longer needs dlopen. Support for the dns module remains to be added, and also support for disabling dlopen altogether. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nss_files: Move into libcFlorian Weimer2021-07-071-8/+5
| | | | | | This is the first step towards fixing bug 27959. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nss_files: Add generic code for set*ent, end*ent and file openFlorian Weimer2021-07-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reduces RSS usage if nss_files is not actually used, and can be used later to make NSS data thread-specific. It also results in a small code size reduction. Before: text data bss dec hex filename 2288 0 72 2360 938 nss/files-alias.os 1807 0 72 1879 757 nss/files-ethers.os 1371 0 72 1443 5a3 nss/files-grp.os 6246 0 72 6318 18ae nss/files-hosts.os 869 0 0 869 365 nss/files-initgroups.os 666 0 0 666 29a nss/files-init.os 1934 0 0 1934 78e nss/files-netgrp.os 2353 0 72 2425 979 nss/files-network.os 2130 0 72 2202 89a nss/files-proto.os 1372 0 72 1444 5a4 nss/files-pwd.os 2124 0 72 2196 894 nss/files-rpc.os 2265 0 72 2337 921 nss/files-service.os 1125 0 72 1197 4ad nss/files-sgrp.os 1124 0 72 1196 4ac nss/files-spwd.os After: text data bss dec hex filename 2040 0 0 2040 7f8 nss/files-alias.os 1599 0 0 1599 63f nss/files-ethers.os 1155 0 0 1155 483 nss/files-grp.os 6010 0 0 6010 177a nss/files-hosts.os 869 0 0 869 365 nss/files-initgroups.os 666 0 0 666 29a nss/files-init.os 1934 0 0 1934 78e nss/files-netgrp.os 2129 0 0 2129 851 nss/files-network.os 1914 0 0 1914 77a nss/files-proto.os 1156 0 0 1156 484 nss/files-pwd.os 1908 0 0 1908 774 nss/files-rpc.os 2057 0 0 2057 809 nss/files-service.os 909 0 0 909 38d nss/files-sgrp.os 908 0 0 908 38c nss/files-spwd.os 1090 0 8 1098 44a nss/nss_files_data.os 27674 code bytes before, 26344 code bytes after, so it is an overall win despite the extra initialization code. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* dlfcn: Cleanups after -ldl is no longer requiredFlorian Weimer2021-06-031-5/+0
| | | | | | | | | | | | This commit removes the ELF constructor and internal variables from dlfcn/dlfcn.c. The file now serves the same purpose as nptl/libpthread-compat.c, so it is renamed to dlfcn/libdl-compat.c. The use of libdl-shared-only-routines ensures that libdl.a is empty. This commit adjusts the test suite not to use $(libdl). The libdl.so symbolic link is no longer installed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nss: fix nss_database_lookup2's alternate handling [BZ #27416]DJ Delorie2021-03-091-0/+1
| | | | | | | | | | | | | | | | | | | | __nss_database_lookup2's extra arguments were left unused in the nsswitch reloading patch set; this broke compat (default config ignored) and shadow files (secondary name ignored) which relies on these fallbacks. This patch adds in the previous behavior by correcting the initialization of the database list to reflect the fallbacks. This means that the nss_database_lookup2 interface no longer needs to be passed the fallback info, so API and callers were adjusted. Since all callers needed to be edited anyway, the calls were changed from __nss_database_lookup2 to the faster __nss_database_get. This was an intended optimization which was deferred during the initial lookup changes to avoid touching so many files. The test case verifies that compat targets work (passwd) and that the default configuration works (group). Tested on x86-64.
* nsswitch: do not reload if "/" changesDJ Delorie2021-01-271-1/+1
| | | | | | | | | | | https://sourceware.org/bugzilla/show_bug.cgi?id=27077 Before reloading nsswitch.conf, verify that the root directory hasn't changed - if it has, it's likely that we've entered a container and should not trust the nsswitch inside the container nor load any shared objects therein. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Update copyright dates with scripts/update-copyrightsPaul Eggert2021-01-021-1/+1
| | | | | | | | | | | | | | | | I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 6694 files FOO. I then removed trailing white space from benchtests/bench-pthread-locks.c and iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c, to work around this diagnostic from Savannah: remote: *** pre-commit check failed ... remote: *** error: lines with trailing whitespace found remote: error: hook declined to update refs/heads/master
* nsswitch: use new internal API (core)DJ Delorie2020-12-041-1/+2
| | | | | | Core changes to switch the NSS internals to use the new API. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* nss: Implement <nss_database.h>Florian Weimer2020-12-041-1/+1
| | | | | | | | | | | This code manages the mappings of the available databases in NSS (i.e. passwd, hosts, netgroup, etc) with the actions that should be taken to do a query on those databases. This is the main API between query functions scattered throughout glibc and the underlying code (actions, modules, etc). Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* <nss_action.h>: New abstraction for combining NSS modules and NSS actionsFlorian Weimer2020-12-041-1/+2
| | | | | | | | | | nss_action manages a set of lists of actions; these are the portions of the lines in nsswitch.conf to the right of the colons, like "dns [!UNAVAIL=return] files". Each permutation of actions and conditionals is cached for reuse, which limits memory growth, and refers to the static list of modules managed by nss_modules. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* nss: Introduce <nss_module.h>Florian Weimer2020-12-041-1/+1
| | | | | | | | | | | | | | | | This provides the struct nss_module type, which combines the old struct service_library type with the known_function tree, by statically allocating space for all function pointers. struct nss_module is fairly large (536 bytes), but it will be shared across NSS databases. The old known_function handling had non-some per-function overhead (at least 32 bytes per looked-up function, but more for long function anmes), so overall, this is not too bad. Resolving all functions at load time simplifies locking, and the repeated lookups should be fast because the caches are hot at this point. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* nss: Add __nss_fgetent_rFlorian Weimer2020-07-211-1/+3
| | | | | | | | | | | | And helper functions __nss_readline, __nss_readline_seek, __nss_parse_line_result. This consolidates common code for handling overlong lines and parse files. Use the new functionality in internal_getent in nss/nss_files/files-XXX.c. Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* nss_files: Consolidate file opening in __nss_files_fopenFlorian Weimer2020-07-211-1/+1
| | | | | Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* nss: Remove cryptographic key support from nss_files, nss_nis, nss_nisplusFlorian Weimer2020-07-071-1/+2
| | | | | | | | The interface has hard-coded buffer sizes and is therefore tied to DES. It also does not match current practice where different services on the same host use different key material. This change simplifies removal of the sunrpc code.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2020-01-011-1/+1
|
* Prefer https to http for gnu.org and fsf.org URLsPaul Eggert2019-09-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also, change sources.redhat.com to sourceware.org. This patch was automatically generated by running the following shell script, which uses GNU sed, and which avoids modifying files imported from upstream: sed -ri ' s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g ' \ $(find $(git ls-files) -prune -type f \ ! -name '*.po' \ ! -name 'ChangeLog*' \ ! -path COPYING ! -path COPYING.LIB \ ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \ ! -path manual/texinfo.tex ! -path scripts/config.guess \ ! -path scripts/config.sub ! -path scripts/install-sh \ ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \ ! -path INSTALL ! -path locale/programs/charmap-kw.h \ ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \ ! '(' -name configure \ -execdir test -f configure.ac -o -f configure.in ';' ')' \ ! '(' -name preconfigure \ -execdir test -f preconfigure.ac ';' ')' \ -print) and then by running 'make dist-prepare' to regenerate files built from the altered files, and then executing the following to cleanup: chmod a+x sysdeps/unix/sysv/linux/riscv/configure # Omit irrelevant whitespace and comment-only changes, # perhaps from a slightly-different Autoconf version. git checkout -f \ sysdeps/csky/configure \ sysdeps/hppa/configure \ sysdeps/riscv/configure \ sysdeps/unix/sysv/linux/csky/configure # Omit changes that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines git checkout -f \ sysdeps/powerpc/powerpc64/ppc-mcount.S \ sysdeps/unix/sysv/linux/s390/s390-64/syscall.S # Omit change that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
* nss_db: fix endent wrt NULL mappings [BZ #24695] [BZ #24696]DJ Delorie2019-07-101-1/+3
| | | | | | | | | | | | | nss_db allows for getpwent et al to be called without a set*ent, but it only works once. After the last get*ent a set*ent is required to restart, because the end*ent did not properly reset the module. Resetting it to NULL allows for a proper restart. If the database doesn't exist, however, end*ent erroniously called munmap which set errno. The test case runs "makedb" inside the testroot, so needs selinux DSOs installed.
* nss: Fix tst-nss-files-alias-truncated for default --as-needed linkingFlorian Weimer2019-03-141-1/+2
| | | | | | | Linking to the NSS module directly does not work if the linker defaults to --as-needed because it will remove the apparently unused DSO reference and not generate a DT_NEEDED entry. Use an explicit dlopen call, like in the other chroot tests involving NSS modules.
* nss: Add tst-nss-files-hosts-long test [BZ #21915]Patsy Franklin2019-02-081-1/+2
| | | | | | | | | When the /etc/hosts file has a line longer than 1028 characters getent ahostsv4 and ahostsv6 will fail. This test performs a getent call on a /etc/hosts file that contains a very long line (greater than 1028) using the test-in-container framework.
* nss_files: Fix /etc/aliases null pointer dereference [BZ #24059]Florian Weimer2019-01-311-0/+2
| | | | | | | | If /etc/aliases ends with a continuation line (a line that starts with whitespace) which does not have a trailing newline character, the file parser would crash due to a null pointer dereference. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Update copyright dates with scripts/update-copyrights.Joseph Myers2019-01-011-1/+1
| | | | | | | * All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
* Add missing libnss_testX.so requirement for tst-nss-test3.Stefan Liebler2018-12-141-1/+1
| | | | | | | | | | | | | | | Sometimes tst-nss-test3 fails with: error: test-container.c:386: unable to open .../nss/libnss_test1.so for reading The test tst-nss-test3 which runs in a container needs libnss_test[12].so. (see e.g. tst-nss-test3.script). Before this test was moved from tests to tests-container variable, the requirement was met. Thus this patch adds this requirement also for tests in tests-container. ChangeLog: * nss/Makefile (tst-nss-test3.out): New rule.